mirror of
https://github.com/bloxstraplabs/bloxstrap.git
synced 2025-04-12 16:21:29 -07:00
Reorganize models
This commit is contained in:
parent
c58a8ab739
commit
0b20720fdb
Bloxstrap
GlobalUsings.cs
Models
UI/Elements/Settings
@ -3,7 +3,6 @@ global using System.Collections.Generic;
|
||||
global using System.Diagnostics;
|
||||
global using System.Globalization;
|
||||
global using System.IO;
|
||||
global using System.IO.Compression;
|
||||
global using System.Text;
|
||||
global using System.Text.Json;
|
||||
global using System.Text.Json.Serialization;
|
||||
@ -18,10 +17,16 @@ global using Bloxstrap.Enums;
|
||||
global using Bloxstrap.Exceptions;
|
||||
global using Bloxstrap.Extensions;
|
||||
global using Bloxstrap.Models;
|
||||
global using Bloxstrap.Models.APIs.Config;
|
||||
global using Bloxstrap.Models.APIs.GitHub;
|
||||
global using Bloxstrap.Models.APIs.Roblox;
|
||||
global using Bloxstrap.Models.Attributes;
|
||||
global using Bloxstrap.Models.BloxstrapRPC;
|
||||
global using Bloxstrap.Models.RobloxApi;
|
||||
global using Bloxstrap.Models.Entities;
|
||||
global using Bloxstrap.Models.Manifest;
|
||||
global using Bloxstrap.Models.Persistable;
|
||||
global using Bloxstrap.Models.SettingTasks;
|
||||
global using Bloxstrap.Models.SettingTasks.Base;
|
||||
global using Bloxstrap.Resources;
|
||||
global using Bloxstrap.UI;
|
||||
global using Bloxstrap.Utility;
|
@ -1,4 +1,4 @@
|
||||
namespace Bloxstrap.Models
|
||||
namespace Bloxstrap.Models.APIs.Config
|
||||
{
|
||||
public class Supporter
|
||||
{
|
@ -1,4 +1,4 @@
|
||||
namespace Bloxstrap.Models
|
||||
namespace Bloxstrap.Models.APIs.Config
|
||||
{
|
||||
public class SupporterData
|
||||
{
|
8
Bloxstrap/Models/APIs/GitHub/GitHubReleaseAsset.cs
Normal file
8
Bloxstrap/Models/APIs/GitHub/GitHubReleaseAsset.cs
Normal file
@ -0,0 +1,8 @@
|
||||
public class GithubReleaseAsset
|
||||
{
|
||||
[JsonPropertyName("browser_download_url")]
|
||||
public string BrowserDownloadUrl { get; set; } = null!;
|
||||
|
||||
[JsonPropertyName("name")]
|
||||
public string Name { get; set; } = null!;
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
namespace Bloxstrap.Models
|
||||
namespace Bloxstrap.Models.APIs.GitHub
|
||||
{
|
||||
public class GithubRelease
|
||||
{
|
||||
@ -7,7 +7,7 @@
|
||||
|
||||
[JsonPropertyName("name")]
|
||||
public string Name { get; set; } = null!;
|
||||
|
||||
|
||||
[JsonPropertyName("body")]
|
||||
public string Body { get; set; } = null!;
|
||||
|
||||
@ -17,13 +17,4 @@
|
||||
[JsonPropertyName("assets")]
|
||||
public List<GithubReleaseAsset>? Assets { get; set; }
|
||||
}
|
||||
|
||||
public class GithubReleaseAsset
|
||||
{
|
||||
[JsonPropertyName("browser_download_url")]
|
||||
public string BrowserDownloadUrl { get; set; } = null!;
|
||||
|
||||
[JsonPropertyName("name")]
|
||||
public string Name { get; set; } = null!;
|
||||
}
|
||||
}
|
@ -1,14 +1,14 @@
|
||||
namespace Bloxstrap.Models
|
||||
{
|
||||
public class IPInfoResponse
|
||||
{
|
||||
[JsonPropertyName("city")]
|
||||
public string City { get; set; } = null!;
|
||||
|
||||
[JsonPropertyName("country")]
|
||||
public string Country { get; set; } = null!;
|
||||
|
||||
[JsonPropertyName("region")]
|
||||
public string Region { get; set; } = null!;
|
||||
}
|
||||
}
|
||||
namespace Bloxstrap.Models.APIs
|
||||
{
|
||||
public class IPInfoResponse
|
||||
{
|
||||
[JsonPropertyName("city")]
|
||||
public string City { get; set; } = null!;
|
||||
|
||||
[JsonPropertyName("country")]
|
||||
public string Country { get; set; } = null!;
|
||||
|
||||
[JsonPropertyName("region")]
|
||||
public string Region { get; set; } = null!;
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
namespace Bloxstrap.Models.RobloxApi
|
||||
namespace Bloxstrap.Models.APIs.Roblox
|
||||
{
|
||||
/// <summary>
|
||||
/// Roblox.Web.WebAPI.Models.ApiArrayResponse
|
@ -1,4 +1,4 @@
|
||||
namespace Bloxstrap.Models
|
||||
namespace Bloxstrap.Models.APIs.Roblox
|
||||
{
|
||||
public class ClientFlagSettings
|
||||
{
|
@ -1,4 +1,4 @@
|
||||
namespace Bloxstrap.Models
|
||||
namespace Bloxstrap.Models.APIs.Roblox
|
||||
{
|
||||
public class ClientVersion
|
||||
{
|
@ -1,4 +1,4 @@
|
||||
namespace Bloxstrap.Models.RobloxApi
|
||||
namespace Bloxstrap.Models.APIs.Roblox
|
||||
{
|
||||
/// <summary>
|
||||
/// Roblox.Games.Api.Models.Response.GameCreator
|
@ -1,4 +1,4 @@
|
||||
namespace Bloxstrap.Models.RobloxApi
|
||||
namespace Bloxstrap.Models.APIs.Roblox
|
||||
{
|
||||
|
||||
/// <summary>
|
@ -1,4 +1,4 @@
|
||||
namespace Bloxstrap.Models.RobloxApi
|
||||
namespace Bloxstrap.Models.APIs.Roblox
|
||||
{
|
||||
/// <summary>
|
||||
/// Roblox.Web.Responses.Thumbnails.ThumbnailResponse
|
@ -1,4 +1,4 @@
|
||||
namespace Bloxstrap.Models.RobloxApi
|
||||
namespace Bloxstrap.Models.APIs.Roblox
|
||||
{
|
||||
// lmao its just one property
|
||||
public class UniverseIdResponse
|
@ -1,10 +1,10 @@
|
||||
using System.Web;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
|
||||
using Bloxstrap.Models.APIs;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
|
||||
namespace Bloxstrap.Models
|
||||
namespace Bloxstrap.Models.Entities
|
||||
{
|
||||
public class ActivityData
|
||||
{
|
||||
@ -16,7 +16,7 @@ namespace Bloxstrap.Models
|
||||
/// </summary>
|
||||
public ActivityData? RootActivity;
|
||||
|
||||
public long UniverseId
|
||||
public long UniverseId
|
||||
{
|
||||
get => _universeId;
|
||||
set
|
||||
@ -28,19 +28,19 @@ namespace Bloxstrap.Models
|
||||
|
||||
public long PlaceId { get; set; } = 0;
|
||||
|
||||
public string JobId { get; set; } = String.Empty;
|
||||
public string JobId { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// This will be empty unless the server joined is a private server
|
||||
/// </summary>
|
||||
public string AccessCode { get; set; } = String.Empty;
|
||||
|
||||
public string MachineAddress { get; set; } = String.Empty;
|
||||
public string AccessCode { get; set; } = string.Empty;
|
||||
|
||||
public bool MachineAddressValid => !String.IsNullOrEmpty(MachineAddress) && !MachineAddress.StartsWith("10.");
|
||||
public string MachineAddress { get; set; } = string.Empty;
|
||||
|
||||
public bool MachineAddressValid => !string.IsNullOrEmpty(MachineAddress) && !MachineAddress.StartsWith("10.");
|
||||
|
||||
public bool IsTeleport { get; set; } = false;
|
||||
|
||||
|
||||
public ServerType ServerType { get; set; } = ServerType.Public;
|
||||
|
||||
public DateTime TimeJoined { get; set; }
|
||||
@ -52,15 +52,15 @@ namespace Bloxstrap.Models
|
||||
/// <summary>
|
||||
/// This is intended only for other people to use, i.e. context menu invite link, rich presence joining
|
||||
/// </summary>
|
||||
public string RPCLaunchData { get; set; } = String.Empty;
|
||||
public string RPCLaunchData { get; set; } = string.Empty;
|
||||
|
||||
public UniverseDetails? UniverseDetails { get; set; }
|
||||
|
||||
|
||||
public string GameHistoryDescription
|
||||
{
|
||||
get
|
||||
{
|
||||
string desc = String.Format("{0} • {1} - {2}", UniverseDetails?.Data.Creator.Name, TimeJoined.ToString("h:mm tt"), TimeLeft?.ToString("h:mm tt"));
|
||||
string desc = string.Format("{0} • {1} - {2}", UniverseDetails?.Data.Creator.Name, TimeJoined.ToString("h:mm tt"), TimeLeft?.ToString("h:mm tt"));
|
||||
|
||||
if (ServerType != ServerType.Public)
|
||||
desc += " • " + ServerType.ToTranslatedString();
|
||||
@ -82,7 +82,7 @@ namespace Bloxstrap.Models
|
||||
else
|
||||
deeplink += "&gameInstanceId=" + JobId;
|
||||
|
||||
if (launchData && !String.IsNullOrEmpty(RPCLaunchData))
|
||||
if (launchData && !string.IsNullOrEmpty(RPCLaunchData))
|
||||
deeplink += "&launchData=" + HttpUtility.UrlEncode(RPCLaunchData);
|
||||
|
||||
return deeplink;
|
||||
@ -107,7 +107,7 @@ namespace Bloxstrap.Models
|
||||
{
|
||||
var ipInfo = await Http.GetJson<IPInfoResponse>($"https://ipinfo.io/{MachineAddress}/json");
|
||||
|
||||
if (String.IsNullOrEmpty(ipInfo.City))
|
||||
if (string.IsNullOrEmpty(ipInfo.City))
|
||||
throw new InvalidHTTPResponseException("Reported city was blank");
|
||||
|
||||
if (ipInfo.City == ipInfo.Region)
|
||||
@ -127,9 +127,9 @@ namespace Bloxstrap.Models
|
||||
serverQuerySemaphore.Release();
|
||||
|
||||
Frontend.ShowConnectivityDialog(
|
||||
String.Format(Strings.Dialog_Connectivity_UnableToConnect, "ipinfo.io"),
|
||||
Strings.ActivityWatcher_LocationQueryFailed,
|
||||
MessageBoxImage.Warning,
|
||||
string.Format(Strings.Dialog_Connectivity_UnableToConnect, "ipinfo.io"),
|
||||
Strings.ActivityWatcher_LocationQueryFailed,
|
||||
MessageBoxImage.Warning,
|
||||
ex
|
||||
);
|
||||
}
|
||||
@ -142,7 +142,7 @@ namespace Bloxstrap.Models
|
||||
private void RejoinServer()
|
||||
{
|
||||
string playerPath = Path.Combine(Paths.Roblox, "Player", "RobloxPlayerBeta.exe");
|
||||
|
||||
|
||||
Process.Start(playerPath, GetInviteDeeplink(false));
|
||||
}
|
||||
}
|
@ -1,23 +1,23 @@
|
||||
using System.Security.Cryptography;
|
||||
using System.Windows.Markup;
|
||||
|
||||
namespace Bloxstrap.Models
|
||||
namespace Bloxstrap.Models.Entities
|
||||
{
|
||||
public class ModPresetFileData
|
||||
{
|
||||
public string FilePath { get; private set; }
|
||||
|
||||
public string FullFilePath => Path.Combine(Paths.Modifications, FilePath);
|
||||
|
||||
|
||||
public FileStream FileStream => File.OpenRead(FullFilePath);
|
||||
|
||||
public string ResourceIdentifier { get; private set; }
|
||||
|
||||
|
||||
public Stream ResourceStream => Resource.GetStream(ResourceIdentifier);
|
||||
|
||||
public byte[] ResourceHash { get; private set; }
|
||||
|
||||
public ModPresetFileData(string contentPath, string resource)
|
||||
public ModPresetFileData(string contentPath, string resource)
|
||||
{
|
||||
FilePath = contentPath;
|
||||
ResourceIdentifier = resource;
|
@ -1,11 +1,13 @@
|
||||
namespace Bloxstrap.Models
|
||||
using Bloxstrap.Models.APIs.Roblox;
|
||||
|
||||
namespace Bloxstrap.Models.Entities
|
||||
{
|
||||
public class UniverseDetails
|
||||
{
|
||||
private static List<UniverseDetails> _cache { get; set; } = new();
|
||||
|
||||
public GameDetailResponse Data { get; set; } = null!;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Returns data for a 128x128 icon
|
||||
/// </summary>
|
||||
@ -13,9 +15,9 @@
|
||||
|
||||
public static UniverseDetails? LoadFromCache(long id)
|
||||
{
|
||||
var cacheQuery = _cache.Where(x => x.Data?.Id == id);
|
||||
var cacheQuery = _cache.Where(x => x.Data?.Id == id);
|
||||
|
||||
if (cacheQuery.Any())
|
||||
if (cacheQuery.Any())
|
||||
return cacheQuery.First();
|
||||
|
||||
return null;
|
@ -1,8 +1,8 @@
|
||||
namespace Bloxstrap.Models
|
||||
namespace Bloxstrap.Models.Persistable
|
||||
{
|
||||
public class AppState
|
||||
{
|
||||
public string VersionGuid { get; set; } = String.Empty;
|
||||
public string VersionGuid { get; set; } = string.Empty;
|
||||
|
||||
public Dictionary<string, string> PackageHashes { get; set; } = new();
|
||||
|
@ -1,6 +1,6 @@
|
||||
using System.Collections.ObjectModel;
|
||||
|
||||
namespace Bloxstrap.Models
|
||||
namespace Bloxstrap.Models.Persistable
|
||||
{
|
||||
public class Settings
|
||||
{
|
@ -1,13 +1,13 @@
|
||||
namespace Bloxstrap.Models
|
||||
namespace Bloxstrap.Models.Persistable
|
||||
{
|
||||
public class State
|
||||
{
|
||||
public bool ShowFFlagEditorWarning { get; set; } = true;
|
||||
|
||||
|
||||
public bool PromptWebView2Install { get; set; } = true;
|
||||
|
||||
public AppState Player { get; set; } = new();
|
||||
|
||||
|
||||
public AppState Studio { get; set; } = new();
|
||||
|
||||
public WindowState SettingsWindow { get; set; } = new();
|
@ -1,13 +1,13 @@
|
||||
namespace Bloxstrap.Models
|
||||
namespace Bloxstrap.Models.Persistable
|
||||
{
|
||||
public class WindowState
|
||||
{
|
||||
public double Width { get; set; }
|
||||
|
||||
|
||||
public double Height { get; set; }
|
||||
|
||||
|
||||
public double Left { get; set; }
|
||||
|
||||
|
||||
public double Top { get; set; }
|
||||
}
|
||||
}
|
@ -1,4 +1,5 @@
|
||||
using Bloxstrap.Models.SettingTasks.Base;
|
||||
using Bloxstrap.Models.Entities;
|
||||
using Bloxstrap.Models.SettingTasks.Base;
|
||||
|
||||
namespace Bloxstrap.Models.SettingTasks
|
||||
{
|
||||
|
@ -1,4 +1,5 @@
|
||||
using Bloxstrap.Models.SettingTasks.Base;
|
||||
using Bloxstrap.Models.Entities;
|
||||
using Bloxstrap.Models.SettingTasks.Base;
|
||||
|
||||
namespace Bloxstrap.Models.SettingTasks
|
||||
{
|
||||
|
@ -14,7 +14,7 @@ namespace Bloxstrap.UI.Elements.Settings
|
||||
/// </summary>
|
||||
public partial class MainWindow : INavigationWindow
|
||||
{
|
||||
private Models.WindowState _state => App.State.Prop.SettingsWindow;
|
||||
private Models.Persistable.WindowState _state => App.State.Prop.SettingsWindow;
|
||||
|
||||
public MainWindow(bool showAlreadyRunningWarning)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user