using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Runtime.InteropServices; using System.Reflection; using System.IO; /*===================================================+ || # Novic Framework/Emulator Plugin. |+===================================================+ || # Copyright © 2010 Vinksoft. All rights reserved. || # http://vinksoft.com |+===================================================+ || # Novic is provided "as is" and comes without || # warrenty of any kind. Novic Framework is free software! |+===================================================*/ namespace NovicPlugin { public static class IO { #region DLL Imports [DllImport("kernel32")] private static extern long WritePrivateProfileString(string section, string key, string val, string filePath); [DllImport("kernel32")] private static extern int GetPrivateProfileString(string section, string key, string def, StringBuilder retVal, int size, string filePath); #endregion public static string workingDirectory { get { return Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetName().CodeBase).Substring(6); } } public static string readINI(string iniSection, string iniKey, string iniLocation) { StringBuilder _TMP = new StringBuilder(255); try { int i = GetPrivateProfileString(iniSection, iniKey, "", _TMP, 255, iniLocation); return _TMP.ToString(); } catch { return ""; } } public static void writeINI(string iniSection, string iniKey, string iniValue, string iniLocation) { WritePrivateProfileString(iniSection, iniKey, iniValue, iniLocation); } public static bool fileExists(string fileLocation) { return File.Exists(fileLocation); } } }