Пример #1
0
        static void Main(string[] args)
        {
            options = new CliOptions();
            var parser = new Parser(s =>
            {
                s.MutuallyExclusive = true;
                s.CaseSensitive     = true;
                s.HelpWriter        = Console.Error;
            });

            cout = new ConsoleOutput();

            if (parser.ParseArguments(args, options))
            {
                // console output setup
                cout.Debug   = options.debug;
                cout.Verbose = options.verbose;

                // file output setup
                directory   = options.filepath;
                fileName    = options.filename;
                XMLfilename = Path.Combine(directory, fileName + ".xml");

                // if we are creating a new setup, try to find online servers
                // and save the XML
                if (options.create)
                {
                    DiscoverServers();
                    SaveXML();
                }
                // else, try to load the XML file from location
                else if (LoadXML())
                {
                    if (options.calibrate)
                    {
                        RunCalibration();
                    }
                    else if (options.showIndices)
                    {
                        ShowDisplayIndices();
                    }
                    else if (options.hideIndices)
                    {
                        HideDisplayIndices();
                    }
                }
            }
            parser.Dispose();
            cout.DebugWaitForInput();
        }
        static void Main(string[] args)
        {
            options = new CliOptions();
            var parser = new Parser (s =>
                {
                    s.MutuallyExclusive = true;
                    s.CaseSensitive = true;
                    s.HelpWriter = Console.Error;
                });
            cout = new ConsoleOutput();

            if (parser.ParseArguments(args, options))
            {
                // console output setup
                cout.Debug = options.debug;
                cout.Verbose = options.verbose;

                // file output setup
                directory = options.filepath;
                fileName = options.filename;
                XMLfilename = Path.Combine(directory, fileName + ".xml");

                // if we are creating a new setup, try to find online servers
                // and save the XML
                if (options.create)
                {
                    DiscoverServers();
                    SaveXML();
                }
                // else, try to load the XML file from location
                else if (LoadXML())
                {
                    if (options.calibrate)
                    {
                        RunCalibration();
                    }
                    else if (options.showIndices)
                    {
                        ShowDisplayIndices();
                    }
                    else if (options.hideIndices)
                    {
                        HideDisplayIndices();
                    }
                }
            }
            parser.Dispose();
            cout.DebugWaitForInput();
        }