From e3d881b9df5e4fa1bc2c58b4f657dde893814bd2 Mon Sep 17 00:00:00 2001 From: The_miro Date: Thu, 3 Oct 2024 09:22:26 +0200 Subject: [PATCH] =?UTF-8?q?files=20f=C3=BCr=20klassen=20hinzugef=C3=BCgt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SlotClass.cs | 0 TXTFileIO.cs | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 70 insertions(+) create mode 100644 SlotClass.cs create mode 100644 TXTFileIO.cs 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; + } + } +}