Exemplo n.º 1
0
        public ErrorCode SetOutput(string output, long maxLength)
        {
            ErrorCode code = FileChecker.CheckOutput(output, maxLength);

            if (code.IsValid())
            {
                Output = output;
            }

            return(code);
        }
Exemplo n.º 2
0
        public ErrorCode SetInput(string input)
        {
            RomType   type;
            ErrorCode code = FileChecker.CheckInput(input, out type);

            UpdateAvailablePatchs(type);

            if (code.IsValid())
            {
                Input = input;
            }

            return(code);
        }
Exemplo n.º 3
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);
        }