private static bool DMScienceAvailable() { if (_DMCollect != null) { return(true); } if (DMCRun) { return(false); } DMCRun = true; try { Type DMType = AssemblyLoader.loadedAssemblies.SelectMany(a => a.assembly.GetExportedTypes()) .SingleOrDefault(t => t.FullName == DMCollectTypeName); if (DMType == null) { DMC_MBE.LogFormatted_DebugOnly("DMagic Type Not Found"); return(false); } _DMCType = DMType; MethodInfo DMcollectMethod = DMType.GetMethod("PartName", new Type[] { typeof(ContractParameter) }); if (DMcollectMethod == null) { DMC_MBE.LogFormatted_DebugOnly("DMagic String Method Not Found"); return(false); } else { _DMCollect = (DMCollectSci)Delegate.CreateDelegate(typeof(DMCollectSci), DMcollectMethod); DMC_MBE.LogFormatted("DMagic Standard Reflection Method Assigned"); } return(_DMCollect != null); } catch (Exception e) { DMC_MBE.LogFormatted("Exception While Loading DMagic Accessor: {0}", e); } return(false); }
private static bool DMScienceAvailable() { if (_DMCollect != null) return true; if (DMCRun) return false; DMCRun = true; try { Type DMType = AssemblyLoader.loadedAssemblies.SelectMany(a => a.assembly.GetExportedTypes()) .SingleOrDefault(t => t.FullName == DMCollectTypeName); if (DMType == null) { DMC_MBE.LogFormatted_DebugOnly("DMagic Type Not Found"); return false; } _DMCType = DMType; MethodInfo DMcollectMethod = DMType.GetMethod("PartName", new Type[] { typeof(ContractParameter) }); if (DMcollectMethod == null) { DMC_MBE.LogFormatted_DebugOnly("DMagic String Method Not Found"); return false; } else { _DMCollect = (DMCollectSci)Delegate.CreateDelegate(typeof(DMCollectSci), DMcollectMethod); DMC_MBE.LogFormatted("DMagic Standard Reflection Method Assigned"); } return _DMCollect != null; } catch (Exception e) { DMC_MBE.LogFormatted("Exception While Loading DMagic Accessor: {0}", e); } return false; }