In order that the command line interface and the GUI app have the same behavior, this class has been factored out and should be used by both front ends.

Behavior specific to a font end, for example, displaying messages in a GUI window, should be handled via callbacks through an interface passed in here.

 public int DoIt( )
 {
     Validator v = new Validator();
     m_vp.SetupValidator( v );
     OTFontFileVal.Driver driver = new OTFontFileVal.Driver( this );
     return driver.RunValidation( v, m_sFiles );
 }
        public int DoIt( )
        {
            Validator v = new Validator();

            m_vp.SetupValidator(v);
            OTFontFileVal.Driver driver = new OTFontFileVal.Driver(this);
            return(driver.RunValidation(v, m_sFiles));
        }
Exemple #3
0
        // method that will be called when the worker thread is started
        public void Worker()
        {
            m_bValidationInProgress = true;

            OTFontFileVal.Driver driver = new OTFontFileVal.Driver(this);
            driver.RunValidation(m_Validator, m_sFiles);
            m_bValidationInProgress = false;

            // after all work is done, enable the UI and close this dialog
            m_formParent.EnableUI(true);
            //JJF Close();
            CloseOurForm();
        }
        static void Main(string[] args)
        {
            if (args.Length == 0)
            {
                try {
                FreeConsole();
                } catch (Exception e) when ( e is EntryPointNotFoundException || e is DllNotFoundException ) {
                    // FreeConsole() is neither available nor relevant
                    // on non-windows.
                }
                Application.Run(new Form1());
                return ;
            }

            bool err = false;
            string reportDir = null;
            ReportFileDestination rfd = ReportFileDestination.UserDesktop;
            List<string> sFileList = new List<string>();
            ValidatorParameters vp = new ValidatorParameters();

            int i,j;

            for (i = 0; i < args.Length; i++)
            {
                if ("-file" == args[i])
                {
                    j = i + 1;
                    if (j == args.Length)
                    {
                        ErrOut("Argument required for \"" + args[j-1] + "\"");
                        err = true;
                        break;
                    }

                    for (;j < args.Length; j++)
                    {
                        if (args[j][0] == '-' || args[j][0] == '+')
                        {
                            j--;
                            break;
                        }
                        sFileList.Add(args[j]);
                    }

                    if (j == i)
                    {
                        ErrOut("Argument required for \"" + args[i] + "\"");
                        err = true;
                        break;
                    }
                    i = j;

                }
                else if ("+table" == args[i])
                {

                    j = i + 1;
                    if (j == args.Length)
                    {
                        ErrOut("Argument required for \"" + args[j-1] + "\"");
                        err = true;
                        break;
                    }

                    for (; j < args.Length; j++)
                    {
                        if (args[j][0] == '-' || args[j][0] == '+')
                        {
                            j--;
                            break;
                        }
                        vp.AddTable(args[j]);
                    }

                    if (j == i)
                    {
                        ErrOut("Argument required for \"" + args[i] + "\"");
                        err = true;
                        break;
                    }

                    i = j;

                }
                else if ("-table" == args[i])
                {
                    j = i + 1;
                    if (j == args.Length)
                    {
                        ErrOut("Argument required for \"" + args[j - 1] + "\"");
                        err = true;
                        break;
                    }

                    for (; j < args.Length; j++)
                    {
                        if (args[j][0] == '-' || args[j][0] == '+')
                        {
                            j--;
                            break;
                        }
                        vp.RemoveTableFromList(args[j]);
                    }

                    if (j == i)
                    {
                        ErrOut("Argument required for \"" + args[i] + "\"");
                        err = true;
                        break;
                    }

                    i = j;

                }
                else if ("-all-tables" == args[i])
                {
                    vp.SetAllTables();
                }
                else if ("-only-tables" == args[i])
                {
                    vp.ClearTables();
                }
                else if ("-report-dir" == args[i])
                {
                    i++;
                    if (i < args.Length)
                    {
                        reportDir = args[i];
                        rfd = ReportFileDestination.FixedDir;
                    }
                    else
                    {
                        ErrOut("Argument required for \"" + args[i - 1] + "\"");
                        err = true;
                    }

                }
                else if ("-report-in-font-dir" == args[i])
                {
                    rfd = ReportFileDestination.SameDirAsFont;
                }
                else if ( "-temporary-reports" == args[i] ) {
                    rfd = ReportFileDestination.TempFiles;
                }
                else
                {
                    ErrOut("Unknown argument: \"" + args[i] + "\"");
                    err = true;
                }
            }
            if (err)
            {
                Usage();
                return ;
            }

            //Ready to run
            Validator v = new Validator();
            vp.SetupValidator(v);

            Program p = new Program();
            p.m_ReportFileDestination = rfd;
            p.m_sReportFixedDir = reportDir;

            Driver drv = new Driver(p);
            drv.RunValidation(v, sFileList.ToArray());
        }
Exemple #5
0
        // method that will be called when the worker thread is started
        public void Worker()
        {
            m_bValidationInProgress = true;

            OTFontFileVal.Driver driver = new OTFontFileVal.Driver( this );
            driver.RunValidation( m_Validator, m_sFiles );
            m_bValidationInProgress = false;

            // after all work is done, enable the UI and close this dialog
            m_formParent.EnableUI(true);
            //JJF Close();
            CloseOurForm();
        }