diff --git a/SlotClass.cs b/SlotClass.cs new file mode 100644 index 0000000..e69de29 diff --git a/TXTFileIO.cs b/TXTFileIO.cs new file mode 100644 index 0000000..f438fe7 --- /dev/null +++ b/TXTFileIO.cs @@ -0,0 +1,70 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.IO; + +namespace _23012021Rewrite.Modules +{ + public static class TXTFileIO + { + public static void Save(string Path, string Data) + { + File.Delete(Path); + StreamWriter SR = new StreamWriter(Path); + SR.Write(Data); + SR.Close(); + } + public static void Save(string Path, List Data) + { + File.Delete(Path); + StreamWriter SR = new StreamWriter(Path); + foreach (string item in Data) + { + SR.WriteLine(item); + } + SR.Close(); + } + public static void Save(string Path, string[] Data) + { + File.Delete(Path); + StreamWriter SR = new StreamWriter(Path); + foreach (string item in Data) + { + SR.WriteLine(item); + } + SR.Close(); + } + public static string Open(string Path) + { + StreamReader SR = new StreamReader(Path); + string returnstring = ""; + returnstring = SR.ReadToEnd(); + SR.Close(); + return returnstring; + } + public static string[] ArrayOpen(string Path) + { + string[] returnarray; + StreamReader SR = new StreamReader(Path); + string returnstring = ""; + returnstring = SR.ReadToEnd(); + returnarray = returnstring.Split('\n'); + SR.Close(); + return returnarray; + } + public static List ListOpen(string Path) + { + List returnarray; + StreamReader SR = new StreamReader(Path); + string returnstring = ""; + returnstring = SR.ReadToEnd(); + returnarray = new List(); + foreach (string item in returnstring.Split('\n')) + { + returnarray.Add(item); + } + SR.Close(); + return returnarray; + } + } +}