示例#1
0
        string IPlugin.DoAction(Form parentForm, string subtitle, double frameRate, string listViewLineSeparatorString, string subtitleFileName, string videoFileName, string rawText)
        {
            if (string.IsNullOrWhiteSpace(subtitle))
            {
                MessageBox.Show("No subtitle loaded", parentForm.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return(string.Empty);
            }

            if (!string.IsNullOrEmpty(listViewLineSeparatorString))
            {
                Options.UILineBreak = listViewLineSeparatorString;
            }

            var list = subtitle.SplitToLines();

            var srt = new SubRip();
            var sub = new Subtitle(srt);

            srt.LoadSubtitle(sub, list, subtitleFileName);
            using (var form = new PluginForm(sub))
            {
                if (form.ShowDialog(parentForm) == DialogResult.OK)
                {
                    return(form.Subtiitle);
                }
            }
            return(string.Empty);
        }
示例#2
0
文件: Plugin.cs 项目: ulffi/plugins
        string IPlugin.DoAction(Form parentForm, string subtitle, double frameRate, string listViewLineSeparatorString, string subtitleFileName, string videoFileName, string rawText)
        {
            subtitle = subtitle.Trim();
            if (string.IsNullOrEmpty(subtitle))
            {
                MessageBox.Show("No subtitle loaded", parentForm.Text,
                                MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return(string.Empty);
            }

            if (!string.IsNullOrEmpty(listViewLineSeparatorString))
            {
                Configuration.ListViewLineSeparatorString = listViewLineSeparatorString;
            }

            var list = subtitle.Replace(Environment.NewLine, "\n").Split('\n').ToList();

            var srt = new SubRip();
            var sub = new Subtitle(srt);

            srt.LoadSubtitle(sub, list, subtitleFileName);
            if (srt.ErrorCount > 0)
            {
                MessageBox.Show(srt.ErrorCount + " Errors found while parsing .srt",
                                "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            using (var form = new PluginForm(sub, (this as IPlugin).Name, (this as IPlugin).Description, parentForm, srt.ErrorCount))
            {
                if (form.ShowDialog(parentForm) == DialogResult.OK)
                {
                    return(form.FixedSubtitle);
                }
            }
            return(string.Empty);
        }
示例#3
0
文件: Plugin.cs 项目: raidsan/plugins
        string IPlugin.DoAction(Form parentForm, string subtitle, double frameRate, string listViewLineSeparatorString, string subtitleFileName, string videoFileName, string rawText)
        {
            var form = new PluginForm((this as IPlugin).Name, (this as IPlugin).Description);

            if (form.ShowDialog(parentForm) == DialogResult.OK)
            {
                return(form.LoadedSubtitle);
            }
            return(string.Empty);
        }
示例#4
0
文件: Plugin.cs 项目: raidsan/plugins
        string IPlugin.DoAction(Form parentForm, string subtitle, double frameRate, string listViewLineSeparatorString, string subtitleFileName, string videoFileName, string rawText)
        {
            if (!string.IsNullOrEmpty(subtitleFileName))
            {
                subtitleFileName = Path.GetFileName(subtitleFileName);
            }

            var form = new PluginForm(subtitleFileName, rawText, (this as IPlugin).Name, (this as IPlugin).Description);

            form.ShowDialog(parentForm);
            return(string.Empty);
        }
示例#5
0
 string IPlugin.DoAction(Form parentForm, string subtitle, double frameRate, string listViewLineSeparatorString, string subtitleFileName, string videoFileName, string rawText)
 {
     subtitleFileName = subtitleFileName.Trim();
     if (!string.IsNullOrEmpty(subtitleFileName))
     {
         var form = new PluginForm((this as IPlugin).Name, (this as IPlugin).Description, subtitleFileName, rawText);
         if (form.ShowDialog(parentForm) == DialogResult.OK)
         {
         }
     }
     else
     {
         MessageBox.Show("No subtitle loaded", parentForm.Text,
                         MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
     return(string.Empty);
 }
示例#6
0
文件: Plugin.cs 项目: raidsan/plugins
        string IPlugin.DoAction(Form parentForm, string subtitle, double frameRate, string listViewLineSeparatorString, string subtitleFileName, string videoFileName, string rawText)
        {
            subtitle = subtitle.Trim();
            if (string.IsNullOrWhiteSpace(subtitle))
            {
                MessageBox.Show("No subtitle loaded", parentForm.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return(string.Empty);
            }
            if (!IsOfficeInstalled())
            {
                MessageBox.Show(@"Microsoft Office (Word) is not installed in this system.", "Office is not installed!!!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(string.Empty);
            }

            // set frame rate
            Configuration.CurrentFrameRate = frameRate;

            // set newline visualizer for listviews
            if (!string.IsNullOrEmpty(listViewLineSeparatorString))
            {
                Configuration.ListViewLineSeparatorString = listViewLineSeparatorString;
            }

            // load subtitle text into object
            var list = new List <string>();

            foreach (string line in subtitle.Replace(Environment.NewLine, "\n").Split('\n'))
            {
                list.Add(line);
            }

            var sub = new Subtitle();
            var srt = new SubRip();

            srt.LoadSubtitle(sub, list, subtitleFileName);
            var form = new PluginForm(sub, (this as IPlugin).Name, (this as IPlugin).Description);

            if (form.ShowDialog(parentForm) == DialogResult.OK)
            {
                return(form.FixedSubtitle);
            }
            return(string.Empty);
        }
示例#7
0
 string IPlugin.DoAction(Form parentForm, string subtitle, double frameRate, string listViewLineSeparatorString, string subtitleFileName, string videoFileName, string rawText)
 {
     if (string.IsNullOrWhiteSpace(subtitleFileName))
     {
         MessageBox.Show("No subtitle loaded", parentForm.Text,
                         MessageBoxButtons.OK, MessageBoxIcon.Error);
         return(string.Empty);
     }
     if (!File.Exists(subtitleFileName))
     {
         MessageBox.Show("File not found. Make sure you saved before running!", parentForm.Text,
                         MessageBoxButtons.OK, MessageBoxIcon.Warning);
         return(string.Empty);
     }
     using (var form = new PluginForm(subtitleFileName, rawText, videoFileName, (this as IPlugin).Name, (this as IPlugin).Description))
     {
         form.ShowDialog(parentForm);
     }
     return(string.Empty);
 }
示例#8
0
文件: Plugin.cs 项目: ulffi/plugins
        string IPlugin.DoAction(Form parentForm, string subtitle, double frameRate, string listViewLineSeparatorString, string subtitleFileName,
                                string videoFileName, string rawText)
        {
            if (string.IsNullOrWhiteSpace(subtitle))
            {
                MessageBox.Show("No subtitle loaded", parentForm.Text,
                                MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return(string.Empty);
            }
            // set frame rate
            Configuration.CurrentFrameRate = frameRate;

            // set newline visualizer for listviews
            if (!string.IsNullOrEmpty(listViewLineSeparatorString))
            {
                Configuration.ListViewLineSeparatorString = listViewLineSeparatorString;
            }

            // load subtitle text into object
            var list = new List <string>();

            foreach (string line in subtitle.SplitToLines())
            {
                list.Add(line);
            }
            var sub = new Subtitle();
            var srt = new SubRip();

            srt.LoadSubtitle(sub, list, subtitleFileName);

            IPlugin plugin = this;

            using (var form = new PluginForm(sub, plugin.Name, plugin.Description))
            {
                if (form.ShowDialog(parentForm) == DialogResult.OK)
                {
                    return(form.FixedSubtitle);
                }
            }
            return(string.Empty);
        }
示例#9
0
        decimal IPlugin.Version => 3.3M; //Gets or sets the major, minor, build, and revision numbers of the assembly

        #endregion

        string IPlugin.DoAction(Form parentForm, string subtitleText, double frameRate,
                                string listViewLineSeparatorString, string subtitleFileName, string videoFileName, string rawText)
        {
            // Make sure subtitle isn't null or empty
            if (string.IsNullOrWhiteSpace(subtitleText))
            {
                MessageBox.Show("No subtitle loaded", parentForm.Text,
                                MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return(string.Empty);
            }

            // Use custom separator for list view new lines
            if (!string.IsNullOrEmpty(listViewLineSeparatorString))
            {
                Configuration.ListViewLineSeparatorString = listViewLineSeparatorString;
            }

            // Get subtitle raw lines
            var list = new List <string>();

            list.AddRange(subtitleText.SplitToLines());

            var srt = new SubRip();
            var sub = new Subtitle(srt);

            // Load raws subtitle lines into Subtitle object
            srt.LoadSubtitle(sub, list, subtitleFileName);

            IPlugin HI2UC = this;

            using (var form = new PluginForm(sub, HI2UC.Name, HI2UC.Description))
            {
                if (form.ShowDialog(parentForm) == DialogResult.OK)
                {
                    return(form.FixedSubtitle);
                }
            }
            return(string.Empty);
        }
示例#10
0
        public string DoAction(Form parentForm, string srtText, double frame, string uiLineBreak, string file,
                               string videoFile, string rawText)
        {
            // Make sure subtitle isn't null or empty
            if (string.IsNullOrWhiteSpace(srtText))
            {
                MessageBox.Show("No subtitle loaded", parentForm.Text,
                                MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return(string.Empty);
            }

            // Use custom separator for list view new lines
            if (!string.IsNullOrEmpty(uiLineBreak))
            {
                Options.UILineBreak = uiLineBreak;
            }

            // Get subtitle raw lines
            var list = new List <string>(srtText.SplitToLines());
            var srt  = new SubRip();
            var sub  = new Subtitle(srt);

            // Load raws subtitle lines into Subtitle object
            srt.LoadSubtitle(sub, list, file);

            IPlugin hi2Uc = this;

            using (var form = new PluginForm(sub, hi2Uc.Name, hi2Uc.Description))
            {
                if (form.ShowDialog(parentForm) == DialogResult.OK)
                {
                    return(form.Subtitle);
                }
            }

            return(string.Empty);
        }