Ejemplo n.º 1
0
 // -----------------------------------------------------
 private void ShowHelp()
 {
     try
     {
         if (helpForm == null || helpForm.IsDisposed)
         {
             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.Show();
         }
         else
         {
             helpForm.Activate();
         }
     }
     catch
     {
         InfoBox.Show(this, "Error", "Failed to load help file");
     }
 }
Ejemplo n.º 2
0
        // -----------------------------------------------------
        private void buttonCombine_Click(object sender, EventArgs e)
        {
            // Copy the options
            Options options = new Options(this);
            string  errorMsg;

            if (!ValidateOptions(options, out errorMsg))
            {
                InfoBox.Show(this, "Error", errorMsg);
                return;
            }

            if (!ConfirmUnusualOptions(options))
            {
                return;
            }

            PreCombine();
            bool result = CombineFiles(options, out errorMsg);

            if (result)
            {
                PostCombine();
            }
            else
            {
                PostCombine2();
                InfoBox.Show(null, "Error Combining Files", errorMsg);
            }
        }
Ejemplo n.º 3
0
        // -----------------------------------------------------
        private void linkSave_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            string filename = SaveFileDialog("txt files|*.txt", true, optionsFile);

            if (filename == null)
            {
                return;
            }

            Options options = new Options(this);

            if (!options.Save(filename))
            {
                optionsFile = filename;
                InfoBox.Show(this, "Error", "Failed to save options file");
            }
        }
Ejemplo n.º 4
0
        // -----------------------------------------------------
        private void linkLoad_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            string filename = OpenFileDialog("txt files|*.txt", optionsFile);

            if (filename == null)
            {
                return;
            }

            Options options = new Options();

            if (!options.Load(filename))
            {
                InfoBox.Show(this, "Error", "Failed to load options file");
            }
            else
            {
                optionsFile = filename;
                options.CopyToForm(this);
            }
        }
Ejemplo n.º 5
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);
        }
Ejemplo n.º 6
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
        }