mirror of
https://github.com/bloxstraplabs/bloxstrap.git
synced 2025-04-21 10:01:27 -07:00
add RobloxState
This commit is contained in:
parent
3f666333ee
commit
bff40a40a7
@ -42,7 +42,7 @@ namespace Bloxstrap
|
|||||||
|
|
||||||
public static bool IsProductionBuild => IsActionBuild && BuildMetadata.CommitRef.StartsWith("tag", StringComparison.Ordinal);
|
public static bool IsProductionBuild => IsActionBuild && BuildMetadata.CommitRef.StartsWith("tag", StringComparison.Ordinal);
|
||||||
|
|
||||||
public static bool IsStudioVisible => !String.IsNullOrEmpty(App.State.Prop.Studio.VersionGuid);
|
public static bool IsStudioVisible => !String.IsNullOrEmpty(App.RobloxState.Prop.Studio.VersionGuid);
|
||||||
|
|
||||||
public static readonly MD5 MD5Provider = MD5.Create();
|
public static readonly MD5 MD5Provider = MD5.Create();
|
||||||
|
|
||||||
@ -54,6 +54,8 @@ namespace Bloxstrap
|
|||||||
|
|
||||||
public static readonly JsonManager<State> State = new();
|
public static readonly JsonManager<State> State = new();
|
||||||
|
|
||||||
|
public static readonly JsonManager<RobloxState> RobloxState = new();
|
||||||
|
|
||||||
public static readonly FastFlagManager FastFlags = new();
|
public static readonly FastFlagManager FastFlags = new();
|
||||||
|
|
||||||
public static readonly HttpClient HttpClient = new(
|
public static readonly HttpClient HttpClient = new(
|
||||||
@ -336,6 +338,7 @@ namespace Bloxstrap
|
|||||||
|
|
||||||
Settings.Load();
|
Settings.Load();
|
||||||
State.Load();
|
State.Load();
|
||||||
|
RobloxState.Load();
|
||||||
FastFlags.Load();
|
FastFlags.Load();
|
||||||
|
|
||||||
if (!Locale.SupportedLocales.ContainsKey(Settings.Prop.Locale))
|
if (!Locale.SupportedLocales.ContainsKey(Settings.Prop.Locale))
|
||||||
|
@ -16,7 +16,7 @@ namespace Bloxstrap.AppData
|
|||||||
|
|
||||||
public override string ExecutableName => "RobloxPlayerBeta.exe";
|
public override string ExecutableName => "RobloxPlayerBeta.exe";
|
||||||
|
|
||||||
public override AppState State => App.State.Prop.Player;
|
public override AppState State => App.RobloxState.Prop.Player;
|
||||||
|
|
||||||
public override IReadOnlyDictionary<string, string> PackageDirectoryMap { get; set; } = new Dictionary<string, string>()
|
public override IReadOnlyDictionary<string, string> PackageDirectoryMap { get; set; } = new Dictionary<string, string>()
|
||||||
{
|
{
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
public override string ExecutableName => "RobloxStudioBeta.exe";
|
public override string ExecutableName => "RobloxStudioBeta.exe";
|
||||||
|
|
||||||
public override AppState State => App.State.Prop.Studio;
|
public override AppState State => App.RobloxState.Prop.Studio;
|
||||||
|
|
||||||
public override IReadOnlyDictionary<string, string> PackageDirectoryMap { get; set; } = new Dictionary<string, string>()
|
public override IReadOnlyDictionary<string, string> PackageDirectoryMap { get; set; } = new Dictionary<string, string>()
|
||||||
{
|
{
|
||||||
|
@ -61,7 +61,7 @@ namespace Bloxstrap
|
|||||||
private long _totalDownloadedBytes = 0;
|
private long _totalDownloadedBytes = 0;
|
||||||
private bool _packageExtractionSuccess = true;
|
private bool _packageExtractionSuccess = true;
|
||||||
|
|
||||||
private bool _mustUpgrade => App.LaunchSettings.ForceFlag.Active || String.IsNullOrEmpty(AppData.State.VersionGuid) || !File.Exists(AppData.ExecutablePath);
|
private bool _mustUpgrade => App.LaunchSettings.ForceFlag.Active || App.State.Prop.ForceReinstall || String.IsNullOrEmpty(AppData.State.VersionGuid) || !File.Exists(AppData.ExecutablePath);
|
||||||
private bool _noConnection = false;
|
private bool _noConnection = false;
|
||||||
|
|
||||||
private AsyncMutex? _mutex;
|
private AsyncMutex? _mutex;
|
||||||
@ -229,6 +229,7 @@ namespace Bloxstrap
|
|||||||
{
|
{
|
||||||
App.Settings.Load();
|
App.Settings.Load();
|
||||||
App.State.Load();
|
App.State.Load();
|
||||||
|
App.RobloxState.Load();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_noConnection)
|
if (!_noConnection)
|
||||||
@ -784,7 +785,7 @@ namespace Bloxstrap
|
|||||||
{
|
{
|
||||||
string dirName = Path.GetFileName(dir);
|
string dirName = Path.GetFileName(dir);
|
||||||
|
|
||||||
if (dirName != App.State.Prop.Player.VersionGuid && dirName != App.State.Prop.Studio.VersionGuid)
|
if (dirName != App.RobloxState.Prop.Player.VersionGuid && dirName != App.RobloxState.Prop.Studio.VersionGuid)
|
||||||
{
|
{
|
||||||
Filesystem.AssertReadOnlyDirectory(dir);
|
Filesystem.AssertReadOnlyDirectory(dir);
|
||||||
|
|
||||||
@ -1020,8 +1021,8 @@ namespace Bloxstrap
|
|||||||
|
|
||||||
var allPackageHashes = new List<string>();
|
var allPackageHashes = new List<string>();
|
||||||
|
|
||||||
allPackageHashes.AddRange(App.State.Prop.Player.PackageHashes.Values);
|
allPackageHashes.AddRange(App.RobloxState.Prop.Player.PackageHashes.Values);
|
||||||
allPackageHashes.AddRange(App.State.Prop.Studio.PackageHashes.Values);
|
allPackageHashes.AddRange(App.RobloxState.Prop.Studio.PackageHashes.Values);
|
||||||
|
|
||||||
if (!App.Settings.Prop.DebugDisableVersionPackageCleanup)
|
if (!App.Settings.Prop.DebugDisableVersionPackageCleanup)
|
||||||
{
|
{
|
||||||
@ -1050,7 +1051,7 @@ namespace Bloxstrap
|
|||||||
|
|
||||||
AppData.State.Size = distributionSize;
|
AppData.State.Size = distributionSize;
|
||||||
|
|
||||||
int totalSize = App.State.Prop.Player.Size + App.State.Prop.Studio.Size;
|
int totalSize = App.RobloxState.Prop.Player.Size + App.RobloxState.Prop.Studio.Size;
|
||||||
|
|
||||||
using (var uninstallKey = Registry.CurrentUser.CreateSubKey(App.UninstallKey))
|
using (var uninstallKey = Registry.CurrentUser.CreateSubKey(App.UninstallKey))
|
||||||
{
|
{
|
||||||
@ -1060,6 +1061,7 @@ namespace Bloxstrap
|
|||||||
App.Logger.WriteLine(LOG_IDENT, $"Registered as {totalSize} KB");
|
App.Logger.WriteLine(LOG_IDENT, $"Registered as {totalSize} KB");
|
||||||
|
|
||||||
App.State.Save();
|
App.State.Save();
|
||||||
|
App.RobloxState.Save();
|
||||||
|
|
||||||
_isInstalling = false;
|
_isInstalling = false;
|
||||||
}
|
}
|
||||||
@ -1212,7 +1214,7 @@ namespace Bloxstrap
|
|||||||
|
|
||||||
var fileRestoreMap = new Dictionary<string, List<string>>();
|
var fileRestoreMap = new Dictionary<string, List<string>>();
|
||||||
|
|
||||||
foreach (string fileLocation in App.State.Prop.ModManifest)
|
foreach (string fileLocation in App.RobloxState.Prop.ModManifest)
|
||||||
{
|
{
|
||||||
if (modFolderFiles.Contains(fileLocation))
|
if (modFolderFiles.Contains(fileLocation))
|
||||||
continue;
|
continue;
|
||||||
@ -1257,8 +1259,8 @@ namespace Bloxstrap
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
App.State.Prop.ModManifest = modFolderFiles;
|
App.RobloxState.Prop.ModManifest = modFolderFiles;
|
||||||
App.State.Save();
|
App.RobloxState.Save();
|
||||||
|
|
||||||
App.Logger.WriteLine(LOG_IDENT, $"Finished checking file mods");
|
App.Logger.WriteLine(LOG_IDENT, $"Finished checking file mods");
|
||||||
|
|
||||||
|
@ -197,7 +197,7 @@ namespace Bloxstrap
|
|||||||
|
|
||||||
var processes = new List<Process>();
|
var processes = new List<Process>();
|
||||||
|
|
||||||
if (!String.IsNullOrEmpty(App.State.Prop.Player.VersionGuid))
|
if (!String.IsNullOrEmpty(App.RobloxState.Prop.Player.VersionGuid))
|
||||||
processes.AddRange(Process.GetProcessesByName(App.RobloxPlayerAppName));
|
processes.AddRange(Process.GetProcessesByName(App.RobloxPlayerAppName));
|
||||||
|
|
||||||
if (App.IsStudioVisible)
|
if (App.IsStudioVisible)
|
||||||
@ -587,16 +587,23 @@ namespace Bloxstrap
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Utilities.CompareVersions(existingVer, "2.8.3") == VersionComparison.LessThan)
|
if (Utilities.CompareVersions(existingVer, "2.9.0") == VersionComparison.LessThan)
|
||||||
{
|
{
|
||||||
// force reinstallation
|
// move from App.State to App.RobloxState
|
||||||
App.State.Prop.Player.VersionGuid = "";
|
if (App.State.Prop.GetDeprecatedPlayer() != null)
|
||||||
App.State.Prop.Studio.VersionGuid = "";
|
App.RobloxState.Prop.Player = App.State.Prop.GetDeprecatedPlayer()!;
|
||||||
|
|
||||||
|
if (App.State.Prop.GetDeprecatedStudio() != null)
|
||||||
|
App.RobloxState.Prop.Studio = App.State.Prop.GetDeprecatedStudio()!;
|
||||||
|
|
||||||
|
if (App.State.Prop.GetDeprecatedModManifest() != null)
|
||||||
|
App.RobloxState.Prop.ModManifest = App.State.Prop.GetDeprecatedModManifest()!;
|
||||||
}
|
}
|
||||||
|
|
||||||
App.Settings.Save();
|
App.Settings.Save();
|
||||||
App.FastFlags.Save();
|
App.FastFlags.Save();
|
||||||
App.State.Save();
|
App.State.Save();
|
||||||
|
App.RobloxState.Save();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (currentVer is null)
|
if (currentVer is null)
|
||||||
|
11
Bloxstrap/Models/Persistable/RobloxState.cs
Normal file
11
Bloxstrap/Models/Persistable/RobloxState.cs
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
namespace Bloxstrap.Models.Persistable
|
||||||
|
{
|
||||||
|
public class RobloxState
|
||||||
|
{
|
||||||
|
public AppState Player { get; set; } = new();
|
||||||
|
|
||||||
|
public AppState Studio { get; set; } = new();
|
||||||
|
|
||||||
|
public List<string> ModManifest { get; set; } = new();
|
||||||
|
}
|
||||||
|
}
|
@ -6,12 +6,28 @@
|
|||||||
|
|
||||||
public bool PromptWebView2Install { get; set; } = true;
|
public bool PromptWebView2Install { get; set; } = true;
|
||||||
|
|
||||||
public AppState Player { get; set; } = new();
|
public bool ForceReinstall { get; set; } = false;
|
||||||
|
|
||||||
public AppState Studio { get; set; } = new();
|
|
||||||
|
|
||||||
public WindowState SettingsWindow { get; set; } = new();
|
public WindowState SettingsWindow { get; set; } = new();
|
||||||
|
|
||||||
public List<string> ModManifest { get; set; } = new();
|
#region Deprecated properties
|
||||||
|
/// <summary>
|
||||||
|
/// Deprecated, use App.RobloxState.Player
|
||||||
|
/// </summary>
|
||||||
|
public AppState? Player { private get; set; }
|
||||||
|
public AppState? GetDeprecatedPlayer() => Player;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Deprecated, use App.RobloxState.Studio
|
||||||
|
/// </summary>
|
||||||
|
public AppState? Studio { private get; set; }
|
||||||
|
public AppState? GetDeprecatedStudio() => Studio;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Deprecated, use App.RobloxState.ModManifest
|
||||||
|
/// </summary>
|
||||||
|
public List<string>? ModManifest { private get; set; }
|
||||||
|
public List<string>? GetDeprecatedModManifest() => ModManifest;
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,9 +2,6 @@
|
|||||||
{
|
{
|
||||||
public class BehaviourViewModel : NotifyPropertyChangedViewModel
|
public class BehaviourViewModel : NotifyPropertyChangedViewModel
|
||||||
{
|
{
|
||||||
private string _oldPlayerVersionGuid = "";
|
|
||||||
private string _oldStudioVersionGuid = "";
|
|
||||||
|
|
||||||
public bool ConfirmLaunches
|
public bool ConfirmLaunches
|
||||||
{
|
{
|
||||||
get => App.Settings.Prop.ConfirmLaunches;
|
get => App.Settings.Prop.ConfirmLaunches;
|
||||||
@ -21,22 +18,8 @@
|
|||||||
{
|
{
|
||||||
// wouldnt it be better to check old version guids?
|
// wouldnt it be better to check old version guids?
|
||||||
// what about fresh installs?
|
// what about fresh installs?
|
||||||
get => String.IsNullOrEmpty(App.State.Prop.Player.VersionGuid) && String.IsNullOrEmpty(App.State.Prop.Studio.VersionGuid);
|
get => App.State.Prop.ForceReinstall || (String.IsNullOrEmpty(App.RobloxState.Prop.Player.VersionGuid) && String.IsNullOrEmpty(App.RobloxState.Prop.Studio.VersionGuid));
|
||||||
set
|
set => App.State.Prop.ForceReinstall = value;
|
||||||
{
|
|
||||||
if (value)
|
|
||||||
{
|
|
||||||
_oldPlayerVersionGuid = App.State.Prop.Player.VersionGuid;
|
|
||||||
_oldStudioVersionGuid = App.State.Prop.Studio.VersionGuid;
|
|
||||||
App.State.Prop.Player.VersionGuid = "";
|
|
||||||
App.State.Prop.Studio.VersionGuid = "";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
App.State.Prop.Player.VersionGuid = _oldPlayerVersionGuid;
|
|
||||||
App.State.Prop.Studio.VersionGuid = _oldStudioVersionGuid;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user