12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- using Microsoft.Win32;
- using System;
- using System.IO;
- using System.Windows.Forms;
- namespace CLIP.eForm.Consent.UI
- {
- public partial class ConfigForm : Form
- {
- public ConfigForm()
- {
- InitializeComponent();
- }
-
- protected override void OnLoad(EventArgs e)
- {
- //현재 프로그램이 실행되고 있는정보 가져오기: 디버깅 모드라면 bin/debug/프로그램명.exe
- FileInfo exefileinfo = new FileInfo(Path.GetDirectoryName(Application.StartupPath));
- // AppDomain.CurrentDomain.DynamicDirectory
- // Server.MapPath("~")
- string path = Path.GetDirectoryName(Application.StartupPath);//@"C:\eForm Server\Consent-Web-Server-CNUH\";// HttpContext.Current.Request.PhysicalApplicationPath;
- string fileName = @"\config.ini"; //파일명
- //만약 현재 실행 되는 경로가 아닌 특정한 위치를 원한다면 위에 과정 상관없이 바로 경로셋팅 해 주면 된다. (예: c:\config.ini)
- string filePath = path + fileName; //ini 파일 경로
- iniUtil ini = new iniUtil(filePath); // 만들어 놓았던 iniUtil 객체 생성(생성자 인자로 파일경로 정보 넘겨줌)
- //이제 ini 객체를 이용해 맘것 사용하면 된다.
- string sMoniterNumber = ini.GetIniValue("DFH", "MONITER_NUMBER");
- decimal iMoniterNumber = 1;
- if (decimal.TryParse(sMoniterNumber, out iMoniterNumber))
- {
- this.numericUpDownMoniterNumberNumber.Value = iMoniterNumber;
- }
-
- base.OnLoad(e);
- }
- private void btnOK_Click(object sender, EventArgs e)
- {
- //현재 프로그램이 실행되고 있는정보 가져오기: 디버깅 모드라면 bin/debug/프로그램명.exe
- FileInfo exefileinfo = new FileInfo(Path.GetDirectoryName(Application.StartupPath));
- // AppDomain.CurrentDomain.DynamicDirectory
- // Server.MapPath("~")
- string path = Path.GetDirectoryName(Application.StartupPath);//@"C:\eForm Server\Consent-Web-Server-CNUH\";// HttpContext.Current.Request.PhysicalApplicationPath;
- string fileName = @"\config.ini"; //파일명
- //만약 현재 실행 되는 경로가 아닌 특정한 위치를 원한다면 위에 과정 상관없이 바로 경로셋팅 해 주면 된다. (예: c:\config.ini)
- string filePath = path + fileName; //ini 파일 경로
- iniUtil ini = new iniUtil(filePath); // 만들어 놓았던 iniUtil 객체 생성(생성자 인자로 파일경로 정보 넘겨줌)
- //이제 ini 객체를 이용해 맘것 사용하면 된다.
- ini.SetIniValue("DFH", "MONITER_NUMBER", this.numericUpDownMoniterNumberNumber.Value.ToString());
- this.Close();
- }
- }
- }
|