mirror of
https://github.com/MaaAssistantArknights/MaaAssistantArknights.git
synced 2026-07-19 10:32:19 +08:00
chore: code cleanup
This commit is contained in:
@@ -212,7 +212,7 @@ namespace MaaWpfGui.Helper
|
||||
}
|
||||
}
|
||||
|
||||
source = CreateHwndSource(System.Windows.Application.Current.MainWindow);
|
||||
source = CreateHwndSource(Application.Current.MainWindow);
|
||||
if (source != null)
|
||||
{
|
||||
CenterWindow(msg.hwnd);
|
||||
|
||||
@@ -30,8 +30,11 @@ using Notification.Wpf;
|
||||
using Notification.Wpf.Base;
|
||||
using Notification.Wpf.Constants;
|
||||
using Notification.Wpf.Controls;
|
||||
using Semver;
|
||||
using Serilog;
|
||||
using Stylet;
|
||||
using Application = System.Windows.Forms.Application;
|
||||
using FontFamily = System.Windows.Media.FontFamily;
|
||||
|
||||
namespace MaaWpfGui.Helper
|
||||
{
|
||||
@@ -74,9 +77,9 @@ namespace MaaWpfGui.Helper
|
||||
}
|
||||
|
||||
var osVersion = matched.Groups[0].Value;
|
||||
bool verParsed = Semver.SemVersion.TryParse(osVersion, Semver.SemVersionStyles.Strict, out var curVersionObj);
|
||||
bool verParsed = SemVersion.TryParse(osVersion, SemVersionStyles.Strict, out var curVersionObj);
|
||||
|
||||
var minimumVersionObj = new Semver.SemVersion(10, 0, 10240);
|
||||
var minimumVersionObj = new SemVersion(10, 0, 10240);
|
||||
_systemToastChecked = verParsed && curVersionObj.CompareSortOrderTo(minimumVersionObj) >= 0;
|
||||
}
|
||||
|
||||
@@ -102,7 +105,7 @@ namespace MaaWpfGui.Helper
|
||||
{
|
||||
try
|
||||
{
|
||||
var icon = Icon.ExtractAssociatedIcon(System.Windows.Forms.Application.ExecutablePath);
|
||||
var icon = Icon.ExtractAssociatedIcon(Application.ExecutablePath);
|
||||
var imageSource = Imaging.CreateBitmapSourceFromHIcon(
|
||||
icon.Handle,
|
||||
Int32Rect.Empty,
|
||||
@@ -329,7 +332,7 @@ namespace MaaWpfGui.Helper
|
||||
public TextContentSettings BaseTextSettings => new TextContentSettings()
|
||||
{
|
||||
FontStyle = FontStyles.Normal,
|
||||
FontFamily = new System.Windows.Media.FontFamily("Microsoft Yahei"),
|
||||
FontFamily = new FontFamily("Microsoft Yahei"),
|
||||
FontSize = 14,
|
||||
FontWeight = FontWeights.Normal,
|
||||
TextAlignment = TextAlignment.Left,
|
||||
@@ -633,7 +636,7 @@ namespace MaaWpfGui.Helper
|
||||
{
|
||||
var fInfo = default(FLASHWINFO);
|
||||
fInfo.cbSize = Convert.ToUInt32(Marshal.SizeOf(fInfo));
|
||||
fInfo.hwnd = hWnd != default ? hWnd : new WindowInteropHelper(Application.Current.MainWindow!).Handle;
|
||||
fInfo.hwnd = hWnd != default ? hWnd : new WindowInteropHelper(System.Windows.Application.Current.MainWindow!).Handle;
|
||||
fInfo.dwFlags = (uint)type;
|
||||
fInfo.uCount = count;
|
||||
fInfo.dwTimeout = 0;
|
||||
|
||||
@@ -17,6 +17,7 @@ using System.Linq;
|
||||
using System.Windows;
|
||||
using MaaWpfGui.Constants;
|
||||
using Stylet;
|
||||
using Screen = System.Windows.Forms.Screen;
|
||||
|
||||
namespace MaaWpfGui.Helper
|
||||
{
|
||||
@@ -41,7 +42,7 @@ namespace MaaWpfGui.Helper
|
||||
|
||||
public void MoveWindowToDisplay(string displayName, Window window)
|
||||
{
|
||||
var screen = System.Windows.Forms.Screen.AllScreens.FirstOrDefault(x => x.DeviceName == displayName);
|
||||
var screen = Screen.AllScreens.FirstOrDefault(x => x.DeviceName == displayName);
|
||||
if (screen != null)
|
||||
{
|
||||
var screenRect = screen.Bounds;
|
||||
|
||||
@@ -21,7 +21,6 @@ using System.Windows;
|
||||
using MaaWpfGui.Constants;
|
||||
using MaaWpfGui.Extensions;
|
||||
using MaaWpfGui.Helper;
|
||||
using MaaWpfGui.ViewModels;
|
||||
using MaaWpfGui.ViewModels.UI;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
@@ -22,9 +22,7 @@ using MaaWpfGui.Helper;
|
||||
using MaaWpfGui.Services;
|
||||
using MaaWpfGui.Services.HotKeys;
|
||||
using MaaWpfGui.Services.Managers;
|
||||
using MaaWpfGui.ViewModels;
|
||||
using MaaWpfGui.ViewModels.UI;
|
||||
using MaaWpfGui.Views;
|
||||
using MaaWpfGui.Views.UI;
|
||||
using Microsoft.Toolkit.Uwp.Notifications;
|
||||
using Serilog;
|
||||
|
||||
@@ -15,7 +15,6 @@ using System;
|
||||
using System.Windows;
|
||||
using MaaWpfGui.Helper;
|
||||
using MaaWpfGui.Services.Managers;
|
||||
using MaaWpfGui.ViewModels;
|
||||
using MaaWpfGui.ViewModels.UI;
|
||||
using StyletIoC;
|
||||
|
||||
|
||||
@@ -13,11 +13,9 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing.Printing;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using System.Threading.Tasks;
|
||||
@@ -25,7 +23,6 @@ using MaaWpfGui.Constants;
|
||||
using MaaWpfGui.Helper;
|
||||
using MaaWpfGui.ViewModels.UI;
|
||||
using Serilog;
|
||||
using Serilog.Core;
|
||||
|
||||
namespace MaaWpfGui.Services
|
||||
{
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
// </copyright>
|
||||
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using MaaWpfGui.Helper;
|
||||
using MaaWpfGui.Services.Managers;
|
||||
@@ -46,7 +47,7 @@ namespace MaaWpfGui.Services
|
||||
private void InitIcon()
|
||||
{
|
||||
this._notifyIcon.Text = "MaaAssistantArknights";
|
||||
this._notifyIcon.Icon = System.Drawing.Icon.ExtractAssociatedIcon(System.Windows.Forms.Application.ExecutablePath);
|
||||
this._notifyIcon.Icon = Icon.ExtractAssociatedIcon(Application.ExecutablePath);
|
||||
_notifyIcon.MouseClick += NotifyIcon_MouseClick;
|
||||
_notifyIcon.MouseDoubleClick += OnNotifyIconDoubleClick;
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
// but WITHOUT ANY WARRANTY
|
||||
// </copyright>
|
||||
|
||||
using System;
|
||||
using MaaWpfGui.Helper;
|
||||
using Stylet;
|
||||
|
||||
@@ -33,7 +34,7 @@ namespace MaaWpfGui.ViewModels
|
||||
Name = name;
|
||||
OriginalName = name;
|
||||
_storageKey = storageKey;
|
||||
IsChecked = System.Convert.ToBoolean(ConfigurationHelper.GetCheckedStorage(storageKey, name, bool.TrueString));
|
||||
IsChecked = Convert.ToBoolean(ConfigurationHelper.GetCheckedStorage(storageKey, name, bool.TrueString));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -47,7 +48,7 @@ namespace MaaWpfGui.ViewModels
|
||||
Name = name;
|
||||
OriginalName = originalName;
|
||||
_storageKey = storageKey;
|
||||
IsChecked = System.Convert.ToBoolean(ConfigurationHelper.GetCheckedStorage(storageKey, name, bool.TrueString));
|
||||
IsChecked = Convert.ToBoolean(ConfigurationHelper.GetCheckedStorage(storageKey, name, bool.TrueString));
|
||||
}
|
||||
|
||||
private string _originalName;
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
|
||||
using System;
|
||||
using MaaWpfGui.Constants;
|
||||
using MaaWpfGui.Helper;
|
||||
using Stylet;
|
||||
|
||||
namespace MaaWpfGui.ViewModels
|
||||
|
||||
@@ -24,13 +24,12 @@ using MaaWpfGui.Constants;
|
||||
using MaaWpfGui.Helper;
|
||||
using MaaWpfGui.Main;
|
||||
using MaaWpfGui.Services;
|
||||
using Microsoft.Win32;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Stylet;
|
||||
using StyletIoC;
|
||||
using DataFormats = System.Windows.Forms.DataFormats;
|
||||
using DragEventArgs = System.Windows.DragEventArgs;
|
||||
using Screen = Stylet.Screen;
|
||||
|
||||
namespace MaaWpfGui.ViewModels.UI
|
||||
{
|
||||
@@ -398,7 +397,7 @@ namespace MaaWpfGui.ViewModels.UI
|
||||
/// </summary>
|
||||
public void SelectFile()
|
||||
{
|
||||
var dialog = new Microsoft.Win32.OpenFileDialog
|
||||
var dialog = new OpenFileDialog
|
||||
{
|
||||
Filter = "JSON|*.json",
|
||||
};
|
||||
|
||||
@@ -77,7 +77,7 @@ namespace MaaWpfGui.ViewModels.UI
|
||||
set => SetAndNotify(ref _recruitResult, value);
|
||||
}
|
||||
|
||||
private bool _chooseLevel3 = System.Convert.ToBoolean(ConfigurationHelper.GetValue(ConfigurationKeys.ChooseLevel3, bool.FalseString));
|
||||
private bool _chooseLevel3 = Convert.ToBoolean(ConfigurationHelper.GetValue(ConfigurationKeys.ChooseLevel3, bool.FalseString));
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether to choose level 3.
|
||||
@@ -92,7 +92,7 @@ namespace MaaWpfGui.ViewModels.UI
|
||||
}
|
||||
}
|
||||
|
||||
private bool _chooseLevel4 = System.Convert.ToBoolean(ConfigurationHelper.GetValue(ConfigurationKeys.ChooseLevel4, bool.TrueString));
|
||||
private bool _chooseLevel4 = Convert.ToBoolean(ConfigurationHelper.GetValue(ConfigurationKeys.ChooseLevel4, bool.TrueString));
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether to choose level 4.
|
||||
@@ -107,7 +107,7 @@ namespace MaaWpfGui.ViewModels.UI
|
||||
}
|
||||
}
|
||||
|
||||
private bool _chooseLevel5 = System.Convert.ToBoolean(ConfigurationHelper.GetValue(ConfigurationKeys.ChooseLevel5, bool.TrueString));
|
||||
private bool _chooseLevel5 = Convert.ToBoolean(ConfigurationHelper.GetValue(ConfigurationKeys.ChooseLevel5, bool.TrueString));
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether to choose level 5.
|
||||
@@ -122,7 +122,7 @@ namespace MaaWpfGui.ViewModels.UI
|
||||
}
|
||||
}
|
||||
|
||||
private bool _chooseLevel6 = System.Convert.ToBoolean(ConfigurationHelper.GetValue(ConfigurationKeys.ChooseLevel6, bool.TrueString));
|
||||
private bool _chooseLevel6 = Convert.ToBoolean(ConfigurationHelper.GetValue(ConfigurationKeys.ChooseLevel6, bool.TrueString));
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether to choose level 6.
|
||||
@@ -137,7 +137,7 @@ namespace MaaWpfGui.ViewModels.UI
|
||||
}
|
||||
}
|
||||
|
||||
private bool _autoSetTime = System.Convert.ToBoolean(ConfigurationHelper.GetValue(ConfigurationKeys.AutoSetTime, bool.TrueString));
|
||||
private bool _autoSetTime = Convert.ToBoolean(ConfigurationHelper.GetValue(ConfigurationKeys.AutoSetTime, bool.TrueString));
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether to set time automatically.
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
// </copyright>
|
||||
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using MaaWpfGui.Main;
|
||||
using Stylet;
|
||||
using StyletIoC;
|
||||
@@ -122,7 +123,7 @@ namespace MaaWpfGui.ViewModels.UI
|
||||
/// <inheritdoc/>
|
||||
protected override void OnClose()
|
||||
{
|
||||
System.Windows.Application.Current.Shutdown();
|
||||
Application.Current.Shutdown();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,9 +14,11 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.IO.Compression;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
@@ -34,9 +36,11 @@ using MaaWpfGui.Services.HotKeys;
|
||||
using MaaWpfGui.Services.Managers;
|
||||
using MaaWpfGui.Utilities;
|
||||
using MaaWpfGui.Utilities.ValueType;
|
||||
using Microsoft.Win32;
|
||||
using Newtonsoft.Json;
|
||||
using Stylet;
|
||||
using StyletIoC;
|
||||
using IContainer = StyletIoC.IContainer;
|
||||
using Timer = System.Timers.Timer;
|
||||
|
||||
namespace MaaWpfGui.ViewModels.UI
|
||||
{
|
||||
@@ -432,7 +436,7 @@ namespace MaaWpfGui.ViewModels.UI
|
||||
public void TryToStartEmulator(bool manual = false)
|
||||
{
|
||||
if ((EmulatorPath.Length == 0
|
||||
|| !System.IO.File.Exists(EmulatorPath))
|
||||
|| !File.Exists(EmulatorPath))
|
||||
|| !(StartEmulator
|
||||
|| manual))
|
||||
{
|
||||
@@ -598,7 +602,7 @@ namespace MaaWpfGui.ViewModels.UI
|
||||
/// </summary>
|
||||
public void SelectEmulatorExec()
|
||||
{
|
||||
var dialog = new Microsoft.Win32.OpenFileDialog
|
||||
var dialog = new OpenFileDialog
|
||||
{
|
||||
Filter = LocalizationHelper.GetString("Executable") + "|*.exe;*.bat;*.lnk",
|
||||
};
|
||||
@@ -929,7 +933,7 @@ namespace MaaWpfGui.ViewModels.UI
|
||||
/// </summary>
|
||||
public void SelectCustomInfrastFile()
|
||||
{
|
||||
var dialog = new Microsoft.Win32.OpenFileDialog
|
||||
var dialog = new OpenFileDialog
|
||||
{
|
||||
Filter = LocalizationHelper.GetString("CustomInfrastFile") + "|*.json",
|
||||
};
|
||||
@@ -966,7 +970,7 @@ namespace MaaWpfGui.ViewModels.UI
|
||||
|
||||
private NotifyType _notifySource = NotifyType.None;
|
||||
|
||||
private System.Timers.Timer _resetNotifyTimer;
|
||||
private Timer _resetNotifyTimer;
|
||||
|
||||
private void ResetNotifySource()
|
||||
{
|
||||
@@ -976,7 +980,7 @@ namespace MaaWpfGui.ViewModels.UI
|
||||
_resetNotifyTimer.Close();
|
||||
}
|
||||
|
||||
_resetNotifyTimer = new System.Timers.Timer(20);
|
||||
_resetNotifyTimer = new Timer(20);
|
||||
_resetNotifyTimer.Elapsed += (source, e) =>
|
||||
{
|
||||
_notifySource = NotifyType.None;
|
||||
@@ -1382,13 +1386,13 @@ namespace MaaWpfGui.ViewModels.UI
|
||||
|
||||
public class TimerModel
|
||||
{
|
||||
public class TimerProperties : System.ComponentModel.INotifyPropertyChanged
|
||||
public class TimerProperties : INotifyPropertyChanged
|
||||
{
|
||||
public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
protected void OnPropertyChanged([CallerMemberName] string name = null)
|
||||
{
|
||||
PropertyChanged?.Invoke(this, new System.ComponentModel.PropertyChangedEventArgs(name));
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));
|
||||
}
|
||||
|
||||
public int TimerId { get; set; }
|
||||
@@ -1950,7 +1954,10 @@ namespace MaaWpfGui.ViewModels.UI
|
||||
}
|
||||
}
|
||||
|
||||
private readonly Dictionary<string, List<string>> _defaultAddress = new Dictionary<string, List<string>>
|
||||
/// <summary>
|
||||
/// Gets the default addresses.
|
||||
/// </summary>
|
||||
public Dictionary<string, List<string>> DefaultAddress { get; } = new Dictionary<string, List<string>>
|
||||
{
|
||||
{ "General", new List<string> { string.Empty } },
|
||||
{ "BlueStacks", new List<string> { "127.0.0.1:5555", "127.0.0.1:5556", "127.0.0.1:5565", "127.0.0.1:5575", "127.0.0.1:5585", "127.0.0.1:5595", "127.0.0.1:5554" } },
|
||||
@@ -1961,11 +1968,6 @@ namespace MaaWpfGui.ViewModels.UI
|
||||
{ "WSA", new List<string> { "127.0.0.1:58526" } },
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Gets the default addresses.
|
||||
/// </summary>
|
||||
public Dictionary<string, List<string>> DefaultAddress => _defaultAddress;
|
||||
|
||||
/// <summary>
|
||||
/// Refreshes ADB config.
|
||||
/// </summary>
|
||||
@@ -2041,7 +2043,7 @@ namespace MaaWpfGui.ViewModels.UI
|
||||
/// </summary>
|
||||
public void SelectFile()
|
||||
{
|
||||
var dialog = new Microsoft.Win32.OpenFileDialog
|
||||
var dialog = new OpenFileDialog
|
||||
{
|
||||
Filter = LocalizationHelper.GetString("ADBProgram") + "|*.exe",
|
||||
};
|
||||
@@ -2089,13 +2091,13 @@ namespace MaaWpfGui.ViewModels.UI
|
||||
return;
|
||||
}
|
||||
|
||||
if (!System.IO.File.Exists(_bluestacksConfig))
|
||||
if (!File.Exists(_bluestacksConfig))
|
||||
{
|
||||
ConfigurationHelper.SetValue(ConfigurationKeys.BluestacksConfigError, "File not exists");
|
||||
return;
|
||||
}
|
||||
|
||||
var all_lines = System.IO.File.ReadAllLines(_bluestacksConfig);
|
||||
var all_lines = File.ReadAllLines(_bluestacksConfig);
|
||||
foreach (var line in all_lines)
|
||||
{
|
||||
if (line.StartsWith(_bluestacksKeyWord))
|
||||
@@ -2136,7 +2138,7 @@ namespace MaaWpfGui.ViewModels.UI
|
||||
|
||||
public async void ReplaceADB()
|
||||
{
|
||||
if (!System.IO.File.Exists(AdbPath))
|
||||
if (!File.Exists(AdbPath))
|
||||
{
|
||||
Execute.OnUIThread(() =>
|
||||
{
|
||||
@@ -2146,7 +2148,7 @@ namespace MaaWpfGui.ViewModels.UI
|
||||
return;
|
||||
}
|
||||
|
||||
if (!System.IO.File.Exists(GoogleAdbFilename))
|
||||
if (!File.Exists(GoogleAdbFilename))
|
||||
{
|
||||
var downloadResult = await _httpService.DownloadFileAsync(new Uri(GoogleAdbDownloadUrl), GoogleAdbFilename);
|
||||
if (!downloadResult)
|
||||
@@ -2168,7 +2170,7 @@ namespace MaaWpfGui.ViewModels.UI
|
||||
process.Kill();
|
||||
}
|
||||
|
||||
System.IO.File.Copy(AdbPath, AdbPath + ".bak", true);
|
||||
File.Copy(AdbPath, AdbPath + ".bak", true);
|
||||
|
||||
const string UnzipDir = "adb_unzip";
|
||||
if (Directory.Exists(UnzipDir))
|
||||
@@ -2176,8 +2178,8 @@ namespace MaaWpfGui.ViewModels.UI
|
||||
Directory.Delete(UnzipDir, true);
|
||||
}
|
||||
|
||||
System.IO.Compression.ZipFile.ExtractToDirectory(GoogleAdbFilename, UnzipDir);
|
||||
System.IO.File.Copy(UnzipDir + "/platform-tools/adb.exe", AdbPath, true);
|
||||
ZipFile.ExtractToDirectory(GoogleAdbFilename, UnzipDir);
|
||||
File.Copy(UnzipDir + "/platform-tools/adb.exe", AdbPath, true);
|
||||
Directory.Delete(UnzipDir, true);
|
||||
});
|
||||
await procTask;
|
||||
|
||||
@@ -22,7 +22,7 @@ using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Forms;
|
||||
using MaaWpfGui.Constants;
|
||||
using MaaWpfGui.Extensions;
|
||||
using MaaWpfGui.Helper;
|
||||
@@ -35,6 +35,9 @@ using Newtonsoft.Json.Linq;
|
||||
using Serilog;
|
||||
using Stylet;
|
||||
using StyletIoC;
|
||||
using Application = System.Windows.Application;
|
||||
using ComboBox = System.Windows.Controls.ComboBox;
|
||||
using Screen = Stylet.Screen;
|
||||
|
||||
namespace MaaWpfGui.ViewModels.UI
|
||||
{
|
||||
@@ -168,7 +171,7 @@ namespace MaaWpfGui.ViewModels.UI
|
||||
}
|
||||
*/
|
||||
|
||||
private readonly System.Windows.Forms.Timer _timer = new System.Windows.Forms.Timer();
|
||||
private readonly Timer _timer = new Timer();
|
||||
|
||||
private void InitTimer()
|
||||
{
|
||||
|
||||
@@ -13,22 +13,24 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.IO.Compression;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Windows;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using MaaWpfGui.Constants;
|
||||
using MaaWpfGui.Helper;
|
||||
using MaaWpfGui.Services;
|
||||
using MaaWpfGui.Utilities;
|
||||
using Markdig;
|
||||
using Neo.Markdig.Xaml;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Semver;
|
||||
using Stylet;
|
||||
using StyletIoC;
|
||||
|
||||
@@ -209,7 +211,7 @@ namespace MaaWpfGui.ViewModels.UI
|
||||
Directory.Delete(extractDir, true);
|
||||
}
|
||||
|
||||
System.IO.Compression.ZipFile.ExtractToDirectory(UpdatePackageName, extractDir);
|
||||
ZipFile.ExtractToDirectory(UpdatePackageName, extractDir);
|
||||
}
|
||||
catch (InvalidDataException)
|
||||
{
|
||||
@@ -379,7 +381,7 @@ namespace MaaWpfGui.ViewModels.UI
|
||||
{
|
||||
return version;
|
||||
}
|
||||
else if (Semver.SemVersion.TryParse(version, Semver.SemVersionStyles.AllowLowerV, out var semVersion) &&
|
||||
else if (SemVersion.TryParse(version, SemVersionStyles.AllowLowerV, out var semVersion) &&
|
||||
isNightlyVersion(semVersion))
|
||||
{
|
||||
// v4.6.6-1.g{Hash}
|
||||
@@ -614,8 +616,8 @@ namespace MaaWpfGui.ViewModels.UI
|
||||
}
|
||||
else
|
||||
{
|
||||
bool curParsed = Semver.SemVersion.TryParse(_curVersion, Semver.SemVersionStyles.AllowLowerV, out var curVersionObj);
|
||||
bool latestPared = Semver.SemVersion.TryParse(_latestVersion, Semver.SemVersionStyles.AllowLowerV, out var latestVersionObj);
|
||||
bool curParsed = SemVersion.TryParse(_curVersion, SemVersionStyles.AllowLowerV, out var curVersionObj);
|
||||
bool latestPared = SemVersion.TryParse(_latestVersion, SemVersionStyles.AllowLowerV, out var latestVersionObj);
|
||||
if (curParsed && latestPared)
|
||||
{
|
||||
if (curVersionObj.CompareSortOrderTo(latestVersionObj) >= 0)
|
||||
@@ -704,7 +706,7 @@ namespace MaaWpfGui.ViewModels.UI
|
||||
.ConfigureAwait(false).GetAwaiter().GetResult();
|
||||
}
|
||||
|
||||
private static System.Collections.ObjectModel.ObservableCollection<LogItemViewModel> _logItemViewModels = null;
|
||||
private static ObservableCollection<LogItemViewModel> _logItemViewModels = null;
|
||||
|
||||
public static void OutputDownloadProgress(long value = 0, long maximum = 1, int len = 0, double ts = 1)
|
||||
{
|
||||
@@ -771,7 +773,7 @@ namespace MaaWpfGui.ViewModels.UI
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if (!Semver.SemVersion.TryParse(version, Semver.SemVersionStyles.AllowLowerV, out var semVersion))
|
||||
else if (!SemVersion.TryParse(version, SemVersionStyles.AllowLowerV, out var semVersion))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -783,7 +785,7 @@ namespace MaaWpfGui.ViewModels.UI
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool isNightlyVersion(Semver.SemVersion version)
|
||||
private bool isNightlyVersion(SemVersion version)
|
||||
{
|
||||
if (!version.IsPrerelease)
|
||||
{
|
||||
@@ -824,7 +826,7 @@ namespace MaaWpfGui.ViewModels.UI
|
||||
/// </summary>
|
||||
/// <param name="sender">The sender.</param>
|
||||
/// <param name="e">The event arguments.</param>
|
||||
public void OpenHyperlink(object sender, System.Windows.Input.ExecutedRoutedEventArgs e)
|
||||
public void OpenHyperlink(object sender, ExecutedRoutedEventArgs e)
|
||||
{
|
||||
Process.Start(e.Parameter.ToString());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user