private void ParsePerfCounterDefinitionFiles(string definitionFilePath) { LoadUnloadPerfCounterLocalizedText loadUnloadText = new LoadUnloadPerfCounterLocalizedText(); foreach (string path in Directory.GetFiles(definitionFilePath, "*.ini")) { try { string text = Path.Combine(definitionFilePath, path); string driverName = this.GetDriverName(text); this.InstallCounterStrings(loadUnloadText, driverName, text); } catch (TaskException exception) { base.WriteError(exception, ErrorCategory.InvalidData, null); } } }
private void InstallCounterStrings(LoadUnloadPerfCounterLocalizedText loadUnloadText, string categoryName, string iniFilePath) { string name = string.Format("SYSTEM\\CurrentControlSet\\Services\\{0}\\Performance", categoryName); using (RegistryKey registryKey = Registry.LocalMachine.OpenSubKey(name)) { if (registryKey != null) { try { loadUnloadText.UnloadLocalizedText(iniFilePath, categoryName); loadUnloadText.LoadLocalizedText(iniFilePath, categoryName); } catch (FileNotFoundException exception) { base.WriteError(exception, ErrorCategory.InvalidData, null); } catch (TaskException exception2) { base.WriteError(exception2, ErrorCategory.InvalidData, null); } } } }