|
@@ -1,7 +1,6 @@
|
|
|
using Avalonia.Controls.ApplicationLifetimes;
|
|
|
using ReactiveUI;
|
|
|
using System;
|
|
|
-using System.Collections.Generic;
|
|
|
using System.Collections.ObjectModel;
|
|
|
using System.Diagnostics;
|
|
|
using System.IO;
|
|
@@ -9,20 +8,13 @@ using System.Text;
|
|
|
using System.Text.Json;
|
|
|
using System.Threading.Tasks;
|
|
|
using VeloeMinecraftLauncher.Entity.LauncherProfiles;
|
|
|
-using VeloeMinecraftLauncher.Entity.VersionManifest;
|
|
|
using VeloeMinecraftLauncher.MinecraftLauncher;
|
|
|
using VeloeMinecraftLauncher.Views;
|
|
|
-using System;
|
|
|
-using System.Threading.Tasks;
|
|
|
-using System.Windows;
|
|
|
using Microsoft.AspNetCore.SignalR.Client;
|
|
|
using VeloeMinecraftLauncher.Entity.McStatus;
|
|
|
using System.Timers;
|
|
|
-using System.ComponentModel;
|
|
|
using System.Reflection;
|
|
|
using Serilog;
|
|
|
-using Serilog.Events;
|
|
|
-using Serilog.Formatting;
|
|
|
using Avalonia.Controls;
|
|
|
using Avalonia.Threading;
|
|
|
using System.Net;
|
|
@@ -96,8 +88,8 @@ namespace VeloeMinecraftLauncher.ViewModels
|
|
|
{
|
|
|
|
|
|
logger.Debug("Connecting to WebSoket");
|
|
|
- //conection to my servers
|
|
|
- connection = new HubConnectionBuilder()
|
|
|
+ //conection to my servers
|
|
|
+ connection = new HubConnectionBuilder()
|
|
|
.WithUrl("https://monitor.veloe.link/hubs/data")
|
|
|
.WithAutomaticReconnect()
|
|
|
.Build();
|
|
@@ -134,8 +126,8 @@ namespace VeloeMinecraftLauncher.ViewModels
|
|
|
mcTfcTimer.Stop();
|
|
|
mcTfcTimer.Start();
|
|
|
|
|
|
- //ConsoleText += message;
|
|
|
- });
|
|
|
+ //ConsoleText += message;
|
|
|
+ });
|
|
|
|
|
|
connection.On<string>("UpdateMcVanilla", (message) =>
|
|
|
{
|
|
@@ -144,8 +136,8 @@ namespace VeloeMinecraftLauncher.ViewModels
|
|
|
McVanillaPlayersBlock = $"{status.NumPlayers}/{status.MaxPlayers}";
|
|
|
mcTechTimer.Stop();
|
|
|
mcTechTimer.Start();
|
|
|
- //ConsoleText += message;
|
|
|
- });
|
|
|
+ //ConsoleText += message;
|
|
|
+ });
|
|
|
|
|
|
connection.On<string>("UpdateMcTech", (message) =>
|
|
|
{
|
|
@@ -154,8 +146,8 @@ namespace VeloeMinecraftLauncher.ViewModels
|
|
|
McTechPlayersBlock = $"{status.NumPlayers}/{status.MaxPlayers}";
|
|
|
mcVanillaTimer.Stop();
|
|
|
mcVanillaTimer.Start();
|
|
|
- //ConsoleText += message;
|
|
|
- });
|
|
|
+ //ConsoleText += message;
|
|
|
+ });
|
|
|
|
|
|
mcTfcTimer.Elapsed += OnTimedEventMcTfc;
|
|
|
mcTfcTimer.Start();
|
|
@@ -178,7 +170,7 @@ namespace VeloeMinecraftLauncher.ViewModels
|
|
|
OpenErrorWindow(ex);
|
|
|
}
|
|
|
});
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
|
|
|
System.Timers.Timer mcTfcTimer = new System.Timers.Timer(30000);
|
|
@@ -189,7 +181,7 @@ namespace VeloeMinecraftLauncher.ViewModels
|
|
|
private HubConnection connection;
|
|
|
private string downloadButton = "Download versions";
|
|
|
private string startButton = "Start Minecraft";
|
|
|
- private string username;
|
|
|
+ private string username = "";
|
|
|
private StringBuilder consoleText = new StringBuilder();
|
|
|
private int downloadedIndex;
|
|
|
private string argumentsBox;
|
|
@@ -245,21 +237,15 @@ namespace VeloeMinecraftLauncher.ViewModels
|
|
|
}
|
|
|
}
|
|
|
public string Greeting => "Welcome to Cringe Launcher!";
|
|
|
- public string DownloadButton {
|
|
|
- get => downloadButton;
|
|
|
- set
|
|
|
- {
|
|
|
- this.RaiseAndSetIfChanged(ref downloadButton, value);
|
|
|
- }
|
|
|
+ public string DownloadButton {
|
|
|
+ get => downloadButton;
|
|
|
+ set => this.RaiseAndSetIfChanged(ref downloadButton, value);
|
|
|
}
|
|
|
|
|
|
public string StartButton
|
|
|
{
|
|
|
get => startButton;
|
|
|
- set
|
|
|
- {
|
|
|
- this.RaiseAndSetIfChanged(ref startButton, value);
|
|
|
- }
|
|
|
+ set => this.RaiseAndSetIfChanged(ref startButton, value);
|
|
|
}
|
|
|
|
|
|
public string Username
|
|
@@ -295,131 +281,87 @@ namespace VeloeMinecraftLauncher.ViewModels
|
|
|
public string ArgumentsBox
|
|
|
{
|
|
|
get => argumentsBox;
|
|
|
- set
|
|
|
- {
|
|
|
- this.RaiseAndSetIfChanged(ref argumentsBox, value);
|
|
|
- }
|
|
|
+ set => this.RaiseAndSetIfChanged(ref argumentsBox, value);
|
|
|
}
|
|
|
|
|
|
public string SettingsButton
|
|
|
{
|
|
|
get => settingsButton;
|
|
|
- set
|
|
|
- {
|
|
|
- this.RaiseAndSetIfChanged(ref settingsButton, value);
|
|
|
- }
|
|
|
+ set => this.RaiseAndSetIfChanged(ref settingsButton, value);
|
|
|
}
|
|
|
|
|
|
public bool IsNoGameRunning
|
|
|
{
|
|
|
get => isNoGameRunning;
|
|
|
- set
|
|
|
- {
|
|
|
- this.RaiseAndSetIfChanged(ref isNoGameRunning, value);
|
|
|
- }
|
|
|
+ set => this.RaiseAndSetIfChanged(ref isNoGameRunning, value);
|
|
|
}
|
|
|
|
|
|
public bool IsUpdateAvailable
|
|
|
{
|
|
|
get => isUpdateAvailable;
|
|
|
- set
|
|
|
- {
|
|
|
- this.RaiseAndSetIfChanged(ref isUpdateAvailable, value);
|
|
|
- }
|
|
|
+ set => this.RaiseAndSetIfChanged(ref isUpdateAvailable, value);
|
|
|
}
|
|
|
|
|
|
public string McTfcBlock
|
|
|
{
|
|
|
get => mcTfcBlock;
|
|
|
- set
|
|
|
- {
|
|
|
- this.RaiseAndSetIfChanged(ref mcTfcBlock, value);
|
|
|
- }
|
|
|
+ set => this.RaiseAndSetIfChanged(ref mcTfcBlock, value);
|
|
|
}
|
|
|
|
|
|
public string McTechBlock
|
|
|
{
|
|
|
get => mcTechBlock;
|
|
|
- set
|
|
|
- {
|
|
|
- this.RaiseAndSetIfChanged(ref mcTechBlock, value);
|
|
|
- }
|
|
|
+ set => this.RaiseAndSetIfChanged(ref mcTechBlock, value);
|
|
|
}
|
|
|
|
|
|
public string McVanillaBlock
|
|
|
{
|
|
|
get => mcVanillaBlock;
|
|
|
- set
|
|
|
- {
|
|
|
- this.RaiseAndSetIfChanged(ref mcVanillaBlock, value);
|
|
|
- }
|
|
|
+ set => this.RaiseAndSetIfChanged(ref mcVanillaBlock, value);
|
|
|
}
|
|
|
|
|
|
public string McTfcPlayersBlock
|
|
|
{
|
|
|
get => mcTfcPlayersBlock;
|
|
|
- set
|
|
|
- {
|
|
|
- this.RaiseAndSetIfChanged(ref mcTfcPlayersBlock, value);
|
|
|
- }
|
|
|
+ set => this.RaiseAndSetIfChanged(ref mcTfcPlayersBlock, value);
|
|
|
}
|
|
|
|
|
|
public string McTechPlayersBlock
|
|
|
{
|
|
|
get => mcTechPlayersBlock;
|
|
|
- set
|
|
|
- {
|
|
|
- this.RaiseAndSetIfChanged(ref mcTechPlayersBlock, value);
|
|
|
- }
|
|
|
+ set => this.RaiseAndSetIfChanged(ref mcTechPlayersBlock, value);
|
|
|
}
|
|
|
|
|
|
public string McVanillaPlayersBlock
|
|
|
{
|
|
|
get => mcVanillaPlayersBlock;
|
|
|
- set
|
|
|
- {
|
|
|
- this.RaiseAndSetIfChanged(ref mcVanillaPlayersBlock, value);
|
|
|
- }
|
|
|
+ set => this.RaiseAndSetIfChanged(ref mcVanillaPlayersBlock, value);
|
|
|
}
|
|
|
|
|
|
public string McTfcTip
|
|
|
{
|
|
|
get => mcTfcTip;
|
|
|
- set
|
|
|
- {
|
|
|
- this.RaiseAndSetIfChanged(ref mcTfcTip, value);
|
|
|
- }
|
|
|
+ set => this.RaiseAndSetIfChanged(ref mcTfcTip, value);
|
|
|
}
|
|
|
|
|
|
public string McTechTip
|
|
|
{
|
|
|
get => mcTechTip;
|
|
|
- set
|
|
|
- {
|
|
|
- this.RaiseAndSetIfChanged(ref mcTechTip, value);
|
|
|
- }
|
|
|
+ set => this.RaiseAndSetIfChanged(ref mcTechTip, value);
|
|
|
}
|
|
|
|
|
|
public string McVanillaTip
|
|
|
{
|
|
|
get => mcVanillaTip;
|
|
|
- set
|
|
|
- {
|
|
|
- this.RaiseAndSetIfChanged(ref mcVanillaTip, value);
|
|
|
- }
|
|
|
+ set => this.RaiseAndSetIfChanged(ref mcVanillaTip, value);
|
|
|
}
|
|
|
|
|
|
public int ConsoleTextCaretIndex
|
|
|
{
|
|
|
get { return int.MaxValue; }
|
|
|
- set
|
|
|
- {
|
|
|
- this.RaisePropertyChanged(nameof(ConsoleTextCaretIndex));
|
|
|
- }
|
|
|
+ set => this.RaisePropertyChanged(nameof(ConsoleTextCaretIndex));
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
public void OnClickCommand()
|
|
|
{
|
|
|
var versionsDownloader = new VersionsDownloader
|
|
@@ -444,7 +386,10 @@ namespace VeloeMinecraftLauncher.ViewModels
|
|
|
{
|
|
|
logger.Debug("Starting minecraft.");
|
|
|
if (DownloadedVerion is null)
|
|
|
+ {
|
|
|
+ IsNoGameRunning = true;
|
|
|
return;
|
|
|
+ }
|
|
|
|
|
|
|
|
|
int version = 0;
|
|
@@ -764,7 +709,7 @@ namespace VeloeMinecraftLauncher.ViewModels
|
|
|
OpenErrorWindow(new FileNotFoundException($"File {updater.StartInfo.FileName} not found!"));
|
|
|
}
|
|
|
|
|
|
- private void UpdateUpdater()
|
|
|
+ private void UpdateUpdater()
|
|
|
{
|
|
|
try
|
|
|
{
|