Exemplo n.º 1
0
        void Load()
        {
            exceptionManager.RestoreDefaults();
            var section = settingsManager.GetOrCreateSection(SETTINGS_GUID);

            foreach (var exx in section.SectionsWithName("Exception"))
            {
                var  exceptionType      = exx.Attribute <ExceptionType?>("ExceptionType");
                var  fullName           = exx.Attribute <string>("FullName");
                bool?breakOnFirstChance = exx.Attribute <bool?>("BreakOnFirstChance");
                bool isOtherExceptions  = exx.Attribute <bool?>("IsOtherExceptions") ?? false;
                var  diffType           = exx.Attribute <ExceptionDiffType?>("DiffType");

                if (diffType == null)
                {
                    continue;
                }
                if (exceptionType == null || exceptionType.Value < 0 || exceptionType.Value >= ExceptionType.Last)
                {
                    continue;
                }
                if (fullName == null)
                {
                    continue;
                }

                var key = new ExceptionInfoKey(exceptionType.Value, fullName);
                switch (diffType.Value)
                {
                case ExceptionDiffType.Remove:
                    exceptionManager.Remove(key);
                    break;

                case ExceptionDiffType.AddOrUpdate:
                    if (breakOnFirstChance == null)
                    {
                        continue;
                    }
                    exceptionManager.AddOrUpdate(key, breakOnFirstChance.Value, isOtherExceptions);
                    break;

                default:
                    Debug.Fail("Unknown ExceptionDiffType");
                    break;
                }
            }
        }