Exemple #1
0
        void UpdatePackagedFiles(string folder)
        {
            if (xv == null)
            {
                return;
            }

            string PackageId = xv.GetInnerText(xv.PackageId, "PackageId", "").ToLower();

            List <PackagedFile> notFound = xv.PackagedFiles.FindAll(x => !PackagedFileExists(folder, x));

            if (notFound.Count == 0)
            {
                return;
            }

            System.Text.StringBuilder sb = new System.Text.StringBuilder();
            sb.AppendLine("The following files in the Sims3Pack manifest XML cannot be found:");
            foreach (PackagedFile pf in notFound)
            {
                if (pf.GetInnerText(pf.Guid, "Guid", "").ToLower().Equals(PackageId) || pf.GetInnerText(pf.Name, "Name", "").ToLower().Equals(PackageId + ".package"))
                {
                    throw new System.Xml.XmlException("Missing file found matching outer PackageId.  Please investigate.");
                }

                sb.AppendLine(pf.Name.InnerText);
                xv.RemovePackagedFile(pf.Name.InnerText);
            }
            CopyableMessageBox.Show(sb.ToString(), "Missing files", CopyableMessageBoxButtons.OK, CopyableMessageBoxIcon.Warning);
        }
Exemple #2
0
        void Search_SearchComplete(object sender, MainForm.CompletionEventArgs e)
        {
            Diagnostics.Log(String.Format("Search_SearchComplete {0}", e.arg));
            searching = false;
            while (searchThread != null && searchThread.IsAlive)
            {
                searchThread.Join(100);
            }
            searchThread = null;
            MainForm.SetFT(useCC, useEA, checkInstallDirsCB, this);

            updateProgressCB(true, "", true, -1, false, 0);

            btnSearch.Enabled = btnCancel.Enabled = listView1.Enabled = searchContextMenu.Enabled = tbText.Enabled = tlpWhere.Enabled = cbCatalogType.Enabled = true;
            btnSearch.Text    = "&Search";
            tlpCount.Visible  = true;
            lbCount.Text      = "" + listView1.Items.Count;

            if (e.errors.Count > 0)
            {
                CopyableMessageBox.Show("The following resources could not be processed:\n\n  " + String.Join("\n  ", e.errors),
                                        "Errors during Search", CopyableMessageBoxButtons.OK, CopyableMessageBoxIcon.Warning);
            }

            if (listView1.Visible && listView1.Items.Count > 0)
            {
                listView1.Items[0].EnsureVisible();
                listView1.Items[0].Focused = true;
                //listView1.Items[0].Selected = true;
            }
        }
Exemple #3
0
 private void warrantyToolStripMenuItem_Click(object sender, EventArgs e)
 {
     CopyableMessageBox.Show("\n" +
                             "Disclaimer of Warranty.\n" +
                             "\n" +
                             "THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.\n" +
                             "EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER\n" +
                             "PARTIES PROVIDE THE PROGRAM \"AS IS\" WITHOUT WARRANTY OF ANY KIND,\n" +
                             "EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,\n" +
                             "THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.\n" +
                             "THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.\n" +
                             "SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.\n" +
                             "\n" +
                             "\n" +
                             "Limitation of Liability.\n" +
                             "\n" +
                             "IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER,\n" +
                             "OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE,\n" +
                             "BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES\n" +
                             "ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM\n" +
                             "(INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE\n" +
                             "OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),\n" +
                             "EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.\n" +
                             "\n",
                             myName);
 }
