diff --git a/Deploy/NAppUpdate/FeedBuilder.config b/Deploy/NAppUpdate/FeedBuilder.config index f06954dd29..4e99a397fd 100644 --- a/Deploy/NAppUpdate/FeedBuilder.config +++ b/Deploy/NAppUpdate/FeedBuilder.config @@ -1,18 +1,16 @@  - + http://127.0.0.1:8888 True False True - True + False <?xml version="1.0" encoding="utf-16"?> -<ArrayOfString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" /> + <ArrayOfString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" /> True - True - E:\github\Wox\Output\Debug + False + ..\..\Output\Release True False - E:\github\Wox\Output\Update\Update.xml - - http://127.0.0.1:8888 + ..\..\Output\Update\Update.xml diff --git a/Deploy/NAppUpdate/FeedBuilder.exe b/Deploy/NAppUpdate/FeedBuilder.exe index fae2128316..278eea2032 100644 Binary files a/Deploy/NAppUpdate/FeedBuilder.exe and b/Deploy/NAppUpdate/FeedBuilder.exe differ diff --git a/Wox.Core/UI/ResourceMerger.cs b/Wox.Core/UI/ResourceMerger.cs index b2167a3cd3..6d7a892982 100644 --- a/Wox.Core/UI/ResourceMerger.cs +++ b/Wox.Core/UI/ResourceMerger.cs @@ -39,7 +39,7 @@ namespace Wox.Core.UI foreach (var pluginI18n in pluginI18ns) { - string languageFile = InternationalizationManager.Internationalization.GetLanguageFile( + string languageFile = InternationalizationManager.Instance.GetLanguageFile( ((IPluginI18n)Activator.CreateInstance(pluginI18n)).GetLanguagesFolder()); if (!string.IsNullOrEmpty(languageFile)) { diff --git a/Wox.Core/Updater/UpdaterManager.cs b/Wox.Core/Updater/UpdaterManager.cs index 7f07171606..c89d651db5 100644 --- a/Wox.Core/Updater/UpdaterManager.cs +++ b/Wox.Core/Updater/UpdaterManager.cs @@ -6,6 +6,8 @@ using System.Windows.Threading; using NAppUpdate.Framework; using NAppUpdate.Framework.Common; using NAppUpdate.Framework.Sources; +using Wox.Core.i18n; +using Wox.Core.UserSettings; using Wox.Infrastructure.Logger; namespace Wox.Core.Updater @@ -31,11 +33,14 @@ namespace Wox.Core.Updater UpdateManager.Instance.UpdateSource = GetUpdateSource(); } + public bool IsUpdateAvailable() + { + return UpdateManager.Instance.UpdatesAvailable > 0; + } + public void CheckUpdate() { - // Get a local pointer to the UpdateManager instance UpdateManager updManager = UpdateManager.Instance; - updManager.BeginCheckForUpdates(asyncResult => { if (asyncResult.IsCompleted) @@ -43,9 +48,9 @@ namespace Wox.Core.Updater // still need to check for caught exceptions if any and rethrow try { - ((UpdateProcessAsyncResult) asyncResult).EndInvoke(); + ((UpdateProcessAsyncResult)asyncResult).EndInvoke(); } - catch(System.Exception e) + catch (System.Exception e) { Log.Error(e); updManager.CleanUp(); @@ -55,7 +60,6 @@ namespace Wox.Core.Updater // No updates were found, or an error has occured. We might want to check that... if (updManager.UpdatesAvailable == 0) { - MessageBox.Show("All is up to date!"); return; } } @@ -63,53 +67,44 @@ namespace Wox.Core.Updater updManager.BeginPrepareUpdates(result => { ((UpdateProcessAsyncResult)result).EndInvoke(); + string updateReady = InternationalizationManager.Instance.GetTranslation("update_wox_update_ready"); + string updateInstall = InternationalizationManager.Instance.GetTranslation("update_wox_update_install"); + updateInstall = string.Format(updateInstall, updManager.UpdatesAvailable); + DialogResult dr = MessageBox.Show(updateInstall, updateReady, MessageBoxButtons.YesNo); - // ApplyUpdates is a synchronous method by design. Make sure to save all user work before calling - // it as it might restart your application - // get out of the way so the console window isn't obstructed - try + if (dr == DialogResult.Yes) { - updManager.ApplyUpdates(true,false,true); - } - catch - { - // this.WindowState = WindowState.Normal; - MessageBox.Show( - "An error occurred while trying to install software updates"); - } - updManager.CleanUp(); + // ApplyUpdates is a synchronous method by design. Make sure to save all user work before calling + // it as it might restart your application + // get out of the way so the console window isn't obstructed + try + { + updManager.ApplyUpdates(true, UserSettingStorage.Instance.EnableUpdateLog, false); + } + catch (System.Exception e) + { + string updateError = + InternationalizationManager.Instance.GetTranslation("update_wox_update_error"); + Log.Error(e); + MessageBox.Show(updateError); + } + + updManager.CleanUp(); + } + else + { + updManager.CleanUp(); + } }, null); }, null); } - public void Reinstall() - { - UpdateManager.Instance.ReinstateIfRestarted(); - } - - private void OnPrepareUpdatesCompleted(bool obj) - { - UpdateManager updManager = UpdateManager.Instance; - - DialogResult dr = MessageBox.Show( - "Updates are ready to install. Do you wish to install them now?", - "Software updates ready", - MessageBoxButtons.YesNo); - - if (dr == DialogResult.Yes) - { - // This is a synchronous method by design, make sure to save all user work before calling - // it as it might restart your application - updManager.ApplyUpdates(true,true,true); - } - } - private IUpdateSource GetUpdateSource() { // Normally this would be a web based source. // But for the demo app, we prepare an in-memory source. - var source = new NAppUpdate.Framework.Sources.SimpleWebSource("http://127.0.0.1:8888/Update.xml"); + var source = new SimpleWebSource("http://127.0.0.1:8888/Update.xml"); return source; } } diff --git a/Wox.Core/UserSettings/UserSettingStorage.cs b/Wox.Core/UserSettings/UserSettingStorage.cs index 9b1af13a61..5f7c243c74 100644 --- a/Wox.Core/UserSettings/UserSettingStorage.cs +++ b/Wox.Core/UserSettings/UserSettingStorage.cs @@ -14,6 +14,9 @@ namespace Wox.Core.UserSettings [JsonProperty] public bool DontPromptUpdateMsg { get; set; } + [JsonProperty] + public bool EnableUpdateLog { get; set; } + [JsonProperty] public string Hotkey { get; set; } diff --git a/Wox.Core/i18n/InternationalizationManager.cs b/Wox.Core/i18n/InternationalizationManager.cs index a1f0a9049c..cfe1ca7fc7 100644 --- a/Wox.Core/i18n/InternationalizationManager.cs +++ b/Wox.Core/i18n/InternationalizationManager.cs @@ -14,7 +14,7 @@ namespace Wox.Core.i18n private static Internationalization instance; private static object syncObject = new object(); - public static Internationalization Internationalization + public static Internationalization Instance { get { diff --git a/Wox.CrashReporter/ReportWindow.xaml.cs b/Wox.CrashReporter/ReportWindow.xaml.cs index 55ec0555b7..ec041fb7cd 100644 --- a/Wox.CrashReporter/ReportWindow.xaml.cs +++ b/Wox.CrashReporter/ReportWindow.xaml.cs @@ -45,7 +45,7 @@ namespace Wox.CrashReporter private void btnSend_Click(object sender, RoutedEventArgs e) { - string sendingMsg = InternationalizationManager.Internationalization.GetTranslation("reportWindow_sending"); + string sendingMsg = InternationalizationManager.Instance.GetTranslation("reportWindow_sending"); tbSendReport.Content = sendingMsg; btnSend.IsEnabled = false; ThreadPool.QueueUserWorkItem(o => SendReport()); @@ -57,11 +57,11 @@ namespace Wox.CrashReporter string response = HttpRequest.Post(APIServer.ErrorReportURL, error, HttpProxy.Instance); if (response.ToLower() == "ok") { - MessageBox.Show(InternationalizationManager.Internationalization.GetTranslation("reportWindow_report_succeed")); + MessageBox.Show(InternationalizationManager.Instance.GetTranslation("reportWindow_report_succeed")); } else { - MessageBox.Show(InternationalizationManager.Internationalization.GetTranslation("reportWindow_report_failed")); + MessageBox.Show(InternationalizationManager.Instance.GetTranslation("reportWindow_report_failed")); } Dispatcher.Invoke(new Action(Close)); } diff --git a/Wox/ActionKeyword.xaml.cs b/Wox/ActionKeyword.xaml.cs index e6832be527..96f5e9dcc3 100644 --- a/Wox/ActionKeyword.xaml.cs +++ b/Wox/ActionKeyword.xaml.cs @@ -29,7 +29,7 @@ namespace Wox PluginPair plugin = PluginManager.GetPlugin(pluginId); if (plugin == null) { - MessageBox.Show(InternationalizationManager.Internationalization.GetTranslation("cannotFindSpecifiedPlugin")); + MessageBox.Show(InternationalizationManager.Instance.GetTranslation("cannotFindSpecifiedPlugin")); Close(); return; } @@ -52,14 +52,14 @@ namespace Wox { if (string.IsNullOrEmpty(tbAction.Text)) { - MessageBox.Show(InternationalizationManager.Internationalization.GetTranslation("newActionKeywordCannotBeEmpty")); + MessageBox.Show(InternationalizationManager.Instance.GetTranslation("newActionKeywordCannotBeEmpty")); return; } //check new action keyword didn't used by other plugin if (PluginManager.AllPlugins.Exists(o => o.Metadata.ActionKeyword == tbAction.Text.Trim())) { - MessageBox.Show(InternationalizationManager.Internationalization.GetTranslation("newActionKeywordHasBeenAssigned")); + MessageBox.Show(InternationalizationManager.Instance.GetTranslation("newActionKeywordHasBeenAssigned")); return; } @@ -81,7 +81,7 @@ namespace Wox customizedPluginConfig.Actionword = tbAction.Text.Trim(); } UserSettingStorage.Instance.Save(); - MessageBox.Show(InternationalizationManager.Internationalization.GetTranslation("succeed")); + MessageBox.Show(InternationalizationManager.Instance.GetTranslation("succeed")); Close(); } } diff --git a/Wox/CustomQueryHotkeySetting.xaml.cs b/Wox/CustomQueryHotkeySetting.xaml.cs index 2c9bba0c1d..759defa29a 100644 --- a/Wox/CustomQueryHotkeySetting.xaml.cs +++ b/Wox/CustomQueryHotkeySetting.xaml.cs @@ -29,7 +29,7 @@ namespace Wox { if (!ctlHotkey.CurrentHotkeyAvailable) { - MessageBox.Show(InternationalizationManager.Internationalization.GetTranslation("hotkeyIsNotUnavailable")); + MessageBox.Show(InternationalizationManager.Instance.GetTranslation("hotkeyIsNotUnavailable")); return; } @@ -49,13 +49,13 @@ namespace Wox settingWidow.MainWindow.ChangeQuery(pluginHotkey.ActionKeyword); settingWidow.MainWindow.ShowApp(); }); - MessageBox.Show(InternationalizationManager.Internationalization.GetTranslation("succeed")); + MessageBox.Show(InternationalizationManager.Instance.GetTranslation("succeed")); } else { if (updateCustomHotkey.Hotkey != ctlHotkey.CurrentHotkey.ToString() && !ctlHotkey.CurrentHotkeyAvailable) { - MessageBox.Show(InternationalizationManager.Internationalization.GetTranslation("hotkeyIsNotUnavailable")); + MessageBox.Show(InternationalizationManager.Instance.GetTranslation("hotkeyIsNotUnavailable")); return; } var oldHotkey = updateCustomHotkey.Hotkey; @@ -68,7 +68,7 @@ namespace Wox settingWidow.MainWindow.ShowApp(); settingWidow.MainWindow.ChangeQuery(updateCustomHotkey.ActionKeyword); }); - MessageBox.Show(InternationalizationManager.Internationalization.GetTranslation("succeed")); + MessageBox.Show(InternationalizationManager.Instance.GetTranslation("succeed")); } UserSettingStorage.Instance.Save(); @@ -81,7 +81,7 @@ namespace Wox updateCustomHotkey = UserSettingStorage.Instance.CustomPluginHotkeys.FirstOrDefault(o => o.ActionKeyword == item.ActionKeyword && o.Hotkey == item.Hotkey); if (updateCustomHotkey == null) { - MessageBox.Show(InternationalizationManager.Internationalization.GetTranslation("invalidPluginHotkey")); + MessageBox.Show(InternationalizationManager.Instance.GetTranslation("invalidPluginHotkey")); Close(); return; } @@ -89,7 +89,7 @@ namespace Wox tbAction.Text = updateCustomHotkey.ActionKeyword; ctlHotkey.SetHotkey(updateCustomHotkey.Hotkey, false); update = true; - lblAdd.Text = InternationalizationManager.Internationalization.GetTranslation("update"); + lblAdd.Text = InternationalizationManager.Instance.GetTranslation("update"); } private void BtnTestActionKeyword_OnClick(object sender, RoutedEventArgs e) diff --git a/Wox/HotkeyControl.xaml.cs b/Wox/HotkeyControl.xaml.cs index 1725f64019..bc89336ac2 100644 --- a/Wox/HotkeyControl.xaml.cs +++ b/Wox/HotkeyControl.xaml.cs @@ -99,12 +99,12 @@ namespace Wox if (!CurrentHotkeyAvailable) { tbMsg.Foreground = new SolidColorBrush(Colors.Red); - tbMsg.Text = InternationalizationManager.Internationalization.GetTranslation("hotkeyUnavailable"); + tbMsg.Text = InternationalizationManager.Instance.GetTranslation("hotkeyUnavailable"); } else { tbMsg.Foreground = new SolidColorBrush(Colors.Green); - tbMsg.Text = InternationalizationManager.Internationalization.GetTranslation("succeed"); + tbMsg.Text = InternationalizationManager.Instance.GetTranslation("succeed"); } OnOnHotkeyChanged(); } diff --git a/Wox/Languages/en.xaml b/Wox/Languages/en.xaml index 4f1561034b..54d55f7490 100644 --- a/Wox/Languages/en.xaml +++ b/Wox/Languages/en.xaml @@ -98,4 +98,9 @@ Report failed Wox got an error + + Wox updates available + Wox updates are ready to install. {0} files will be added and replaced, this operation may restart Wox. Do you wish to install them now? + An error occurred while trying to install software updates + \ No newline at end of file diff --git a/Wox/Languages/zh-cn.xaml b/Wox/Languages/zh-cn.xaml index 5e06761f1c..1c341d32eb 100644 --- a/Wox/Languages/zh-cn.xaml +++ b/Wox/Languages/zh-cn.xaml @@ -97,4 +97,10 @@ 发送成功 发送失败 Wox出错啦 + + + Wox更新 + Wox更新啦!{0}个文件会被添加和替换,并且在此过程中可能会重启Wox。你确定需要更新吗? + 更新Wox出错 + \ No newline at end of file diff --git a/Wox/Languages/zh-tw.xaml b/Wox/Languages/zh-tw.xaml index d3c8812995..825679f6e1 100644 --- a/Wox/Languages/zh-tw.xaml +++ b/Wox/Languages/zh-tw.xaml @@ -98,4 +98,9 @@ 發送失敗 Wox出錯啦 + + Wox更新 + Wox更新啦!{0}個文件會被添加和替換,並且在此過程中可能會重啟Wox。你確定需要更新嗎? + 更新Wox出錯 + \ No newline at end of file diff --git a/Wox/MainWindow.xaml.cs b/Wox/MainWindow.xaml.cs index 7a4cd03db1..110faad2bc 100644 --- a/Wox/MainWindow.xaml.cs +++ b/Wox/MainWindow.xaml.cs @@ -24,7 +24,6 @@ using Wox.Infrastructure; using Wox.Infrastructure.Hotkey; using Wox.Plugin; using Wox.Storage; -using Wox.Update; using Brushes = System.Windows.Media.Brushes; using Color = System.Windows.Media.Color; using ContextMenu = System.Windows.Forms.ContextMenu; @@ -124,7 +123,7 @@ namespace Wox public string GetTranslation(string key) { - return InternationalizationManager.Internationalization.GetTranslation(key); + return InternationalizationManager.Instance.GetTranslation(key); } public List GetAllPlugins() @@ -175,7 +174,7 @@ namespace Wox pnlResult.RightMouseClickEvent += pnlResult_RightMouseClickEvent; ThemeManager.Theme.ChangeTheme(UserSettingStorage.Instance.Theme); - InternationalizationManager.Internationalization.ChangeLanguage(UserSettingStorage.Instance.Language); + InternationalizationManager.Instance.ChangeLanguage(UserSettingStorage.Instance.Language); SetHotkey(UserSettingStorage.Instance.Hotkey, OnHotkey); SetCustomPluginHotkey(); @@ -193,7 +192,6 @@ namespace Wox Thread.Sleep(50); PreLoadImages(); }); - CheckUpdate(); } private bool KListener_hookedKeyboardCallback(KeyEvent keyevent, int vkcode, SpecialKeyState state) @@ -215,22 +213,6 @@ namespace Wox ShowContextMenu(result); } - void CheckUpdate() - { - ThreadPool.QueueUserWorkItem(o => - { - Release release = new UpdateChecker().CheckUpgrade(); - if (release != null && !UserSettingStorage.Instance.DontPromptUpdateMsg) - { - Dispatcher.Invoke(new Action(() => - { - NewVersionWindow newVersinoWindow = new NewVersionWindow(); - newVersinoWindow.Show(); - })); - } - }); - } - void MainWindow_Closing(object sender, CancelEventArgs e) { UserSettingStorage.Instance.WindowLeft = Left; @@ -278,7 +260,7 @@ namespace Wox } catch (Exception) { - string errorMsg = string.Format(InternationalizationManager.Internationalization.GetTranslation("registerHotkeyFailed"), hotkeyStr); + string errorMsg = string.Format(InternationalizationManager.Instance.GetTranslation("registerHotkeyFailed"), hotkeyStr); MessageBox.Show(errorMsg); } } @@ -673,7 +655,7 @@ namespace Wox } catch (Exception ex) { - string errorMsg = string.Format(InternationalizationManager.Internationalization.GetTranslation("couldnotStartCmd"), cmd); + string errorMsg = string.Format(InternationalizationManager.Instance.GetTranslation("couldnotStartCmd"), cmd); ShowMsg(errorMsg, ex.Message, null); } return false; @@ -691,7 +673,7 @@ namespace Wox } else { - MessageBox.Show(InternationalizationManager.Internationalization.GetTranslation("invalidWoxPluginFileFormat")); + MessageBox.Show(InternationalizationManager.Instance.GetTranslation("invalidWoxPluginFileFormat")); } } } diff --git a/Wox/SettingWindow.xaml b/Wox/SettingWindow.xaml index 50e5341b9d..704f39936f 100644 --- a/Wox/SettingWindow.xaml +++ b/Wox/SettingWindow.xaml @@ -318,7 +318,6 @@ - diff --git a/Wox/SettingWindow.xaml.cs b/Wox/SettingWindow.xaml.cs index 56152f8c18..e4c43d99d7 100644 --- a/Wox/SettingWindow.xaml.cs +++ b/Wox/SettingWindow.xaml.cs @@ -13,7 +13,6 @@ using System.Windows.Media.Imaging; using Wox.Core.Plugin; using Wox.Plugin; using Wox.Helper; -using Wox.Update; using Application = System.Windows.Forms.Application; using File = System.IO.File; using MessageBox = System.Windows.MessageBox; @@ -218,15 +217,6 @@ namespace Wox #region About tbVersion.Text = ConfigurationManager.AppSettings["version"]; - Release newRelease = new UpdateChecker().CheckUpgrade(); - if (newRelease == null) - { - tbNewVersionAvailable.Visibility = Visibility.Collapsed; - } - else - { - tbNewVersionAvailable.Text = newRelease.version + " available"; - } #endregion @@ -235,7 +225,7 @@ namespace Wox private void LoadLanguages() { - cbLanguages.ItemsSource = InternationalizationManager.Internationalization.LoadAvailableLanguages(); + cbLanguages.ItemsSource = InternationalizationManager.Instance.LoadAvailableLanguages(); cbLanguages.DisplayMemberPath = "Display"; cbLanguages.SelectedValuePath = "LanguageCode"; cbLanguages.SelectedValue = UserSettingStorage.Instance.Language; @@ -244,7 +234,7 @@ namespace Wox void cbLanguages_SelectionChanged(object sender, SelectionChangedEventArgs e) { - InternationalizationManager.Internationalization.ChangeLanguage(cbLanguages.SelectedItem as Language); + InternationalizationManager.Instance.ChangeLanguage(cbLanguages.SelectedItem as Language); } private void EnableProxy() @@ -329,12 +319,12 @@ namespace Wox CustomPluginHotkey item = lvCustomHotkey.SelectedItem as CustomPluginHotkey; if (item == null) { - MessageBox.Show(InternationalizationManager.Internationalization.GetTranslation("pleaseSelectAnItem")); + MessageBox.Show(InternationalizationManager.Instance.GetTranslation("pleaseSelectAnItem")); return; } - string deleteWarning = string.Format(InternationalizationManager.Internationalization.GetTranslation("deleteCustomHotkeyWarning"), item.Hotkey); - if (MessageBox.Show(deleteWarning, InternationalizationManager.Internationalization.GetTranslation("delete"), MessageBoxButton.YesNo) == MessageBoxResult.Yes) + string deleteWarning = string.Format(InternationalizationManager.Instance.GetTranslation("deleteCustomHotkeyWarning"), item.Hotkey); + if (MessageBox.Show(deleteWarning, InternationalizationManager.Instance.GetTranslation("delete"), MessageBoxButton.YesNo) == MessageBoxResult.Yes) { UserSettingStorage.Instance.CustomPluginHotkeys.Remove(item); lvCustomHotkey.Items.Refresh(); @@ -354,7 +344,7 @@ namespace Wox } else { - MessageBox.Show(InternationalizationManager.Internationalization.GetTranslation("pleaseSelectAnItem")); + MessageBox.Show(InternationalizationManager.Instance.GetTranslation("pleaseSelectAnItem")); } } @@ -488,7 +478,7 @@ namespace Wox pluginTitle.Text = pair.Metadata.Name; pluginTitle.Cursor = Cursors.Hand; pluginActionKeyword.Text = pair.Metadata.ActionKeyword; - pluginAuthor.Text = InternationalizationManager.Internationalization.GetTranslation("author") + ": " + pair.Metadata.Author; + pluginAuthor.Text = InternationalizationManager.Instance.GetTranslation("author") + ": " + pair.Metadata.Author; pluginSubTitle.Text = pair.Metadata.Description; pluginId = pair.Metadata.ID; pluginIcon.Source = ImageLoader.ImageLoader.Load(pair.Metadata.FullIcoPath); @@ -627,17 +617,17 @@ namespace Wox { if (string.IsNullOrEmpty(tbProxyServer.Text)) { - MessageBox.Show(InternationalizationManager.Internationalization.GetTranslation("serverCantBeEmpty")); + MessageBox.Show(InternationalizationManager.Instance.GetTranslation("serverCantBeEmpty")); return; } if (string.IsNullOrEmpty(tbProxyPort.Text)) { - MessageBox.Show(InternationalizationManager.Internationalization.GetTranslation("portCantBeEmpty")); + MessageBox.Show(InternationalizationManager.Instance.GetTranslation("portCantBeEmpty")); return; } if (!int.TryParse(tbProxyPort.Text, out port)) { - MessageBox.Show(InternationalizationManager.Internationalization.GetTranslation("invalidPortFormat")); + MessageBox.Show(InternationalizationManager.Instance.GetTranslation("invalidPortFormat")); return; } } @@ -648,25 +638,25 @@ namespace Wox UserSettingStorage.Instance.ProxyPassword = tbProxyPassword.Password; UserSettingStorage.Instance.Save(); - MessageBox.Show(InternationalizationManager.Internationalization.GetTranslation("saveProxySuccessfully")); + MessageBox.Show(InternationalizationManager.Instance.GetTranslation("saveProxySuccessfully")); } private void btnTestProxy_Click(object sender, RoutedEventArgs e) { if (string.IsNullOrEmpty(tbProxyServer.Text)) { - MessageBox.Show(InternationalizationManager.Internationalization.GetTranslation("serverCantBeEmpty")); + MessageBox.Show(InternationalizationManager.Instance.GetTranslation("serverCantBeEmpty")); return; } if (string.IsNullOrEmpty(tbProxyPort.Text)) { - MessageBox.Show(InternationalizationManager.Internationalization.GetTranslation("portCantBeEmpty")); + MessageBox.Show(InternationalizationManager.Instance.GetTranslation("portCantBeEmpty")); return; } int port; if (!int.TryParse(tbProxyPort.Text, out port)) { - MessageBox.Show(InternationalizationManager.Internationalization.GetTranslation("invalidPortFormat")); + MessageBox.Show(InternationalizationManager.Instance.GetTranslation("invalidPortFormat")); return; } @@ -687,16 +677,16 @@ namespace Wox HttpWebResponse response = (HttpWebResponse)request.GetResponse(); if (response.StatusCode == HttpStatusCode.OK) { - MessageBox.Show(InternationalizationManager.Internationalization.GetTranslation("proxyIsCorrect")); + MessageBox.Show(InternationalizationManager.Instance.GetTranslation("proxyIsCorrect")); } else { - MessageBox.Show(InternationalizationManager.Internationalization.GetTranslation("proxyConnectFailed")); + MessageBox.Show(InternationalizationManager.Instance.GetTranslation("proxyConnectFailed")); } } catch { - MessageBox.Show(InternationalizationManager.Internationalization.GetTranslation("proxyConnectFailed")); + MessageBox.Show(InternationalizationManager.Instance.GetTranslation("proxyConnectFailed")); } } @@ -704,14 +694,5 @@ namespace Wox { Process.Start("http://www.getwox.com"); } - - private void tbNewVersionAvailable_MouseUp(object sender, MouseButtonEventArgs e) - { - Release newRelease = new UpdateChecker().CheckUpgrade(); - if (newRelease != null) - { - Process.Start("http://www.getwox.com/release/version/" + newRelease.version); - } - } } } diff --git a/Wox/Update/NewVersionWindow.xaml b/Wox/Update/NewVersionWindow.xaml deleted file mode 100644 index 924e61a202..0000000000 --- a/Wox/Update/NewVersionWindow.xaml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/Wox/Update/NewVersionWindow.xaml.cs b/Wox/Update/NewVersionWindow.xaml.cs deleted file mode 100644 index 8ef0447828..0000000000 --- a/Wox/Update/NewVersionWindow.xaml.cs +++ /dev/null @@ -1,46 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Configuration; -using System.Diagnostics; -using System.Linq; -using System.Text; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Shapes; -using Wox.Core.Version; - -namespace Wox.Update -{ - public partial class NewVersionWindow : Window - { - public NewVersionWindow() - { - InitializeComponent(); - - tbCurrentVersion.Text = VersionManager.Instance.CurrentVersion.ToString(); - Release newRelease = new UpdateChecker().CheckUpgrade(); - if (newRelease == null) - { - tbNewVersion.Visibility = Visibility.Collapsed; - } - else - { - tbNewVersion.Text = newRelease.version; - } - } - - private void tbNewVersion_MouseUp(object sender, MouseButtonEventArgs e) - { - Release newRelease = new UpdateChecker().CheckUpgrade(); - if (newRelease != null) - { - Process.Start("http://www.getwox.com/release/version/" + newRelease.version); - } - } - } -} diff --git a/Wox/Update/Release.cs b/Wox/Update/Release.cs deleted file mode 100644 index 3664f5f2fa..0000000000 --- a/Wox/Update/Release.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace Wox.Update -{ - public class Release - { - public string version { get; set; } - public string download_link { get; set; } - public string download_link1 { get; set; } - public string download_link2 { get; set; } - public string description { get; set; } - } -} diff --git a/Wox/Update/UpdateChecker.cs b/Wox/Update/UpdateChecker.cs deleted file mode 100644 index 65fb0c4d3f..0000000000 --- a/Wox/Update/UpdateChecker.cs +++ /dev/null @@ -1,55 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Configuration; -using System.IO; -using System.Linq; -using System.Net; -using System.Text; -using Newtonsoft.Json; -using Wox.Core; -using Wox.Core.UserSettings; -using Wox.Core.Version; -using Wox.Helper; -using Wox.Infrastructure; -using Wox.Infrastructure.Http; - -namespace Wox.Update -{ - public class UpdateChecker - { - private static Release newRelease; - private static bool checkedUpdate = false; - - /// - /// If new release is available, then return the new release - /// otherwise, return null - /// - /// - public Release CheckUpgrade(bool forceCheck = false) - { - if (checkedUpdate && !forceCheck) return newRelease; - string json = HttpRequest.Get(APIServer.LastestReleaseURL,HttpProxy.Instance); - if (string.IsNullOrEmpty(json)) return null; - - try - { - newRelease = JsonConvert.DeserializeObject(json); - if (!IsNewerThanCurrent(newRelease)) - { - newRelease = null; - } - checkedUpdate = true; - } - catch{} - - return newRelease; - } - - private bool IsNewerThanCurrent(Release release) - { - if (release == null) return false; - - return new SemanticVersion(release.version) > VersionManager.Instance.CurrentVersion; - } - } -} diff --git a/Wox/Wox.csproj b/Wox/Wox.csproj index 7339787130..a71e300ffc 100644 --- a/Wox/Wox.csproj +++ b/Wox/Wox.csproj @@ -113,11 +113,6 @@ - - NewVersionWindow.xaml - - - MSBuild:Compile Designer @@ -235,10 +230,6 @@ Designer PreserveNewest - - Designer - MSBuild:Compile - diff --git a/appveyor.yml b/appveyor.yml index 67d04c4cd9..56829a53ff 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -15,7 +15,7 @@ build: after_test: - ps: .\deploy\nuget\pack.ps1 - - ps: .\deploy\Installer\pack.ps1 + - cmd: .\deploy\NAppUpdate\build.bat deploy: provider: NuGet @@ -32,5 +32,5 @@ artifacts: - path: '*.nupkg' name: nugetpackage - - path: Output\Wox-setup.exe - name: setup + - path: Output\Update + name: update-binary