Example #1
0
 private void LoadSettings(SerilogSettings logSettings)
 {
     txtbDirectory.Text       = logSettings.Directory;
     txtbOpenFileFilters.Text = logSettings.FileOpenDialogFilters;
     txtbSupportedFiles.Text  = string.Join(";", logSettings.SupportFormats.ToList());
     lstbRegularExpressions.Items.Clear();
     lstbRegularExpressions.Items.AddRange(logSettings.RegexPatterns.ToArray());
     lstbIgnoreColumn.Items.Clear();
     lstbIgnoreColumn.Items.AddRange(logSettings.IgnoredAttributes.ToArray());
     rbtnCLEF.Checked    = logSettings.Format == SerilogFileFormat.CLEF;
     rbRegexFile.Checked = logSettings.Format == SerilogFileFormat.REGEX;
     rbJson.Checked      = logSettings.Format == SerilogFileFormat.JSON;
 }
Example #2
0
 private void LoadSettings(SerilogSettings logSettings)
 {
     txtbDirectory.Text       = logSettings.Directory;
     txtbOpenFileFilters.Text = logSettings.FileOpenDialogFilters;
     txtbSupportedFiles.Text  = string.Join(";", logSettings.SupportFormats.ToList());
     lstbIgnoreColumn.Items.Clear();
     lstbIgnoreColumn.Items.AddRange(logSettings.IgnoredAttributes.ToArray());
     rbtnCLEF.Checked                 = Settings.Format == FileFormat.CompactJsonFormatPerLine;
     rbtnJsonPerLine.Checked          = Settings.Format == FileFormat.JsonFormatPerLine;
     rbtnCompactJsonFile.Checked      = Settings.Format == FileFormat.CompactJsonFormatPerFile;
     rbtnJsonFile.Checked             = Settings.Format == FileFormat.JsonFormatFile;
     rbtnReset.Checked                = Settings.Format == FileFormat.Unknown;
     rbDetectionModeAutomatic.Checked = Settings.FileFormatDetection == FileFormatDetection.Automatic;
     rbDetectionModeManual.Checked    = Settings.FileFormatDetection == FileFormatDetection.Manual;
 }
Example #3
0
        private void LoadSettings(SerilogSettings logSettings)
        {
            txtbDirectory.Text = logSettings.Directory;
            txtbOpenFileFilters.Text = logSettings.FileOpenDialogFilters;
            txtbSupportedFiles.Text = string.Join(";", logSettings.SupportFormats.ToList());
            lstbRegularExpressions.Items.Clear();
            lstbRegularExpressions.Items.AddRange(logSettings.RegexPatterns.ToArray());
            rbtnCLEF.Checked = logSettings.Format == SerilogFileFormat.CLEF;
            rbRegexFile.Checked = logSettings.Format == SerilogFileFormat.REGEX;
            rbJson.Checked = logSettings.Format == SerilogFileFormat.JSON;
            if (logSettings.PropertyColumnMappings != null)
            {
                propertyColumnMappingTable.Rows.Clear();
                // get mappings for each well-known column, ignore any other
                foreach (var x in Constants.DefaultMappings)
                {
                    var col = x.Key;
                    var propDefault = x.Value;
                    if (logSettings.PropertyColumnMappings.TryGetValue(col, out var prop))
                    {

                        var addedRow = propertyColumnMappingTable.Rows.Add(col, prop);
                        if (prop != propDefault)
                        {
                            propertyColumnMappingTable.Rows[addedRow].Cells[1].Style.ForeColor = Color.Blue;
                        }
                    }
                    else
                    {
                        propertyColumnMappingTable.Rows.Add(col, propDefault);
                    }
                }
            try
            {
                timeZoneComboBox.SelectedItem = TimeZoneInfo.FindSystemTimeZoneById(logSettings.UserTimeZone);
            }
            catch(Exception ex)
            {
                timeZoneComboBox.SelectedItem = null;
            }
        }
Example #4
0
        private void btnImport_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog1 = new OpenFileDialog();

            openFileDialog1.Filter      = "Analogy Serilog Settings (*.Json)|*.json";
            openFileDialog1.Title       = @"Import Serilog settings";
            openFileDialog1.Multiselect = true;
            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    var             json     = File.ReadAllText(openFileDialog1.FileName);
                    SerilogSettings settings = JsonConvert.DeserializeObject <SerilogSettings>(json);
                    LoadSettings(settings);
                    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);
                }
            }
        }