From 1b63e60c5da175e2fa91d58cb56bcdf1add1f018 Mon Sep 17 00:00:00 2001 From: PlatinumMaster Date: Mon, 22 May 2023 03:38:40 -0400 Subject: [PATCH 01/17] Port of initial rewrite to main branch. Fixes needed. --- .travis.yml | 7 - App.axaml | 19 +- App.axaml.cs | 46 +- Converters/MapMatrixRowConverter.cs | 38 -- Handlers/CommandUpdateHandler.cs | 34 -- Handlers/GameController.cs | 18 + Handlers/IO.cs | 50 +++ Handlers/Logging.cs | 35 ++ Handlers/MessageHandler.cs | 28 -- Handlers/Messages.cs | 34 ++ Handlers/Preferences.cs | 102 +++++ Handlers/PreferencesHandler.cs | 13 - Handlers/ScriptHandler.cs | 42 ++ Models/NewProjectModel.cs | 30 ++ Models/Preferences.cs | 20 +- Pages/MapEditor.axaml | 55 --- Pages/MapEditor.axaml.cs | 18 - Pages/MatrixEditor.axaml | 21 - Pages/MatrixEditor.axaml.cs | 18 - Pages/ScriptEditor.axaml | 43 -- Pages/ScriptEditor.axaml.cs | 18 - Pages/TextEditor.axaml | 45 -- Pages/TextEditor.axaml.cs | 18 - Pages/TrainerEditor.axaml | 280 ------------ Pages/TrainerEditor.axaml.cs | 18 - Pages/WildPokemonEditor.axaml | 439 ------------------- Pages/WildPokemonEditor.axaml.cs | 18 - Pages/ZoneEntitiesEditor.axaml | 214 --------- Pages/ZoneEntitiesEditor.axaml.cs | 18 - Pages/ZoneHeaderEditor.axaml | 167 ------- Pages/ZoneHeaderEditor.axaml.cs | 18 - Styles/Border.axaml | 24 - Styles/Sidebar.axaml | 66 --- SwissArmyKnife.Avalonia.csproj | 34 +- Util.cs | 108 ----- ViewLocator.cs | 24 + ViewModels/Editors/MapEditorViewModel.cs | 259 +---------- ViewModels/Editors/MatrixEditorViewModel.cs | 40 +- ViewModels/Editors/ScriptEditorViewModel.cs | 144 +++--- ViewModels/Editors/TextEditorViewModel.cs | 128 +++--- ViewModels/Editors/TrainerEditorViewModel.cs | 183 +------- ViewModels/Editors/ViewModelTemplate.cs | 19 - ViewModels/Editors/WildPokemonViewModel.cs | 146 ------ ViewModels/Editors/ZoneEntitiesViewModel.cs | 161 ------- ViewModels/Editors/ZoneHeaderViewModel.cs | 70 --- ViewModels/MainWindowViewModel.cs | 50 --- ViewModels/NewProjectViewModel.cs | 127 ------ Views/Flow.axaml | 112 +++++ Views/Flow.axaml.cs | 38 ++ Views/MainWindow.axaml | 110 ----- Views/MainWindow.axaml.cs | 39 -- Views/NewProjectWindow.axaml | 64 --- Views/NewProjectWindow.axaml.cs | 36 -- Views/ProjectManagementWindow.axaml | 34 -- Views/ProjectManagementWindow.axaml.cs | 58 --- Views/Startup.axaml | 73 +++ Views/Startup.axaml.cs | 9 + 57 files changed, 839 insertions(+), 3241 deletions(-) delete mode 100644 .travis.yml delete mode 100644 Converters/MapMatrixRowConverter.cs delete mode 100644 Handlers/CommandUpdateHandler.cs create mode 100644 Handlers/GameController.cs create mode 100644 Handlers/IO.cs create mode 100644 Handlers/Logging.cs delete mode 100644 Handlers/MessageHandler.cs create mode 100644 Handlers/Messages.cs create mode 100644 Handlers/Preferences.cs delete mode 100644 Handlers/PreferencesHandler.cs create mode 100644 Handlers/ScriptHandler.cs create mode 100644 Models/NewProjectModel.cs delete mode 100644 Pages/MapEditor.axaml delete mode 100644 Pages/MapEditor.axaml.cs delete mode 100644 Pages/MatrixEditor.axaml delete mode 100644 Pages/MatrixEditor.axaml.cs delete mode 100644 Pages/ScriptEditor.axaml delete mode 100644 Pages/ScriptEditor.axaml.cs delete mode 100644 Pages/TextEditor.axaml delete mode 100644 Pages/TextEditor.axaml.cs delete mode 100644 Pages/TrainerEditor.axaml delete mode 100644 Pages/TrainerEditor.axaml.cs delete mode 100644 Pages/WildPokemonEditor.axaml delete mode 100644 Pages/WildPokemonEditor.axaml.cs delete mode 100644 Pages/ZoneEntitiesEditor.axaml delete mode 100644 Pages/ZoneEntitiesEditor.axaml.cs delete mode 100644 Pages/ZoneHeaderEditor.axaml delete mode 100644 Pages/ZoneHeaderEditor.axaml.cs delete mode 100644 Styles/Border.axaml delete mode 100644 Styles/Sidebar.axaml delete mode 100644 Util.cs create mode 100644 ViewLocator.cs delete mode 100644 ViewModels/Editors/ViewModelTemplate.cs delete mode 100644 ViewModels/Editors/WildPokemonViewModel.cs delete mode 100644 ViewModels/Editors/ZoneEntitiesViewModel.cs delete mode 100644 ViewModels/Editors/ZoneHeaderViewModel.cs delete mode 100644 ViewModels/MainWindowViewModel.cs delete mode 100644 ViewModels/NewProjectViewModel.cs create mode 100644 Views/Flow.axaml create mode 100644 Views/Flow.axaml.cs delete mode 100644 Views/MainWindow.axaml delete mode 100644 Views/MainWindow.axaml.cs delete mode 100644 Views/NewProjectWindow.axaml delete mode 100644 Views/NewProjectWindow.axaml.cs delete mode 100644 Views/ProjectManagementWindow.axaml delete mode 100644 Views/ProjectManagementWindow.axaml.cs create mode 100644 Views/Startup.axaml create mode 100644 Views/Startup.axaml.cs diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 083a15d..0000000 --- a/.travis.yml +++ /dev/null @@ -1,7 +0,0 @@ -language: csharp -mono: none -dotnet: 5.0.302 -solution: SwissArmyKnife.sln -install: - - sudo dosomething - - nuget restore solution-name.sln \ No newline at end of file diff --git a/App.axaml b/App.axaml index 057b5b2..8a05df6 100644 --- a/App.axaml +++ b/App.axaml @@ -1,12 +1,17 @@ + xmlns:local="using:SwissArmyKnife" + xmlns:themes="clr-namespace:Material.Styles.Themes;assembly=Material.Styles" + x:Class="SwissArmyKnife.App"> + + + + + + - - - - - + + - \ No newline at end of file + diff --git a/App.axaml.cs b/App.axaml.cs index 09dadeb..79d53cf 100644 --- a/App.axaml.cs +++ b/App.axaml.cs @@ -1,19 +1,29 @@ -using Avalonia; -using Avalonia.Controls.ApplicationLifetimes; -using Avalonia.Markup.Xaml; -using SwissArmyKnife.Avalonia.Views; - -namespace SwissArmyKnife.Avalonia { - public class App : Application { - public override void Initialize() { - AvaloniaXamlLoader.Load(this); - } - - public override void OnFrameworkInitializationCompleted() { - if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop) - desktop.MainWindow = new ProjectManagementWindow(); - - base.OnFrameworkInitializationCompleted(); - } - } +using System.IO; +using Avalonia; +using Avalonia.Controls.ApplicationLifetimes; +using Avalonia.Markup.Xaml; +using SwissArmyKnife.Avalonia.Handlers; +using SwissArmyKnife.Handlers; +using SwissArmyKnife.ViewModels; +using SwissArmyKnife.ViewModels.Main; +using SwissArmyKnife.Views; + +namespace SwissArmyKnife { + public partial class App : Application { + public override void Initialize() { + AvaloniaXamlLoader.Load(this); + } + + public override void OnFrameworkInitializationCompleted() { + Logging.InitializeLogger(); + Preferences.ReadPreferences(Path.Combine("Configuration", "Preferences.yml")); + if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop) { + desktop.MainWindow = new StartupWindow { + DataContext = new StartupViewModel() + }; + } + + base.OnFrameworkInitializationCompleted(); + } + } } \ No newline at end of file diff --git a/Converters/MapMatrixRowConverter.cs b/Converters/MapMatrixRowConverter.cs deleted file mode 100644 index 8556a65..0000000 --- a/Converters/MapMatrixRowConverter.cs +++ /dev/null @@ -1,38 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Data; -using System.Globalization; -using Avalonia.Data.Converters; -using BeaterLibrary.Formats.Maps; - -namespace SwissArmyKnife.Avalonia.Converters; - -public class MapMatrixRowConverter : IValueConverter { - public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { - var matrix = value as ObservableCollection; - if (matrix != null) { - int nRows, nColumns; - if ((nRows = matrix.Count) > 0 && (nColumns = matrix[0].Count) > 0) { - DataTable t = new DataTable(); - for (int index = 0; index < nColumns; ++index) { - t.Columns.Add(new DataColumn(index.ToString())); - } - for (int row = 0; row < nRows; ++row) { - DataRow newRow = t.NewRow(); - for (int column = 0; column < nColumns; ++column) { - newRow[column] = matrix[row][column]; - } - t.Rows.Add(newRow); - } - - return t.DefaultView; - } - } - return null; - } - - public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { - return null; - } -} \ No newline at end of file diff --git a/Handlers/CommandUpdateHandler.cs b/Handlers/CommandUpdateHandler.cs deleted file mode 100644 index f067a43..0000000 --- a/Handlers/CommandUpdateHandler.cs +++ /dev/null @@ -1,34 +0,0 @@ -using System; -using System.IO; -using System.Net; -using SwissArmyKnife.Avalonia.Utils; - -namespace SwissArmyKnife.Avalonia.Handlers { - public static class CommandUpdateHandler { - public static bool FetchScriptCommands() { - using (var w = new WebClient()) { - if (!DownloadYml(w, "Base", Path.Combine("Resources", "Scripts", UI.GameInfo.title, "Base.yml"))) - throw new WebException("Failed to download script commands"); - foreach (var plugin in UI.GameInfo.scriptPlugins) - if (!DownloadYml(w, $"Overlay {plugin}", - Path.Combine("Resources", "Scripts", UI.GameInfo.title, $"Overlay {plugin}.yml"))) - throw new WebException($"Failed to download script plugin {plugin}."); - - return true; - } - } - - public static bool DownloadYml(WebClient w, string ymlName, string expPath) { - DirectoryInfo reqPath = Directory.GetParent(expPath); - if (!reqPath.Exists) { - reqPath.Create(); - } - w.DownloadFile(new Uri(GetLinkToYml(ymlName)), expPath); - return true; - } - - public static string GetLinkToYml(string ymlName) { - return $"{PreferencesHandler.Prefs.ScriptCommandsLink}{UI.GameInfo.title}/{ymlName}.yml"; - } - } -} \ No newline at end of file diff --git a/Handlers/GameController.cs b/Handlers/GameController.cs new file mode 100644 index 0000000..2410104 --- /dev/null +++ b/Handlers/GameController.cs @@ -0,0 +1,18 @@ +using System; +using Hotswap; + +namespace SwissArmyKnife.Handlers; + +public class GameController { + public static Patcher? PatcherInstance { get; private set; } + public static IProject? Project { get; private set; } + public static void Init(string BaseROMConfigurationPath) { + PatcherInstance = new Patcher(BaseROMConfigurationPath); + } + + public static bool HandleProject(IProject Configuration) { + Project = Configuration; + PatcherInstance?.LoadProject(Configuration); + return true; + } +} \ No newline at end of file diff --git a/Handlers/IO.cs b/Handlers/IO.cs new file mode 100644 index 0000000..67236c5 --- /dev/null +++ b/Handlers/IO.cs @@ -0,0 +1,50 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Net; +using System.Threading.Tasks; +using Avalonia.Controls; + +namespace SwissArmyKnife.Handlers; + +public class IO { + private static async Task HandleFolderFileChoice(bool saving, bool isFile, Window parentInstance, List dialogFilter) { + string? result; + if (isFile) { + if (saving) { + result = await new SaveFileDialog { + Filters = dialogFilter + }.ShowAsync(parentInstance); + } + else { + string[]? resultArray = await new OpenFileDialog { + Filters = dialogFilter + }.ShowAsync(parentInstance); + result = resultArray != null && resultArray.Length != 0 ? resultArray[0] : null; + } + } else { + result = await new OpenFolderDialog().ShowAsync(parentInstance); + } + + return string.IsNullOrEmpty(result) ? String.Empty : result; + } + + public static async Task OpenFolder(Window parentInstance) => await HandleFolderFileChoice(false, false, parentInstance, null); + public static async Task OpenFile(Window parentInstance, List dialogFilter) => await HandleFolderFileChoice(false, true, parentInstance, dialogFilter); + public static async Task SaveFile(Window parentInstance, List dialogFilter) => await HandleFolderFileChoice(true, true, parentInstance, dialogFilter); + + public static async Task TryReadBinaryFile(Window Instance, List Filters) { + string? FilePath = await OpenFile(Instance, Filters); + if (!FilePath.Equals("")) { + return await File.ReadAllBytesAsync(FilePath); + } + return null; + } + + public static async Task TryWriteBinaryFile(Window Instance, byte[] Buffer, List Filters) { + string? FilePath = await SaveFile(Instance, Filters); + if (!FilePath.Equals("")) { + await File.WriteAllBytesAsync(FilePath, Buffer); + } + } +} \ No newline at end of file diff --git a/Handlers/Logging.cs b/Handlers/Logging.cs new file mode 100644 index 0000000..458c299 --- /dev/null +++ b/Handlers/Logging.cs @@ -0,0 +1,35 @@ +using System; +using System.IO; + +namespace SwissArmyKnife.Avalonia.Handlers; + +public static class Logging { + private static TextWriter loggerStream; + private static string logFileName; + + private static void Log(string Message) { + using (loggerStream = File.AppendText(logFileName)) { + loggerStream.WriteLine($"[{DateTime.Now}] {Message}"); + loggerStream.Flush(); + loggerStream.Close(); + } + } + + public static void LogWarning(string Message) => Log($": {Message}"); + public static void LogError(string Message) => Log($": {Message}"); + public static void LogStandard(string Message) => Log($"{Message}"); + + public static void StopLogger() => loggerStream.Close(); + + public static void InitializeLogger() { + string baseName = $"SAKLog-{DateTime.Today.Year}{DateTime.Today.Month}{DateTime.Today.Day}"; + int sessionNumber = 0; + + Directory.CreateDirectory("Logs"); + while (File.Exists(logFileName = Path.Combine("Logs", $"{baseName}-{sessionNumber}.log"))) { + sessionNumber++; + } + Log($"# SwissArmyKnife - (Commit Version Here) - Log File"); + } + +} \ No newline at end of file diff --git a/Handlers/MessageHandler.cs b/Handlers/MessageHandler.cs deleted file mode 100644 index 2e11d41..0000000 --- a/Handlers/MessageHandler.cs +++ /dev/null @@ -1,28 +0,0 @@ -using System.Threading.Tasks; -using MessageBox.Avalonia; -using MessageBox.Avalonia.DTO; -using MessageBox.Avalonia.Enums; - -namespace SwissArmyKnife.Avalonia.Handlers { - internal class MessageHandler { - public static void ErrorMessage(string title, string caption) { - MessageBoxManager.GetMessageBoxStandardWindow(new MessageBoxStandardParams { - ButtonDefinitions = ButtonEnum.Ok, - ContentTitle = $"Error: {title}", - ContentMessage = caption, - Icon = Icon.Error, - Style = Style.None - }).Show(); - } - - public static Task YesNoMessage(string title, string caption) { - return MessageBoxManager.GetMessageBoxStandardWindow(new MessageBoxStandardParams { - ButtonDefinitions = ButtonEnum.YesNo, - ContentTitle = title, - ContentMessage = caption, - Icon = Icon.Success, - Style = Style.Windows - }).Show(); - } - } -} \ No newline at end of file diff --git a/Handlers/Messages.cs b/Handlers/Messages.cs new file mode 100644 index 0000000..79b5841 --- /dev/null +++ b/Handlers/Messages.cs @@ -0,0 +1,34 @@ +using System.Threading.Tasks; +using Avalonia.Controls; +using Avalonia.Controls.ApplicationLifetimes; +using Material.Dialog; +using MessageBox.Avalonia; +using MessageBox.Avalonia.DTO; +using MessageBox.Avalonia.Enums; +using SwissArmyKnife.Avalonia.Handlers; + +namespace SwissArmyKnife.Handlers; + +public class Messages { + private static async Task DoMessage(IClassicDesktopStyleApplicationLifetime Desktop, string Header, string SupportingText, DialogButton[] Buttons, DialogResult NegativeResult) { + return await DialogHelper.CreateAlertDialog( + new AlertDialogBuilderParams { + ContentHeader = Header, + SupportingText = SupportingText, + StartupLocation = WindowStartupLocation.CenterOwner, + NegativeResult = new DialogResult("No"), + Borderless = true, + DialogButtons = Buttons + }).ShowDialog(Desktop.MainWindow); + } + public static Task YesNoMessage(IClassicDesktopStyleApplicationLifetime Desktop, string Header, string SupportingText) => DoMessage(Desktop, Header, SupportingText, new[] { + new DialogButton { + Content = "Yes", + Result = "Confirm" + }, + new DialogButton { + Content = "No", + Result = "Cancel" + } + }, new DialogResult("No")); +} \ No newline at end of file diff --git a/Handlers/Preferences.cs b/Handlers/Preferences.cs new file mode 100644 index 0000000..a4f0c37 --- /dev/null +++ b/Handlers/Preferences.cs @@ -0,0 +1,102 @@ +using System; +using System.Collections.Generic; +using System.IO; +using SwissArmyKnife.Avalonia.Handlers; +using SwissArmyKnife.Models; +using YamlDotNet.Serialization; + +namespace SwissArmyKnife.Handlers; + +public class Preferences { + public static Models.Preferences Prefs; + public static void ReadPreferences(string path) { + Dictionary preferences = new Dictionary { + { "ScriptCommandsLink", "https://raw.githubusercontent.com/PlatinumMaster/PokeScriptSDK5/master/yml/" }, + { "BaseROMConfigurationPath", "BaseROM.yml" } + }; + + Dictionary scriptEditorColors = new Dictionary { + { "Method", "Cyan" }, + { "Comment", "Green" }, + { "Operator", "Fuchsia" }, + { "Parameter", "Orange" } + }; + + Dictionary textEditorColors = new Dictionary { + { "Command", "" }, + { "Comment", "" }, + { "Operator", "" }, + { "Parameter", "" } + }; + + if (!File.Exists(path)) { + Logging.LogWarning($"Preferences file not found at path \"{path}\"; using default configuration."); + } + else { + Logging.LogStandard($"Loading preferences from {path}..."); + Dictionary deserializedPreferences = + new Deserializer().Deserialize>(new StringReader(File.ReadAllText(path))); + if (deserializedPreferences.ContainsKey("ScriptCommandsRepository")) { + var newScriptRepository = deserializedPreferences["ScriptCommandsRepository"] as string; + if (newScriptRepository != null) { + preferences["ScriptCommandsLink"] = newScriptRepository; + Logging.LogStandard($"Changed script repository to {newScriptRepository}."); + } + else { + Logging.LogWarning($"Invalid script repository link. Using the default."); + } + } + + if (deserializedPreferences.ContainsKey("BaseROMConfigurationPath")) { + var newBaseROMConfigurationPath = deserializedPreferences["BaseROMConfigurationPath"] as string; + if (newBaseROMConfigurationPath != null) { + preferences["BaseROMConfigurationPath"] = newBaseROMConfigurationPath; + Logging.LogStandard($"Changed BaseROM configuration path to {newBaseROMConfigurationPath}."); + } + else { + Logging.LogWarning($"Invalid BaseROM configuration path. Using the default."); + } + } + + if (deserializedPreferences.ContainsKey("ScriptEditorColors")) { + Dictionary? newScriptEditorColors = deserializedPreferences["ScriptEditorColors"] as Dictionary; + if (newScriptEditorColors != null) { + foreach (KeyValuePair kv in newScriptEditorColors) + if (scriptEditorColors.ContainsKey(kv.Key)) { + scriptEditorColors[kv.Key] = kv.Value; + Logging.LogStandard($"Changed the script editor's {kv.Key} color to {kv.Value}."); + } + } + else { + Logging.LogWarning($"Invalid script editor color configuration. Using the default."); + } + } + + if (deserializedPreferences.ContainsKey("TextEditorColors")) { + Dictionary? newTextEditorColors = + deserializedPreferences["TextEditorColors"] as Dictionary; + if (newTextEditorColors != null) { + foreach (KeyValuePair kv in newTextEditorColors) + if (textEditorColors.ContainsKey(kv.Key)) { + textEditorColors[kv.Key] = kv.Value; + Logging.LogStandard($"Changed the text editor's {kv.Key} color to {kv.Value}."); + } + } + else { + Logging.LogWarning($"Invalid text editor color configuration. Using the default."); + } + } + } + + Prefs = new Models.Preferences { + ScriptCommandsLink = preferences["ScriptCommandsLink"], + BaseROMConfigurationPath = preferences["BaseROMConfigurationPath"], + ScriptEditorColors = scriptEditorColors, + TextEditorColors = textEditorColors + }; + + Logging.LogStandard($"Done loading preferences."); + } + + public static void Serialize(string path) { } +} \ No newline at end of file diff --git a/Handlers/PreferencesHandler.cs b/Handlers/PreferencesHandler.cs deleted file mode 100644 index 38d5f1c..0000000 --- a/Handlers/PreferencesHandler.cs +++ /dev/null @@ -1,13 +0,0 @@ -using SwissArmyKnife.Avalonia.Models; - -namespace SwissArmyKnife.Avalonia.Handlers { - public class PreferencesHandler { - public static Preferences Prefs = new(); - - public static void ReadPreferences() { - } - - public static void Serialize(Preferences prefs, string path) { - } - } -} \ No newline at end of file diff --git a/Handlers/ScriptHandler.cs b/Handlers/ScriptHandler.cs new file mode 100644 index 0000000..1817f86 --- /dev/null +++ b/Handlers/ScriptHandler.cs @@ -0,0 +1,42 @@ +using System.Collections.Generic; +using System.Linq; +using System.Reflection.Metadata; +using System.Text; +using BeaterLibrary.Formats.Scripts; + +namespace SwissArmyKnife.Handlers; + +public class ScriptHandler { + public static string PrintMethod(ScriptMethod Method, bool IsAnonymous = false) { + StringBuilder ConvertedMethod = new StringBuilder(); + // List JumpAddresses = Method.Commands.FindAll(Commands => Commands.Type.Equals(Commands.Type == CommandTypes.Jump)).Select(Command => (int)Command.Parameters[^1]).ToList(); + // ConvertedMethod.AppendLine(IsAnonymous ? $"AnonymousScriptMethod_{Method.Address}:" : $"Script_{Method.Address}:"); + // for (int Start = Method.Address, CommandPointer = 0; Start < Method.Address + Method.Size; ++CommandPointer) { + // if (JumpAddresses.Contains(Start)) { + // ConvertedMethod.AppendLine($"AnonymousScriptMethod_{Start}:"); + // } + // ConvertedMethod.AppendLine($"\t{Method.Commands[CommandPointer]}"); + // Start += Method.Commands[CommandPointer].Size(); + // } + return ConvertedMethod.ToString(); + } + + public static void CoalesceBranches(List> Jumps) { + // List> Js = new List>(); + // foreach (Link Link in Jumps) { + // List> SameEnd = Jumps.FindAll(x => + // x.StartAddress + x.Data.Size == Link.StartAddress + Link.Data.Size); + // Link Max = SameEnd[0]; + // foreach (Link Cmp in SameEnd) { + // if (Cmp.StartAddress <= Max.StartAddress) { + // Max = Cmp; + // } + // } + // + // if (Js.All(x => x.StartAddress != Max.StartAddress)) { + // Js.Add(Max); + // } + // } + // Js.Clear(); + } +} \ No newline at end of file diff --git a/Models/NewProjectModel.cs b/Models/NewProjectModel.cs new file mode 100644 index 0000000..7a0ae03 --- /dev/null +++ b/Models/NewProjectModel.cs @@ -0,0 +1,30 @@ +using System; +using ReactiveUI; +using SwissArmyKnife.ViewModels; +using SwissArmyKnife.ViewModels.Base; + +namespace SwissArmyKnife.Models; + +public class NewProjectModel : ReactiveObject { + private string _projectName, _projectTitle, _projectROMCode; + + public NewProjectModel() { + ProjectName = String.Empty; + ProjectROMCode = String.Empty; + Path = String.Empty; + } + public string ProjectName { + get => _projectName; + set => this.RaiseAndSetIfChanged(ref _projectName, value); + } + + public string Path { + get => _projectTitle; + set => this.RaiseAndSetIfChanged(ref _projectTitle, value); + } + + public string ProjectROMCode { + get => _projectROMCode; + set => this.RaiseAndSetIfChanged(ref _projectROMCode, value); + } +} \ No newline at end of file diff --git a/Models/Preferences.cs b/Models/Preferences.cs index bcf61ea..345e8b1 100644 --- a/Models/Preferences.cs +++ b/Models/Preferences.cs @@ -1,11 +1,15 @@ -namespace SwissArmyKnife.Avalonia.Models { - public class Preferences { - public Preferences() { - ScriptCommandsLink = "https://raw.githubusercontent.com/HelloOO7/PokeScriptSDK5/master/yml/"; - BaseRomConfiguration = "Configuration/BaseROM.yml"; - } +using System.Collections.Generic; - public string ScriptCommandsLink { get; } - public string BaseRomConfiguration { get; } +namespace SwissArmyKnife.Models; + +public class Preferences { + public Preferences() { + ScriptCommandsLink = "https://raw.githubusercontent.com/PlatinumMaster/PokeScriptSDK5/master/yml/"; + BaseROMConfigurationPath = "BaseROM.yml"; } + + public string ScriptCommandsLink { get; set; } + public string BaseROMConfigurationPath { get; set; } + public Dictionary ScriptEditorColors { get; set; } + public Dictionary TextEditorColors { get; set; } } \ No newline at end of file diff --git a/Pages/MapEditor.axaml b/Pages/MapEditor.axaml deleted file mode 100644 index 77f788f..0000000 --- a/Pages/MapEditor.axaml +++ /dev/null @@ -1,55 +0,0 @@ - - - - - - -