Beispiel #1
0
        void AddCore(DbgExceptionSettingsInfo[] settings)
        {
            dbgDispatcherProvider.VerifyAccess();
            var added = new List <DbgExceptionSettingsInfo>(settings.Length);

            lock (lockObj) {
                foreach (var s in settings)
                {
                    if (toExceptionInfo.ContainsKey(s.Definition.Id))
                    {
                        continue;
                    }
                    bool b = !(s.Definition.Id.Category is null) && !(s.Settings.Conditions is null);
                    Debug.Assert(b);
                    if (!b)
                    {
                        continue;
                    }
                    var info = new ExceptionInfo(s.Definition, s.Settings);
                    toExceptionInfo.Add(s.Definition.Id, info);
                    added.Add(new DbgExceptionSettingsInfo(info.Definition, info.Settings));
                }
            }
            if (added.Count > 0)
            {
                ExceptionsChanged?.Invoke(this, new DbgCollectionChangedEventArgs <DbgExceptionSettingsInfo>(added.ToArray(), added: true));
            }
        }
Beispiel #2
0
        void RemoveCore(DbgExceptionId[] ids)
        {
            dbgDispatcherProvider.VerifyAccess();
            var removed = new List <DbgExceptionSettingsInfo>(ids.Length);

            lock (lockObj) {
                foreach (var id in ids)
                {
                    if (!toExceptionInfo.TryGetValue(id, out var info))
                    {
                        continue;
                    }
                    toExceptionInfo.Remove(id);
                    removed.Add(new DbgExceptionSettingsInfo(info.Definition, info.Settings));
                }
            }
            if (removed.Count > 0)
            {
                ExceptionsChanged?.Invoke(this, new DbgCollectionChangedEventArgs <DbgExceptionSettingsInfo>(removed.ToArray(), added: false));
            }
        }
Beispiel #3
0
 void ResetCore()
 {
     dbgDispatcherProvider.VerifyAccess();
     DbgExceptionSettingsInfo[] removed;
     DbgExceptionSettingsInfo[] added;
     lock (lockObj) {
         removed = toExceptionInfo.Values.Select(a => new DbgExceptionSettingsInfo(a.Definition, a.Settings)).ToArray();
         toExceptionInfo.Clear();
         foreach (var def in defaultExceptionDefinitionsProvider.Definitions)
         {
             toExceptionInfo[def.Id] = new ExceptionInfo(def, new DbgExceptionSettings(def.Flags));
         }
         added = toExceptionInfo.Values.Select(a => new DbgExceptionSettingsInfo(a.Definition, a.Settings)).ToArray();
     }
     if (removed.Length > 0)
     {
         ExceptionsChanged?.Invoke(this, new DbgCollectionChangedEventArgs <DbgExceptionSettingsInfo>(removed, added: false));
     }
     if (added.Length > 0)
     {
         ExceptionsChanged?.Invoke(this, new DbgCollectionChangedEventArgs <DbgExceptionSettingsInfo>(added, added: true));
     }
 }