diff --git a/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/QuickLook.Plugin.ArchiveViewer.csproj b/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/QuickLook.Plugin.ArchiveViewer.csproj index 96aa4de..6bc6f38 100644 --- a/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/QuickLook.Plugin.ArchiveViewer.csproj +++ b/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/QuickLook.Plugin.ArchiveViewer.csproj @@ -50,10 +50,11 @@ MinimumRecommendedRules.ruleset - true + false - key.snk + + @@ -106,7 +107,6 @@ - diff --git a/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/key.snk b/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/key.snk deleted file mode 100644 index 174ee23..0000000 Binary files a/QuickLook.Plugin/QuickLook.Plugin.ArchiveViewer/key.snk and /dev/null differ diff --git a/QuickLook.Plugin/QuickLook.Plugin.CsvViewer/QuickLook.Plugin.CsvViewer.csproj b/QuickLook.Plugin/QuickLook.Plugin.CsvViewer/QuickLook.Plugin.CsvViewer.csproj index 91faa1f..63084e2 100644 --- a/QuickLook.Plugin/QuickLook.Plugin.CsvViewer/QuickLook.Plugin.CsvViewer.csproj +++ b/QuickLook.Plugin/QuickLook.Plugin.CsvViewer/QuickLook.Plugin.CsvViewer.csproj @@ -49,10 +49,11 @@ MinimumRecommendedRules.ruleset - true + false - key.snk + + @@ -91,7 +92,6 @@ - diff --git a/QuickLook.Plugin/QuickLook.Plugin.CsvViewer/key.snk b/QuickLook.Plugin/QuickLook.Plugin.CsvViewer/key.snk deleted file mode 100644 index 174ee23..0000000 Binary files a/QuickLook.Plugin/QuickLook.Plugin.CsvViewer/key.snk and /dev/null differ diff --git a/QuickLook.Plugin/QuickLook.Plugin.HtmlViewer/QuickLook.Plugin.HtmlViewer.csproj b/QuickLook.Plugin/QuickLook.Plugin.HtmlViewer/QuickLook.Plugin.HtmlViewer.csproj index 1b2b7d5..2c39706 100644 --- a/QuickLook.Plugin/QuickLook.Plugin.HtmlViewer/QuickLook.Plugin.HtmlViewer.csproj +++ b/QuickLook.Plugin/QuickLook.Plugin.HtmlViewer/QuickLook.Plugin.HtmlViewer.csproj @@ -53,10 +53,11 @@ MinimumRecommendedRules.ruleset - true + false - key.snk + + @@ -109,8 +110,5 @@ True - - - \ No newline at end of file diff --git a/QuickLook.Plugin/QuickLook.Plugin.HtmlViewer/key.snk b/QuickLook.Plugin/QuickLook.Plugin.HtmlViewer/key.snk deleted file mode 100644 index 174ee23..0000000 Binary files a/QuickLook.Plugin/QuickLook.Plugin.HtmlViewer/key.snk and /dev/null differ diff --git a/QuickLook.Plugin/QuickLook.Plugin.IPreviewHandlers/QuickLook.Plugin.IPreviewHandlers.csproj b/QuickLook.Plugin/QuickLook.Plugin.IPreviewHandlers/QuickLook.Plugin.IPreviewHandlers.csproj index 214d9f2..6a5f604 100644 --- a/QuickLook.Plugin/QuickLook.Plugin.IPreviewHandlers/QuickLook.Plugin.IPreviewHandlers.csproj +++ b/QuickLook.Plugin/QuickLook.Plugin.IPreviewHandlers/QuickLook.Plugin.IPreviewHandlers.csproj @@ -51,10 +51,11 @@ MinimumRecommendedRules.ruleset - true + false - key.snk + + @@ -103,8 +104,5 @@ MSBuild:Compile - - - \ No newline at end of file diff --git a/QuickLook.Plugin/QuickLook.Plugin.IPreviewHandlers/key.snk b/QuickLook.Plugin/QuickLook.Plugin.IPreviewHandlers/key.snk deleted file mode 100644 index 174ee23..0000000 Binary files a/QuickLook.Plugin/QuickLook.Plugin.IPreviewHandlers/key.snk and /dev/null differ diff --git a/QuickLook.Plugin/QuickLook.Plugin.ImageViewer/QuickLook.Plugin.ImageViewer.csproj b/QuickLook.Plugin/QuickLook.Plugin.ImageViewer/QuickLook.Plugin.ImageViewer.csproj index e585705..690d384 100644 --- a/QuickLook.Plugin/QuickLook.Plugin.ImageViewer/QuickLook.Plugin.ImageViewer.csproj +++ b/QuickLook.Plugin/QuickLook.Plugin.ImageViewer/QuickLook.Plugin.ImageViewer.csproj @@ -52,10 +52,11 @@ MinimumRecommendedRules.ruleset - true + false - key.snk + + @@ -103,7 +104,6 @@ - diff --git a/QuickLook.Plugin/QuickLook.Plugin.ImageViewer/key.snk b/QuickLook.Plugin/QuickLook.Plugin.ImageViewer/key.snk deleted file mode 100644 index 174ee23..0000000 Binary files a/QuickLook.Plugin/QuickLook.Plugin.ImageViewer/key.snk and /dev/null differ diff --git a/QuickLook.Plugin/QuickLook.Plugin.MailViewer/QuickLook.Plugin.MailViewer.csproj b/QuickLook.Plugin/QuickLook.Plugin.MailViewer/QuickLook.Plugin.MailViewer.csproj index f11147e..e849b53 100644 --- a/QuickLook.Plugin/QuickLook.Plugin.MailViewer/QuickLook.Plugin.MailViewer.csproj +++ b/QuickLook.Plugin/QuickLook.Plugin.MailViewer/QuickLook.Plugin.MailViewer.csproj @@ -49,10 +49,11 @@ MinimumRecommendedRules.ruleset - true + false - key.snk + + @@ -99,7 +100,6 @@ - diff --git a/QuickLook.Plugin/QuickLook.Plugin.MailViewer/key.snk b/QuickLook.Plugin/QuickLook.Plugin.MailViewer/key.snk deleted file mode 100644 index 174ee23..0000000 Binary files a/QuickLook.Plugin/QuickLook.Plugin.MailViewer/key.snk and /dev/null differ diff --git a/QuickLook.Plugin/QuickLook.Plugin.MarkdownViewer/QuickLook.Plugin.MarkdownViewer.csproj b/QuickLook.Plugin/QuickLook.Plugin.MarkdownViewer/QuickLook.Plugin.MarkdownViewer.csproj index a0eeb9c..43cd886 100644 --- a/QuickLook.Plugin/QuickLook.Plugin.MarkdownViewer/QuickLook.Plugin.MarkdownViewer.csproj +++ b/QuickLook.Plugin/QuickLook.Plugin.MarkdownViewer/QuickLook.Plugin.MarkdownViewer.csproj @@ -50,10 +50,11 @@ MinimumRecommendedRules.ruleset - true + false - key.snk + + @@ -94,7 +95,6 @@ - diff --git a/QuickLook.Plugin/QuickLook.Plugin.MarkdownViewer/key.snk b/QuickLook.Plugin/QuickLook.Plugin.MarkdownViewer/key.snk deleted file mode 100644 index 174ee23..0000000 Binary files a/QuickLook.Plugin/QuickLook.Plugin.MarkdownViewer/key.snk and /dev/null differ diff --git a/QuickLook.Plugin/QuickLook.Plugin.PDFViewer/QuickLook.Plugin.PdfViewer.csproj b/QuickLook.Plugin/QuickLook.Plugin.PDFViewer/QuickLook.Plugin.PdfViewer.csproj index 5645347..a625702 100644 --- a/QuickLook.Plugin/QuickLook.Plugin.PDFViewer/QuickLook.Plugin.PdfViewer.csproj +++ b/QuickLook.Plugin/QuickLook.Plugin.PDFViewer/QuickLook.Plugin.PdfViewer.csproj @@ -54,10 +54,11 @@ MinimumRecommendedRules.ruleset - true + false - key.snk + + @@ -108,9 +109,6 @@ Designer - - - PreserveNewest diff --git a/QuickLook.Plugin/QuickLook.Plugin.PDFViewer/key.snk b/QuickLook.Plugin/QuickLook.Plugin.PDFViewer/key.snk deleted file mode 100644 index 174ee23..0000000 Binary files a/QuickLook.Plugin/QuickLook.Plugin.PDFViewer/key.snk and /dev/null differ diff --git a/QuickLook.Plugin/QuickLook.Plugin.TextViewer/QuickLook.Plugin.TextViewer.csproj b/QuickLook.Plugin/QuickLook.Plugin.TextViewer/QuickLook.Plugin.TextViewer.csproj index 9f65f6d..77b06b6 100644 --- a/QuickLook.Plugin/QuickLook.Plugin.TextViewer/QuickLook.Plugin.TextViewer.csproj +++ b/QuickLook.Plugin/QuickLook.Plugin.TextViewer/QuickLook.Plugin.TextViewer.csproj @@ -50,10 +50,11 @@ MinimumRecommendedRules.ruleset - true + false - key.snk + + @@ -93,7 +94,6 @@ - diff --git a/QuickLook.Plugin/QuickLook.Plugin.TextViewer/key.snk b/QuickLook.Plugin/QuickLook.Plugin.TextViewer/key.snk deleted file mode 100644 index 174ee23..0000000 Binary files a/QuickLook.Plugin/QuickLook.Plugin.TextViewer/key.snk and /dev/null differ diff --git a/QuickLook.Plugin/QuickLook.Plugin.VideoViewer/QuickLook.Plugin.VideoViewer.csproj b/QuickLook.Plugin/QuickLook.Plugin.VideoViewer/QuickLook.Plugin.VideoViewer.csproj index 4507bf3..6ff8fd5 100644 --- a/QuickLook.Plugin/QuickLook.Plugin.VideoViewer/QuickLook.Plugin.VideoViewer.csproj +++ b/QuickLook.Plugin/QuickLook.Plugin.VideoViewer/QuickLook.Plugin.VideoViewer.csproj @@ -53,10 +53,11 @@ MinimumRecommendedRules.ruleset - true + false - key.snk + + @@ -109,7 +110,6 @@ Code - diff --git a/QuickLook.Plugin/QuickLook.Plugin.VideoViewer/key.snk b/QuickLook.Plugin/QuickLook.Plugin.VideoViewer/key.snk deleted file mode 100644 index 174ee23..0000000 Binary files a/QuickLook.Plugin/QuickLook.Plugin.VideoViewer/key.snk and /dev/null differ diff --git a/QuickLook/App.xaml.cs b/QuickLook/App.xaml.cs index 241c3ec..85015c7 100644 --- a/QuickLook/App.xaml.cs +++ b/QuickLook/App.xaml.cs @@ -25,7 +25,6 @@ using System.Threading; using System.Threading.Tasks; using System.Windows; using QuickLook.Helpers; -using QuickLook.Properties; namespace QuickLook { @@ -39,8 +38,8 @@ namespace QuickLook public static readonly bool Is64Bit = Environment.Is64BitProcess; public static readonly bool IsUWP = ProcessHelper.IsRunningAsUWP(); public static readonly bool IsWin10 = Environment.OSVersion.Version >= new Version(10, 0); - public static readonly string LocalDataPath = Path.GetFullPath(Path.Combine(ConfigurationManager - .OpenExeConfiguration(ConfigurationUserLevel.PerUserRoamingAndLocal).FilePath, @"..\..\")); + public static readonly string LocalDataPath = + Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), @"pooi.moe\QuickLook\"); private bool _isFirstInstance; private Mutex _isRunning; @@ -74,7 +73,7 @@ namespace QuickLook RemoteCallShowPreview(e); // second instance: duplicate else - MessageBox.Show(TranslationHelper.GetString("APP_SECOND")); + MessageBox.Show(TranslationHelper.Get("APP_SECOND")); Shutdown(); return; @@ -91,24 +90,23 @@ namespace QuickLook private void CheckUpdate() { - if (DateTime.Now - Settings.Default.LastUpdate < TimeSpan.FromDays(7)) + if (DateTime.Now - SettingHelper.Get("LastUpdate") < TimeSpan.FromDays(7)) return; Task.Delay(120 * 1000).ContinueWith(_ => Updater.CheckForUpdates(true)); - Settings.Default.LastUpdate = DateTime.Now; - Settings.Default.Save(); + SettingHelper.Set("LastUpdate", DateTime.Now); } private void UpgradeSettings() { try { - if (!Settings.Default.Upgraded) + if (!SettingHelper.Get("Upgraded", true)) return; Updater.CollectAndShowReleaseNotes(); - Settings.Default.Upgrade(); + SettingHelper.Set("Upgraded", false); } catch (ConfigurationErrorsException e) { @@ -124,8 +122,7 @@ namespace QuickLook //return; } - Settings.Default.Upgraded = false; - Settings.Default.Save(); + SettingHelper.Set("Upgraded", false); } private void RemoteCallShowPreview(StartupEventArgs e) @@ -137,7 +134,7 @@ namespace QuickLook { TrayIconManager.GetInstance(); if (!e.Args.Contains("/autorun") && !IsUWP) - TrayIconManager.ShowNotification("", TranslationHelper.GetString("APP_START")); + TrayIconManager.ShowNotification("", TranslationHelper.Get("APP_START")); if (e.Args.Contains("/first")) AutoStartupHelper.CreateAutorunShortcut(); diff --git a/QuickLook/Helpers/SettingHelper.cs b/QuickLook/Helpers/SettingHelper.cs new file mode 100644 index 0000000..e00d41f --- /dev/null +++ b/QuickLook/Helpers/SettingHelper.cs @@ -0,0 +1,113 @@ +// Copyright © 2018 Paddy Xu +// +// This file is part of QuickLook program. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +using System; +using System.Collections.Generic; +using System.IO; +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.Serialization; +using System.Xml; + +namespace QuickLook.Helpers +{ + internal class SettingHelper + { + private static readonly Dictionary FileCache = new Dictionary(); + + [MethodImpl(MethodImplOptions.NoInlining)] + public static T Get(string id, T failsafe = default(T), Assembly calling = null) + { + if (!typeof(T).IsSerializable && !typeof(ISerializable).IsAssignableFrom(typeof(T))) + throw new InvalidOperationException("A serializable Type is required"); + + var file = Path.Combine(App.LocalDataPath, + (calling ?? Assembly.GetCallingAssembly()).GetName().Name + ".config"); + + var doc = GetConfigFile(file); + + // try to get setting + var s = GetSettingFromXml(doc, id, failsafe); + + return s != null ? s : failsafe; + } + + [MethodImpl(MethodImplOptions.NoInlining)] + public static void Set(string id, object value, Assembly calling = null) + { + if (!value.GetType().IsSerializable) + throw new NotSupportedException("New value if not serializable."); + + var file = Path.Combine(App.LocalDataPath, + (calling ?? Assembly.GetCallingAssembly()).GetName().Name + ".config"); + + WriteSettingToXml(GetConfigFile(file), id, value); + } + + private static T GetSettingFromXml(XmlDocument doc, string id, T failsafe) + { + var v = doc.SelectSingleNode($@"/Settings/{id}"); + var result = v == null ? failsafe : (T) Convert.ChangeType(v.InnerText, typeof(T)); + + return result; + } + + private static void WriteSettingToXml(XmlDocument doc, string id, object value) + { + var v = doc.SelectSingleNode($@"/Settings/{id}"); + + if (v != null) + { + v.InnerText = value.ToString(); + } + else + { + var node = doc.CreateNode(XmlNodeType.Element, id, doc.NamespaceURI); + node.InnerText = value.ToString(); + doc.SelectSingleNode(@"/Settings").AppendChild(node); + } + + doc.Save(new Uri(doc.BaseURI).LocalPath); + } + + private static XmlDocument GetConfigFile(string file) + { + if (FileCache.ContainsKey(file)) + return FileCache[file]; + + Directory.CreateDirectory(Path.GetDirectoryName(file)); + if (!File.Exists(file)) + CreateNewConfig(file); + + var doc = new XmlDocument(); + doc.Load(file); + FileCache.Add(file, doc); + return doc; + } + + private static void CreateNewConfig(string file) + { + using (var writer = XmlWriter.Create(file)) + { + writer.WriteStartDocument(); + writer.WriteStartElement("Settings"); + writer.WriteEndElement(); + writer.WriteEndDocument(); + } + } + } +} \ No newline at end of file diff --git a/QuickLook/Helpers/TranslationHelper.cs b/QuickLook/Helpers/TranslationHelper.cs index edfc31a..ce6b748 100644 --- a/QuickLook/Helpers/TranslationHelper.cs +++ b/QuickLook/Helpers/TranslationHelper.cs @@ -30,10 +30,9 @@ namespace QuickLook.Helpers //private static readonly CultureInfo CurrentCultureInfo = CultureInfo.GetCultureInfo("zh-CN"); private static readonly Dictionary FileCache = new Dictionary(); - private static readonly Dictionary StringCache = new Dictionary(); [MethodImpl(MethodImplOptions.NoInlining)] - public static string GetString(string id, string file = null, CultureInfo locale = null, string failsafe = null, + public static string Get(string id, string file = null, CultureInfo locale = null, string failsafe = null, Assembly calling = null) { if (file == null) @@ -69,12 +68,7 @@ namespace QuickLook.Helpers private static string GetStringFromXml(XPathNavigator nav, string id, CultureInfo locale) { - var cacheKey = $"{nav.BaseURI.GetHashCode()}::{locale.Name}::{id}"; - if (StringCache.ContainsKey(cacheKey)) - return StringCache[cacheKey]; - var result = nav.SelectSingleNode($@"/Translations/{locale.Name}/{id}"); - StringCache.Add(cacheKey, result?.Value); return result?.Value; } diff --git a/QuickLook/Helpers/Updater.cs b/QuickLook/Helpers/Updater.cs index 97d521a..de34684 100644 --- a/QuickLook/Helpers/Updater.cs +++ b/QuickLook/Helpers/Updater.cs @@ -48,7 +48,7 @@ namespace QuickLook.Helpers if (!silent) Application.Current.Dispatcher.Invoke( () => TrayIconManager.ShowNotification("", - TranslationHelper.GetString("Update_NoUpdate"))); + TranslationHelper.Get("Update_NoUpdate"))); return; } @@ -58,7 +58,7 @@ namespace QuickLook.Helpers () => { TrayIconManager.ShowNotification("", - string.Format(TranslationHelper.GetString("Update_Found"), nVersion), + string.Format(TranslationHelper.Get("Update_Found"), nVersion), timeout: 20000, clickEvent: () => Process.Start( @@ -70,7 +70,7 @@ namespace QuickLook.Helpers Debug.WriteLine(e.Message); Application.Current.Dispatcher.Invoke( () => TrayIconManager.ShowNotification("", - string.Format(TranslationHelper.GetString("Update_Error"), e.Message))); + string.Format(TranslationHelper.Get("Update_Error"), e.Message))); } }); } @@ -106,7 +106,7 @@ namespace QuickLook.Helpers Debug.WriteLine(e.Message); Application.Current.Dispatcher.Invoke( () => TrayIconManager.ShowNotification("", - string.Format(TranslationHelper.GetString("Update_Error"), e.Message))); + string.Format(TranslationHelper.Get("Update_Error"), e.Message))); } }); } diff --git a/QuickLook/Plugin/ContextObject.cs b/QuickLook/Plugin/ContextObject.cs index 7fe5c02..8ed016c 100644 --- a/QuickLook/Plugin/ContextObject.cs +++ b/QuickLook/Plugin/ContextObject.cs @@ -198,7 +198,25 @@ namespace QuickLook.Plugin [MethodImpl(MethodImplOptions.NoInlining)] public string GetString(string id, string file = null, CultureInfo locale = null, string failsafe = null) { - return TranslationHelper.GetString(id, file, locale, failsafe, Assembly.GetCallingAssembly()); + return TranslationHelper.Get(id, file, locale, failsafe, Assembly.GetCallingAssembly()); + } + + /// + /// Get a setting from Xml document. + /// + [MethodImpl(MethodImplOptions.NoInlining)] + public T GetSetting(string id, T failsafe = default(T)) + { + return SettingHelper.Get(id, failsafe, Assembly.GetCallingAssembly()); + } + + /// + /// Set a setting from Xml document. + /// + [MethodImpl(MethodImplOptions.NoInlining)] + public void SetSetting(string id, object value) + { + SettingHelper.Set(id, value, Assembly.GetCallingAssembly()); } /// diff --git a/QuickLook/Plugin/InfoPanel/InfoPanel.xaml.cs b/QuickLook/Plugin/InfoPanel/InfoPanel.xaml.cs index 8c76060..5f5981d 100644 --- a/QuickLook/Plugin/InfoPanel/InfoPanel.xaml.cs +++ b/QuickLook/Plugin/InfoPanel/InfoPanel.xaml.cs @@ -68,7 +68,7 @@ namespace QuickLook.Plugin.InfoPanel filename.Text = string.IsNullOrEmpty(name) ? path : name; var last = File.GetLastWriteTime(path); - modDate.Text = string.Format(TranslationHelper.GetString("InfoPanel_LastModified"), + modDate.Text = string.Format(TranslationHelper.Get("InfoPanel_LastModified"), last.ToString(CultureInfo.CurrentCulture)); Stop = false; @@ -91,7 +91,7 @@ namespace QuickLook.Plugin.InfoPanel Dispatcher.Invoke(() => { totalSize.Text = - string.Format(TranslationHelper.GetString("InfoPanel_DriveSize"), + string.Format(TranslationHelper.Get("InfoPanel_DriveSize"), totalSpace.ToPrettySize(2), totalFreeSpace.ToPrettySize(2)); }); @@ -107,16 +107,16 @@ namespace QuickLook.Plugin.InfoPanel string t; var folders = totalDirsL == 0 ? string.Empty - : string.Format(TranslationHelper.GetString( + : string.Format(TranslationHelper.Get( totalDirsL == 1 ? "InfoPanel_Folder" : "InfoPanel_Folders"), totalDirsL); var files = totalFilesL == 0 ? string.Empty - : string.Format(TranslationHelper.GetString( + : string.Format(TranslationHelper.Get( totalFilesL == 1 ? "InfoPanel_File" : "InfoPanel_Files"), totalFilesL); if (!string.IsNullOrEmpty(folders) && !string.IsNullOrEmpty(files)) t = string.Format( - TranslationHelper.GetString("InfoPanel_FolderAndFile"), folders, files); + TranslationHelper.Get("InfoPanel_FolderAndFile"), folders, files); else if (string.IsNullOrEmpty(folders) && string.IsNullOrEmpty(files)) t = string.Empty; else diff --git a/QuickLook/Properties/Settings.Designer.cs b/QuickLook/Properties/Settings.Designer.cs deleted file mode 100644 index c1a6ae1..0000000 --- a/QuickLook/Properties/Settings.Designer.cs +++ /dev/null @@ -1,50 +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 QuickLook.Properties { - - - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.1.0.0")] - internal 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.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("True")] - public bool Upgraded { - get { - return ((bool)(this["Upgraded"])); - } - set { - this["Upgraded"] = value; - } - } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("2017-01-01")] - public global::System.DateTime LastUpdate { - get { - return ((global::System.DateTime)(this["LastUpdate"])); - } - set { - this["LastUpdate"] = value; - } - } - } -} diff --git a/QuickLook/Properties/Settings.settings b/QuickLook/Properties/Settings.settings deleted file mode 100644 index 2e9bed7..0000000 --- a/QuickLook/Properties/Settings.settings +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - True - - - 2017-01-01 - - - \ No newline at end of file diff --git a/QuickLook/QuickLook.csproj b/QuickLook/QuickLook.csproj index d3c1d63..8f194c9 100644 --- a/QuickLook/QuickLook.csproj +++ b/QuickLook/QuickLook.csproj @@ -79,10 +79,11 @@ true - true + false - key.snk + + @@ -134,6 +135,7 @@ + @@ -207,11 +209,6 @@ True Resources.resx - - True - Settings.settings - True - @@ -231,11 +228,6 @@ PreserveNewest - - - SettingsSingleFileGenerator - Settings.Designer.cs - diff --git a/QuickLook/TrayIconManager.cs b/QuickLook/TrayIconManager.cs index 421ff68..556aedb 100644 --- a/QuickLook/TrayIconManager.cs +++ b/QuickLook/TrayIconManager.cs @@ -30,7 +30,7 @@ namespace QuickLook private readonly NotifyIcon _icon; private readonly MenuItem _itemAutorun = - new MenuItem(TranslationHelper.GetString("Icon_RunAtStartup"), + new MenuItem(TranslationHelper.Get("Icon_RunAtStartup"), (sender, e) => { if (AutoStartupHelper.IsAutorun()) @@ -43,7 +43,7 @@ namespace QuickLook { _icon = new NotifyIcon { - Text = string.Format(TranslationHelper.GetString("Icon_ToolTip"), + Text = string.Format(TranslationHelper.Get("Icon_ToolTip"), Application.ProductVersion), Icon = GetTrayIconByDPI(), Visible = true, @@ -51,10 +51,10 @@ namespace QuickLook { new MenuItem($"v{Application.ProductVersion}{(App.IsUWP ? " (UWP)" : "")}") {Enabled = false}, new MenuItem("-"), - new MenuItem(TranslationHelper.GetString("Icon_CheckUpdate"), + new MenuItem(TranslationHelper.Get("Icon_CheckUpdate"), (sender, e) => Updater.CheckForUpdates()) {Enabled = !App.IsUWP}, _itemAutorun, - new MenuItem(TranslationHelper.GetString("Icon_Quit"), + new MenuItem(TranslationHelper.Get("Icon_Quit"), (sender, e) => System.Windows.Application.Current.Shutdown()) }) }; diff --git a/QuickLook/ViewerWindow.Actions.cs b/QuickLook/ViewerWindow.Actions.cs index a7c446e..0dae0fd 100644 --- a/QuickLook/ViewerWindow.Actions.cs +++ b/QuickLook/ViewerWindow.Actions.cs @@ -243,7 +243,7 @@ namespace QuickLook if (replaceWith.Length > 16) replaceWith = replaceWith.Substring(0, 14) + "…" + replaceWith.Substring(replaceWith.Length - 2); - str = TranslationHelper.GetString(str); + str = TranslationHelper.Get(str); var elements = str.Split(new[] {"{0}"}, StringSplitOptions.None).ToList(); while (elements.Count < 2) elements.Add(string.Empty); diff --git a/QuickLook/ViewerWindow.xaml.cs b/QuickLook/ViewerWindow.xaml.cs index 060c656..5feffd5 100644 --- a/QuickLook/ViewerWindow.xaml.cs +++ b/QuickLook/ViewerWindow.xaml.cs @@ -41,7 +41,7 @@ namespace QuickLook InitializeComponent(); - FontFamily = new FontFamily(TranslationHelper.GetString("UI_FontFamily", failsafe: "Segoe UI")); + FontFamily = new FontFamily(TranslationHelper.Get("UI_FontFamily", failsafe: "Segoe UI")); SizeChanged += SaveWindowSizeOnSizeChanged; diff --git a/QuickLook/key.snk b/QuickLook/key.snk deleted file mode 100644 index 174ee23..0000000 Binary files a/QuickLook/key.snk and /dev/null differ