files für klassen hinzugefügt

main
The_miro 2024-10-03 09:22:26 +02:00
parent 463a0c25fc
commit e3d881b9df
2 changed files with 70 additions and 0 deletions

0
SlotClass.cs Normal file
View File

70
TXTFileIO.cs Normal file
View File

@ -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<string> 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<string> ListOpen(string Path)
{
List<string> returnarray;
StreamReader SR = new StreamReader(Path);
string returnstring = "";
returnstring = SR.ReadToEnd();
returnarray = new List<string>();
foreach (string item in returnstring.Split('\n'))
{
returnarray.Add(item);
}
SR.Close();
return returnarray;
}
}
}