123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- using System;
- using System.IO;
- using System.Reflection;
- namespace OpenSim.Region.ScriptEngine.Shared
- {
- [Serializable]
- public class AssemblyResolver : MarshalByRefObject
- {
- public static Assembly OnAssemblyResolve(object sender,
- ResolveEventArgs args)
- {
- if (!(sender is System.AppDomain))
- return null;
- AppDomain myDomain = (AppDomain)sender;
- string dirName = myDomain.FriendlyName;
- string ScriptEnginesPath = myDomain.SetupInformation.PrivateBinPath;
- string[] pathList = new string[] {"bin", ScriptEnginesPath,
- Path.Combine(ScriptEnginesPath, dirName)};
- string assemblyName = args.Name;
- if (assemblyName.IndexOf(",") != -1)
- assemblyName = args.Name.Substring(0, args.Name.IndexOf(","));
- foreach (string s in pathList)
- {
- string path = Path.Combine(Directory.GetCurrentDirectory(),
- Path.Combine(s, assemblyName))+".dll";
- if (File.Exists(path))
- return Assembly.LoadFrom(path);
- }
- return null;
- }
- }
- }
|