Exemple #4
0
        static bool Execute(IResource res, Helper helper, string command, string arguments)
        {
            command   = command.Replace("{}", helper.filename);
            arguments = arguments.Replace("{}", helper.filename);
            foreach (string prop in res.ContentFields)
            {
                if (arguments.IndexOf("{" + prop.ToLower() + "}") >= 0)
                {
                    arguments = arguments.Replace("{" + prop.ToLower() + "}", "" + res[prop]);
                }
            }

            System.Diagnostics.Process p = new System.Diagnostics.Process();

            p.StartInfo.FileName        = command;
            p.StartInfo.Arguments       = arguments;
            p.StartInfo.UseShellExecute = false;

            try { p.Start(); }
            catch (Exception ex)
            {
                CopyableMessageBox.IssueException(ex,
                                                  typeof(HelperManager).Assembly.FullName + "\n" + String.Format("Application failed to start:\n{0}\n{1}", command, arguments),
                                                  "Launch failed");
                return(false);
            }

            Application.DoEvents();
            while (!p.WaitForExit(500))
            {
                Application.DoEvents();
            }

            return(p.ExitCode == 0);
        }
Exemple #5
0
        bool Commit()
        {
            if (_PresenterController.CommitRequired)
            {
                int i = CopyableMessageBox.Show(
                    "You have unsaved changes - do you want to save before you continue?\n\n" +
                    "Press \"Yes\" to save and continue.\n" +
                    "Press \"No\" to continue without saving.\n" +
                    "Press \"Cancel\" to stop this action without saving.",
                    "Save?", CopyableMessageBoxButtons.YesNoCancel, CopyableMessageBoxIcon.Question);
                if (i == 2)
                {
                    return(false); // Cancel
                }
                if (i == 0)        // Yes -> Save
                {
                    saveToolStripMenuItem_Click(null, null);
                    // If we still have unsaved changes, the user must have cancelled somewhere
                    if (_PresenterController.CommitRequired)
                    {
                        return(false);
                    }
                }
                // fall through on "No" or successful save
            }

            return(true);
        }
Exemple #6
0
        private void openToolStripMenuItem_Click(object sender, EventArgs e)
        {
            // Save whatever we have but keep any filename
            if (!Commit())
            {
                return;
            }

            // Get the proposed filename from the user
            openFileDialog1.FilterIndex = 1;
            DialogResult dr = openFileDialog1.ShowDialog();

            if (dr != DialogResult.OK)
            {
                return;
            }

            // See if there are any objections to using it (like it's a bad package, for example)
            string message;

            if (!_PresenterController.IsValidFilename(openFileDialog1.FileName, false, out message))
            {
                CopyableMessageBox.Show(message, "Open file...", CopyableMessageBoxButtons.OK, CopyableMessageBoxIcon.Stop);
                return;
            }

            _PresenterController.DoFileOpen(openFileDialog1.FileName);
        }
Exemple #7
0
        void contextMenuStrip1_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
        {
            Type type = e.ClickedItem.Tag as Type;

            if (type == null)
            {
                return;
            }

            int selectedIndex = listBox1.SelectedIndex;

            try
            {
                fieldList.Add(type);
                if ("Add".Equals(contextMenuStrip1.Tag))
                {
                    selectedIndex = fieldList.Count - 1;
                }
                else
                {
                    doInsert();
                }
            }
            catch (NotImplementedException)
            {
                CopyableMessageBox.Show("This list does not allow entries to be added this way.", "Grid", CopyableMessageBoxButtons.OK, CopyableMessageBoxIcon.Information);
            }
            catch (Exception ex)
            {
                MainForm.IssueException(ex, "");
            }
            fillListBox(selectedIndex);
        }
Exemple #8
0
        private void simpleAddInsert(bool add)
        {
            int selectedIndex = listBox1.SelectedIndex;

            try
            {
                fieldList.Add();
                if (add)
                {
                    selectedIndex = fieldList.Count - 1;
                }
                else
                {
                    doInsert();
                }
            }
            catch (NotImplementedException)
            {
                CopyableMessageBox.Show("This list does not allow entries to be added this way.", "Grid", CopyableMessageBoxButtons.OK, CopyableMessageBoxIcon.Information);
            }
            catch (Exception ex)
            {
                MainForm.IssueException(ex, "");
            }
            fillListBox(selectedIndex);
        }
