private void ApplyTranslation(BackgroundWorker worker, Stream outStream) { using (FileStream inStream = new FileStream(Input, FileMode.Open, FileAccess.Read, FileShare.Read)) { using (Stream patch = ResourcesManager.GetStream(PatchId)) { outStream.Position = 0; Decoder decoder = new Decoder(inStream, patch, outStream); decoder.ProgressChanged += delegate(double p) { worker.ReportProgress((int)(p * 100)); }; decoder.Run(); } } }
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); }
private void PlaySound() { player = new SoundPlayer(ResourcesManager.GetStream("sound.wav")); player.PlayLooping(); FormClosing += delegate { player.Stop(); }; }