diff --git a/MONI/Data/MoniSettings.cs b/MONI/Data/MoniSettings.cs index e37b5f9..88fd223 100644 --- a/MONI/Data/MoniSettings.cs +++ b/MONI/Data/MoniSettings.cs @@ -3,6 +3,7 @@ using MahApps.Metro.Native; using Newtonsoft.Json; using System.Linq; +using MONI.Util; namespace MONI.Data { @@ -14,7 +15,7 @@ public class MoniSettings public static MoniSettings GetEmptySettings() { var ms = new MainSettings { - DataDirectory = AppDomain.CurrentDomain.BaseDirectory, + DataDirectory = Utils.MoniAppDataPath(),//AppDomain.CurrentDomain.BaseDirectory, MonlistExecutablePath = @"n:\Monlist2\Monlist2.exe", ProjectNumberFilePath = @"n:\Monlist2\projekte.txt", UpdateInfoURL = "http://mtools/moni_updates.json", diff --git a/MONI/Properties/AssemblyInfo.cs b/MONI/Properties/AssemblyInfo.cs index 50ce578..c4406ca 100644 --- a/MONI/Properties/AssemblyInfo.cs +++ b/MONI/Properties/AssemblyInfo.cs @@ -50,6 +50,6 @@ // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.1.0")] -[assembly: AssemblyFileVersion("1.0.1.0")] -[assembly: AssemblyProduct("moni 1.0.1.0")] \ No newline at end of file +[assembly: AssemblyVersion("1.0.2.0")] +[assembly: AssemblyFileVersion("1.0.2.0")] +[assembly: AssemblyProduct("moni 1.0.2.0")] \ No newline at end of file diff --git a/MONI/Util/AppHelper.cs b/MONI/Util/AppHelper.cs index 7d0297e..5ef6b8b 100644 --- a/MONI/Util/AppHelper.cs +++ b/MONI/Util/AppHelper.cs @@ -187,14 +187,13 @@ private void ConfigureLogging() var fileTarget = new FileTarget(); config.AddTarget("file", fileTarget); - ColoredConsoleTarget consoleTarget = null; - if (false) - { - consoleTarget = new ColoredConsoleTarget(); - config.AddTarget("console", consoleTarget); - // Step 3. Set target properties - consoleTarget.Layout = "${longdate} ${level:uppercase=true} ${logger} ${message} ${exception:format=Message,Type,StackTrace:separator=//}"; - } + // Step 3. Set target properties + +#if DEBUG + var consoleTarget = new ColoredConsoleTarget(); + consoleTarget.Layout = "${longdate} ${level:uppercase=true} ${logger} ${message} ${exception:format=Message,Type,StackTrace:separator=//}"; + config.AddTarget("console", consoleTarget); + config.LoggingRules.Add(new LoggingRule("*", LogLevel.Info, consoleTarget)); // check where we can write if (Utils.CanCreateFile(".")) @@ -205,20 +204,16 @@ private void ConfigureLogging() { fileTarget.FileName = Utils.MoniAppDataPath() + "/logs/" + this.ApplicationName + ".${shortdate}.log"; } +#else + fileTarget.FileName = Utils.MoniAppDataPath() + "/logs/" + this.ApplicationName + ".${shortdate}.log"; +#endif fileTarget.KeepFileOpen = false; fileTarget.CreateDirs = true; fileTarget.ConcurrentWrites = true; fileTarget.Layout = "${longdate} ${level:uppercase=true} ${logger} ${message} ${exception:format=Message,Type,StackTrace:separator=//}"; // Step 4. Define rules - if (consoleTarget != null) - { - var rule1 = new LoggingRule("*", LogLevel.Debug, consoleTarget); - config.LoggingRules.Add(rule1); - } - - var rule2 = new LoggingRule("*", LogLevel.Debug, fileTarget); - config.LoggingRules.Add(rule2); + config.LoggingRules.Add(new LoggingRule("*", LogLevel.Debug, fileTarget)); // Step 5. Activate the configuration LogManager.Configuration = config; diff --git a/MONI/Util/Utils.cs b/MONI/Util/Utils.cs index c86f995..5d0aba0 100644 --- a/MONI/Util/Utils.cs +++ b/MONI/Util/Utils.cs @@ -25,8 +25,7 @@ public static bool CanCreateFile(string dir) public static string MoniAppDataPath() { - var appData = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); - var moniAppData = Path.Combine(appData, "moni"); + var moniAppData = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "moni"); return moniAppData; } diff --git a/moni_updates.json b/moni_updates.json index 83c524c..5bba726 100644 --- a/moni_updates.json +++ b/moni_updates.json @@ -157,4 +157,11 @@ ], "DownLoadURL": "https://github.com/dotob/moni/releases/download/1.0.1/MONI.exe" }, + { + "Version": "1.0.2", + "Changes": [ + "Update: Das Data und Log Verzeichnis ist jetzt beim ersten Start C:\Users\\AppData\Roaming\moni\", + ], + "DownLoadURL": "https://github.com/dotob/moni/releases/download/1.0.2/MONI.exe" + }, ] \ No newline at end of file