Exemple #9
0
 static Checker()
 {
     // Should only be set to "AskMe" the first time through (although it might have been reset by the user)
     if (pgmSettings.AutoUpdateChoice == 0) // AskMe
     {
         int dr = CopyableMessageBox.Show(
             PortableSettingsProvider.ExecutableName + " is under development.\n"
             + "It is recommended you allow automated update checking\n"
             + "(no more than once per day, when the program is run).\n\n"
             + "Do you want " + PortableSettingsProvider.ExecutableName + " to check for updates automatically?"
             , PortableSettingsProvider.ExecutableName + " AutoUpdate Setting"
             , CopyableMessageBoxButtons.YesNo, CopyableMessageBoxIcon.Question, -1, 1
             );
         if (dr == 0)
         {
             AutoUpdateChoice = true; // Daily
         }
         else
         {
             AutoUpdateChoice = false; // Manual
             CopyableMessageBox.Show("You can enable AutoUpdate checking under the Settings Menu.\n" +
                                     "Manual update checking is under the Help Menu."
                                     , PortableSettingsProvider.ExecutableName + " AutoUpdate Setting"
                                     , CopyableMessageBoxButtons.OK, CopyableMessageBoxIcon.Information
                                     );
         }
         pgmSettings.Save();
         OnAutoUpdateChoice_Changed();
     }
 }
Exemple #10
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            try
            {
                folderBrowserDialog1.SelectedPath = CLIPexportAsNewName.Properties.Settings.Default.LastExportFolder;
                DialogResult dr = folderBrowserDialog1.ShowDialog();
                if (dr != System.Windows.Forms.DialogResult.OK)
                {
                    return;
                }

                CLIPexportAsNewName.Properties.Settings.Default.LastExportFolder = folderBrowserDialog1.SelectedPath;
                CLIPexportAsNewName.Properties.Settings.Default.Save();

                string filename = Path.Combine(folderBrowserDialog1.SelectedPath, String.Format("S3_{0:X8}_{1:X8}_{2:X16}_{3}%%+CLIP.animation",
                                                                                                0x6B20C4F3, Program.CurrentGroup, FNV64CLIP.GetHash(tbClipName.Text), tbClipName.Text));

                if (File.Exists(filename) && CopyableMessageBox.Show(String.Format("File '{0}' exists.\n\nReplace?", Path.GetFileName(filename)), "File exists",
                                                                     CopyableMessageBoxButtons.YesNo, CopyableMessageBoxIcon.Question, 1, 1) != 0)
                {
                    return;
                }

                using (BinaryWriter w = new BinaryWriter(new FileStream(filename, FileMode.Create)))
                {
                    w.Write(data);
                    w.Close();
                }

                Environment.ExitCode = 0;
            }
            finally { this.Close(); }
        }
Exemple #11
0
        string SaveToNewFilename(string prompt)
        {
            // Get the filename from the user
            saveFileDialog1.FilterIndex = 1;
            DialogResult dr = saveFileDialog1.ShowDialog();

            if (dr != DialogResult.OK)
            {
                return(null);
            }

            // See if there are any objections to using it
            string message;

            if (!_PresenterController.IsValidFilename(saveFileDialog1.FileName, true, out message))
            {
                CopyableMessageBox.Show(message, prompt, CopyableMessageBoxButtons.OK, CopyableMessageBoxIcon.Stop);
                return(null);
            }

            // Write out to the new filename
            _PresenterController.DoFileSaveAs(saveFileDialog1.FileName);

            return(saveFileDialog1.FileName);
        }
Exemple #12
0
        public static void Show(string value, string title = "")
        {
            string msg = value.Trim('\n');

            if (msg == "")
            {
                return;
            }
            if (title == "")
            {
                Debug.WriteLine(msg);
                if (popups)
                {
                    CopyableMessageBox.Show(msg);
                }
            }
            else
            {
                Debug.WriteLine(String.Format("{0}: {1}", title, msg));
                if (popups)
                {
                    CopyableMessageBox.Show(msg, title);
                }
            }
            if (logging)
            {
                Log(value);
            }
        }
