필자는 읽기/쓰기가 필요한 모든 설정이 포함 된 XML 파일을 작성하려고합니다.
이 파일은 데이터 테이블되는 WriteXml 및되는 ReadXml의 내장 방법을 사용
이 작업을 수행하는 easyest 방법 (Enviroment.SpecialFolder.CommonApplicationData를 사용하는) 경우 ProgramData처럼 잘 알려진 폴더에 저장 될 수있다.
데이터 테이블을 사용하여 설정을 내부적으로로드 및 저장하고 메토를 제공하여 개별 설정 (데이터 테이블의 행)을 검색하고 설정할 수있는 클래스를 구현할 수 있습니다.
public class MyAppSettings
{
// Where to store your settings
private DataTable _storage = null;
public MyAppSettings()
{
string settingFile = Path.Combine(Environment.GetFolderPath
(Environment.SpecialFolder.CommonApplicationData),
"MyAppName", "MyAppSettings.xml");
_storage = new DataTable();
_storage.ReadXml(settingFile);
}
public void Save()
{
string settingFile = Path.Combine(Environment.GetFolderPath
(Environment.SpecialFolder.CommonApplicationData),
"MyAppName", "MyAppSettings.xml");
_storage.WriteXml(settingFile);
}
public string GetValue(string settingName)
{
// Code to search the base table
}
public void SetValue(string settingName, string settingValue)
{
// Code to update/insert the base table
}
}
스크래치 레지스트리 아이디어를 제발. 우리는 거의 레지스트리 nigthmares 무료입니다. 돌아 가지 마라. – Steve
저는 주로 이러한 상황을 처리하기 위해 권장되거나 권장되는 방법을 찾고 있습니다.이 상황에서 다른 사람들은 무엇을하고 있습니까? – crlanglois