using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.IO; using System.Diagnostics; namespace Item_Creator { class Files { public static string LocalPath = System.IO.Path.GetDirectoryName(Process.GetCurrentProcess().MainModule.FileName) + @"\"; public static void Exist() { if (!File.Exists(LocalPath + "Log.txt")) { File.Create(LocalPath + "Log.txt"); } if (!File.Exists(LocalPath + "Config.txt")) { using (FileStream ConfigStream = new FileStream(LocalPath + "Config.txt", FileMode.Append, FileAccess.Write)) { using (StreamWriter Writer = new StreamWriter(ConfigStream)) { Writer.WriteLine(@"Login: .\SQLEXPRESS"); Writer.WriteLine("Teva: w00_Character"); Writer.WriteLine("Apoline: w1_Character"); } } } } public static void Log(string Information) { using (FileStream LogStream = new FileStream(LocalPath + "Log.txt", FileMode.Append, FileAccess.Write)) { using (StreamWriter Writer = new StreamWriter(LogStream)) { Writer.WriteLine("[" + DateTime.Now.ToString("HH:mm:ss") + "] " + Information); } } } public static void SetupConfig() { } public static string GetValue(string Value) { using (StreamReader Reader = new StreamReader(LocalPath + "Config.txt")) { string Line; while ((Line = Reader.ReadLine()) != null) { if (Line.Contains(Value)) { Line = Line.Replace(Value, ""); return Line; } } } return Value; } } }