Exemple #13
0
        static int Main(params string[] args)
        {
            List <string> largs = new List <string>(args);

            bool export = largs.Contains("/export");

            if (export)
            {
                largs.Remove("/export");
            }

            bool import = largs.Contains("/import");

            if (import)
            {
                largs.Remove("/import");
            }

            if ((export && import) || (!export && !import))
            {
                CopyableMessageBox.Show("Missing /export or /import on command line.", Application.ProductName, CopyableMessageBoxButtons.OK, CopyableMessageBoxIcon.Error);
                Environment.Exit(1);
            }

            args = largs.ToArray();

            Filename = (args.Length > 0 ? Path.GetFileNameWithoutExtension(args[args.Length - 1]) : "*");

            System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture;
            //return s3pi.Helpers.RunHelper.Run(export ? typeof(ExportForm) : typeof(ImportForm), args);
            return(0);
        }
Exemple #14
0
        private void fileOpenExecuted(object sender, ExecutedRoutedEventArgs e)
        {             // Save whatever we have but keep any filename
            if (!Commit())
            {
                return;
            }

            // Get the proposed filename from the user
            ofdOpenPackage.FilterIndex = 1;
            bool?dr = ofdOpenPackage.ShowDialog();

            if (dr != true)
            {
                return;
            }

            // See if there are any objections to using it (like it's a bad package, for example)
            string message;

            if (!_PresenterController.IsValidFilename(ofdOpenPackage.FileName, false, out message))
            {
                CopyableMessageBox.Show(message, "Open file...", CopyableMessageBoxButtons.OK, CopyableMessageBoxIcon.Stop);
                return;
            }

            _PresenterController.DoFileOpen(ofdOpenPackage.FileName);
        }
        bool saveImage(string filename)
        {
            var ext = Array.IndexOf(new[] { ".png", ".gif", ".jpg", ".bmp", }, Path.GetExtension(filename).ToLower());
            var fmt = ext >= 0 ? fmts[ext] : System.Drawing.Imaging.ImageFormat.Png;

            ddsPanel1.Image.Save(filename, fmt);
            CopyableMessageBox.Show("Saved.", "Save Image...");
            return(true);
        }
Exemple #16
0
 private static void ShowErrorMessage(bool autoCheck, Exception exception)
 {
     CopyableMessageBox.Show(
         "Problem checking for update" + (autoCheck ? " - will try again later" : "") + "\n"
         + exception.Message
         , PortableSettingsProvider.ExecutableName + " AutoUpdate"
         , CopyableMessageBoxButtons.OK
         , CopyableMessageBoxIcon.Error);
 }
Exemple #17
0
        private void checkForUpdateToolStripMenuItem_Click(object sender, EventArgs e)
        {
            bool msgDisplayed = AutoUpdate.Checker.GetUpdate(false);

            if (!msgDisplayed)
            {
                CopyableMessageBox.Show("Your " + System.Configuration.PortableSettingsProvider.ExecutableName + " is up to date", myName,
                                        CopyableMessageBoxButtons.OK, CopyableMessageBoxIcon.Information);
            }
        }
 bool saveDDS(string filename)
 {
     using (FileStream fs = new FileStream(filename, FileMode.Create, FileAccess.Write))
     {
         ddsPanel1.DDSSave(fs);
         fs.Close();
     }
     CopyableMessageBox.Show("Saved.", "Save DDS...");
     return(true);
 }
