// public void Run(string fileName, string reportsFolder) { if (File.Exists(fileName)) { //executor.Invoke(fileName + " processing started"); //string binpath = System.IO.Path.GetDirectoryName( // System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase).Substring(6); try { // simulating console args for the filing processor string[] args = new string[] { @"/" + FilingProcessor.INSTANCE_COMMAND + "=" + fileName , @"/" + FilingProcessor.SAVEAS_COMMAND + "=Xml", @"/" + FilingProcessor.REPORTS_FOLDER_COMMAND + "=" + reportsFolder //,@"/" + FilingProcessor.XSLT_STYLESHEET_COMMAND + "=" + binpath + // @"\" + XBRLReportBuilder.Utilities.RulesEngineUtils.RESOURCES_FOLDER + @"\" + // @"\" + XBRLReportBuilder.Utilities.RulesEngineUtils.TransformFile }; FilingProcessor proc = FilingProcessor.Load(this.executor, args); proc.ProcessFilings(); } catch (Exception ex) { executor.Invoke("Renderer starter unexpected error: " + ex.Message); } } else { executor.Invoke("File " + fileName + " not found"); } }
public Filing(UpdateStatusExecutor executor, string instancePath ) { if( !Path.IsPathRooted( instancePath ) ) { string tmp = Path.Combine( FilingProcessor.cd, instancePath ); executor.Invoke("Information: Instance document has a relative path " + instancePath + "."); executor.Invoke("\tAdjusting path to current locatin " + tmp + ""); instancePath = tmp; } this.InstancePath = instancePath; }
public Filing(UpdateStatusExecutor executor, string instancePath) { if (!Path.IsPathRooted(instancePath)) { string tmp = Path.Combine(FilingProcessor.cd, instancePath); executor.Invoke("Information: Instance document has a relative path " + instancePath + "."); executor.Invoke("\tAdjusting path to current locatin " + tmp + ""); instancePath = tmp; } this.InstancePath = instancePath; }
private static bool UnzipPackage(UpdateStatusExecutor executor, Filing f, string zipPath, out string[] zipFiles) { zipFiles = new string[0]; string errorMsg; if (!ZipUtilities.TryUnzipAndUncompressFiles(f.InstancePath, zipPath, out zipFiles, out errorMsg)) { executor.Invoke("Error: The ZIP file cannot be opened."); executor.Invoke("\tSkipping filing: " + f.InstancePath); return(false); } return(true); }
public void TestProcess(params string[] args) { executor.Invoke("File " + args[0] + " processing started"); System.Threading.Thread.Sleep(2000); for (int i = 0; i < 20; i++) { executor.Invoke(string.Format("Step\t {0} complete", i)); System.Threading.Thread.Sleep(200); } }
public static FilingProcessor Load(UpdateStatusExecutor executor, params string[] args) { FilingProcessor fp = new FilingProcessor(executor); //return fp; foreach (string arg in args) { if (!arg.StartsWith("/")) { executor.Invoke("Ignoring parameter. Reason: incorrect format." + separator + "\t" + arg + ""); continue; } int commandEnd = arg.IndexOf('='); bool isCommandOnly = commandEnd == -1; string command = isCommandOnly ? arg.Substring(1) : arg.Substring(1, commandEnd - 1); if (isCommandOnly && !string.Equals(command, QUIET_COMMAND)) { executor.Invoke("Ignoring parameter. Reason: incorrect format." + separator + "\t" + arg + ""); continue; } string value = arg.Substring(commandEnd + 1); switch (command) { case INSTANCE_COMMAND: Filing filing = new Filing(executor, value); fp.Filings.Add(filing); break; case REPORTS_FOLDER_COMMAND: fp.SetReportsFolder(value, "Arguments"); break; case REPORT_FORMAT_COMMAND: fp.SetReportFormat(value, "Arguments"); break; case HTML_REPORT_FORMAT_COMMAND: fp.SetHtmlReportFormat(value, "Arguments"); break; case REMOTE_CACHE_POLICY_COMMAND: fp.SetRemoteFileCachePolicy(value, "Arguments"); break; case QUIET_COMMAND: fp.Quiet = true; break; case SAVEAS_COMMAND: fp.SetSaveAs(value, "Arguments"); break; case XSLT_STYLESHEET_COMMAND: fp.SetXsltStylesheetPath(value, "Arguments"); break; default: executor.Invoke("Arguments: Ignoring parameter " + command + ". Reason: unrecognized command " + command + "" + separator + "\t" + arg + ""); break; } } return(fp); }
private static bool UnzipPackage(UpdateStatusExecutor executor, Filing f, string zipPath, out string[] zipFiles ) { zipFiles = new string[ 0 ]; string errorMsg; if( !ZipUtilities.TryUnzipAndUncompressFiles( f.InstancePath, zipPath, out zipFiles, out errorMsg ) ) { executor.Invoke( "Error: The ZIP file cannot be opened." ); executor.Invoke( "\tSkipping filing: " + f.InstancePath ); return false; } return true; }
public static FilingProcessor Load(UpdateStatusExecutor executor, params string[] args) { FilingProcessor fp = new FilingProcessor(executor); //return fp; foreach( string arg in args ) { if( !arg.StartsWith( "/" ) ) { executor.Invoke( "Ignoring parameter. Reason: incorrect format." + separator + "\t" + arg +"" ); continue; } int commandEnd = arg.IndexOf( '=' ); bool isCommandOnly = commandEnd == -1; string command = isCommandOnly ? arg.Substring( 1 ) : arg.Substring( 1, commandEnd - 1 ); if( isCommandOnly && !string.Equals( command, QUIET_COMMAND ) ) { executor.Invoke( "Ignoring parameter. Reason: incorrect format." + separator + "\t" + arg + "" ); continue; } string value = arg.Substring( commandEnd + 1 ); switch( command ) { case INSTANCE_COMMAND: Filing filing = new Filing(executor, value ); fp.Filings.Add( filing ); break; case REPORTS_FOLDER_COMMAND: fp.SetReportsFolder( value, "Arguments" ); break; case REPORT_FORMAT_COMMAND: fp.SetReportFormat( value, "Arguments" ); break; case HTML_REPORT_FORMAT_COMMAND: fp.SetHtmlReportFormat( value, "Arguments" ); break; case REMOTE_CACHE_POLICY_COMMAND: fp.SetRemoteFileCachePolicy( value, "Arguments" ); break; case QUIET_COMMAND: fp.Quiet = true; break; case SAVEAS_COMMAND: fp.SetSaveAs( value, "Arguments" ); break; case XSLT_STYLESHEET_COMMAND: fp.SetXsltStylesheetPath( value, "Arguments" ); break; default: executor.Invoke( "Arguments: Ignoring parameter " + command + ". Reason: unrecognized command " + command + "" + separator + "\t" + arg + "" ); break; } } return fp; }