From ca40871a6312998b99664b92c12a45a2683d95db Mon Sep 17 00:00:00 2001 From: Michael Date: Fri, 19 May 2017 21:47:02 -0400 Subject: [PATCH] document paths system --- ShiftOS_TheReturn/Paths.cs | 45 +++++++++++++++++++++++++++++++++++--- 1 file changed, 42 insertions(+), 3 deletions(-) diff --git a/ShiftOS_TheReturn/Paths.cs b/ShiftOS_TheReturn/Paths.cs index 10fd7d7..5b75ae6 100644 --- a/ShiftOS_TheReturn/Paths.cs +++ b/ShiftOS_TheReturn/Paths.cs @@ -35,8 +35,14 @@ using System.Threading; namespace ShiftOS.Engine { + /// + /// Management class for ShiftFS path variables. + /// public static class Paths { + /// + /// Initiate the path system. + /// public static void Init() { Locations = new Dictionary(); @@ -88,6 +94,10 @@ namespace ShiftOS.Engine } + /// + /// Gets all full paths without their keynames. + /// + /// A string array representing all paths. public static string[] GetAllWithoutKey() { List strings = new List(); @@ -99,11 +109,19 @@ namespace ShiftOS.Engine } + /// + /// Get the full path using a path key. + /// + /// The path key (folder/filename) for the path. + /// The full path. public static string GetPath(string id) { return Locations[id]; } + /// + /// Checks all directories in the path system to see if they exist, and if not, creates them. + /// private static void CheckPathExistence() { foreach(var path in Locations) @@ -119,8 +137,14 @@ namespace ShiftOS.Engine } } + /// + /// Gets or sets a representing all paths in the system. + /// private static Dictionary Locations { get; set; } + /// + /// Mounts the ShiftOS shared directory to 1:/, creating the directory if it does not exist. + /// public static void CreateAndMountSharedFolder() { if (!System.IO.Directory.Exists(SharedFolder)) @@ -201,9 +225,7 @@ namespace ShiftOS.Engine t.Start(); } - - - public static void ScanForDirectories(string folder, int mount) + private static void ScanForDirectories(string folder, int mount) { foreach (var file in System.IO.Directory.GetFiles(folder)) { @@ -220,10 +242,27 @@ namespace ShiftOS.Engine } } + /// + /// Gets the ShiftOS shared folder. + /// public static string SharedFolder { get { return Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\ShiftOS_Shared"; } } + + /// + /// Gets the location of the ShiftOS.mfs file. + /// public static string SaveFile { get { return Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\ShiftOS.mfs"; } } + + /// + /// Gets the path of the inner save file. + /// + [Obsolete("Not used.")] public static string SaveFileInner { get { return Locations["save.json"]; } } + /// + /// Add a path to the system. + /// + /// The path's parent directory. + /// The filename for the path. public static void AddPath(string parent, string path) { Locations.Add(path, Locations[parent] + "/" + path);