Exemple #19
0
        private void doViewer(bool fromForm = true)
        {
            string tmpFilename = Path.Combine(Path.GetTempPath(), lbAssyName.Text);

            using (FileStream fs = new FileStream(tmpFilename, FileMode.Create, FileAccess.Write))
            {
                byte[] data = new byte[s3sa.Assembly.BaseStream.Length];
                s3sa.Assembly.BaseStream.Read(data, 0, data.Length);
                fs.Write(data, 0, data.Length);
            }

            Properties.Settings.Default.AssyViewerCmd  = tbViewer.Text;
            Properties.Settings.Default.AssyViewerArgs = tbArgs.Text;

            System.Diagnostics.Process p = new System.Diagnostics.Process();

            p.StartInfo.FileName = Properties.Settings.Default.AssyViewerCmd;

            if (tbArgs.Text.Contains("{}"))
            {
                p.StartInfo.Arguments = tbArgs.Text.Replace("{}", tmpFilename);
            }
            else if (tbArgs.Text.Length > 0)
            {
                p.StartInfo.Arguments = String.Format("{0} {1}", tbArgs.Text, tmpFilename);
            }
            else
            {
                p.StartInfo.Arguments = tmpFilename;
            }

            p.StartInfo.UseShellExecute = false;

            if (fromForm)
            {
                CopyableMessageBox.Show(this.GetType().Assembly.FullName + "\n"
                                        + String.Format("Starting:\n{0}\n{1}", p.StartInfo.FileName, p.StartInfo.Arguments),
                                        "Launch", CopyableMessageBoxButtons.OK, CopyableMessageBoxIcon.Information);
            }

            try
            {
                p.Start();

                Properties.Settings.Default.Save();
                Environment.ExitCode = 0;
            }
            catch (Exception ex)
            {
                CopyableMessageBox.IssueException(ex,
                                                  this.GetType().Assembly.FullName + "\n" + String.Format("Application failed to start:\n{0}\n{1}", p.StartInfo.FileName, p.StartInfo.Arguments),
                                                  "Launch failed");
                Environment.ExitCode = 1;
            }
        }
Exemple #20
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            S3Pack.Sims3Pack.Pack(tbSource.Text, tbTarget.Text, xv);

            CopyableMessageBox.Show("Done!", "Sims3Pack created", CopyableMessageBoxButtons.OK, CopyableMessageBoxIcon.Information);

            ResetSource();
            ResetTarget();
            xv = null;
            OKforOK();
        }
Exemple #21
0
        static int Main(params string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            bool   allowOption = !(new string[] { "unpack", "repack", "pack", }).Contains(Path.GetFileNameWithoutExtension(Application.ExecutablePath).ToLower());
            string filename    = null;
            int    value       = CmdLine(allowOption, ref filename, args);

            if (value == -1)
            {
                return(-1);
            }
            if (!allowOption && value >= 0) // option specified
            {
                CopyableMessageBox.Show("Invalid command line: '" + Environment.CommandLine + "'.", "s3su", CopyableMessageBoxButtons.OK, CopyableMessageBoxIcon.Error);
                return(-1);
            }
            if (!allowOption)
            {
                switch (Path.GetFileNameWithoutExtension(Application.ExecutablePath).ToLower())
                {
                case "unpack": value = 0; break;

                case "repack": value = 1; break;

                case "pack": value = 2; break;

                default:
                    CopyableMessageBox.Show("Invalid command line: '" + Environment.CommandLine + "'.", "s3su", CopyableMessageBoxButtons.OK, CopyableMessageBoxIcon.Error);
                    return(-1);
                }
            }
            else if (value < 0)
            {
                ChooseMode cm = new ChooseMode();
                cm.ShowDialog();
                if (cm.Mode == -1)
                {
                    return(0);
                }
                value = cm.Mode;
            }

            switch (value)
            {
            case 0: Application.Run(filename == null ? new Unpack() : new Unpack(filename)); break;

            case 1: Application.Run(filename == null ? new Repack() : new Repack(filename)); break;

            case 2: Application.Run(filename == null ? new Pack() : new Pack(filename)); break;
            }
            return(0);
        }
Exemple #22
0
 private void openFileDialog1_FileOk(object sender, CancelEventArgs e)
 {
     string[] names = openFileDialog1.FileNames;
     if (names.Length > 2)
     {
         CopyableMessageBox.Show(this, "Please select one or two packages at a time.",
                                 myName, CopyableMessageBoxIcon.Error, new List <string>(new string[] { "OK" }), 0, 0);
         e.Cancel = true;
         return;
     }
 }
