diff --git a/Qiqqa.Build/patch_settings_file.js b/Qiqqa.Build/patch_settings_file.js
index f6bd8cdef..370ec20b9 100644
--- a/Qiqqa.Build/patch_settings_file.js
+++ b/Qiqqa.Build/patch_settings_file.js
@@ -39,12 +39,12 @@ if (opts._.length != 1) {
-// construct the path to the settings.settings file as managed by Visual Studio: we're going to patch these values into that master file:
-var settings_path = path.join(opts._[0], "Properties/Settings.settings");
+// construct the path to the Misc/Constants.cs file: we're going to patch these values into that master file:
+var settings_path = path.join(opts._[0], "Misc/Constants.cs");
if (fs.existsSync(settings_path))
{
- var xml_str = fs.readFileSync(settings_path, 'utf8');
- var original_xml_str = xml_str;
+ var cs_str = fs.readFileSync(settings_path, 'utf8');
+ var original_cs_str = cs_str;
var names = [ "TargetDir", "ProjectDir", "SolutionDir", "Build" ];
for (var key in names) {
@@ -54,38 +54,28 @@ if (fs.existsSync(settings_path))
console.error(`key ${name} not found in provided commandline parameters?!`);
}
- //
- // $(TargetDir)
- //
- var re = new RegExp(`Name="${name}"[^]+?`, 'g');
- if (opts.debug) console.log("NAME regexp + match = ", re, re.exec(xml_str));
+ // public const string QiqqaDevProjectDir = "VANILLA_REFERENCE";
+ var re = new RegExp(`public\\s+const\\s+string\\s+QiqqaDev${name}\\s*=\\s*"[^"]*";`, 'g');
+ if (opts.debug) console.log("NAME regexp + match = ", re, re.exec(cs_str));
- xml_str = xml_str.replace(re, function (m) {
- var re2 = new RegExp('([^]*?)|', 'g');
+ cs_str = cs_str.replace(re, function (m) {
+ if (opts.debug) console.log("processing NAME match = ", name, m);
- if (opts.debug) console.log("processing NAME match = ", name, m, re2, re2.exec(m));
+ var dst = opts[name];
+ dst = dst.replace(/[\\/]/g, '/');
- m = m.replace(re2, function (m2, p1, p2) {
- if (opts.debug) console.log("processing NAME SUBmatch = ", name, m2, p1, p2, re2);
-
- var dst = opts[name];
- dst = dst.replace(/[\\/]/g, '/');
-
- return `${dst}`;
- });
-
- return m;
+ return `public const string QiqqaDev${name} = "${dst}";`;
});
}
- if (opts.debug) console.log("Resulting XML:", xml_str);
+ if (opts.debug) console.log("Resulting C#:", cs_str);
- if (original_xml_str != xml_str) {
- console.log("Rewriting the settings file: ", settings_path);
+ if (original_cs_str != cs_str) {
+ console.log("Rewriting the constants file: ", settings_path);
- fs.writeFileSync(settings_path, xml_str, 'utf8');
+ fs.writeFileSync(settings_path, cs_str, 'utf8');
} else {
- console.log("Nothing to rewrite in the settings file: ", settings_path);
+ console.log("Nothing to rewrite in the constants file: ", settings_path);
}
}
else
@@ -94,61 +84,5 @@ else
}
-
-// construct the path to the app.config file as managed by Visual Studio: we're going to patch these values into that master file:
-var settings_path = path.join(opts._[0], "app.config");
-if (fs.existsSync(settings_path))
-{
- var xml_str = fs.readFileSync(settings_path, 'utf8');
- var original_xml_str = xml_str;
-
- var names = [ "TargetDir", "ProjectDir", "SolutionDir", "Build" ];
- for (var key in names) {
- var name = names[key];
-
- if (!opts[name]) {
- console.error(`key ${name} not found in provided commandline parameters?!`);
- }
-
- //
- // $(TargetDir)
- //
- var re = new RegExp(``, 'g');
- if (opts.debug) console.log("NAME regexp + match = ", re, re.exec(xml_str));
-
- xml_str = xml_str.replace(re, function (m) {
- var re2 = new RegExp('([^]*?)|', 'g');
-
- if (opts.debug) console.log("processing NAME match = ", name, m, re2, re2.exec(m));
- m = m.replace(re2, function (m2, p1) {
- if (opts.debug) console.log("processing NAME SUBmatch = ", name, m2, p1, re2);
-
- var dst = opts[name];
- dst = dst.replace(/[\\/]/g, '/');
-
- return `${dst}`;
- });
-
- return m;
- });
- }
-
- if (opts.debug) console.log("Resulting XML:", xml_str);
-
- if (original_xml_str != xml_str) {
- console.log("Rewriting the settings file: ", settings_path);
-
- fs.writeFileSync(settings_path, xml_str, 'utf8');
- } else {
- console.log("Nothing to rewrite in the settings file: ", settings_path);
- }
-}
-else
-{
- throw new Error("file does not exist: " + settings_path);
-}
-
-
-
process.exit(0);
diff --git a/Qiqqa/Main/SplashScreenStuff/SplashScreenWindow.xaml.cs b/Qiqqa/Main/SplashScreenStuff/SplashScreenWindow.xaml.cs
index 90b56f94f..9b914a539 100644
--- a/Qiqqa/Main/SplashScreenStuff/SplashScreenWindow.xaml.cs
+++ b/Qiqqa/Main/SplashScreenStuff/SplashScreenWindow.xaml.cs
@@ -1,9 +1,12 @@
using System;
using System.IO;
+using System.Text;
using System.Windows;
using System.Windows.Media;
using System.Windows.Media.Imaging;
+using Utilities;
using Utilities.GUI;
+using Utilities.Misc;
using Application = System.Windows.Forms.Application;
namespace Qiqqa.Main.SplashScreenStuff
@@ -18,7 +21,46 @@ public static BitmapImage GetSplashImage()
string image_filename = Path.GetFullPath(Path.Combine(Common.Configuration.ConfigurationManager.Instance.StartupDirectoryForQiqqa, @"Qiqqa.jpg"));
if (!File.Exists(image_filename))
{
- throw new ApplicationException($"Cannot locate the application splash image file '{image_filename}'. Looks like the Qiqqa installation is buggered. Please report this at https://github.com/jimmejardine/qiqqa-open-source/issues");
+ try
+ {
+ throw new ApplicationException($"Cannot locate the application splash image file '{image_filename}'. Looks like the Qiqqa installation is buggered. Please report this at https://github.com/jimmejardine/qiqqa-open-source/issues");
+ }
+ catch (Exception ex)
+ {
+ AppDomain domain = AppDomain.CreateDomain("MyDomain", null);
+
+ StringBuilder sb = new StringBuilder();
+
+ sb.AppendLine(ex.Message + "\n -- ");
+ sb.AppendLine($"Designer: {Runtime.IsRunningInVisualStudioDesigner},");
+ sb.AppendLine($"S1:{System.Reflection.Assembly.GetExecutingAssembly().CodeBase},");
+ sb.AppendLine($"s2:{System.Reflection.Assembly.GetExecutingAssembly().Location},");
+ sb.AppendLine($"S3:{System.Windows.Forms.Application.StartupPath},");
+
+ // c# getassembly is a type, which is not valid in the given context
+ TriState to = new TriState();
+ Type t = to.GetType();
+
+ sb.AppendLine($"S4:{System.Reflection.Assembly.GetAssembly(t).CodeBase},");
+ sb.AppendLine($"s5:{System.Reflection.Assembly.GetAssembly(t).Location},");
+
+ // Output to the console.
+ sb.AppendLine("Host domain: " + AppDomain.CurrentDomain.FriendlyName);
+ sb.AppendLine("New domain: " + domain.FriendlyName);
+ sb.AppendLine("Application base is: " + domain.BaseDirectory);
+ sb.AppendLine("Relative search path is: " + domain.RelativeSearchPath);
+ sb.AppendLine("Shadow copy files is set to: " + domain.ShadowCopyFiles);
+ AppDomain.Unload(domain);
+
+ sb.AppendLine(Utilities.Constants.QiqqaDevSolutionDir);
+ sb.AppendLine(Utilities.Constants.QiqqaDevProjectDir);
+ sb.AppendLine(Utilities.Constants.QiqqaDevTargetDir);
+ sb.AppendLine(Utilities.Constants.QiqqaDevBuild);
+
+ Logging.Error(sb.ToString());
+
+ throw new Exception(sb.ToString(), ex);
+ }
}
BitmapImage bi = new BitmapImage();
bi.BeginInit();
diff --git a/Utilities/DetectUnitTestRunner.cs b/Utilities/DetectUnitTestRunner.cs
index ac2469779..16b1abca5 100644
--- a/Utilities/DetectUnitTestRunner.cs
+++ b/Utilities/DetectUnitTestRunner.cs
@@ -91,9 +91,11 @@ public static string StartupDirectoryForQiqqa
if (Runtime.IsRunningInVisualStudioDesigner && null == _StartupDirectoryForQiqqa)
{
//string s1 = System.Reflection.Assembly.GetExecutingAssembly().CodeBase;
- string loc = System.Reflection.Assembly.GetExecutingAssembly().Location;
+ //string s2 = System.Reflection.Assembly.GetExecutingAssembly().Location;
//string s3 = System.Windows.Forms.Application.StartupPath;
- string basedir = Path.GetFullPath(Path.GetDirectoryName(Path.GetFullPath(loc)));
+ //string basedir = Path.GetFullPath(Path.GetDirectoryName(Path.GetFullPath(loc)));
+ string loc = Path.Combine(Utilities.Constants.QiqqaDevSolutionDir, "Qiqqa/bin/", Utilities.Constants.QiqqaDevBuild);
+ string basedir = Path.GetFullPath(loc);
_StartupDirectoryForQiqqa = basedir;
}
#endif
diff --git a/Utilities/Misc/Constants.cs b/Utilities/Misc/Constants.cs
index 767ff25a4..63c72590b 100644
--- a/Utilities/Misc/Constants.cs
+++ b/Utilities/Misc/Constants.cs
@@ -11,5 +11,14 @@ public class Constants
public const string UNKNOWN_YEAR = "(unknown year)";
public const string VanillaReferenceFileType = "VANILLA_REFERENCE";
+
+ // These 4 constants are live-patched by the Pre-build task (Qiqqa.Build/patch_settings_file.js)
+ // vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
+ public const string QiqqaDevProjectDir = "W:/Users/Ger/Projects/sites/library.visyond.gov/80/lib/tooling/qiqqa/Utilities/";
+ public const string QiqqaDevSolutionDir = "W:/Users/Ger/Projects/sites/library.visyond.gov/80/lib/tooling/qiqqa/";
+ public const string QiqqaDevTargetDir = "W:/Users/Ger/Projects/sites/library.visyond.gov/80/lib/tooling/qiqqa/Utilities/bin/Debug/";
+ public const string QiqqaDevBuild = "Debug";
+ // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ // These 4 constants are live-patched by the Pre-build task (Qiqqa.Build/patch_settings_file.js)
}
}
diff --git a/Utilities/Properties/Settings.Designer.cs b/Utilities/Properties/Settings.Designer.cs
deleted file mode 100644
index 786def0c1..000000000
--- a/Utilities/Properties/Settings.Designer.cs
+++ /dev/null
@@ -1,53 +0,0 @@
-//------------------------------------------------------------------------------
-//
-// This code was generated by a tool.
-// Runtime Version:4.0.30319.42000
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-//
-//------------------------------------------------------------------------------
-
-namespace Utilities.Properties {
-
-
- [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.3.0.0")]
- public sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
-
- private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
-
- public static Settings Default {
- get {
- return defaultInstance;
- }
- }
-
- [global::System.Configuration.ApplicationScopedSettingAttribute()]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("")]
- public string TargetDir {
- get {
- return ((string)(this["TargetDir"]));
- }
- }
-
- [global::System.Configuration.ApplicationScopedSettingAttribute()]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("")]
- public string ProjectDir {
- get {
- return ((string)(this["ProjectDir"]));
- }
- }
-
- [global::System.Configuration.ApplicationScopedSettingAttribute()]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("")]
- public string SolutionDir {
- get {
- return ((string)(this["SolutionDir"]));
- }
- }
- }
-}
diff --git a/Utilities/Properties/Settings.settings b/Utilities/Properties/Settings.settings
deleted file mode 100644
index f0c77e6c8..000000000
--- a/Utilities/Properties/Settings.settings
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
-
-
-
- W:/Users/Ger/Projects/sites/library.visyond.gov/80/lib/tooling/qiqqa/Utilities/bin/Debug/
-
-
- W:/Users/Ger/Projects/sites/library.visyond.gov/80/lib/tooling/qiqqa/Utilities/
-
-
- W:/Users/Ger/Projects/sites/library.visyond.gov/80/lib/tooling/qiqqa/
-
-
-
\ No newline at end of file
diff --git a/Utilities/Settings.cs b/Utilities/Settings.cs
deleted file mode 100644
index 13d1edba9..000000000
--- a/Utilities/Settings.cs
+++ /dev/null
@@ -1,28 +0,0 @@
-namespace Utilities.Properties {
-
-
- // This class allows you to handle specific events on the settings class:
- // The SettingChanging event is raised before a setting's value is changed.
- // The PropertyChanged event is raised after a setting's value is changed.
- // The SettingsLoaded event is raised after the setting values are loaded.
- // The SettingsSaving event is raised before the setting values are saved.
- public sealed partial class Settings {
-
- public Settings() {
- // // To add event handlers for saving and changing settings, uncomment the lines below:
- //
- // this.SettingChanging += this.SettingChangingEventHandler;
- //
- // this.SettingsSaving += this.SettingsSavingEventHandler;
- //
- }
-
- private void SettingChangingEventHandler(object sender, System.Configuration.SettingChangingEventArgs e) {
- // Add code to handle the SettingChangingEvent event here.
- }
-
- private void SettingsSavingEventHandler(object sender, System.ComponentModel.CancelEventArgs e) {
- // Add code to handle the SettingsSaving event here.
- }
- }
-}
diff --git a/Utilities/app.config b/Utilities/app.config
deleted file mode 100644
index 441dec1b1..000000000
--- a/Utilities/app.config
+++ /dev/null
@@ -1,21 +0,0 @@
-
-
-
-
-
-
-
-
-
-
- W:/Users/Ger/Projects/sites/library.visyond.gov/80/lib/tooling/qiqqa/Utilities/bin/Debug/
-
-
- W:/Users/Ger/Projects/sites/library.visyond.gov/80/lib/tooling/qiqqa/Utilities/
-
-
- W:/Users/Ger/Projects/sites/library.visyond.gov/80/lib/tooling/qiqqa/
-
-
-
-
\ No newline at end of file