示例#1
0
        static void Main(string[] args)
        {
            string diffProgram = "windiff";
            string cvsProgram  = "cvs -z3";
            string diffOptions = "-u -N";
            bool   fOld        = false;
            bool   fSkipNext   = false;

            for (int i = 0; i < args.Length; i++)
            {
                if (fSkipNext)
                {
                    fSkipNext = false;
                    continue;
                }

                if (args[i] == "-h" || args[i] == "-help" || args[i] == "--help" || args[i] == "/?" || args[i] == "/h" || args[i] == "-v" || args[i] == "--version")
                {
                    Usage();
                    return;
                }

                if (args[i] == "-diff")
                {
                    if (args.Length < i + 1)
                    {
                        Usage();
                        return;
                    }
                    diffProgram = args[i + 1];
                    Console.WriteLine("Using diff program {0}", diffProgram);
                }

                if (args[i] == "-cvs")
                {
                    if (args.Length < i + 1)
                    {
                        Usage();
                        return;
                    }
                    cvsProgram = args[i + 1].Trim('\"');
                }

                if (args[i] == "-cvsargs")
                {
                    if (args.Length < i + 1)
                    {
                        Usage();
                        return;
                    }
                    diffOptions = args[i + 1].Trim('\"');
                }

                if (args[i] == "-old")
                {
                    fOld = true;
                }
            }

            var sc = new Scdiff();

            sc.fOld_        = fOld;
            sc.diffProgram_ = diffProgram;
            sc.diffOptions_ = diffOptions;

            string[] cvsCommands = cvsProgram.Split(" ".ToCharArray(), 2);
            sc.cvsProgram_ = cvsCommands[0].Trim();
            if (2 == cvsCommands.Length)
            {
                sc.cvsOptions_ = cvsCommands[1].Trim();
            }
            sc.run();
        }
示例#2
0
文件: scdiff.cs 项目: kjk/kjkpub
        static void Main(string[] args)
        {
            string diffProgram = "windiff";
            string cvsProgram = "cvs -z3";
            string diffOptions = "-u -N";
            bool fOld=false;
            bool fSkipNext = false;
            for (int i = 0; i < args.Length; i++)
            {
                if (fSkipNext)
                {
                    fSkipNext = false;
                    continue;
                }

                if (args[i]=="-h" || args[i]=="-help" || args[i]=="--help" || args[i]=="/?" || args[i]=="/h" || args[i] == "-v" || args[i] == "--version")
                {
                    Usage();
                    return;
                }

                if (args[i]=="-diff")
                {
                    if (args.Length<i+1)
                    {
                        Usage();
                        return;
                    }
                    diffProgram = args[i+1];
                    Console.WriteLine("Using diff program {0}", diffProgram);
                }

                if (args[i]=="-cvs")
                {
                    if (args.Length<i+1)
                    {
                        Usage();
                        return;
                    }
                    cvsProgram = args[i+1].Trim('\"');
                }

                if (args[i]=="-cvsargs")
                {
                    if (args.Length<i+1)
                    {
                        Usage();
                        return;
                    }
                    diffOptions = args[i+1].Trim('\"');
                }

                if (args[i]=="-old")
                    fOld=true;
            }

            var sc = new Scdiff();
            sc.fOld_ = fOld;
            sc.diffProgram_ = diffProgram;
            sc.diffOptions_ = diffOptions;

            string[] cvsCommands = cvsProgram.Split(" ".ToCharArray(), 2);
            sc.cvsProgram_ = cvsCommands[0].Trim();
            if (2 == cvsCommands.Length)
                sc.cvsOptions_ = cvsCommands[1].Trim();
            sc.run();
        }