diff --git a/History.md b/History.md index 6e49b3b..f60fbb3 100644 --- a/History.md +++ b/History.md @@ -1,5 +1,9 @@ ##History +Ver 1.1.2 2015-12-2 + + - Fixed exception when loading settings file + Ver 1.1.1 2015-11-18 - Added flyout to notification area icon diff --git a/Images/Screenshot_Win10.png b/Images/Screenshot_Win10.png index fda52c9..faaca63 100644 Binary files a/Images/Screenshot_Win10.png and b/Images/Screenshot_Win10.png differ diff --git a/Images/Screenshot_Win81.png b/Images/Screenshot_Win81.png index bbdf4d7..f3e7587 100644 Binary files a/Images/Screenshot_Win81.png and b/Images/Screenshot_Win81.png differ diff --git a/README.md b/README.md index 9a6b10e..c747778 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ WLAN Profile Viewer is a Windows desktop app to manage wireless LAN profiles. It ##Download -[Download](https://github.com/emoacht/WlanProfileViewer/releases/download/1.1.1/WlanProfileViewer111.zip) +[Download](https://github.com/emoacht/WlanProfileViewer/releases/download/1.1.2/WlanProfileViewer112.zip) ##Install diff --git a/README_ja.md b/README_ja.md index 200cb26..6dd666a 100644 --- a/README_ja.md +++ b/README_ja.md @@ -19,7 +19,7 @@ WLAN Profile Viewerは無線LANプロファイルを管理するためのWindows ##ダウンロード -[ダウンロード](https://github.com/emoacht/WlanProfileViewer/releases/download/1.1.1/WlanProfileViewer111.zip) +[ダウンロード](https://github.com/emoacht/WlanProfileViewer/releases/download/1.1.2/WlanProfileViewer112.zip) ##インストール diff --git a/ReactivePropertyTest/ReactivePropertyTest.csproj b/ReactivePropertyTest/ReactivePropertyTest.csproj index cb27431..4e617e3 100644 --- a/ReactivePropertyTest/ReactivePropertyTest.csproj +++ b/ReactivePropertyTest/ReactivePropertyTest.csproj @@ -36,15 +36,15 @@ - ..\packages\ReactiveProperty.2.2.8\lib\net45\ReactiveProperty.dll + ..\packages\ReactiveProperty.2.3\lib\net45\ReactiveProperty.dll True - ..\packages\ReactiveProperty.2.2.8\lib\net45\ReactiveProperty.DataAnnotations.dll + ..\packages\ReactiveProperty.2.3\lib\net45\ReactiveProperty.DataAnnotations.dll True - ..\packages\ReactiveProperty.2.2.8\lib\net45\ReactiveProperty.NET45.dll + ..\packages\ReactiveProperty.2.3\lib\net45\ReactiveProperty.NET45.dll True diff --git a/ReactivePropertyTest/packages.config b/ReactivePropertyTest/packages.config index 88a6a63..1d17de3 100644 --- a/ReactivePropertyTest/packages.config +++ b/ReactivePropertyTest/packages.config @@ -1,6 +1,6 @@  - + diff --git a/WlanProfileViewer/Models/LanguageService.cs b/WlanProfileViewer/Models/LanguageService.cs index b94768e..012ecfa 100644 --- a/WlanProfileViewer/Models/LanguageService.cs +++ b/WlanProfileViewer/Models/LanguageService.cs @@ -41,16 +41,17 @@ private static Dictionary RetrieveLanguageContent(string languag var sources = Properties.Resources.ResourceManager.GetResourceSet(CultureInfo.InvariantCulture, true, true) .Cast() .Where(x => x.Key.ToString().StartsWith("language_")) // language_en, language_ja, etc. - .ToDictionary(x => x.Key.ToString().Substring(9), x => x.Value.ToString()); + .ToDictionary(x => x.Key.ToString().Substring(9), x => x.Value.ToString()); // 9 means "language_". var source = sources.ContainsKey(languageName) ? sources[languageName] : sources["en"]; // language_en as fallback return source.Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries) - .Select(x => new { Index = x.IndexOf(_delimiter), Line = x }) - .Where(x => (0 < x.Index) && (x.Index + 1 < x.Line.Length)) // Both key and value are not empty. - .ToDictionary(x => x.Line.Substring(0, x.Index), x => x.Line.Substring(x.Index + 1)); + .Select(x => x.Split(new[] { _delimiter }, 2)) + .Select(x => x.Select(y => y.Trim()).Where(y => !string.IsNullOrEmpty(y)).ToArray()) + .Where(x => x.Length == 2) // Both key and value are not empty. + .ToDictionary(x => x[0], x => x[1]); } #endregion diff --git a/WlanProfileViewer/Models/LogService.cs b/WlanProfileViewer/Models/LogService.cs index 20fee87..67f2c35 100644 --- a/WlanProfileViewer/Models/LogService.cs +++ b/WlanProfileViewer/Models/LogService.cs @@ -20,7 +20,7 @@ internal class LogService public static void RecordException(object sender, Exception exception) { - var content = string.Format("[Date: {0} Sender: {1}]", DateTime.Now, sender) + Environment.NewLine + var content = $"[Date: {DateTime.Now} Sender: {sender}]" + Environment.NewLine + exception + Environment.NewLine + Environment.NewLine; RecordAppData(_exceptionFileName, content); diff --git a/WlanProfileViewer/Models/Settings.cs b/WlanProfileViewer/Models/Settings.cs index 7a56b98..b0827c5 100644 --- a/WlanProfileViewer/Models/Settings.cs +++ b/WlanProfileViewer/Models/Settings.cs @@ -6,6 +6,7 @@ using System.Text; using System.Threading.Tasks; using System.Windows; +using System.Xml; using System.Xml.Serialization; using static System.Math; @@ -49,29 +50,33 @@ public int AutoReloadInterval public static void Load() { + IsLoaded = true; + + if (!File.Exists(_settingsFilePath)) + return; + try { - if (File.Exists(_settingsFilePath)) + using (var fs = new FileStream(_settingsFilePath, FileMode.Open, FileAccess.Read)) { - using (var fs = new FileStream(_settingsFilePath, FileMode.Open, FileAccess.Read)) - { - var serializer = new XmlSerializer(typeof(Settings)); - var loaded = (Settings)serializer.Deserialize(fs); - - typeof(Settings) - .GetProperties(BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly) - .Where(x => x.CanWrite) - .ToList() - .ForEach(x => x.SetValue(Current, x.GetValue(loaded))); - } + var serializer = new XmlSerializer(typeof(Settings)); + var loaded = (Settings)serializer.Deserialize(fs); + + typeof(Settings) + .GetProperties(BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly) + .Where(x => x.CanWrite) + .ToList() + .ForEach(x => x.SetValue(Current, x.GetValue(loaded))); } } + catch (InvalidOperationException ex) when (ex.InnerException is XmlException) + { + // Ignore broken settings file. + } catch (Exception ex) { throw new Exception("Failed to load settings.", ex); } - - IsLoaded = true; } public static void Save() diff --git a/WlanProfileViewer/Properties/AssemblyInfo.cs b/WlanProfileViewer/Properties/AssemblyInfo.cs index 77e4766..6769a5a 100644 --- a/WlanProfileViewer/Properties/AssemblyInfo.cs +++ b/WlanProfileViewer/Properties/AssemblyInfo.cs @@ -51,5 +51,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.1.1.6")] -[assembly: AssemblyFileVersion("1.1.1.6")] +[assembly: AssemblyVersion("1.1.2.8")] +[assembly: AssemblyFileVersion("1.1.2.8")] diff --git a/WlanProfileViewer/WlanProfileViewer.csproj b/WlanProfileViewer/WlanProfileViewer.csproj index 0ed6a4c..d3a21f9 100644 --- a/WlanProfileViewer/WlanProfileViewer.csproj +++ b/WlanProfileViewer/WlanProfileViewer.csproj @@ -51,15 +51,15 @@ Library\MonitorAware.dll - ..\packages\ReactiveProperty.2.2.8\lib\net45\ReactiveProperty.dll + ..\packages\ReactiveProperty.2.3\lib\net45\ReactiveProperty.dll True - ..\packages\ReactiveProperty.2.2.8\lib\net45\ReactiveProperty.DataAnnotations.dll + ..\packages\ReactiveProperty.2.3\lib\net45\ReactiveProperty.DataAnnotations.dll True - ..\packages\ReactiveProperty.2.2.8\lib\net45\ReactiveProperty.NET45.dll + ..\packages\ReactiveProperty.2.3\lib\net45\ReactiveProperty.NET45.dll True diff --git a/WlanProfileViewer/packages.config b/WlanProfileViewer/packages.config index 88a6a63..1d17de3 100644 --- a/WlanProfileViewer/packages.config +++ b/WlanProfileViewer/packages.config @@ -1,6 +1,6 @@  - +