Exemple #1
0
        // -----------------------------------------------------
        public bool ConfirmUnusualOptions(Options options)
        {
            if (options.inputExeFile == "")
            {
                DialogResult result = InfoBox.Show(this, "Confirm 'msi-only' mode", "Are you sure you want to use the msi file without using the corresponding exe file?\n[not recommended]", InfoBox.Buttons.YesNo);
                if (result != DialogResult.Yes)
                {
                    textBoxExe.Select();
                    return(false);
                }
            }

            if (File.Exists(options.outputExeFile))
            {
                DialogResult result = InfoBox.Show(this, "Confirm overwrite", "Are you sure you want to overwrite the existing output file (" + Path.GetFileName(options.outputExeFile) + ")?", InfoBox.Buttons.YesNo);
                if (result != DialogResult.Yes)
                {
                    textBoxOutputExe.Select();
                    return(false);
                }
            }

            return(true);
        }
Exemple #2
0
        // -----------------------------------------------------
        public bool RunInCommandLineMode(string [] args)
        {
            // Enable console output
            AttachConsole(-1);

            // join all options into one string
            string uberArgString = "";

            foreach (string s in args)
            {
                uberArgString += s;
            }

            // Make some options to populate from command line arguments
            Options options   = new Options();
            bool    optionsOk = true;

            // Display help
            if (uberArgString == "/?")
            {
                helpForm = new HelpForm();
                string helpfile = Application.StartupPath + "\\Content\\readme.mht";
                helpForm.webBrowser.Url = new Uri(helpfile);
                helpForm.Location       = new Point(
                    this.Location.X + (this.Size.Width >> 1) - (helpForm.Size.Width >> 1),
                    this.Location.Y + (this.Size.Height >> 1) - (helpForm.Size.Height >> 1)
                    );
                helpForm.ShowDialog();

                return(false);
            }

            // Load from file
            else if (File.Exists(uberArgString))
            {
                optionsOk = options.Load(uberArgString);
            }

            // Load from options string
            else
            {
                optionsOk = options.LoadFromString(uberArgString);
            }

            // Print error if the options aren't right
            if (!optionsOk)
            {
                Console.WriteLine("ExeMsiCombiner Error - Failed to load options:\n\n" + uberArgString + "\n\nUse the '/?' option to get further help.");
                InfoBox.Show(null, "ExeMsiCombiner Error", "Failed to load options:\n\n" + uberArgString + "\n\nUse the '/?' option to get further help.");
                return(false);
            }

            string errorMsg;

            if (!ValidateOptions(options, out errorMsg))
            {
                Console.WriteLine("ExeMsiCombiner Error\n\n" + errorMsg + "\n\nUse the '/?' option to get further help.");
                InfoBox.Show(null, "ExeMsiCombiner Error", errorMsg + "\n\nUse the '/?' option to get further help.");
                return(false);
            }

            if (!CombineFiles(options, out errorMsg))
            {
                Console.WriteLine("ExeMsiCombiner Error Combining Files:\n\n" + errorMsg);
                return(false);
            }

            return(true);    // success
        }
        // -----------------------------------------------------------------
        // Brings up a basic message box, with the chosen button
        // -----------------------------------------------------------------
        public static DialogResult Show(IWin32Window owner, string title, string message, Buttons buttons)
        {
            InfoBox infoBoxDialog = new InfoBox(title, message, buttons);

            return(infoBoxDialog.ShowDialog(owner));
        }
        // -----------------------------------------------------------------
        // Brings up a basic message box with an OK button
        // -----------------------------------------------------------------
        public static DialogResult Show(IWin32Window owner, string title, string promptText)
        {
            InfoBox infoBoxDialog = new InfoBox(title, promptText, Buttons.Ok);

            return(infoBoxDialog.ShowDialog(owner));
        }