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 _TMP = new StringBuilder(0xff); try { int i = GetPrivateProfileString(iniSection, iniKey, "", _TMP, 0xff, iniLocation); return _TMP.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); } } } }