diff --git a/src/Gml.Client b/src/Gml.Client
index 0d334ab..9fa59a1 160000
--- a/src/Gml.Client
+++ b/src/Gml.Client
@@ -1 +1 @@
-Subproject commit 0d334abe23f13b2fe361a7444d5df6e9924eb6e8
+Subproject commit 9fa59a165af6e33ca04193ea990e40c86c2e584e
diff --git a/src/Gml.Launcher/Assets/Resources/ResourceKeysDictionary.Template.cs b/src/Gml.Launcher/Assets/Resources/ResourceKeysDictionary.Template.cs
index 35085dc..2d15214 100644
--- a/src/Gml.Launcher/Assets/Resources/ResourceKeysDictionary.Template.cs
+++ b/src/Gml.Launcher/Assets/Resources/ResourceKeysDictionary.Template.cs
@@ -24,6 +24,7 @@ public static class ResourceKeysDictionary
public const string InstallingUpdates = "InstallingUpdates";
public const string FailedOs = "FailedOs";
public const string JavaNotFound = "JavaNotFound";
+ public const string IsDiskFull = "IsDiskFull";
public const string Host = "{{HOST}}";
public const string FolderName = "{{FOLDER_NAME}}";
}
diff --git a/src/Gml.Launcher/Assets/Resources/ResourceKeysDictionary.cs b/src/Gml.Launcher/Assets/Resources/ResourceKeysDictionary.cs
index e10bcee..b641583 100644
--- a/src/Gml.Launcher/Assets/Resources/ResourceKeysDictionary.cs
+++ b/src/Gml.Launcher/Assets/Resources/ResourceKeysDictionary.cs
@@ -5,6 +5,7 @@ public static class ResourceKeysDictionary
public const string MainPageTitle = "DefaultPageTitle";
public const string DefaultPageTitle = "DefaultPageTitle";
public const string Error = "Error";
+ public const string GameProfileError = "GameProfileError";
public const string InvalidFolder = "InvalidFolder";
public const string NotSetting = "NotSetting";
public const string Updating = "Updating";
@@ -23,9 +24,8 @@ public static class ResourceKeysDictionary
public const string CheckUpdates = "CheckUpdates";
public const string InstallingUpdates = "InstallingUpdates";
public const string FailedOs = "FailedOs";
-
public const string JavaNotFound = "JavaNotFound";
-
+ public const string IsDiskFull = "IsDiskFull";
// public const string Host = "https://gmlb.recloud.tech";
public const string Host = "https://gmlb-test.recloud.tech";
public const string FolderName = "GamerVIILacunerhV2";
diff --git a/src/Gml.Launcher/Assets/Resources/Resources.Designer.cs b/src/Gml.Launcher/Assets/Resources/Resources.Designer.cs
index 649e671..916933e 100644
--- a/src/Gml.Launcher/Assets/Resources/Resources.Designer.cs
+++ b/src/Gml.Launcher/Assets/Resources/Resources.Designer.cs
@@ -258,5 +258,21 @@ public static string InvalidFolder {
return ResourceManager.GetString("InvalidFolder", resourceCulture);
}
}
+ ///
+ /// Ищет локализованную строку, похожую на ProfileNotConfigured.
+ ///
+ public static string IsDiskFull {
+ get {
+ return ResourceManager.GetString("IsDiskFull", resourceCulture);
+ }
+ }
+ ///
+ /// Ищет локализованную строку, похожую на ProfileNotConfigured.
+ ///
+ public static string GameProfileError {
+ get {
+ return ResourceManager.GetString("GameProfileError", resourceCulture);
+ }
+ }
}
}
diff --git a/src/Gml.Launcher/Assets/Resources/Resources.en.resx b/src/Gml.Launcher/Assets/Resources/Resources.en.resx
index 3441c25..ba38ddd 100644
--- a/src/Gml.Launcher/Assets/Resources/Resources.en.resx
+++ b/src/Gml.Launcher/Assets/Resources/Resources.en.resx
@@ -135,4 +135,10 @@
Failed to change the installation folder or an error occurred while changing the folder.
+
+ Not enough disk space
+
+
+ Error initializing the game profile.
+
diff --git a/src/Gml.Launcher/Assets/Resources/Resources.resx b/src/Gml.Launcher/Assets/Resources/Resources.resx
index 32ad5b3..52adde4 100644
--- a/src/Gml.Launcher/Assets/Resources/Resources.resx
+++ b/src/Gml.Launcher/Assets/Resources/Resources.resx
@@ -143,4 +143,10 @@
Failed to change the installation folder or an error occurred while changing the folder.
+
+ Not enough disk space
+
+
+ Error initializing the game profile.
+
diff --git a/src/Gml.Launcher/Assets/Resources/Resources.ru.resx b/src/Gml.Launcher/Assets/Resources/Resources.ru.resx
index b1a4814..0be8cae 100644
--- a/src/Gml.Launcher/Assets/Resources/Resources.ru.resx
+++ b/src/Gml.Launcher/Assets/Resources/Resources.ru.resx
@@ -135,4 +135,10 @@
Не получилось сменить папку установки или произошла ошибка при смене папки
+
+ Недостаточно места на диске
+
+
+ Ошибка инициализации игрового профиля.
+
diff --git a/src/Gml.Launcher/Core/Services/ISystemService.cs b/src/Gml.Launcher/Core/Services/ISystemService.cs
index 3f15683..445fd4d 100644
--- a/src/Gml.Launcher/Core/Services/ISystemService.cs
+++ b/src/Gml.Launcher/Core/Services/ISystemService.cs
@@ -1,4 +1,5 @@
using System.Collections.Generic;
+using System.IO;
using System.Threading.Tasks;
using Gml.Launcher.Models;
using Gml.Web.Api.Domains.System;
@@ -52,4 +53,6 @@ public interface ISystemService
///
/// A task representing the asynchronous operation.
Task LoadSystemData();
+
+ bool IsDiskFull(IOException ioException);
}
diff --git a/src/Gml.Launcher/Core/Services/SystemService.cs b/src/Gml.Launcher/Core/Services/SystemService.cs
index 00e96d9..b55c811 100644
--- a/src/Gml.Launcher/Core/Services/SystemService.cs
+++ b/src/Gml.Launcher/Core/Services/SystemService.cs
@@ -3,6 +3,7 @@
using System.Globalization;
using System.IO;
using System.Linq;
+using System.Runtime.InteropServices;
using System.Threading.Tasks;
using Gml.Launcher.Models;
using Gml.Web.Api.Domains.System;
@@ -15,6 +16,7 @@ public class SystemService : ISystemService
{
private const string NotSupportedMessage = "The operating system is not supported.";
private readonly HardwareInfo _hardwareInfo = new();
+ const int ERROR_DISK_FULL = 0x70;
public ulong GetMaxRam()
{
@@ -63,6 +65,12 @@ public async Task LoadSystemData()
await Task.WhenAll(refreshDriveListTask, refreshMotherboardListTask, refreshCpuListTask);
}
+ public bool IsDiskFull(IOException ioException)
+ {
+ int hr = Marshal.GetHRForException(ioException);
+ return (hr & 0xFFFF) == ERROR_DISK_FULL;
+ }
+
public OsType GetOsType()
{
if (IsWindows()) return OsType.Windows;
diff --git a/src/Gml.Launcher/ViewModels/Pages/OverviewPageViewModel.cs b/src/Gml.Launcher/ViewModels/Pages/OverviewPageViewModel.cs
index 007ea90..ffb8221 100644
--- a/src/Gml.Launcher/ViewModels/Pages/OverviewPageViewModel.cs
+++ b/src/Gml.Launcher/ViewModels/Pages/OverviewPageViewModel.cs
@@ -161,6 +161,9 @@ await ExecuteFromNewThread(async () =>
_gameProcess?.Close();
_gameProcess = await GenerateProcess(cancellationToken, profileInfo);
_gameProcess.Start();
+ _gameProcess.BeginOutputReadLine();
+ _gameProcess.BeginErrorReadLine();
+
await Task.Delay(TimeSpan.FromSeconds(5), cancellationToken);
Dispatcher.UIThread.Invoke(() => _mainViewModel._gameLaunched.OnNext(true));
UpdateProgress(string.Empty, string.Empty, false);
@@ -178,6 +181,13 @@ await ExecuteFromNewThread(async () =>
Console.WriteLine(exception);
}
+ catch (IOException ioException) when (_systemService.IsDiskFull(ioException))
+ {
+ ShowError(ResourceKeysDictionary.Error,
+ LocalizationService.GetString(ResourceKeysDictionary.IsDiskFull));
+
+ Console.WriteLine(ioException);
+ }
catch (Exception exception)
{
ShowError(ResourceKeysDictionary.Error, string.Join(". ", exception.Message));
@@ -207,7 +217,29 @@ private async Task GenerateProcess(CancellationToken cancellationToken,
await _gmlManager.DownloadNotInstalledFiles(profileInfo.Data, cancellationToken);
- var process = await _gmlManager.GetProcess(profileInfo.Data, _systemService.GetOsType());
+ Process process = await _gmlManager.GetProcess(profileInfo.Data, _systemService.GetOsType());
+
+ process.OutputDataReceived += (sender, e) =>
+ {
+ if (!string.IsNullOrEmpty(e.Data))
+ {
+ Console.WriteLine(e.Data);
+
+ // ToDo: Add sentry java logging
+ // if (e.Data.Contains("log4j:Throwable"))
+ // {
+ //
+ // }
+ }
+ };
+
+ process.ErrorDataReceived += (sender, e) =>
+ {
+ if (!string.IsNullOrEmpty(e.Data) && !e.Data.Contains("[gml-patch]"))
+ {
+ ShowError(ResourceKeysDictionary.GameProfileError, e.Data);
+ }
+ };
await _gmlManager.ClearFiles(profileInfo.Data);
diff --git a/src/Gml.Launcher/Views/Components/GmlButton.axaml.cs b/src/Gml.Launcher/Views/Components/GmlButton.axaml.cs
index a7d267a..700eae4 100644
--- a/src/Gml.Launcher/Views/Components/GmlButton.axaml.cs
+++ b/src/Gml.Launcher/Views/Components/GmlButton.axaml.cs
@@ -89,10 +89,6 @@ protected override void OnApplyTemplate(TemplateAppliedEventArgs e)
base.OnApplyTemplate(e);
if (this.GetTemplateChildren().First() is Button button)
- button.Click += (sender, args) =>
- {
- RaiseEvent(new RoutedEventArgs(ClickEvent));
- Command?.Execute(CommandParameter);
- };
+ button.Click += (_, _) => RaiseEvent(new RoutedEventArgs(ClickEvent));;
}
}