public static int Run(TlbExpOptions options) { s_Options = options; int RetCode = SuccessReturnCode; try { // Load the assembly. Assembly asm = Assembly.LoadFrom(s_Options.m_strAssemblyName); // If the typelib name is null then create it from the assembly name. if (s_Options.m_strTypeLibName == null) { s_Options.m_strTypeLibName = Path.Combine(s_Options.m_strOutputDir, asm.GetName().Name) + ".tlb"; } // If the input assembly has an embedded type library, give a warning unless we are in silent mode. if (!s_Options.m_bSilentMode && (LoadEmbeddedTlb(s_Options.m_strAssemblyName) != null)) { WriteWarningMsg(Resource.FormatString("Wrn_AssemblyHasEmbeddedTlb", s_Options.m_strAssemblyName)); } // Import the typelib to an assembly. UCOMITypeLib Tlb = DoExport(asm, s_Options.m_strTypeLibName); // Display the success message unless silent mode is enabled. if (!s_Options.m_bSilentMode) { Console.WriteLine(Resource.FormatString("Msg_AssemblyExported", s_Options.m_strTypeLibName)); } } catch (ReflectionTypeLoadException e) { int i; Exception[] exceptions; WriteErrorMsg(Resource.FormatString("Err_TypeLoadExceptions")); exceptions = e.LoaderExceptions; for (i = 0; i < exceptions.Length; i++) { try { Console.Error.WriteLine(Resource.FormatString("Msg_DisplayException", i, exceptions[i])); } catch (Exception ex) { Console.Error.WriteLine(Resource.FormatString("Msg_DisplayNestedException", i, ex)); } } RetCode = ErrorReturnCode; } catch (Exception e) { WriteErrorMsg(null, e); RetCode = ErrorReturnCode; } return(RetCode); }
public int Run(TlbExpOptions s_options) { return(TlbExpCode.Run(s_options)); }