Exemple #1
0
        //
        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");
            }
        }
Exemple #2
0
        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;
        }
Exemple #3
0
        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;
        }
Exemple #4
0
        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);
        }
Exemple #5
0
        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);
            }
        }
Exemple #6
0
        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);
        }
Exemple #7
0
        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;
        }
Exemple #8
0
        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;
        }