Jobini클래스 일부 업데이트
ReadDictionary메서드를 대채할 GetiniData메서드 추가 에러 핸들링을 가진 새로운 메서드임 ReadDictionary는 이제 사용되지 않는 메서드임 ClearLocalDictionaryData라는 새로운 메서드 추가 로컬 스토리지에 저장된 데이터에 들어있는 값을 삭제할 때 사용함 즉 값의 삭제 변경사항에 대하여 메모리에만 반영이 아닌 로컬 데이터에도 영구적인 반영이 필요할때 사용 위의 클래스 변경사항에 맞춰 메인 프로그램 코드도 일부의 수정이 되었음
This commit is contained in:
@@ -148,8 +148,44 @@ public class Jobini
|
||||
iniData.Clear();
|
||||
}
|
||||
|
||||
public Dictionary<string,string> ReadDictionary()
|
||||
[Obsolete("use GetiniData instead.")]
|
||||
public Dictionary<string, string> ReadDictionary()
|
||||
{
|
||||
return this.iniData;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 딕셔너리 데이터가 저장되있는 파일의 내용을 싹 지웁니다. 결과에 따라 bool형 반환이 존재합니다.
|
||||
/// </summary>
|
||||
/// <returns>true = 정상적으로 작업이 수행됨, false = 어떠한 오류로 작업에 실패함</returns>
|
||||
public bool ClearLocalDictionaryData()
|
||||
{
|
||||
try
|
||||
{
|
||||
if(File.Exists(this.filePath))
|
||||
{
|
||||
File.WriteAllText(this.filePath, "");
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine(e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public Dictionary<string, string>? GetiniData()
|
||||
{
|
||||
try
|
||||
{
|
||||
return iniData;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine(e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user