Exemplo n.º 1
0
        static void process(string[] args)
        {
            var arguments = CmdArgParser.Parse(args);

            //if (arguments.Has("-u"))
            //{
            //    Console.WriteLine("u:{0}", arguments.Get("-u").Next);
            //}

            //if (arguments.Has("-p"))
            //{
            //    Console.WriteLine("p:{0}", arguments.Get("-p").Next);
            //}

            if (arguments.Has("-f"))
            {
                string filepath  = arguments.Get("-f").Next;
                string filepath2 = System.Web.HttpUtility.UrlEncode(filepath);
                string ext       = Path.GetExtension(filepath);
                string ext2      = ext.ToLower();
                if (".ppt" != ext2 && ".pptx" != ext2 && ".jpg" != ext2 && ".jpeg" != ext2 && ".bmp" != ext2 && ".png" != ext2 && ".gif" != ext2)
                {
                    System.Windows.Forms.MessageBox.Show("请选择PPT文件或图片文件!", "Warning");
                    return;
                }

                string url  = "http://localhost:8986/SelectPPT?filepath=" + filepath2;
                string resp = HTTPReq.HttpGet(url);
            }
        }
Exemplo n.º 2
0
        public void Usage(string errorInfo)
        {
            if (errorInfo != null)
            {
                Console.WriteLine(new Run(errorInfo));
            }

            Console.WriteLine(CmdArgParser.Usage(typeof(ClientCommandLineArguments)));

            Environment.Exit(Environment.ExitCode);
        }
Exemplo n.º 3
0
        public static void Parse(ClientCommandLineArguments options, string[] args)
        {
            try
            {
                CmdArgParser.Parse(options, args);
            }
            catch (Wintellect.Exception <InvalidCmdArgumentExceptionArgs> e)
            {
                if (!options.ShowUsage)
                {
                    options.Usage("Unrecognized command line argument: '" + e.Args.InvalidCmdArg + "'.");
                    ClientApp.Current.Shutdown();
                }
            }

            if (!options.ShowUsage)
            {
                return;
            }

            options.Usage(null);
            ClientApp.Current.Shutdown();
        }