Пример #1
0
        // Save current file
        private void SaveFileButton_Click(object sender, EventArgs e)
        {
            SaveFileDialog saveFileDialog = new SaveFileDialog();

            if (saveFileDialog.ShowDialog() == DialogResult.OK)
            {
                FileInputOutput fileOutput = new FileInputOutput(saveFileDialog.OpenFile());
                fileOutput.WriteFile(shapeList);
            }
        }
Пример #2
0
        /* Public methods */

        /// <summary>Saves subtitles to the file with the specified properties.</summary>
        /// <param name="subtitles">The subtitles to save.</param>
        /// <param name="properties">The properties of the file to save the subtitles to. Its <see cref="TimingMode" /> property is used to
        /// choose the timing mode for subtitle formats that support both time and frame modes.</param>
        /// <param name="textType">The type of text content to save.</param>
        /// <remarks>An updated <see cref="SubLib.FileProperties" /> object can be accessed with <see cref="FileProperties" /> after saving.</remarks>
        public void Save(Subtitles subtitles, FileProperties properties, SubtitleTextType textType)
        {
            SubtitleFormat format = BuiltInSubtitleFormats.GetFormat(properties.SubtitleType);
            SubtitleOutput output = new SubtitleOutput(format, textType);

            string text = output.Build(subtitles.Collection, subtitles.Properties, properties);

            FileInputOutput.WriteFile(properties.Path, text, properties.Encoding);

            fileProperties = GetUpdatedFileProperties(properties);
            Logger.Info("[SubtitleSaver] Saved {0} \"{1}\" with encoding \"{2}\", format \"{3}\" and frame rate \"{4}\"",
                        textType, properties.Path, properties.Encoding, format.Name, subtitles.Properties.CurrentFrameRate);
        }