internal string GetTypeName(string assemblyPath, string progId, string classId) { string typeNameFromProgId = ""; AssemblyManager manager = null; AppDomain domain = AppDomain.CreateDomain("SoapDomain"); if (domain != null) { try { AssemblyName name = typeof(AssemblyManager).Assembly.GetName(); ObjectHandle handle = domain.CreateInstance(name.FullName, typeof(AssemblyManager).FullName, false, BindingFlags.Default, null, null, null, null); if (handle == null) { return(typeNameFromProgId); } manager = (AssemblyManager)handle.Unwrap(); if (classId.Length > 0) { return(manager.InternalGetTypeNameFromClassId(assemblyPath, classId)); } typeNameFromProgId = manager.InternalGetTypeNameFromProgId(assemblyPath, progId); } finally { AppDomain.Unload(domain); } } return(typeNameFromProgId); }
internal string GetTypeName(string assemblyPath, string progId, string classId) { string retVal = ""; AssemblyManager manager = null; AppDomain domain = AppDomain.CreateDomain("SoapDomain"); if (null != domain) { AssemblyName n = typeof(AssemblyManager).Assembly.GetName(); Evidence baseEvidence = AppDomain.CurrentDomain.Evidence; Evidence evidence = new Evidence(baseEvidence); evidence.AddAssembly(n); ObjectHandle h = domain.CreateInstance(n.FullName, typeof(AssemblyManager).FullName, false, 0, null, null, null, null, evidence); if (null != h) { manager = (AssemblyManager)h.Unwrap(); if (classId.Length > 0) { retVal = manager.InternalGetTypeNameFromClassId(assemblyPath, classId); } else { retVal = manager.InternalGetTypeNameFromProgId(assemblyPath, progId); } } AppDomain.Unload(domain); } return(retVal); }