namespace Holo { using System; using System.IO; using System.Reflection; using System.Runtime.InteropServices; using System.Text; public static class IO { public static bool fileExists(string fileLocation) { return File.Exists(fileLocation); } [DllImport("kernel32")] private static extern int GetPrivateProfileString(string section, string key, string def, StringBuilder retVal, int size, string filePath); public static string readINI(string iniSection, string iniKey, string iniLocation) { StringBuilder retVal = new StringBuilder(0xff); try { GetPrivateProfileString(iniSection, iniKey, "", retVal, 0xff, iniLocation); return retVal.ToString(); } catch { return ""; } } public static void writeINI(string iniSection, string iniKey, string iniValue, string iniLocation) { WritePrivateProfileString(iniSection, iniKey, iniValue, iniLocation); } [DllImport("kernel32")] private static extern long WritePrivateProfileString(string section, string key, string val, string filePath); public static string workingDirectory { get { return Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetName().CodeBase).Substring(6); } } } }