public void tryToFetchAssemblyFromO2GitHub(string assemblyToLoad, bool useCacheInfo) { string localFilePath = ""; if (assemblyToLoad.contains("".tempDir())) // don't try to fetch temp assemblies { return; } var thread = O2Thread.mtaThread(() => downloadThread(assemblyToLoad, ref localFilePath, useCacheInfo)); var maxWait = 60; if (thread.Join(maxWait * 1000) == false) { if (File.Exists(localFilePath)) { "TimeOut (of {1} secs) was reached, but Assembly was sucessfully fetched from O2GitHub: {0}".info(maxWait, localFilePath); } else { "error while tring to fetchAssembly: {0} (max wait of {1} seconds reached)".error(assemblyToLoad, maxWait); } } }
public object instanceInvocation(string assemblyToUse, string typeToLoad, string methodToExecute, object[] methodParams) { try { Assembly assembly = AppDomain.CurrentDomain.Load(assemblyToUse); if (assembly.isNull()) { PublicDI.log.error("in instanceInvocation assembly was null : {0} {1}", assemblyToUse); } else { Type type = PublicDI.reflection.getType(assembly, typeToLoad); if (type == null) { PublicDI.log.error("in instanceInvocation type was null : {0} {1}", assembly, typeToLoad); } else { object typeObject = PublicDI.reflection.createObject(assembly, type, methodParams); if (typeObject == null) { PublicDI.log.error("in dynamicInvocation typeObject was null : {0} {1}", assembly, type); } else { if (methodToExecute == "") { // means we don't want to execute a method (i.e we called the constructore) so just want the current proxy return(typeObject); } MethodInfo method = PublicDI.reflection.getMethod(type, methodToExecute, methodParams); if (method == null) { PublicDI.log.error("in instanceInvocation method was null : {0} {1}", type, methodToExecute); } else { object returnValue = null; if (InvokeInStaThread) { O2Thread.staThread(() => { returnValue = PublicDI.reflection.invoke(typeObject, method, methodParams); }).Join(); return(returnValue); } if (InvokeInMtaThread) { O2Thread.mtaThread(() => { returnValue = PublicDI.reflection.invoke(typeObject, method, methodParams); }).Join(); return(returnValue); } return(PublicDI.reflection.invoke(typeObject, method, methodParams)); } } } } } catch (Exception ex) { PublicDI.log.ex(ex, "in instanceInvocation"); } return(null); }