public OfflineDataProvider()
 {
     LogParserSettings = new SplitterLogParserSettings
     {
         Splitter = "|",
         SupportedFilesExtensions = new List <string> {
             "*.txt"
         },
         Maps = new Dictionary <int, AnalogyLogMessagePropertyName>
         {
             { 0, AnalogyLogMessagePropertyName.Date },
             { 1, AnalogyLogMessagePropertyName.Level },
             { 2, AnalogyLogMessagePropertyName.Source },
             { 3, AnalogyLogMessagePropertyName.Text }
         },
         IsConfigured = true
     };
     parser = new PlainTextLogFileLoader(LogParserSettings);
 }
示例#2
0
        private void btnImport_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog1 = new OpenFileDialog();

            openFileDialog1.Filter      = "Analogy plain Text Settings (*.AnalogyPlainTextSettings)|*.AnalogyPlainTextSettings";
            openFileDialog1.Title       = @"Import plain Text settings";
            openFileDialog1.Multiselect = true;
            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    var json = File.ReadAllText(openFileDialog1.FileName);
                    SplitterLogParserSettings nlog = JsonConvert.DeserializeObject <SplitterLogParserSettings>(json);
                    LoadNLogSettings(nlog);
                    MessageBox.Show("File Imported. Save settings if desired", @"Import settings", MessageBoxButtons.OK,
                                    MessageBoxIcon.Information);
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Error Import: " + ex.Message, @"Error Import file", MessageBoxButtons.OK,
                                    MessageBoxIcon.Error);
                }
            }
        }