public static string SavePersistenceData(String logFileName, PersistenceData persistenceData, Preferences preferences) { string fileName = BuildPersisterFileName(logFileName, preferences); if (preferences.saveLocation == SessionSaveLocation.SameDir) { // make to log file in .lxp file relative string filePart = Path.GetFileName(persistenceData.fileName); persistenceData.fileName = filePart; } Save(fileName, persistenceData); return fileName; }
public static PersistenceData LoadPersistenceDataOptionsOnly(string logFileName, Preferences preferences) { string fileName = BuildPersisterFileName(logFileName, preferences); return LoadOptionsOnly(fileName); }
void ApplyDataGridViewPrefs(DataGridView dataGridView, Preferences prefs) { if (dataGridView.Columns.Count > 1) { if (prefs.setLastColumnWidth) { dataGridView.Columns[dataGridView.Columns.Count - 1].MinimumWidth = prefs.lastColumnWidth; } else { // Workaround for a .NET bug which brings the DataGridView into an unstable state (causing lots of NullReferenceExceptions). dataGridView.FirstDisplayedScrollingColumnIndex = 0; dataGridView.Columns[dataGridView.Columns.Count - 1].MinimumWidth = 5; // default } } if (dataGridView.RowCount > 0) { dataGridView.UpdateRowHeightInfo(0, true); } dataGridView.Invalidate(); dataGridView.Refresh(); AutoResizeColumns(dataGridView); }
private static string BuildPersisterFileName(string logFileName, Preferences preferences) { string dir = null; string file = null; switch (preferences.saveLocation) { case SessionSaveLocation.SameDir: default: FileInfo fileInfo = new FileInfo(logFileName); dir = fileInfo.DirectoryName; file = fileInfo.DirectoryName + Path.DirectorySeparatorChar + fileInfo.Name + PERSISTENCE_EXTENSION; break; case SessionSaveLocation.DocumentsDir: dir = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + Path.DirectorySeparatorChar + "LogExpert"; file = dir + Path.DirectorySeparatorChar + BuildSessionFileNameFromPath(logFileName); break; case SessionSaveLocation.OwnDir: dir = preferences.saveDirectory; file = dir + Path.DirectorySeparatorChar + BuildSessionFileNameFromPath(logFileName); break; } if (!Directory.Exists(dir)) { try { Directory.CreateDirectory(dir); } catch (Exception e) { MessageBox.Show(e.Message, "LogExpert"); } } return file; }
public void PreferencesChanged(Preferences newPreferences, bool isLoadTime, SettingsFlags flags) { if ((flags & SettingsFlags.GuiOrColors) == SettingsFlags.GuiOrColors) { _normalFont = new Font(new FontFamily(newPreferences.fontName), newPreferences.fontSize); _fontBold = new Font(NormalFont, FontStyle.Bold); _fontMonospaced = new Font("Courier New", Preferences.fontSize, FontStyle.Bold); dataGridView.DefaultCellStyle.Font = NormalFont; filterGridView.DefaultCellStyle.Font = NormalFont; _lineHeight = NormalFont.Height + 4; dataGridView.RowTemplate.Height = NormalFont.Height + 4; ShowBookmarkBubbles = Preferences.showBubbles; ApplyDataGridViewPrefs(dataGridView, newPreferences); ApplyDataGridViewPrefs(filterGridView, newPreferences); if (Preferences.timestampControl) { SetTimestampLimits(); SyncTimestampDisplay(); } if (isLoadTime) { filterTailCheckBox.Checked = Preferences.filterTail; syncFilterCheckBox.Checked = Preferences.filterSync; } _timeSpreadCalc.TimeMode = Preferences.timeSpreadTimeMode; timeSpreadingControl1.ForeColor = Preferences.timeSpreadColor; timeSpreadingControl1.ReverseAlpha = Preferences.reverseAlpha; if (CurrentColumnizer.IsTimeshiftImplemented()) { timeSpreadingControl1.Invoke(new MethodInvoker(timeSpreadingControl1.Refresh)); ShowTimeSpread(Preferences.showTimeSpread); } ToggleColumnFinder(Preferences.showColumnFinder, false); } if ((flags & SettingsFlags.FilterList) == SettingsFlags.FilterList) { HandleChangedFilterList(); } if ((flags & SettingsFlags.FilterHistory) == SettingsFlags.FilterHistory) { UpdateFilterHistoryFromSettings(); } }