Exemple #23
0
        private void ImportBatch(IList <MyDataFormat> ldata)
        {
            ImportBatch  importBatch = new ImportBatch(ldata);
            DialogResult result      = importBatch.ShowDialog();

            if (result != DialogResult.OK)
            {
                return;
            }

            List <MyDataFormat> output = new List <MyDataFormat>();

            foreach (string b in importBatch.Batch)
            {
                foreach (MyDataFormat data in ldata)
                {
                    if (data.tgin == b)
                    {
                        output.Add(data);
                        break;
                    }
                }
            }

            if (output.Count == 0)
            {
                return;
            }
            if (output.Count == 1)
            {
                this.ImportSingle(output[0]);
                return;
            }

            try
            {
                foreach (MyDataFormat data in output)
                {
                    this.ImportStream(data,
                                      importBatch.UseNames,
                                      importBatch.Rename,
                                      importBatch.Compress,
                                      importBatch.Replace ? DuplicateHandling.Replace : DuplicateHandling.Reject,
                                      false);
                    Application.DoEvents();
                }
            }
            catch (Exception ex)
            {
                CopyableMessageBox.IssueException(ex, "Could not import all resources.\n", "Aborting import");
            }
        }
Exemple #24
0
        static void Execute(string command)
        {
            System.Diagnostics.Process p = new System.Diagnostics.Process();

            p.StartInfo.FileName        = command;
            p.StartInfo.UseShellExecute = true;

            try { p.Start(); }
            catch (Exception ex)
            {
                CopyableMessageBox.IssueException(ex, "Launch failed");
                return;
            }
        }
Exemple #25
0
        private void Form1_FormClosing(object sender, FormClosingEventArgs e)
        {
            int r = CopyableMessageBox.Show("Delete temp files?", myName, CopyableMessageBoxButtons.YesNoCancel, CopyableMessageBoxIcon.Question);

            if (r == 2)
            {
                e.Cancel = true;
                return;
            }
            if (r == 1)
            {
                return;
            }
            CleanTemp();
        }
Exemple #26
0
        public static bool GetUpdate(bool autoCheck)
        {
            string versionIni = "version.ini";
            bool   hasUpdate;

            if (!File.Exists(versionIni))
            {
                CopyableMessageBox.Show(
                    "Problem checking for update" + (autoCheck ? " - will try again later" : "") + "\n"
                    + versionIni + " - not found"
                    , PortableSettingsProvider.ExecutableName + " AutoUpdate"
                    , CopyableMessageBoxButtons.OK
                    , CopyableMessageBoxIcon.Error);
                return(true);
            }

            try
            {
                string currentVersion = new StreamReader(versionIni).ReadLine();
                currentVersion = currentVersion.Trim();
                GithubVersion localVersion  = new GithubVersion(currentVersion);
                GithubVersion githubVersion = new GithubVersion();
                hasUpdate = localVersion.CompareTo(githubVersion) < 0;
            }
            catch (WebException we)
            {
                ShowErrorMessage(autoCheck, we);
                return(true);
            }
            catch (IOException ioe)
            {
                ShowErrorMessage(autoCheck, ioe);
                return(true);
            }

            if (hasUpdate)
            {
                string message      = "New version available\nDo you want to visit the download site now?";
                int    dialogResult = CopyableMessageBox.Show(message, "", CopyableMessageBoxButtons.YesNo);

                if (dialogResult == 0)
                {
                    Process.Start(DownloadPage);
                }
                return(true);
            }
            return(false);
        }
