예제 #1
0
파일: Program.cs 프로젝트: ewin66/SP-REC
        static void Main(string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            FrmSpRec frmSpRec = new FrmSpRec();

            if (args.Length > 0)
            {
                parseArgs(frmSpRec, args);
            }
            Application.Run(frmSpRec);
        }
예제 #2
0
파일: Program.cs 프로젝트: ewin66/SP-REC
        private static void parseArgs(FrmSpRec frmSpRec, string[] args)
        {
            int resultInt;
            //byte resultByte;
            //double resultDouble;
            IPAddress resultIP;

            for (int i = 0; i < args.Length; ++i)
            {
                switch (args[i].ToLower())
                {
                case "-a":
                    if (++i > args.Length)
                    {
                        return;
                    }
                    if (IPAddress.TryParse(args[i], out resultIP))
                    {
                        frmSpRec.TcpServerAddress = resultIP;
                    }
                    break;

                case "-g":
                    if (++i > args.Length)
                    {
                        return;
                    }
                    if (System.IO.File.Exists(args[i]))
                    {
                        frmSpRec.GrammarFile = args[i];
                    }
                    break;

                case "-h":
                case "--h":
                case "-help":
                case "--help":
                case "/h":
                    showHelp();
                    break;

                case "-r":
                    if (++i > args.Length)
                    {
                        return;
                    }
                    if (Int32.TryParse(args[i], out resultInt) && (resultInt >= 0))
                    {
                        frmSpRec.TcpPortIn = resultInt;
                    }
                    break;

                case "-sr":
                    frmSpRec.SendRejected = true;
                    break;

                case "-w":
                    if (++i > args.Length)
                    {
                        return;
                    }
                    if (Int32.TryParse(args[i], out resultInt) && (resultInt >= 0))
                    {
                        frmSpRec.TcpPortOut = resultInt;
                    }
                    break;
                }
            }
        }