Beispiel #1
0
        private void openToolStripMenuItem_Click(object sender, EventArgs e)
        {
            openFileDialog1.Reset();
            openFileDialog1.Title = Localizable.OpenTitle;
            openFileDialog1.Filter = Localizable.OpenFileType;
            openFileDialog1.ShowDialog();
            if (openFileDialog1.FileName.Length == 0) return;

            StreamReader fileReader = new StreamReader(openFileDialog1.FileName);
            subtitles = new AdvancedSubStationAlpha();
            subtitles.LoadAss(fileReader.ReadToEnd());
            fileReader.Close();
            fromXS = false;
            LoadSubtitles();
        }
Beispiel #2
0
        private void openMenuItem_Click(object sender, EventArgs e)
        {
            if (askToSave())
            {
                openFileDialog1.Reset();
                openFileDialog1.Filter = Localizable.OpenFileType;
                openFileDialog1.Title = Localizable.OpenTitle;
                openFileDialog1.ShowDialog();

                if (openFileDialog1.FileName.Length == 0) return;
                fileName = openFileDialog1.FileName;

                string fileContent = readFromFile(fileName);
                subtitles = new AdvancedSubStationAlpha();

                switch (Path.GetExtension(fileName))
                {
                    case ".xss":
                        subtitles.LoadXss(fileContent);
                        ScriptTextBox.Text = fileContent;
                        changeEffectsMode(false, true);
                        this.Text = String.Format(Localizable.Title, Localizable.NormalMode, fileName);
                        break;
                    case ".ass":
                        subtitles.LoadAss(fileContent);
                        ScriptTextBox.Text = subtitles.ToXingSub();
                        changeEffectsMode(false, true);
                        this.Text = String.Format(Localizable.Title, Localizable.NormalMode, fileName);
                        break;
                    case ".xse":
                        ScriptTextBox.Text = fileContent;
                        changeEffectsMode(true, true);
                        this.Text = String.Format(Localizable.Title, Localizable.EffectsMode, fileName);
                        break;
                    default:
                        ScriptTextBox.Text = fileContent;
                        changeEffectsMode(false, true);
                        this.Text = String.Format(Localizable.Title, Localizable.NormalMode, fileName);
                        break;
                }

                isSaved = true;
            }
        }