Exemple #27
0
        public static void ShowException(Exception ex, string prefix, string caption)
        {
            StringBuilder builder = new StringBuilder();

            builder.Append(prefix);
            for (Exception exception = ex; exception != null; exception = exception.InnerException)
            {
                builder.Append("\nSource: " + exception.Source);
                builder.Append("\nAssembly: " + exception.TargetSite.DeclaringType.Assembly.FullName);
                builder.Append("\n" + exception.Message);
                System.Diagnostics.StackTrace trace = new System.Diagnostics.StackTrace(ex, false);
                builder.Append("\n" + trace);
                builder.Append("\n-----");
            }
            CopyableMessageBox.Show(builder.ToString(), caption, CopyableMessageBoxButtons.OK,
                                    CopyableMessageBoxIcon.Error, 0);
        }
Exemple #28
0
        void importBatch(IList <myDataFormat> ldata)
        {
            ImportBatch  ib = new ImportBatch(ldata);
            DialogResult dr = ib.ShowDialog();

            if (dr != DialogResult.OK)
            {
                return;
            }

            List <myDataFormat> output = new List <myDataFormat>();

            foreach (string b in ib.Batch)
            {
                foreach (myDataFormat data in ldata)
                {
                    if (data.tgin == b)
                    {
                        output.Add(data); goto next;
                    }
                }
                next : { }
            }

            if (output.Count == 0)
            {
                return;
            }
            if (output.Count == 1)
            {
                importSingle(output[0]); return;
            }

            try
            {
                foreach (myDataFormat data in output)
                {
                    importStream(data, ib.UseNames, ib.Rename, ib.Compress, ib.Replace ? DuplicateHandling.replace : DuplicateHandling.reject, false);
                    Application.DoEvents();
                }
            }
            catch (Exception ex)
            {
                CopyableMessageBox.IssueException(ex, "Could not import all resources.\n", "Aborting import");
            }
        }
Exemple #29
0
        // ---

        public void CmdLine(params string[] args)
        {
            var mruLeft  = Properties.Settings.Default.MRULeft;
            var mruRight = Properties.Settings.Default.MRURight;

            if (mruLeft != null && mruRight != null)
            {
                tbPkgA.Text = mruLeft[0];
                tbPkgB.Text = mruRight[0];
            }

            List <string> cmdline = new List <string>(args);
            List <string> pkgs    = new List <string>();

            while (cmdline.Count > 0)
            {
                string option = cmdline[0];
                cmdline.RemoveAt(0);
                if (!File.Exists(option))
                {
                    CopyableMessageBox.Show(this, "File not found:\n" + option,
                                            myName, CopyableMessageBoxIcon.Error, new List <string>(new string[] { "OK" }), 0, 0);
                    Environment.Exit(1);
                }
                pkgs.Add(Path.GetFullPath(option));
            }
            if (pkgs.Count > 2)
            {
                CopyableMessageBox.Show(this, "Please select one or two packages at a time.",
                                        myName, CopyableMessageBoxIcon.Error, new List <string>(new string[] { "OK" }), 0, 0);
                Environment.Exit(1);
            }


            if (pkgs.Count > 0)
            {
                tbPkgA.Text = pkgs[0];
            }
            if (pkgs.Count > 1)
            {
                tbPkgB.Text = pkgs[1];
            }

            btnGo.Enabled = File.Exists(tbPkgA.Text) && File.Exists(tbPkgB.Text);
        }
Exemple #30
0
        private void licenceToolStripMenuItem_Click(object sender, EventArgs e)
        {
            int dr = CopyableMessageBox.Show("\n" +
                                             "This program is distributed under the terms of the\nGNU General Public Licence version 3.\n" +
                                             "\n" +
                                             "If you wish to see the full text of the licence,\nplease visit http://www.fsf.org/licensing/licenses/gpl.html.\n" +
                                             "\n" +
                                             "Do you wish to visit this site now?" +
                                             "\n",
                                             myName,
                                             CopyableMessageBoxButtons.YesNo, CopyableMessageBoxIcon.Question, 1);

            if (dr != 0)
            {
                return;
            }
            Help.ShowHelp(this, "http://www.fsf.org/licensing/licenses/gpl.html");
        }