Ejemplo n.º 1
0
        private static void WriteDefaultSettingFile(LogAnalyzer analyzer)
        {
            if (!Directory.Exists(DIR))
            {
                Directory.CreateDirectory(DIR);
            }
            var defaultSettingFilePath = Path.Combine(DIR, DEFAULT_SETTING_FILE_NAME);

            File.WriteAllText(defaultSettingFilePath, JsonConvert.SerializeObject(analyzer));
        }
Ejemplo n.º 2
0
        private void loadDefaultSettingButton_Click(object sender, EventArgs e)
        {
            var r = MessageBox.Show("標準設定を読み込みます\ndefault.jsonとは異なります", "", MessageBoxButtons.OKCancel, MessageBoxIcon.Asterisk);

            if (r == DialogResult.Cancel)
            {
                return;
            }
            Analyzer = new LogAnalyzer();
            CreateScreen();
            ApplySetting();
        }
Ejemplo n.º 3
0
        internal TitleForm(LogAnalyzer analyzer)
        {
            InitializeComponent();
            Analyzer = analyzer;
            #region titleMessageDisappear

            /*
             * label1.Visible = false;
             * label2.Visible = false;
             * label3.Visible = false;
             */
            #endregion
        }
Ejemplo n.º 4
0
        private static LogAnalyzer FetchDefaultSetting()
        {
            var         defaultSettingFilePath = Path.Combine(DIR, DEFAULT_SETTING_FILE_NAME);
            LogAnalyzer analyzer = null;

            if (Directory.Exists(DIR) && File.Exists(defaultSettingFilePath))
            {
                analyzer = JsonConvert.DeserializeObject <LogAnalyzer>(File.ReadAllText(defaultSettingFilePath));
            }
            if (analyzer == null)
            {
                analyzer = new LogAnalyzer();
                WriteDefaultSettingFile(analyzer);
            }
            return(analyzer);
        }
Ejemplo n.º 5
0
 public LogData(double unixTime, Dictionary <string, string> data, LogAnalyzer analyzer)
 {
     if (data.Count < analyzer.Keys.Count)
     {
         var s = new List <string>(analyzer.Keys);
         foreach (var d in data)
         {
             s.Remove(d.Key);
         }
         throw new LogDataException(s.ToArray(), true);
     }
     else if (data.Count < analyzer.Keys.Count)
     {
         var dataKeys = new List <string>(data.Keys);
         foreach (var k in analyzer.Keys)
         {
             dataKeys.Remove(k);
         }
         throw new LogDataException(dataKeys.ToArray(), false);
     }
     DateTimeOffset = DateTimeOffset.FromUnixTimeSeconds((long)unixTime).ToLocalTime();
     UnixTime       = unixTime;
     _Data          = data;
 }
Ejemplo n.º 6
0
 private void loadButton_Click(object sender, EventArgs e)
 {
     openFileDialog1.Filter           = "Jsonファイル(*.json)|*.json";
     openFileDialog1.FileName         = "";
     openFileDialog1.InitialDirectory = Path.Combine(Environment.CurrentDirectory + "setting");
     openFileDialog1.FileOk          += (s, oe) =>
     {
         var json = JsonConvert.DeserializeObject <LogAnalyzer>(File.ReadAllText(openFileDialog1.FileName));
         if (json != null)
         {
             if (Modified)
             {
                 var r = MessageBox.Show("変更を破棄します", "", MessageBoxButtons.OKCancel, MessageBoxIcon.Asterisk);
                 if (r == DialogResult.Cancel)
                 {
                     return;
                 }
             }
             Analyzer = json;
             CreateScreen();
         }
     };
     openFileDialog1.ShowDialog();
 }