示例#1
0
            // VS CODE TODO: RegistryKey should be replaced with some sort of generic configuration store, and it should NOT be
            // optional.
            public ExceptionCategorySettings(ExceptionManager parent, /*OPTIONAL*/ RegistryKey categoryKey)
            {
                _parent = parent;
                if (categoryKey != null)
                {
                    this.CategoryName         = categoryKey.GetSubKeyNames().Single();
                    this.DefaultCategoryState = RegistryToExceptionBreakpointState(categoryKey.GetValue("*"));
                    Dictionary <string, ExceptionBreakpointState> exceptionSettings = new Dictionary <string, ExceptionBreakpointState>();
                    foreach (string valueName in categoryKey.GetValueNames())
                    {
                        if (string.IsNullOrEmpty(valueName) || valueName == "*" || !ExceptionManager.IsSupportedException(valueName))
                        {
                            continue;
                        }

                        ExceptionBreakpointState value = RegistryToExceptionBreakpointState(categoryKey.GetValue(valueName));
                        if (value == this.DefaultCategoryState)
                        {
                            Debug.Fail("Redundant exception trigger found in the registry.");
                            continue;
                        }

                        exceptionSettings.Add(valueName, value);
                    }
                    this.DefaultRules = new ReadOnlyDictionary <string, ExceptionBreakpointState>(exceptionSettings);
                }
                else
                {
                    this.CategoryName         = string.Empty;
                    this.DefaultCategoryState = ExceptionBreakpointState.None;
                    this.DefaultRules         = new ReadOnlyDictionary <string, ExceptionBreakpointState>(new Dictionary <string, ExceptionBreakpointState>(0));
                }

                this._settingsUpdate = new SettingsUpdates(this.DefaultCategoryState, this.DefaultRules);
            }
示例#2
0
            public ExceptionCategorySettings(ExceptionManager parent, HostConfigurationSection categoryKey, string categoryName)
            {
                _parent                   = parent;
                this.CategoryName         = categoryName;
                this.DefaultCategoryState = RegistryToExceptionBreakpointState(categoryKey.GetValue("*"));
                Dictionary <string, ExceptionBreakpointState> exceptionSettings = new Dictionary <string, ExceptionBreakpointState>();

                foreach (string valueName in categoryKey.GetValueNames())
                {
                    if (string.IsNullOrEmpty(valueName) || valueName == "*" || !ExceptionManager.IsSupportedException(valueName))
                    {
                        continue;
                    }

                    ExceptionBreakpointState value = RegistryToExceptionBreakpointState(categoryKey.GetValue(valueName));
                    if (value == this.DefaultCategoryState)
                    {
                        Debug.Fail("Redundant exception trigger found in the registry.");
                        continue;
                    }

                    exceptionSettings.Add(valueName, value);
                }
                this.DefaultRules = new ReadOnlyDictionary <string, ExceptionBreakpointState>(exceptionSettings);
                _settingsUpdate   = new SettingsUpdates(this.DefaultCategoryState, this.DefaultRules);
            }