示例#1
0
        static bool HandleArguments(string[] args)
        {
            if (args == null || args.Length < 1)
            {
                return(false);
            }

            for (int i = 0; i < args.Length; i++)
            {
                string arg = args[i];
                switch (arg)
                {
                case "-x":      // modify xml file
                {
                    Program.Log.Write("Begin modifying xml file.");

                    string file  = null;
                    string xpath = null;
                    string value = null;

                    i++;
                    if (i < args.Length)
                    {
                        file = args[i];
                    }
                    i++;
                    if (i < args.Length)
                    {
                        xpath = args[i];
                    }
                    i++;
                    if (i < args.Length)
                    {
                        value = args[i];
                    }

                    ModifyXMLFile(file, xpath, value);

                    Program.Log.Write("End modifying xml file.");
                    return(true);
                }

                case "-r":      // replace text in a text file
                {
                    Program.Log.Write("Begin replacing text in a text file.");

                    string file    = null;
                    string oldtext = null;
                    string newtext = null;

                    i++;
                    if (i < args.Length)
                    {
                        file = args[i];
                    }
                    i++;
                    if (i < args.Length)
                    {
                        oldtext = args[i];
                    }
                    i++;
                    if (i < args.Length)
                    {
                        newtext = args[i];
                    }

                    ReplaceText(file, oldtext, newtext);

                    Program.Log.Write("End replacing text in a text file.");
                    return(true);
                }

                case "-g":     // generate script files 20090625
                {
                    Program.Log.Write("Begin generating script files.");

                    ScriptGenerator.WriteCreateDBBatFile();
                    ScriptGenerator.WriteDropDBBatFile();
                    ScriptGenerator.WriteCreateVirtualPathBatFile();
                    ScriptGenerator.WriteDropVirtualPathBatFile();
                    ScriptGenerator.WriteCreateVirtualPathBatFile_iis6();
                    ScriptGenerator.WriteDropVirtualPathBatFile_iis6();
                    ScriptGenerator.WriteWebPortalShortCut();
                    ScriptGenerator.WriteApplyWebConfigShortCut();

                    Program.Log.Write("End generating script files.");
                    return(true);
                }

                case "-a":      // register this integration solution into the platform
                {
                    Program.Log.Write("Begin registering this integration solution into the platform.");

                    RegisterIntegrationSolution();

                    Program.Log.Write("End registering this integration solution into the platform.");
                    return(true);
                }

                case "-d":      // unregister this integration solution into the platform
                {
                    Program.Log.Write("Begin unregistering this integration solution into the platform.");

                    UnregisterIntegrationSolution();

                    Program.Log.Write("End unregistering this integration solution into the platform.");
                    return(true);
                }
                }
            }

            return(false);
        }