123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Runtime.InteropServices;
- using System.Text;
- namespace CLIP.eForm.Consent.UI
- {
- class iniUtil
- {
- private string iniPath;
- public iniUtil(string path)
- {
- this.iniPath = path; //INI 파일 위치를 생성할때 인자로 넘겨 받음
- }
- [DllImport("kernel32.dll")]
- private static extern int GetPrivateProfileString( // GetIniValue 를 위해
- String section,
- String key,
- String def,
- StringBuilder retVal,
- int size,
- String filePath);
- [DllImport("kernel32.dll")]
- private static extern long WritePrivateProfileString( // SetIniValue를 위해
- String section,
- String key,
- String val,
- String filePath);
- // INI 값을 읽어 온다.
- public String GetIniValue(String Section, String Key)
- {
- StringBuilder temp = new StringBuilder(255);
- int i = GetPrivateProfileString(Section, Key, "", temp, 255, iniPath);
- return temp.ToString();
- }
- // INI 값을 셋팅
- public void SetIniValue(String Section, String Key, String Value)
- {
- WritePrivateProfileString(Section, Key, Value, iniPath);
- }
- }
- }
|