| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 39fee54 commit da2bb40
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -208,6 +208,19 @@ public static Assembly LoadAssemblyPath(string name) { | |||
| 208 | 208 | return assembly; | |
| 209 | 209 | } | |
| 210 | 210 | ||
| 211 | + //=================================================================== | ||
| 212 | + // Returns an assembly that's already been loaded | ||
| 213 | + //=================================================================== | ||
| 214 | + | ||
| 215 | + public static Assembly FindLoadedAssembly(string name) { | ||
| 216 | + for (int i = 0; i < assemblies.Count; i++) { | ||
| 217 | + Assembly a = (Assembly)assemblies[i]; | ||
| 218 | + if (a.GetName().Name == name) { | ||
| 219 | + return a; | ||
| 220 | + } | ||
| 221 | + } | ||
| 222 | + return null; | ||
| 223 | + } | ||
| 211 | 224 | ||
| 212 | 225 | //=================================================================== | |
| 213 | 226 | // Given a qualified name of the form A.B.C.D, attempt to load | |
@@ -233,7 +246,10 @@ public static bool LoadImplicit(string name, bool warn=true) { | |||
| 233 | 246 | if (assemblies == null) { | |
| 234 | 247 | assemblies = new HashSet<Assembly>(AppDomain.CurrentDomain.GetAssemblies()); | |
| 235 | 248 | } | |
| 236 | - Assembly a = LoadAssemblyPath(s); | ||
| 249 | + Assembly a = FindLoadedAssembly(s); | ||
| 250 | + if (a == null) { | ||
| 251 | + a = LoadAssemblyPath(s); | ||
| 252 | + } | ||
| 237 | 253 | if (a == null) { | |
| 238 | 254 | a = LoadAssembly(s); | |
| 239 | 255 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -385,7 +385,11 @@ public static Assembly AddReference(string name) | |||
| 385 | 385 | { | |
| 386 | 386 | AssemblyManager.UpdatePath(); | |
| 387 | 387 | Assembly assembly = null; | |
| 388 | - assembly = AssemblyManager.LoadAssemblyPath(name); | ||
| 388 | + assembly = AssemblyManager.FindLoadedAssembly(name); | ||
| 389 | + if (assembly == null) | ||
| 390 | + { | ||
| 391 | + assembly = AssemblyManager.LoadAssemblyPath(name); | ||
| 392 | + } | ||
| 389 | 393 | if (assembly == null) | |
| 390 | 394 | { | |
| 391 | 395 | assembly = AssemblyManager.LoadAssembly(name); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments