|
@@ -502,7 +502,6 @@ public class MainWindowViewModel : ViewModelBase
|
|
UseShellExecute = false,
|
|
UseShellExecute = false,
|
|
RedirectStandardOutput = true,
|
|
RedirectStandardOutput = true,
|
|
RedirectStandardError = true,
|
|
RedirectStandardError = true,
|
|
- WindowStyle = ProcessWindowStyle.Hidden,
|
|
|
|
CreateNoWindow = true,
|
|
CreateNoWindow = true,
|
|
FileName = Path.GetFullPath(Path.Combine(Settings.minecraftForlderPath, javaPath)),
|
|
FileName = Path.GetFullPath(Path.Combine(Settings.minecraftForlderPath, javaPath)),
|
|
StandardErrorEncoding = Encoding.UTF8,
|
|
StandardErrorEncoding = Encoding.UTF8,
|
|
@@ -763,28 +762,40 @@ public class MainWindowViewModel : ViewModelBase
|
|
fileName += ".exe";
|
|
fileName += ".exe";
|
|
if (File.Exists(fileName))
|
|
if (File.Exists(fileName))
|
|
{
|
|
{
|
|
- FileVersionInfo fileVersionInfo = FileVersionInfo.GetVersionInfo(fileName);
|
|
|
|
var latestLauncherVersion = await Downloader.DownloadAndDeserializeJsonData<LatestLauncherVersion>("https://files.veloe.link/launcher/update/versions.json");
|
|
var latestLauncherVersion = await Downloader.DownloadAndDeserializeJsonData<LatestLauncherVersion>("https://files.veloe.link/launcher/update/versions.json");
|
|
-
|
|
|
|
- if (OperatingSystem.IsLinux())
|
|
|
|
|
|
+
|
|
|
|
+ if (OperatingSystem.IsWindows())
|
|
{
|
|
{
|
|
- _logger.Information("Manual updates only.");
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
|
|
+ FileVersionInfo fileVersionInfo = FileVersionInfo.GetVersionInfo(fileName);
|
|
|
|
+ if (latestLauncherVersion?.Updater is not null && fileVersionInfo?.FileVersion is not null)
|
|
|
|
+ {
|
|
|
|
+ _logger.Information("Latest updater version on server: {0}", latestLauncherVersion.Updater);
|
|
|
|
+ _logger.Information("Updater version: {0}", fileVersionInfo.FileVersion);
|
|
|
|
|
|
- if (latestLauncherVersion?.Updater is not null && fileVersionInfo?.FileVersion is not null)
|
|
|
|
|
|
+ if (!(new Version(latestLauncherVersion.Updater) > new Version(fileVersionInfo.FileVersion)))
|
|
|
|
+ {
|
|
|
|
+ _logger.Information($"No update for \"{fileName}\" required.");
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ _logger.Warning("Version verification for {0} failed: latestLauncherVersion or fileVersionInfo does not contain version info or null!", fileName);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (OperatingSystem.IsLinux())
|
|
{
|
|
{
|
|
- _logger.Information("Latest updater version on server: {0}", latestLauncherVersion.Updater);
|
|
|
|
- _logger.Information("Updater version: {0}", fileVersionInfo.FileVersion);
|
|
|
|
|
|
+ using var updaterProcess = Process.Start(new ProcessStartInfo() { FileName = fileName, Arguments = " --version", RedirectStandardOutput = true });
|
|
|
|
+ updaterProcess.WaitForExit();
|
|
|
|
|
|
- if (!(new Version(latestLauncherVersion.Updater) > new Version(fileVersionInfo.FileVersion)))
|
|
|
|
|
|
+ var versionStr = System.Text.RegularExpressions.Regex.Match(updaterProcess.StandardOutput.ReadToEnd(), "[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+").Value;
|
|
|
|
+ if (!string.IsNullOrWhiteSpace(versionStr) &&
|
|
|
|
+ latestLauncherVersion?.Updater is not null &&
|
|
|
|
+ !(new Version(latestLauncherVersion.Updater) > new Version(versionStr)))
|
|
{
|
|
{
|
|
_logger.Information($"No update for \"{fileName}\" required.");
|
|
_logger.Information($"No update for \"{fileName}\" required.");
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- else
|
|
|
|
- _logger.Warning("Version verification for {0} failed: latestLauncherVersion or fileVersionInfo does not contain version info or null!", fileName);
|
|
|
|
}
|
|
}
|
|
|
|
|
|
try
|
|
try
|