Skip to content

Commit

Permalink
Remove CheckUpdate feature
Browse files Browse the repository at this point in the history
Signed-off-by: akarin <[email protected]>
  • Loading branch information
AkarinVS committed Jan 22, 2023
1 parent 989a7fc commit cae379f
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 216 deletions.
1 change: 0 additions & 1 deletion OKEGui/OKEGui/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ private void AppStartup(object sender, StartupEventArgs e)
Initializer.ConfigLogger();
Initializer.WriteConfig();
Initializer.ClearOldLogs();
Initializer.CheckUpdate();
Logger.Info("程序正常启动");
}
else
Expand Down
14 changes: 0 additions & 14 deletions OKEGui/OKEGui/Gui/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ namespace OKEGui
public partial class MainWindow : Window
{
private static readonly NLog.Logger Logger = NLog.LogManager.GetCurrentClassLogger();
private SystemMenu _systemMenu;

public int WorkerCount = 0;
public TaskManager tm = new TaskManager();
Expand Down Expand Up @@ -65,25 +64,12 @@ public MainWindow()
}
WorkerNumber.Text = "工作单元:" + WorkerCount.ToString();

// 初始化更新菜单
_systemMenu = new SystemMenu(this);
_systemMenu.AddCommand("检查更新(&U)", () => { Updater.CheckUpdate(true); }, true);

if (Initializer.Config.memoryTotal == WmiUtils.GetTotalPhysicalMemory())
{
TxtFreeMemory.Text = Initializer.Config.memoryLimit.ToString();
}
}

protected override void OnSourceInitialized(EventArgs e)
{
base.OnSourceInitialized(e);
if (PresentationSource.FromVisual(this) is HwndSource hwndSource)
{
hwndSource.AddHook(_systemMenu.HandleMessage);
}
}

private void Checkbox_Changed(object sender, RoutedEventArgs e)
{
if (!wm.IsRunning)
Expand Down
1 change: 0 additions & 1 deletion OKEGui/OKEGui/OKEGui.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@
<Compile Include="Utils\SystemMenu.cs" />
<Compile Include="Utils\TChapterExtension.cs" />
<Compile Include="Utils\Timecode.cs" />
<Compile Include="Utils\Updater.cs" />
<Compile Include="Utils\WmiUtils.cs" />
<Compile Include="Worker\ExecuteTaskService.cs" />
<Compile Include="Task\TaskStatus.cs" />
Expand Down
28 changes: 0 additions & 28 deletions OKEGui/OKEGui/Utils/Initializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -206,33 +206,5 @@ public static void ClearOldLogs()
.ForEach(f => f.Delete());
}
}

public static void CheckUpdate()
{
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
Updater.SoftwareName = "OKEGui";
Updater.CurrentVersion = Assembly.GetExecutingAssembly().GetName().Version;
Updater.RepoName = "AmusementClub/OKEGui";
try
{
var reg = RegistryStorage.Load(null, "LastCheck");
if (string.IsNullOrEmpty(reg))
{
RegistryStorage.Save(DateTime.Now.ToString(CultureInfo.InvariantCulture), null, "LastCheck");
return;
}

var lastCheckTime = DateTime.Parse(reg);
if (DateTime.Now - lastCheckTime > new TimeSpan(7, 0, 0, 0))
{
Updater.CheckUpdate();
RegistryStorage.Save(DateTime.Now.ToString(CultureInfo.InvariantCulture), null, "LastCheck");
}
}
catch (Exception ex)
{
Logger.Error(ex, "Failed to check update");
}
}
}
}
172 changes: 0 additions & 172 deletions OKEGui/OKEGui/Utils/Updater.cs

This file was deleted.

0 comments on commit cae379f

Please sign in to comment.