Example #1
0
        static int Main(string[] args)
        {
            try
            {
                cmdline = new CmdLine(args);

                // Protect against running from the command line.
                if (!cmdline.Exists("Spawned"))
                {
                    throw new Exception("This program may not be executed directly.");
                }

                // The Boku solution folder. Visual Studio macro $(SolutionDir).
                if (!cmdline.Exists("SolutionDir"))
                {
                    throw new Exception("Solution directory was not supplied.");
                }

                // Get the rooted representation of the solution path (containing no relative path elements).
                solutionDir = cmdline.GetString("SolutionDir", "");
                solutionDir = solutionDir.Trim('"');
                solutionDir = Path.GetFullPath(solutionDir);

                // Dispatch the command

                string command = cmdline.GetString("Command", "");
                switch (command)
                {
                // Increment Boku's version number
                case "IncBuild":
                    return(DoIncBuild());

                // Checkout the Content.wxs file from Source Depot
                case "CheckoutContentWxs":
                    return(DoCheckoutContentWxs());

                default:
                    throw new Exception("Unrecognized command: " + command);
                }
            }
            catch (Exception e)
            {
                Console.Error.WriteLine(e.Message);
                return(-1);
            }
        }