public static void LoadLastSession() { ColumnHelper.ColumnCollectionFileName = RegistryHandler.ReadFromRegistry("ColumnsFileName"); if (ColumnHelper.ColumnCollectionFileName == "") { ColumnHelper.ColumnCollectionFileName = null; string defaultColumnName = RegistryHandler.ReadFromRegistry("DefaultColumnName"); if (defaultColumnName == "TextDataCleaned") { ColumnHelper.ColumnCollection = ColumnHelper.XmlToColumnCollection(SQLEventAnalyzer.Properties.Resources.TextDataCleaned); } } else { ColumnCollection temporaryColumns = ColumnHelper.XmlToColumnCollection(XmlHelper.ReadXmlFromFile(ColumnHelper.ColumnCollectionFileName)); if (ColumnHelper.ColumnCollection == null) { ColumnHelper.ColumnCollectionFileName = null; } else { ColumnHelper.ColumnCollection = temporaryColumns; } } }
public static void SetTraceFileDirectory() { TraceFileDirectory = RegistryHandler.ReadFromRegistry("TraceFileDirectory"); if (TraceFileDirectory == "") { if (!Convert.ToBoolean(OfflineMode)) { DatabaseOperation databaseOperation = new DatabaseOperation(); databaseOperation.InitializeDal(ConnectionString); string traceFileDir = databaseOperation.GetSqlServerDataDir(); databaseOperation.Dispose(); if (!Directory.Exists(traceFileDir)) { traceFileDir = GenericHelper.TempPath; } TraceFileDirectory = traceFileDir; } else { TraceFileDirectory = GenericHelper.TempPath; } } }
private void LoadTraceFileDir() { string traceFileDirFromRegistry = RegistryHandler.ReadFromRegistry("ImportTraceFileDir"); if (traceFileDirFromRegistry != "") { traceFileDirComboBox.Text = traceFileDirFromRegistry; } }
public static void LoadColumnWidthAndOrder(DataViewerParameters dataViewerParameters, string registryName) { string xml = RegistryHandler.ReadFromRegistry(registryName); if (xml == "") { return; } XmlDocument xmlDocument = new XmlDocument(); xmlDocument.LoadXml(xml); XmlNodeList xmlNodeList = xmlDocument.SelectNodes("columns/column"); Dictionary <string, string[]> newColumns = new Dictionary <string, string[]>(); if (xmlNodeList != null) { foreach (XmlElement xmlElement in xmlNodeList) { string key = xmlElement.GetAttribute("key"); string type = xmlElement.GetAttribute("type"); string width = xmlElement.GetAttribute("width"); if (dataViewerParameters.Columns.ContainsKey(key)) { string[] values = dataViewerParameters.Columns[key]; values[4] = type; values[3] = width; newColumns.Add(key, values); } } } foreach (KeyValuePair <string, string[]> column in dataViewerParameters.Columns) { bool found = false; foreach (KeyValuePair <string, string[]> newColumn in newColumns) { if (column.Key == newColumn.Key) { found = true; break; } } if (!found) { newColumns.Add(column.Key, column.Value); } } dataViewerParameters.Columns = newColumns; }
public void Initialize(DataSet traceDataInfo, DateTime lastEventStartTime) { InitializeDictionary(); filter1ContentUserControl1.Initialize(traceDataInfo, lastEventStartTime); filter1ContentUserControl1.EnterKeyEvent += Filter1ContentUserControl1_EnterKeyEvent; _defaultSavedSearch = RegistryHandler.ReadFromRegistry(string.Format("DefaultSavedSearch_{0}", _registryName)); InitializeSavedSearch(_defaultSavedSearch); }
public void Initialize(DatabaseOperation databaseOperation) { InitializeDictionary(); _databaseOperation = databaseOperation; Reset(); InitializeComboBoxGroups(); AddComboBoxEventHandlers(); InitializeColumnsComboBox(); InitializeOperatorsComboBox(); _defaultSavedSearch = RegistryHandler.ReadFromRegistry(string.Format("DefaultSavedSearch_{0}", _registryName)); InitializeSavedSearch(_defaultSavedSearch); }
public static void LoadLastSession() { if (EnableLoadLastSessionTaskCollection) { TaskHelper.TaskCollectionFileName = RegistryHandler.ReadFromRegistry("TaskCollectionFileName"); if (TaskHelper.TaskCollectionFileName == "") { TaskHelper.TaskCollectionFileName = null; } else { TaskCollection temporaryTaskCollection = TaskHelper.XmlToTaskCollection(XmlHelper.ReadXmlFromFile(TaskHelper.TaskCollectionFileName)); if (temporaryTaskCollection == null) { TaskHelper.TaskCollectionFileName = null; } else { TaskHelper.TaskCollection = temporaryTaskCollection; } } } if (EnableLoadLastSessionStylesheetCollection) { StylesheetHelper.StylesheetCollectionFileName = RegistryHandler.ReadFromRegistry("StylesheetCollectionFileName"); if (StylesheetHelper.StylesheetCollectionFileName == "") { StylesheetHelper.StylesheetCollectionFileName = null; } else { StylesheetCollection temporaryStylesheetCollection = StylesheetHelper.XmlToStylesheetCollection(XmlHelper.ReadXmlFromFile(StylesheetHelper.StylesheetCollectionFileName)); if (StylesheetHelper.StylesheetCollection == null) { StylesheetHelper.StylesheetCollectionFileName = null; } else { StylesheetHelper.StylesheetCollection = temporaryStylesheetCollection; } } } }
public static void SetRecordTraceFileDirectory(DatabaseOperation databaseOperation) { RecordTraceFileDir = RegistryHandler.ReadFromRegistry("RecordTraceFileDir"); if (RecordTraceFileDir == "") { string traceFileDir = databaseOperation.GetSqlServerDataDir(); if (traceFileDir == null || !Directory.Exists(traceFileDir)) { traceFileDir = GenericHelper.TempPath; } RecordTraceFileDir = traceFileDir; } }
private static void GetSqlEventAnalyzerServerInfoText(string connectionStringFromCmdLine, string sqlEventAnalyzerDatabaseName) { string databaseName = sqlEventAnalyzerDatabaseName; if (sqlEventAnalyzerDatabaseName == null) { databaseName = RegistryHandler.ReadFromRegistry("DatabaseName"); } OutputHandler.WriteToLog(string.Format("SQL Event Analyzer database name: {0}", databaseName)); string connectionString = connectionStringFromCmdLine; if (connectionStringFromCmdLine == null) { connectionString = RegistryHandler.ReadFromRegistry("ConnectionString"); } string sqlEventAnalyzerDatabaseSqlServerName = GenericHelper.GetServerName(new SqlConnectionStringBuilder(connectionString).DataSource); OutputHandler.WriteToLog(string.Format("Server containing the SQL Event Analyzer database: {0}", sqlEventAnalyzerDatabaseSqlServerName)); }
public static void LoadConfig() { ConnectionString = ConnectionStringSecurity.Decode(RegistryHandler.ReadFromRegistry("ConnectionString"), "ConnectionString"); if (ConnectionString == "") { ConnectionString = @"Data Source=SQLServerName\SQLServerInstance;Initial Catalog=master;Integrated Security=True"; } ConnectionStringToSave = ConnectionStringSecurity.Decode(RegistryHandler.ReadFromRegistry("ConnectionString"), "ConnectionString"); if (ConnectionStringToSave == "") { ConnectionStringToSave = @"Data Source=SQLServerName\SQLServerInstance;Initial Catalog=master;Integrated Security=True"; } SaveConnectionString = RegistryHandler.ReadFromRegistry("SaveConnectionString"); if (SaveConnectionString == "") { SaveConnectionString = "True"; } WordWrap = RegistryHandler.ReadFromRegistry("WordWrap"); if (WordWrap == "") { WordWrap = "False"; } if (TraceFileDirectory == null) { TraceFileDirectory = ""; } EditWindowSize = RegistryHandler.ReadFromRegistry("EditWindowSize"); if (EditWindowSize == "") { EditWindowSize = GenericHelper.DefaultWindowSize; } EditorWindowSize = RegistryHandler.ReadFromRegistry("EditorWindowSize"); if (EditorWindowSize == "") { EditorWindowSize = GenericHelper.DefaultWindowSize; } CommandLineParametersWindowSize = RegistryHandler.ReadFromRegistry("CommandLineParametersWindowSize"); if (CommandLineParametersWindowSize == "") { CommandLineParametersWindowSize = GenericHelper.DefaultWindowSize; } MainWindowSize = RegistryHandler.ReadFromRegistry("MainWindowSize"); if (MainWindowSize == "") { MainWindowSize = GenericHelper.DefaultWindowSize; } ResultsWindowSize = RegistryHandler.ReadFromRegistry("ResultsWindowSize"); if (ResultsWindowSize == "") { ResultsWindowSize = GenericHelper.DefaultWindowSize; } ValueSubstitutorWindowSize = RegistryHandler.ReadFromRegistry("ValueSubstitutorWindowSize"); if (ValueSubstitutorWindowSize == "") { ValueSubstitutorWindowSize = GenericHelper.DefaultWindowSize; } EditorFontFamily = RegistryHandler.ReadFromRegistry("EditorFontFamily"); if (EditorFontFamily == "") { EditorFontFamily = "Courier New"; } EditorFontSize = RegistryHandler.ReadFromRegistry("EditorFontSize"); if (EditorFontSize == "") { EditorFontSize = "10"; } DefaultStylesheet = RegistryHandler.ReadFromRegistry("DefaultStylesheet"); if (DefaultStylesheet == "") { DefaultStylesheet = "Graphs"; } UseExtendedEvents = RegistryHandler.ReadFromRegistry("UseExtendedEvents"); if (UseExtendedEvents == "") { UseExtendedEvents = ""; } IgnoreErrors = RegistryHandler.ReadFromRegistry("IgnoreErrors"); OfflineMode = RegistryHandler.ReadFromRegistry("OfflineMode"); if (OfflineMode == "") { OfflineMode = "False"; } OfflineModeToSave = RegistryHandler.ReadFromRegistry("OfflineModeToSave"); if (OfflineModeToSave == "") { OfflineModeToSave = "False"; } CheckForUpdatesOnStart = RegistryHandler.ReadFromRegistry("CheckForUpdatesOnStart"); if (CheckForUpdatesOnStart == "") { CheckForUpdatesOnStart = "True"; } string installed = RegistryHandler.ReadFromRegistry("Installed", Registry.CurrentUser); if (installed == "1") { SaveConfig(); // To set default values in registry if (TaskHelper.TaskCollection.Tasks.Count == 0) { TaskHelper.TaskCollection.Description = "No Task Collection loaded.\r\nTo load or create a Task Collection choose \"Options\", \"Task Collection Editor...\"."; TaskHelper.TaskCollection.Connections = 1; TaskHelper.TaskCollection.PerformanceCountersSamplingInterval = 0; TaskHelper.TaskCollection.TimeBetweenConnections = 0; } if (StylesheetHelper.StylesheetCollection.Stylesheets.Count == 0) { StylesheetHelper.StylesheetCollection = StylesheetHelper.XmlToStylesheetCollection(PerformanceTestTool.Properties.Resources.DefaultStylesheets); } SessionHelper.SaveSession(); RegistryHandler.SaveToRegistry("Installed", "2", Registry.CurrentUser); } UpdateServiceUrl = RegistryHandler.ReadFromRegistry("UpdateServiceUrl"); if (UpdateServiceUrl == "") { UpdateServiceUrl = "http://virtcore.com/VirtcoreService.asmx"; RegistryHandler.SaveToRegistry("UpdateServiceUrl", UpdateServiceUrl); } }
public static void LoadConfig() { ConnectionString = ConnectionStringSecurity.Decode(RegistryHandler.ReadFromRegistry("ConnectionString"), "ConnectionString"); if (ConnectionString == "") { ConnectionString = @"Data Source=SQLServerName\SQLServerInstance;Initial Catalog=master;Integrated Security=True"; } ConnectionStringToSave = ConnectionStringSecurity.Decode(RegistryHandler.ReadFromRegistry("ConnectionString"), "ConnectionString"); if (ConnectionStringToSave == "") { ConnectionStringToSave = @"Data Source=SQLServerName\SQLServerInstance;Initial Catalog=master;Integrated Security=True"; } SaveConnectionString = RegistryHandler.ReadFromRegistry("SaveConnectionString"); if (SaveConnectionString == "") { SaveConnectionString = "True"; } DescriptionFields = XmlToDescriptionFields(RegistryHandler.ReadFromRegistry("DescriptionFields")); DescriptionTemplates = XmlToDescriptionTemplates(RegistryHandler.ReadFromRegistry("DescriptionTemplates")); WindowSize = RegistryHandler.ReadFromRegistry("WindowSize"); if (WindowSize == "") { WindowSize = "822; 555"; } SplitterDistanceVertical = RegistryHandler.ReadFromRegistry("SplitterDistanceVertical"); if (SplitterDistanceVertical == "") { SplitterDistanceVertical = "216"; } SplitterDistanceHorizontal = RegistryHandler.ReadFromRegistry("SplitterDistanceHorizontal"); if (SplitterDistanceHorizontal == "") { SplitterDistanceHorizontal = "200"; } TextDataFontFamily = RegistryHandler.ReadFromRegistry("TextDataFontFamily"); if (TextDataFontFamily == "") { TextDataFontFamily = "Courier New"; } TextDataFontSize = RegistryHandler.ReadFromRegistry("TextDataFontSize"); if (TextDataFontSize == "") { TextDataFontSize = "10"; } DescriptionFontFamily = RegistryHandler.ReadFromRegistry("DescriptionFontFamily"); if (DescriptionFontFamily == "") { DescriptionFontFamily = "Courier New"; } DescriptionFontSize = RegistryHandler.ReadFromRegistry("DescriptionFontSize"); if (DescriptionFontSize == "") { DescriptionFontSize = "10"; } CheckForUpdatesOnStart = RegistryHandler.ReadFromRegistry("CheckForUpdatesOnStart"); if (CheckForUpdatesOnStart == "") { CheckForUpdatesOnStart = "True"; } ShowDdlScript = RegistryHandler.ReadFromRegistry("ShowDdlScript"); if (ShowDdlScript == "") { ShowDdlScript = "True"; } SchemaName = RegistryHandler.ReadFromRegistry("SchemaName"); if (SchemaName == "") { SchemaName = "dbo"; } UpdateServiceUrl = RegistryHandler.ReadFromRegistry("UpdateServiceUrl"); if (UpdateServiceUrl == "") { UpdateServiceUrl = "http://virtcore.com/VirtcoreService.asmx"; RegistryHandler.SaveToRegistry("UpdateServiceUrl", UpdateServiceUrl); } }
private static string[] LoadValuesFromRegistry(string registryKeyName) { string items = RegistryHandler.ReadFromRegistry(registryKeyName); return(items.Split(new[] { '\r' }, System.StringSplitOptions.RemoveEmptyEntries)); }
public static void LoadConfig() { WorkloadManagerTaskCollectionPath = RegistryHandler.ReadFromRegistry("WorkloadManagerTaskCollectionPath"); WorkloadManagerStylesheetCollectionPath = RegistryHandler.ReadFromRegistry("WorkloadManagerStylesheetCollectionPath"); WorkloadManagerHiddenMode = RegistryHandler.ReadFromRegistry("WorkloadManagerHiddenMode"); if (WorkloadManagerHiddenMode == "") { WorkloadManagerHiddenMode = "True"; } WorkloadManagerCustomTaskCollection = RegistryHandler.ReadFromRegistry("WorkloadManagerCustomTaskCollection"); if (WorkloadManagerCustomTaskCollection == "") { WorkloadManagerCustomTaskCollection = "False"; } WorkloadManagerCustomStylesheetCollection = RegistryHandler.ReadFromRegistry("WorkloadManagerCustomStylesheetCollection"); if (WorkloadManagerCustomStylesheetCollection == "") { WorkloadManagerCustomStylesheetCollection = "False"; } WorkloadManagerRuns = RegistryHandler.ReadFromRegistry("WorkloadManagerRuns"); if (WorkloadManagerRuns == "") { WorkloadManagerRuns = "1"; } WorkloadManagerTimeBetweenRuns = RegistryHandler.ReadFromRegistry("WorkloadManagerTimeBetweenRuns"); if (WorkloadManagerTimeBetweenRuns == "") { WorkloadManagerTimeBetweenRuns = "0"; } WorkloadManagerIncludeResultXml = RegistryHandler.ReadFromRegistry("WorkloadManagerIncludeResultXml"); if (WorkloadManagerIncludeResultXml == "") { WorkloadManagerIncludeResultXml = "False"; } WorkloadManagerIncludeTransformedStylesheets = RegistryHandler.ReadFromRegistry("WorkloadManagerIncludeTransformedStylesheets"); if (WorkloadManagerIncludeTransformedStylesheets == "") { WorkloadManagerIncludeTransformedStylesheets = "False"; } WorkloadManagerLogDirectory = RegistryHandler.ReadFromRegistry("WorkloadManagerLogDirectory"); if (WorkloadManagerLogDirectory == "") { WorkloadManagerLogDirectory = @"C:\MyLogDir"; } }
public static void LoadConfig() { ConnectionString = ConnectionStringSecurity.DecodeConnectionString(RegistryHandler.ReadFromRegistry("ConnectionString"), "ConnectionString"); if (ConnectionString == "") { ConnectionString = @"Data Source=SQLServerName\SQLServerInstance;Initial Catalog=master;Integrated Security=True"; } ConnectionStringToSave = ConnectionStringSecurity.DecodeConnectionString(RegistryHandler.ReadFromRegistry("ConnectionString"), "ConnectionString"); if (ConnectionStringToSave == "") { ConnectionStringToSave = @"Data Source=SQLServerName\SQLServerInstance;Initial Catalog=master;Integrated Security=True"; } SaveConnectionString = RegistryHandler.ReadFromRegistry("SaveConnectionString"); if (SaveConnectionString == "") { SaveConnectionString = "True"; } TextDataFontFamily = RegistryHandler.ReadFromRegistry("TextDataFontFamily"); if (TextDataFontFamily == "") { TextDataFontFamily = "Courier New"; } TextDataFontSize = RegistryHandler.ReadFromRegistry("TextDataFontSize"); if (TextDataFontSize == "") { TextDataFontSize = "10"; } EditorFontFamily = RegistryHandler.ReadFromRegistry("EditorFontFamily"); if (EditorFontFamily == "") { EditorFontFamily = "Courier New"; } EditorFontSize = RegistryHandler.ReadFromRegistry("EditorFontSize"); if (EditorFontSize == "") { EditorFontSize = "10"; } WindowSize = RegistryHandler.ReadFromRegistry("WindowSize"); if (WindowSize == "") { WindowSize = "900; 680"; } SplitterDistance = RegistryHandler.ReadFromRegistry("SplitterDistance"); if (SplitterDistance == "") { SplitterDistance = "271"; } ColumnEditorWindowSize = RegistryHandler.ReadFromRegistry("ColumnEditorWindowSize"); if (ColumnEditorWindowSize == "") { ColumnEditorWindowSize = "900; 680"; } ColumnEditorSplitterDistance = RegistryHandler.ReadFromRegistry("ColumnEditorSplitterDistance"); if (ColumnEditorSplitterDistance == "") { ColumnEditorSplitterDistance = "271"; } ColumnsWindowSize = RegistryHandler.ReadFromRegistry("ColumnsWindowSize"); if (ColumnsWindowSize == "") { ColumnsWindowSize = "900; 680"; } ViewStatisticsWindowSize = RegistryHandler.ReadFromRegistry("ViewStatisticsWindowSize"); if (ViewStatisticsWindowSize == "") { ViewStatisticsWindowSize = "900; 680"; } ViewRowWindowSize = RegistryHandler.ReadFromRegistry("ViewRowWindowSize"); if (ViewRowWindowSize == "") { ViewRowWindowSize = "900; 680"; } TimelineWindowSize = RegistryHandler.ReadFromRegistry("TimelineWindowSize"); if (TimelineWindowSize == "") { TimelineWindowSize = "900; 680"; } if (RegistryHandler.ReadFromRegistry("ItemsPerPage") == "") { ItemsPerPage = 50; } else { ItemsPerPage = Convert.ToInt32(RegistryHandler.ReadFromRegistry("ItemsPerPage")); } Language = RegistryHandler.ReadFromRegistry("Language"); if (Language == "") { Language = "english"; } if (RegistryHandler.ReadFromRegistry("ShowHiddenColumns") == "") { ShowHiddenColumns = false; } else { ShowHiddenColumns = Convert.ToBoolean(RegistryHandler.ReadFromRegistry("ShowHiddenColumns")); } if (RecordTraceFileDir == null) { RecordTraceFileDir = ""; } if (RegistryHandler.ReadFromRegistry("KeepSessionOnExit") == "") { KeepSessionOnExit = false; } else { KeepSessionOnExit = Convert.ToBoolean(RegistryHandler.ReadFromRegistry("KeepSessionOnExit")); } if (RegistryHandler.ReadFromRegistry("EnableFileNameAndType") == "") { EnableFileNameAndType = false; } else { EnableFileNameAndType = Convert.ToBoolean(RegistryHandler.ReadFromRegistry("EnableFileNameAndType")); } if (RegistryHandler.ReadFromRegistry("EnableQuickSearch") == "") { EnableQuickSearch = false; } else { EnableQuickSearch = Convert.ToBoolean(RegistryHandler.ReadFromRegistry("EnableQuickSearch")); } if (RegistryHandler.ReadFromRegistry("AutoPopulateFilter2") == "") { AutoPopulateFilter2 = false; } else { AutoPopulateFilter2 = Convert.ToBoolean(RegistryHandler.ReadFromRegistry("AutoPopulateFilter2")); } if (RegistryHandler.ReadFromRegistry("MaxGraphRows") == "") { MaxGraphRows = 1000; } else { MaxGraphRows = Convert.ToInt32(RegistryHandler.ReadFromRegistry("MaxGraphRows")); } UseExtendedEvents = RegistryHandler.ReadFromRegistry("UseExtendedEvents"); if (UseExtendedEvents == "") { UseExtendedEvents = ""; } CheckForUpdatesOnStart = RegistryHandler.ReadFromRegistry("CheckForUpdatesOnStart"); if (CheckForUpdatesOnStart == "") { CheckForUpdatesOnStart = "True"; } DatabaseName = RegistryHandler.ReadFromRegistry("DatabaseName"); if (DatabaseName == "") { DatabaseName = "SQLEventAnalyzer"; } UpdateServiceUrl = RegistryHandler.ReadFromRegistry("UpdateServiceUrl"); if (UpdateServiceUrl == "") { UpdateServiceUrl = "http://virtcore.com/VirtcoreService.asmx"; if (RegistryModifyAccess) { RegistryHandler.SaveToRegistry("UpdateServiceUrl", UpdateServiceUrl); } } }