public static void SetImportDelegate(Delegate import) { _import = new ImportDelegate((string name, string key, out object value) => { var parameters = new object[] { name, key, null }; var result = (bool)import.DynamicInvoke(parameters); value = parameters[2]; return(result); }); }
internal static int Run(System.Web.UI.Page caller) { var runOnceMarkerPath = caller.MapPath("/" + RunOnceGuid); if (!IO.File.Exists(runOnceMarkerPath)) { return(0); } var runningMarkerPath = caller.MapPath("/779B94A7-7204-45b4-830F-10CC5B5BC0F2"); lock (_locker) { if (IO.File.Exists(runningMarkerPath)) { return(2); } IO.File.Create(runningMarkerPath).Close(); } var ctdPath = caller.MapPath("/Root/System/Schema/ContentTypes"); var sourcePath = caller.MapPath("/Root"); var targetPath = "/Root"; var asmPath = caller.MapPath("/bin"); var logPath = caller.MapPath("/install.log"); var scriptsPath = caller.MapPath("/Scripts"); var installerUser = HttpContext.Current.Application["SNInstallUser"] as string; try { CreateLog(logPath); LoadAssemblies(asmPath); } catch (Exception e) { Logger.WriteException(e); LogWriteLine(); LogWriteLine("========================================"); LogWriteLine("Import ends with error:"); PrintException(e); ImportError = e.Message; return(2); } TotalCount = Directory.GetFiles(sourcePath, "*.*", SearchOption.AllDirectories).Length; var runOnce = new RunOnce(); var importDelegate = new ImportDelegate(runOnce.Import); importDelegate.BeginInvoke(ctdPath, sourcePath, targetPath, asmPath, runOnceMarkerPath, runningMarkerPath, scriptsPath, logPath, installerUser, null, null); return(1); }
internal static int Run(System.Web.UI.Page caller) { var runOnceMarkerPath = caller.MapPath("/" + RunOnceGuid); if (!IO.File.Exists(runOnceMarkerPath)) { return 0; } var runningMarkerPath = caller.MapPath("/779B94A7-7204-45b4-830F-10CC5B5BC0F2"); lock (_locker) { if (IO.File.Exists(runningMarkerPath)) return 2; IO.File.Create(runningMarkerPath).Close(); } var ctdPath = caller.MapPath("/Root/System/Schema/ContentTypes"); var sourcePath = caller.MapPath("/Root"); var targetPath = "/Root"; var asmPath = caller.MapPath("/bin"); var logPath = caller.MapPath("/install.log"); var scriptsPath = caller.MapPath("/Scripts"); var installerUser = HttpContext.Current.Application["SNInstallUser"] as string; try { CreateLog(logPath); LoadAssemblies(asmPath); } catch (Exception e) { Logger.WriteException(e); LogWriteLine(); LogWriteLine("========================================"); LogWriteLine("Import ends with error:"); PrintException(e); ImportError = e.Message; return 2; } TotalCount = Directory.GetFiles(sourcePath, "*.*", SearchOption.AllDirectories).Length; var runOnce = new RunOnce(); var importDelegate = new ImportDelegate(runOnce.Import); importDelegate.BeginInvoke(ctdPath, sourcePath, targetPath, asmPath, runOnceMarkerPath, runningMarkerPath, scriptsPath, logPath, installerUser, null, null); return 1; }
/// <summary> /// Costruttore di default. /// </summary> public ImportDocumentExecutor(bool stampaUnione) { // Inizializzazione del report this.report = new ResultsContainer(); // Inizializzazione del numero di documenti importati this.totalNumberOfAnalyzedDocuments = 0; // Inizializzazione del numero di documenti da importare this.totalNumberOfDocumentToImport = 0; // Inizializzazione dell'oggetto di sincronizzazione manuale if (!stampaUnione) { this._delegate = ImportDocumentManager.ImportDocument; } else { this._delegate = ImportDocumentManager.ImportAndAcquireDocument; } this._stampaUnione = stampaUnione; }