コード例 #1
0
ファイル: BstLogger.cs プロジェクト: wind1up/BladeSoulTool
        private BstLogger()
        {
            var logPath = BstManager.PathVsRoot + BstManager.PathVsLog + DateTime.Now.ToString("yyyy-MM-dd_HH-mm-ss-ffff") + ".log";

            BstManager.CreateFile(logPath);
            var timer = new Timer(5000);

            this._buff      = new StringBuilder();
            timer.Elapsed  += (sender, args) => File.AppendAllText(logPath, _buff.ToString());
            timer.AutoReset = true;
            timer.Enabled   = true;
        }
コード例 #2
0
 public static void WriteJsonFile(string path, JObject json)
 {
     if (!File.Exists(path))
     {
         BstManager.CreateFile(path);
     }
     try
     {
         File.WriteAllText(path, json.ToString(Formatting.Indented));
     }
     catch (IOException ex)
     {
         BstLogger.Instance.Log(ex.ToString());
     }
 }