123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132 |
- using System;
- using System.Collections.Generic;
- using System.Text;
- using System.IO;
- using System.Runtime.InteropServices;
- namespace IControls_FireManager
- {
- public static class _Ini
- {
- public static class IniControl
- {
-
- [DllImport("kernel32")]
- public static extern bool WritePrivateProfileString(string lpAppName, string lpKeyName, string lpString, string lpFileName);
-
- [DllImport("kernel32")]
- public static extern uint GetPrivateProfileInt(string lpAppName, string lpKeyName, int nDefault, string lpFileName);
-
- [DllImport("kernel32")]
- public static extern int GetPrivateProfileString(string lpAppName, string lpKeyName, string lpDefault, StringBuilder lpReturnedString, int nSize, string lpFileName);
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- public static string Read_Ini(string Section, string Key, int Size, string Path)
- {
- try
- {
-
- StringBuilder gStringBuilder = new StringBuilder(Size);
- IniControl.GetPrivateProfileString(Section, Key, "", gStringBuilder, Size, Path);
- return gStringBuilder.ToString();
- }
- catch
- {
- return null;
- }
- }
-
-
-
-
-
- public static void Write_Ini(string Section, string Key, string Value, string Path)
- {
- try
- {
- IniControl.WritePrivateProfileString(Section, Key, Value, Path);
- }
- catch
- {
- }
- }
-
-
- public static bool Create_Ini(string txt, string path)
- {
- try
- {
-
- if (File.Exists(path))
- {
- File.Delete(path);
- }
-
- File.WriteAllText(path, txt);
-
- return true;
- }
- catch
- {
-
-
-
- return false;
- }
- }
-
-
- public static void Delete_Ini(string path)
- {
- try
- {
-
- if (File.Exists(path))
- {
- File.Delete(path);
- }
- }
- catch
- {
- }
- }
- }
- }
|