Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to v0.1.0-rc2 #53

Merged
merged 30 commits into from
Oct 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
2c7c708
#46 Remove redundant command execution in GmlButton
GamerVII-NET Aug 7, 2024
8e37481
Handle disk full errors with new localized messages.
GamerVII-NET Aug 7, 2024
1a6a890
Add error handling for game profile initialization
GamerVII-NET Aug 7, 2024
21cea5a
Add placeholder for Sentry Java logging
GamerVII-NET Aug 7, 2024
5798189
Update submodule link Gml.Client
GamerVII-NET Aug 11, 2024
381684d
Add GameProfileError constant to ResourceKeysDictionary
GamerVII-NET Aug 11, 2024
d919378
Merge branch 'main' into dev
GamerVII-NET Aug 11, 2024
3964872
Update submodule link Gml.Client
GamerVII-NET Aug 11, 2024
5eb6e56
Solving the error for folders that have UTF-8 characters or spaces in…
Dirold2 Aug 16, 2024
bce7880
Fixing warnings and updating the license string in Gml.Launcher.cspro…
Dirold2 Aug 16, 2024
3aa0a37
Merge branch 'main' into dev
GamerVII-NET Aug 18, 2024
7af0abf
Merge pull request #49
GamerVII-NET Aug 18, 2024
9088d27
Merge remote-tracking branch 'origin/dev' into dev
GamerVII-NET Aug 18, 2024
4359dd6
Add GameProfileError constant to ResourceKeysDictionary
GamerVII-NET Sep 1, 2024
3b64970
Log error output from process data receiver
GamerVII-NET Sep 1, 2024
9c221d3
Add SplashScreen view import and update initialization
GamerVII-NET Sep 1, 2024
1917d6d
Merge branch 'main' into dev
GamerVII-NET Sep 1, 2024
e711d61
Add splash screen on app startup
GamerVII-NET Sep 1, 2024
bf9ba33
Refactor variable declaration in OverviewPageViewModel
GamerVII-NET Sep 9, 2024
558b7b3
Integrate Sentry for exception logging
GamerVII-NET Sep 9, 2024
0f96fea
Enhance splash screen initialization and authentication
GamerVII-NET Sep 9, 2024
a208553
Add expired session error handling
GamerVII-NET Sep 9, 2024
1a731eb
Update submodule link Gml.Client
GamerVII-NET Sep 9, 2024
91d8a67
Add LogHandler service for improved log processing
GamerVII-NET Sep 10, 2024
6bff98c
Merge branch 'main' into dev
GamerVII-NET Oct 12, 2024
7cb1d97
Add detailed installation instructions to README.md
Gamer-VII Oct 12, 2024
9ae817b
Add README.md to Gml.Client project in solution
Gamer-VII Oct 12, 2024
a859571
Update submodule link Gml.Client
Gamer-VII Oct 12, 2024
50c4011
Merge remote-tracking branch 'origin/dev' into dev
GamerVII-NET Oct 12, 2024
a906375
Prevent further processing of error data
GamerVII-NET Oct 12, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Gml.Launcher.sln
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "common", "common", "{09A802
load-repositories.bat = load-repositories.bat
load-repositories.sh = load-repositories.sh
.github\workflows\dotnet.yml = .github\workflows\dotnet.yml
src\Gml.Client\README.md = src\Gml.Client\README.md
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Gml.Launcher", "src\Gml.Launcher\Gml.Launcher.csproj", "{F2771E71-C782-4713-862F-217694DDDFF5}"
Expand Down
66 changes: 66 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,69 @@
GamerVII Launcher
=======
The Minecraft Launcher is a user-friendly application designed to streamline the process of launching Minecraft and managing game settings. It provides an intuitive interface and essential features to enhance the Minecraft gaming experience.

## Installation

### Prerequisites

Before installing the GamerVII Launcher, ensure you have the following prerequisites:

