mirror of
https://github.com/bloxstraplabs/bloxstrap.git
synced 2025-04-21 10:01:27 -07:00
Fix font application mod on first install
This commit is contained in:
parent
dc3500e110
commit
f02fba2ce1
@ -17,8 +17,10 @@ namespace Bloxstrap
|
||||
|
||||
// used only for communicating between app and menu - use Directories.Base for anything else
|
||||
public static string BaseDirectory = null!;
|
||||
public static string? CustomFontLocation;
|
||||
|
||||
public static bool ShouldSaveConfigs { get; set; } = false;
|
||||
|
||||
public static bool IsSetupComplete { get; set; } = true;
|
||||
public static bool IsFirstRun { get; private set; } = true;
|
||||
public static bool IsQuiet { get; private set; } = false;
|
||||
|
@ -980,7 +980,6 @@ namespace Bloxstrap
|
||||
bool appDisabled = App.Settings.Prop.UseDisableAppPatch && !_launchCommandLine.Contains("--deeplink");
|
||||
|
||||
// cursors
|
||||
|
||||
await CheckModPreset(App.Settings.Prop.CursorType == CursorType.From2006, new Dictionary<string, string>
|
||||
{
|
||||
{ @"content\textures\Cursors\KeyboardMouse\ArrowCursor.png", "Cursor.From2006.ArrowCursor.png" },
|
||||
@ -1036,9 +1035,14 @@ namespace Bloxstrap
|
||||
// instead of replacing the fonts themselves, we'll just alter the font family manifests
|
||||
|
||||
string modFontFamiliesFolder = Path.Combine(Directories.Modifications, "content\\fonts\\families");
|
||||
string customFontLocation = Path.Combine(Directories.Modifications, "content\\fonts\\CustomFont.ttf");
|
||||
|
||||
if (File.Exists(customFontLocation))
|
||||
if (App.IsFirstRun && App.CustomFontLocation is not null)
|
||||
{
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(Directories.CustomFont)!);
|
||||
File.Copy(App.CustomFontLocation, Directories.CustomFont);
|
||||
}
|
||||
|
||||
if (File.Exists(Directories.CustomFont))
|
||||
{
|
||||
App.Logger.WriteLine("[Bootstrapper::ApplyModifications] Begin font check");
|
||||
|
||||
|
@ -19,6 +19,8 @@
|
||||
|
||||
public static string Application { get; private set; } = "";
|
||||
|
||||
public static string CustomFont => Path.Combine(Modifications, "content\\fonts\\CustomFont.ttf");
|
||||
|
||||
public static bool Initialized => !String.IsNullOrEmpty(Base);
|
||||
|
||||
public static void Initialize(string baseDirectory)
|
||||
|
@ -75,7 +75,7 @@ namespace Bloxstrap.UI.ViewModels.Menu
|
||||
$"The folder you've chosen to install {App.ProjectName} to already exists and is NOT empty. It is strongly recommended for {App.ProjectName} to be installed to its own independent folder.\n\n" +
|
||||
"Changing to the following location is suggested:\n" +
|
||||
$"{suggestedChange}\n\n" +
|
||||
"Would you like to change your install location to this?\n" +
|
||||
"Would you like to change to the suggested location?\n" +
|
||||
"Selecting 'No' will ignore this warning and continue installation.",
|
||||
MessageBoxImage.Warning,
|
||||
MessageBoxButton.YesNoCancel,
|
||||
|
@ -11,14 +11,16 @@ namespace Bloxstrap.UI.ViewModels.Menu
|
||||
{
|
||||
private void OpenModsFolder() => Process.Start("explorer.exe", Directories.Modifications);
|
||||
|
||||
private string _customFontLocation = Path.Combine(Directories.Modifications, "content\\fonts\\CustomFont.ttf");
|
||||
private bool _usingCustomFont => File.Exists(_customFontLocation);
|
||||
private bool _usingCustomFont => App.IsFirstRun && App.CustomFontLocation is not null || !App.IsFirstRun && File.Exists(Directories.CustomFont);
|
||||
|
||||
private void ManageCustomFont()
|
||||
{
|
||||
if (_usingCustomFont)
|
||||
{
|
||||
File.Delete(_customFontLocation);
|
||||
if (App.IsFirstRun)
|
||||
App.CustomFontLocation = null;
|
||||
else
|
||||
File.Delete(Directories.CustomFont);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -30,8 +32,15 @@ namespace Bloxstrap.UI.ViewModels.Menu
|
||||
if (dialog.ShowDialog() != true)
|
||||
return;
|
||||
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(_customFontLocation)!);
|
||||
File.Copy(dialog.FileName, _customFontLocation);
|
||||
if (App.IsFirstRun)
|
||||
{
|
||||
App.CustomFontLocation = dialog.FileName;
|
||||
}
|
||||
else
|
||||
{
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(Directories.CustomFont)!);
|
||||
File.Copy(dialog.FileName, Directories.CustomFont);
|
||||
}
|
||||
}
|
||||
|
||||
OnPropertyChanged(nameof(ChooseCustomFontVisibility));
|
||||
|
Loading…
Reference in New Issue
Block a user