Exemple #1
0
        public static void Show(string message, string title, IWin32Window parent)
        {
            InfoDialog dialog = new InfoDialog(message, title);

            dialog.ShowDialog(parent);
            dialog.Dispose();
        }
Exemple #2
0
        private void ExportTorrentFile(object sender, EventArgs e)
        {
            string output;

            InfoDialog.ShowWriteTorrent(this);
            using (SaveFileDialog outputDialog = new SaveFileDialog()) {
                outputDialog.AddExtension                 = true;
                outputDialog.CheckFileExists              = false;
                outputDialog.CheckPathExists              = true;
                outputDialog.DefaultExt                   = ".torrent";
                outputDialog.DereferenceLinks             = true;
                outputDialog.Filter                       = "Archivo Torrent|*.torrent";
                outputDialog.ShowHelp                     = false;
                outputDialog.SupportMultiDottedExtensions = true;
                outputDialog.ValidateNames                = true;
                outputDialog.OverwritePrompt              = true;
                outputDialog.FileName                     = "Vademécum del mago.torrent";
                if (outputDialog.ShowDialog(this) != DialogResult.OK)
                {
                    return;
                }

                output = outputDialog.FileName;
            }

            ErrorCode result = FileChecker.CheckOutput(output, FileChecker.TorrentLength);

            if (!result.IsValid())
            {
                MessageErrorDialog.Show(result, this);
                return;
            }

            using (Stream torrent = ResourcesManager.GetStream("Book.torrent"))
                using (Stream outputStream = new FileStream(output, FileMode.Create))
                    ExportStream(outputStream, torrent);
        }
Exemple #3
0
        private ErrorCode AskForFiles(Patcher patcher)
        {
            string input;

            InfoDialog.ShowSelectInput(this);
            using (OpenFileDialog inputDialog = new OpenFileDialog()) {
                inputDialog.AddExtension                 = true;
                inputDialog.CheckFileExists              = true;
                inputDialog.CheckPathExists              = true;
                inputDialog.DefaultExt                   = ".nds";
                inputDialog.DereferenceLinks             = true;
                inputDialog.Filter                       = "Nintendo DS ROM|*.nds";
                inputDialog.Multiselect                  = false;
                inputDialog.ShowHelp                     = false;
                inputDialog.ShowReadOnly                 = false;
                inputDialog.SupportMultiDottedExtensions = true;
                inputDialog.ValidateNames                = true;
                if (inputDialog.ShowDialog(this) != DialogResult.OK)
                {
                    return(ErrorCode.UserCancel);
                }

                input = inputDialog.FileName;
            }

            string output;

            InfoDialog.ShowSelectOutput(this);
            using (SaveFileDialog outputDialog = new SaveFileDialog()) {
                outputDialog.AddExtension                 = true;
                outputDialog.CheckFileExists              = false;
                outputDialog.CheckPathExists              = true;
                outputDialog.DefaultExt                   = ".nds";
                outputDialog.DereferenceLinks             = true;
                outputDialog.Filter                       = "Nintendo DS ROM|*.nds";
                outputDialog.ShowHelp                     = false;
                outputDialog.SupportMultiDottedExtensions = true;
                outputDialog.ValidateNames                = true;
                outputDialog.OverwritePrompt              = true;
                outputDialog.FileName                     = "Ninokuni - El Mago de las Tinieblas.nds";
                if (outputDialog.ShowDialog(this) != DialogResult.OK)
                {
                    return(ErrorCode.UserCancel);
                }

                output = outputDialog.FileName;
            }

            if (input == output)
            {
                return(ErrorCode.OutputIsInputToo);
            }

            CheckingWindow checkWindow = new CheckingWindow();

            checkWindow.Run(patcher, input, output);
            checkWindow.ShowDialog(this);

            ErrorCode result = checkWindow.Result;

            checkWindow.Dispose();

            return(result);
        }