- **.NET 8.0 SDK:** You need to have .NET 8.0 SDK installed on your system. You can download it
from [Microsoft's official website](https://dotnet.microsoft.com/download/dotnet/8.0) or use a package manager
suitable for your operating system.

- **Git:** Ensure Git is installed on your system. You can download it from
the [Git website](https://git-scm.com/downloads) or use a package manager.

### Steps to Install GamerVII Launcher

1. **Clone the Repository:**
Open a terminal and clone the repository using Git with the `--recursive` option:
```bash
git clone --recursive https://github.com/GamerVII-NET/minecraft-launcher.git
cd minecraft-launcher
```

2. **Build the Project:**
Restore the dependencies and build the project using the .NET CLI:
```bash
dotnet restore
dotnet build
```

3. **Run the Launcher:**
Once the project is built, you can run the launcher using the following command:
```bash
dotnet run --project path/to/your/project
```

### Troubleshooting

If you encounter any issues during the installation, ensure the following:

- Ensure the .NET SDK is correctly installed and the `DOTNET_HOME` environment variable is set.
- Ensure Git is correctly installed and available in the terminal.
- Make sure you have the necessary permissions to run the build and execute the application.

For additional help, check the project's issue tracker or community forums.

### Updating

To update the GamerVII Launcher to the latest version, navigate to the project directory and pull the latest changes
from the repository:

```bash
git pull origin main
git submodule update --recursive --remote
dotnet build
```

Then, run the launcher again using the command mentioned earlier.

### Uninstallation

To uninstall the GamerVII Launcher, simply delete the project directory:

```bash
rm -rf minecraft-launcher
```
2 changes: 1 addition & 1 deletion src/Gml.Client
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public static class ResourceKeysDictionary
public const string ProfileNotConfigured = "ProfileNotConfigured";
public const string UpdatingDescription = "UpdatingDescription";
public const string InvalidAuthData = "InvalidAuthData";
public const string InvalidSession = "InvalidSession";
public const string Reconnecting = "Reconnecting";
public const string LostConnection = "LostConnection";
public const string CheckUpdates = "CheckUpdates";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public static class ResourceKeysDictionary
public const string ProfileNotConfigured = "ProfileNotConfigured";
public const string UpdatingDescription = "UpdatingDescription";
public const string InvalidAuthData = "InvalidAuthData";
public const string InvalidSession = "InvalidSession";
public const string Reconnecting = "Reconnecting";
public const string LostConnection = "LostConnection";
public const string CheckUpdates = "CheckUpdates";
Expand Down
8 changes: 8 additions & 0 deletions src/Gml.Launcher/Assets/Resources/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions src/Gml.Launcher/Assets/Resources/Resources.en.resx
Original file line number Diff line number Diff line change
Expand Up @@ -141,4 +141,7 @@
<data name="GameProfileError" xml:space="preserve">
<value>Error initializing the game profile.</value>
</data>
<data name="InvalidSession" xml:space="preserve">
<value>Your game session in the launcher has expired, please log in again.</value>
</data>
</root>
3 changes: 3 additions & 0 deletions src/Gml.Launcher/Assets/Resources/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -149,4 +149,7 @@
<data name="GameProfileError" xml:space="preserve">
<value>Error initializing the game profile.</value>
</data>
<data name="InvalidSession" xml:space="preserve">
<value>Your game session in the launcher has expired, please log in again.</value>
</data>
</root>
3 changes: 3 additions & 0 deletions src/Gml.Launcher/Assets/Resources/Resources.ru.resx
Original file line number Diff line number Diff line change
Expand Up @@ -141,4 +141,7 @@
<data name="GameProfileError" xml:space="preserve">
<value>Ошибка инициализации игрового профиля.</value>
</data>
<data name="InvalidSession" xml:space="preserve">
<value>Ваша игровая сессия в лаунчере истекла, авторизуйтесь заново</value>
</data>
</root>
6 changes: 4 additions & 2 deletions src/Gml.Launcher/Core/Converters/AsyncSkinRenderLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using Avalonia.Media.Imaging;
using Gml.Client;
using Gml.Launcher.Core.Services;
using Sentry;

namespace Gml.Launcher.Core.Converters;

Expand Down Expand Up @@ -63,9 +64,10 @@ private static async void OnSourceChanged(Image sender, AvaloniaPropertyChangedE

if (!cts.Token.IsCancellationRequested) sender.Source = bitmap;
}
catch (Exception e)
catch (Exception exception)
{
Console.WriteLine(e);
Console.WriteLine(exception);
SentrySdk.CaptureException(exception);
}
finally
{
Expand Down
25 changes: 3 additions & 22 deletions src/Gml.Launcher/Core/Extensions/ServiceLocator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ public static AppBuilder RegisterServices(this AppBuilder builder)

RegisterLocalizationService();
RegisterSystemService(systemService);
RegisterLogHelper(systemService);
var manager = RegisterGmlManager(systemService, installationDirectory);
var storageService = RegisterStorage();

CheckAndChangeInstallationFolder(storageService, manager);
CheckAndChangeLanguage(storageService, systemService);
InitializeSentry();

AppDomain.CurrentDomain.UnhandledException += (_, args) =>
{
Expand All @@ -39,28 +39,9 @@ public static AppBuilder RegisterServices(this AppBuilder builder)
return builder;
}

private static void InitializeSentry()
private static void RegisterLogHelper(SystemService systemService)
{
var sentryUrl = GmlClientManager.GetSentryLink(ResourceKeysDictionary.Host).Result;

try
{
if (!string.IsNullOrEmpty(sentryUrl))
SentrySdk.Init(options =>
{
options.Dsn = sentryUrl;
options.Debug = true;
options.TracesSampleRate = 1.0;
options.DiagnosticLevel = SentryLevel.Debug;
options.IsGlobalModeEnabled = true;
options.SendDefaultPii = true;
options.MaxAttachmentSize = 10 * 1024 * 1024;
});
}
catch (Exception exception)
{
Console.WriteLine(exception);
}
Locator.CurrentMutable.RegisterConstant(new LogHandler());
}

private static void CheckAndChangeLanguage(LocalStorageService storageService, SystemService systemService)
Expand Down
76 changes: 76 additions & 0 deletions src/Gml.Launcher/Core/Services/LogHandler.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
using System;
using System.Diagnostics;
using System.Reactive.Linq;
using System.Reactive.Subjects;
using System.Text.RegularExpressions;
using Sentry;

namespace Gml.Launcher.Core.Services;

public class LogHandler
{
private readonly Subject<string> _errorDataSubject = new();


public LogHandler()
{
var errorDataObservable = _errorDataSubject
.Where(data => !string.IsNullOrEmpty(data))
.Buffer(() => _errorDataSubject.Where(data => data.Contains("</log4j:Event>")))
.Select(lines => string.Join(Environment.NewLine, lines));

errorDataObservable.Subscribe(HandleErrorData);
}

private void HandleErrorData(string data)
{
return;
Debug.WriteLine(data);

if (data.Contains("Exception", StringComparison.OrdinalIgnoreCase) ||
data.Contains("<log4j:Throwable>", StringComparison.OrdinalIgnoreCase))
{
var exception = ExtractException(data);
ShowError(ResourceKeysDictionary.GameProfileError, data);
SentrySdk.CaptureException(exception);
}

if (data.Contains("[gml-patch]", StringComparison.OrdinalIgnoreCase))
{
}
else
{
ShowError(ResourceKeysDictionary.GameProfileError, data);
SentrySdk.CaptureException(new Exception(data));
}
}

private Exception ExtractException(string data)
{
var throwableRegex = new Regex(@"<log4j:Throwable><!\[CDATA\[(.*?)\]\]></log4j:Throwable>", RegexOptions.Singleline);
var match = throwableRegex.Match(data);

if (match.Success)
{
var stackTrace = match.Groups[1].Value;
return new Exception(stackTrace);
}

return new Exception(data);
}

private void ShowError(string key, string message)
{
// Реализуйте здесь показ ошибок пользователю
}

private static class ResourceKeysDictionary
{
public static string GameProfileError = "GameProfileError";
}

public void ProcessLogs(string data)
{
_errorDataSubject.OnNext(data);
}
}
34 changes: 32 additions & 2 deletions src/Gml.Launcher/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
using System.Reactive;
using Avalonia;
using Avalonia.ReactiveUI;
using Gml.Client;
using Gml.Launcher.Assets;
using Gml.Launcher.Core.Extensions;
using ReactiveUI;
using Sentry;
Expand All @@ -15,13 +17,15 @@ public static void Main(string[] args)
{
try
{
InitializeSentry();
RxApp.DefaultExceptionHandler = Observer.Create<Exception>(GlobalExceptionHandler);
BuildAvaloniaApp()
.StartWithClassicDesktopLifetime(args);
}
catch (Exception e)
catch (Exception exception)
{
Console.WriteLine(e);
SentrySdk.CaptureException(exception);
Console.WriteLine(exception);
}
}

Expand All @@ -39,4 +43,30 @@ public static AppBuilder BuildAvaloniaApp()
.LogToTrace()
.UseReactiveUI();
}



private static void InitializeSentry()
{
var sentryUrl = GmlClientManager.GetSentryLink(ResourceKeysDictionary.Host).Result;

try
{
if (!string.IsNullOrEmpty(sentryUrl))
SentrySdk.Init(options =>
{
options.Dsn = sentryUrl;
options.Debug = true;
options.TracesSampleRate = 1.0;
options.DiagnosticLevel = SentryLevel.Debug;
options.IsGlobalModeEnabled = true;
options.SendDefaultPii = true;
options.MaxAttachmentSize = 10 * 1024 * 1024;
});
}
catch (Exception exception)
{
Console.WriteLine(exception);
}
}
}
6 changes: 4 additions & 2 deletions src/Gml.Launcher/ViewModels/Base/PageViewModelBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using Gml.Launcher.Core.Exceptions;
using Gml.Launcher.Core.Services;
using ReactiveUI;
using Sentry;
using Splat;

namespace Gml.Launcher.ViewModels.Base;
Expand Down Expand Up @@ -71,9 +72,10 @@ async void RunThreadTask()
await func();
tcs.SetResult(null);
}
catch (Exception ex)
catch (Exception exception)
{
tcs.SetException(ex);
tcs.SetException(exception);
SentrySdk.CaptureException(exception);
}
}

Expand Down
Loading
Loading