58 lines
1.6 KiB
C#
58 lines
1.6 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.Text.Json;
|
|
using Cogwheel;
|
|
using SessionZero.Cogwheel;
|
|
using SessionZero.Data;
|
|
using SessionZero.Data.Sztl;
|
|
|
|
namespace SessionZero;
|
|
|
|
public static class AppManager
|
|
{
|
|
public static MainWindow MainWindow { get; set; }
|
|
public static ICogwheelConsole SzConsole { get; } = new SessionZeroConsole();
|
|
public static CommandsManager CommandsManager { get; } = new();
|
|
public static ConsoleControl ConsoleControl { get; } = new();
|
|
public static AppSettings Settings { get; } = new();
|
|
|
|
public static string DataDirectory => Path.Combine(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location), "data");
|
|
public static string DatapacksDirectory => Path.Combine(DataDirectory, "datapacks");
|
|
|
|
public static void Init()
|
|
{
|
|
VerifyDataDirs();
|
|
}
|
|
|
|
public static void VerifyDataDirs()
|
|
{
|
|
if (!Directory.Exists(DataDirectory))
|
|
{
|
|
Directory.CreateDirectory(DataDirectory);
|
|
}
|
|
|
|
if (!Directory.Exists(DatapacksDirectory))
|
|
{
|
|
Directory.CreateDirectory(DatapacksDirectory);
|
|
}
|
|
}
|
|
|
|
public static void ShowConsole()
|
|
{
|
|
MainWindow.ToggleConsole(true);
|
|
}
|
|
|
|
public static void HideConsole()
|
|
{
|
|
MainWindow.ToggleConsole(false);
|
|
}
|
|
|
|
// -- Global Commands -- //
|
|
|
|
[Command(Name = "page", Description = "Change the current page to the given value, if it exists")]
|
|
public static void ChangePage(string pageName)
|
|
{
|
|
MainWindow.ChangePage(pageName);
|
|
}
|
|
} |