| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 7d8f754 commit a321daa
5 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -37,6 +37,9 @@ internal class AssemblyManager | |||
| 37 | 37 | // modified from event handlers below, potentially triggered from different .NET threads | |
| 38 | 38 | private static ConcurrentQueue<Assembly> assemblies; | |
| 39 | 39 | internal static List<string> pypath; | |
| 40 | + | ||
| 41 | + // Triggered when a new namespace is added to the namespaces dictionary | ||
| 42 | + public static event Action<string> namespaceAdded; | ||
| 40 | 43 | ||
| 41 | 44 | private AssemblyManager() | |
| 42 | 45 | { | |
@@ -284,6 +287,17 @@ internal static void ScanAssembly(Assembly assembly) | |||
| 284 | 287 | if (ns != null) | |
| 285 | 288 | { | |
| 286 | 289 | namespaces[ns].TryAdd(assembly, string.Empty); | |
| 290 | + try | ||
| 291 | + { | ||
| 292 | + namespaceAdded?.Invoke(ns); | ||
| 293 | + } | ||
| 294 | + catch (Exception e) | ||
| 295 | + { | ||
| 296 | + // For some reason, exceptions happening here does... nothing. | ||
| 297 | + // Even System.AccessViolationExceptions gets ignored. | ||
| 298 | + Console.WriteLine($"Namespace added callback failed with: {e}"); | ||
| 299 | + throw; | ||
| 300 | + } | ||
| 287 | 301 | } | |
| 288 | 302 | ||
| 289 | 303 | if (ns != null && t.IsGenericTypeDefinition) | |
@@ -312,6 +326,15 @@ public static bool IsValidNamespace(string name) | |||
| 312 | 326 | return !string.IsNullOrEmpty(name) && namespaces.ContainsKey(name); | |
| 313 | 327 | } | |
| 314 | 328 | ||
| 329 | + /// <summary> | ||
| 330 | + /// Returns an IEnumerable<string> containing the namepsaces exported | ||
| 331 | + /// by loaded assemblies in the current app domain. | ||
| 332 | + /// </summary> | ||
| 333 | + public static IEnumerable<string> GetNamespaces () | ||
| 334 | + { | ||
| 335 | + return namespaces.Keys; | ||
| 336 | + } | ||
| 337 | + | ||
| 315 | 338 | /// <summary> | |
| 316 | 339 | /// Returns list of assemblies that declare types in a given namespace | |
| 317 | 340 | /// </summary> | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -83,7 +83,7 @@ public static int tp_setattro(IntPtr ob, IntPtr key, IntPtr val) | |||
| 83 | 83 | { | |
| 84 | 84 | message = "readonly attribute"; | |
| 85 | 85 | } | |
| 86 | - Exceptions.SetError(Exceptions.TypeError, message); | ||
| 86 | + Exceptions.SetError(Exceptions.AttributeError, message); | ||
| 87 | 87 | return -1; | |
| 88 | 88 | } | |
| 89 | 89 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments