diff --git a/StoneRed.LogicSimulator/Content/LoadWorldWindow.xmmp b/StoneRed.LogicSimulator/Content/LoadWorldWindow.xmmp
new file mode 100644
index 0000000..f1536dc
--- /dev/null
+++ b/StoneRed.LogicSimulator/Content/LoadWorldWindow.xmmp
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/StoneRed.LogicSimulator/Content/SaveWorldWindow.xmmp b/StoneRed.LogicSimulator/Content/SaveWorldWindow.xmmp
new file mode 100644
index 0000000..8ce91e9
--- /dev/null
+++ b/StoneRed.LogicSimulator/Content/SaveWorldWindow.xmmp
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/StoneRed.LogicSimulator/Misc/Paths.cs b/StoneRed.LogicSimulator/Misc/Paths.cs
new file mode 100644
index 0000000..51f6f3a
--- /dev/null
+++ b/StoneRed.LogicSimulator/Misc/Paths.cs
@@ -0,0 +1,81 @@
+using Myra.Utility;
+
+using System;
+using System.IO;
+
+namespace StoneRed.LogicSimulator.Misc;
+
+internal static class Paths
+{
+ public static string GetAppDataPath()
+ {
+ string appDataPath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
+ string srlsAppDataPath = Path.Combine(appDataPath, "StoneRed", "LogicSimulator");
+
+ if (!Directory.Exists(srlsAppDataPath))
+ {
+ _ = Directory.CreateDirectory(srlsAppDataPath);
+ }
+
+ return srlsAppDataPath;
+ }
+
+ public static string GetAppDataPath(string fileName)
+ {
+ return Path.Combine(GetAppDataPath(), fileName);
+ }
+
+ public static string GetAppDataPath(params string[] paths)
+ {
+ return Path.Combine(GetAppDataPath(), Path.Combine(paths));
+ }
+
+ public static string GetContentPath()
+ {
+ return Path.Combine(PathUtils.ExecutingAssemblyDirectory, "Content");
+ }
+
+ public static string GetContentPath(string fileName)
+ {
+ return Path.Combine(GetContentPath(), fileName);
+ }
+
+ public static string GetContentPath(params string[] paths)
+ {
+ return Path.Combine(GetContentPath(), Path.Combine(paths));
+ }
+
+ public static string GetSettingsPath()
+ {
+ return Path.Combine(GetAppDataPath(), "settings.json");
+ }
+
+ public static string GetWorldSavesPath()
+ {
+ string savesPath = Path.Combine(GetAppDataPath(), "Saves");
+
+ if (!Directory.Exists(savesPath))
+ {
+ _ = Directory.CreateDirectory(savesPath);
+ }
+
+ return savesPath;
+ }
+
+ public static string GetWorldSaveDirectoryPath(string saveName)
+ {
+ string savePath = Path.Combine(GetWorldSavesPath(), saveName);
+
+ if (!Directory.Exists(savePath))
+ {
+ _ = Directory.CreateDirectory(savePath);
+ }
+
+ return savePath;
+ }
+
+ public static string GetWorldSaveFilePath(string saveName)
+ {
+ return Path.Combine(GetWorldSaveDirectoryPath(saveName), saveName + ".srls");
+ }
+}
\ No newline at end of file
diff --git a/StoneRed.LogicSimulator/Utilities/Settings.cs b/StoneRed.LogicSimulator/Misc/Settings.cs
similarity index 87%
rename from StoneRed.LogicSimulator/Utilities/Settings.cs
rename to StoneRed.LogicSimulator/Misc/Settings.cs
index 4609098..3269233 100644
--- a/StoneRed.LogicSimulator/Utilities/Settings.cs
+++ b/StoneRed.LogicSimulator/Misc/Settings.cs
@@ -1,7 +1,8 @@
using System.IO;
using System.Text.Json;
+using StoneRed.LogicSimulator.Utilities;
-namespace StoneRed.LogicSimulator.Utilities;
+namespace StoneRed.LogicSimulator.Misc;
internal class Settings
{
diff --git a/StoneRed.LogicSimulator/Srls.cs b/StoneRed.LogicSimulator/Srls.cs
index 9e6ab88..57e4828 100644
--- a/StoneRed.LogicSimulator/Srls.cs
+++ b/StoneRed.LogicSimulator/Srls.cs
@@ -8,8 +8,8 @@ using MonoGame.Extended.Screens;
using Myra;
using Myra.Assets;
using Myra.Graphics2D.UI;
-using Myra.Utility;
+using StoneRed.LogicSimulator.Misc;
using StoneRed.LogicSimulator.UserInterface.Screens;
using StoneRed.LogicSimulator.UserInterface.Windows;
using StoneRed.LogicSimulator.Utilities;
@@ -36,18 +36,11 @@ internal class Srls : Game
public Settings Settings { get; set; }
- public string ContentPath { get; }
-
- public string SettingsPath { get; }
-
public Srls()
{
Content.RootDirectory = "Content";
- ContentPath = Path.Combine(PathUtils.ExecutingAssemblyDirectory, "Content");
- SettingsPath = Path.Combine(PathUtils.ExecutingAssemblyDirectory, "settings.json");
-
- Settings = Settings.Load(SettingsPath) ?? new Settings()
+ Settings = Settings.Load(Paths.GetSettingsPath()) ?? new Settings()
{
Resolution = new Resolution(GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width, GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height),
Scale = 1
@@ -101,7 +94,7 @@ internal class Srls : Game
public TextButton ShowContextMenu(string title, Point position, MenuItem[] menuItems, bool showButton = false)
{
- string data = File.ReadAllText(Path.Combine(ContentPath, "ContextMenu.xmmp"));
+ string data = File.ReadAllText(Paths.GetContentPath("ContextMenu.xmmp"));
VerticalStackPanel contextMenu = (VerticalStackPanel)Project.LoadFromXml(data, AssetManager).Root;
contextMenu.FindChildById