diff --git a/rtjiory/Jobini.cs b/rtjiory/Jobini.cs index ded1ece..83e50d3 100644 --- a/rtjiory/Jobini.cs +++ b/rtjiory/Jobini.cs @@ -148,8 +148,44 @@ public class Jobini iniData.Clear(); } - public Dictionary ReadDictionary() + [Obsolete("use GetiniData instead.")] + public Dictionary ReadDictionary() { return this.iniData; } + + /// + /// 딕셔너리 데이터가 저장되있는 파일의 내용을 싹 지웁니다. 결과에 따라 bool형 반환이 존재합니다. + /// + /// true = 정상적으로 작업이 수행됨, false = 어떠한 오류로 작업에 실패함 + 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? GetiniData() + { + try + { + return iniData; + } + catch (Exception e) + { + Console.WriteLine(e); + return null; + } + } } \ No newline at end of file diff --git a/rtjiory/Program.cs b/rtjiory/Program.cs index 21673c0..a5049c1 100644 --- a/rtjiory/Program.cs +++ b/rtjiory/Program.cs @@ -22,7 +22,7 @@ Jobini settingini = new(filePath); Jobini scoreDBini = new(scoreDbPath); //Dictionary settingValues = []; -Dictionary scoreDB = []; +//Dictionary scoreDB = []; // Configure the HTTP request pipeline. if (!app.Environment.IsDevelopment()) @@ -85,6 +85,7 @@ resetTimer.Elapsed += (sender, e) => // Clear the scoreDB scoreDBini.Clear(); + //scoreDBini.ClearLocalDictionaryData(); weekArrow.Clear(); Random random = new(); for (int i = 0; i < random.NextInt64(int.Parse(settingini.NotNullableiniRead("minArrowNum","10")), int.Parse(settingini.NotNullableiniRead("maxArrowNum","30"))/*10,30*/); i++) @@ -104,9 +105,11 @@ resetTimer.Elapsed += (sender, e) => //}//ڱ ڽ аִٰ  ޾Ƶ鿩? => resetTimer 尡 ƴ ٸ 忡 Ѵٴ ī => jobiniŬ ޼ ϳ Ծٰ ε? Ƹ ذ resetTimer.Start(); //ϵ -app.MapGet("/", () => /*scoreDB);*/scoreDB = scoreDBini.ReadDictionary());//scoreDBini.ReadDictionary); +app.MapGet("/", () => scoreDBini.GetiniData());//scoreDBini.ReadDictionary); -app.MapGet("WeekArrow", ()=> weekArrow); +app.MapGet("WeekArrow", () => weekArrow); + +//app.MapGet("cleartest", () => scoreDBini.ClearLocalDictionaryData()); //app.UseHttpsRedirection(); app.UseStaticFiles();