示例#1
0
        private void BtnPatchOnClick(object sender, EventArgs e)
        {
            Patcher patcher = new Patcher(ExtrasWindow.AntiPiracy, ExtrasWindow.Banner);

            ErrorCode result = AskForFiles(patcher);

            if (!result.IsValid())
            {
                MessageErrorDialog errorDialog = new MessageErrorDialog(result);
                errorDialog.ShowDialog(this);
                errorDialog.Dispose();
                return;
            }

            // Add animation
            if (!Animation.Instance.Contains(bgBottom, termito))
            {
                Animation.Instance.Add(bgBottom, termito);
            }

            // Start animation
            termito.Position = new Point(-29, 30);
            PatchProgressChanged(0);
            termito.AutoDisable = false;
            termito.Enabled     = true;

            // Disable button
            btnPatch.Enabled      = false;
            btnShowExtras.Enabled = false;

            // Patch
            patcher.ProgressChanged += PatchProgressChanged;
            patcher.Finished        += PatchFinished;
            patcher.Patch();
        }
示例#2
0
        public static void Show(ErrorCode error, IWin32Window parent)
        {
            MessageErrorDialog dialog = new MessageErrorDialog(error);

            dialog.ShowDialog(parent);
            dialog.Dispose();
        }
示例#3
0
        private void PatchFinished(ErrorCode error)
        {
            // Disable animation
            termito.AutoDisable = true;

            // Enable buttons
            btnPatch.Enabled      = true;
            btnShowExtras.Enabled = true;

            if (error.IsValid())
            {
                DoneDialog.ShowWindow(this);
            }
            else
            {
                MessageErrorDialog.Show(ErrorCode.UnknownError, this);
            }
        }
示例#4
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);
        }