private static bool MCEAvailable() { if (_MCE != null) { return(true); } if (MCERun) { return(false); } MCERun = true; try { Type MCEType = AssemblyLoader.loadedAssemblies.SelectMany(a => a.assembly.GetExportedTypes()) .SingleOrDefault(t => t.FullName == MCETypeName); if (MCEType == null) { DMC_MBE.LogFormatted_DebugOnly("Mision Controller Type Not Found"); return(false); } _MCEType = MCEType; MethodInfo MCEMethod = MCEType.GetMethod("iPartName", new Type[] { typeof(ContractParameter) }); if (MCEMethod == null) { DMC_MBE.LogFormatted_DebugOnly("Mission Controller String Method Not Found"); return(false); } _MCE = (MCESci)Delegate.CreateDelegate(typeof(MCESci), MCEMethod); DMC_MBE.LogFormatted("Mission Control Reflection Method Assigned"); return(_MCE != null); } catch (Exception e) { DMC_MBE.LogFormatted("Exception While Loading Mission Controller Accessor: {0}", e); } return(false); }
private static bool MCEAvailable() { if (_MCE != null) return true; if (MCERun) return false; MCERun = true; try { Type MCEType = AssemblyLoader.loadedAssemblies.SelectMany(a => a.assembly.GetExportedTypes()) .SingleOrDefault(t => t.FullName == MCETypeName); if (MCEType == null) { DMC_MBE.LogFormatted_DebugOnly("Mision Controller Type Not Found"); return false; } _MCEType = MCEType; MethodInfo MCEMethod = MCEType.GetMethod("iPartName", new Type[] { typeof(ContractParameter) }); if (MCEMethod == null) { DMC_MBE.LogFormatted_DebugOnly("Mission Controller String Method Not Found"); return false; } _MCE = (MCESci)Delegate.CreateDelegate(typeof(MCESci), MCEMethod); DMC_MBE.LogFormatted("Mission Control Reflection Method Assigned"); return _MCE != null; } catch (Exception e) { DMC_MBE.LogFormatted("Exception While Loading Mission Controller Accessor: {0}", e); } return false; }