using System; using System.IO; namespace Launcher_Client.Utilitys { class FileSystem { public FileSystem() { if (!Directory.Exists(String.Format("{0}{1}", Utility.LocalPath, Properties.Settings.Default.LauncherFolder))) { Directory.CreateDirectory(String.Format("{0}{1}", Utility.LocalPath, Properties.Settings.Default.LauncherFolder)); } if (!File.Exists(String.Format("{0}{1}{2}", Utility.LocalPath, Properties.Settings.Default.LauncherFolder, Properties.Settings.Default.ClientVersion))) { using (StreamWriter Writer = new StreamWriter(String.Format("{0}{1}{2}", Utility.LocalPath, Properties.Settings.Default.LauncherFolder, Properties.Settings.Default.ClientVersion))) { Writer.WriteLine(0); } } } public void WriteVersion(Int32 Version) { using (StreamWriter Writer = new StreamWriter(String.Format("{0}{1}{2}", Utility.LocalPath, Properties.Settings.Default.LauncherFolder, Properties.Settings.Default.ClientVersion))) { Writer.WriteLine(Version); } } public Int32 ReadVersion() { using (StreamReader Reader = new StreamReader(String.Format("{0}{1}{2}", Utility.LocalPath, Properties.Settings.Default.LauncherFolder, Properties.Settings.Default.ClientVersion))) { return Convert.ToInt32(Reader.ReadLine()); } } } }