mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2025-01-31 13:01:39 +01:00
Removed "System.Windows.Forms" reference from libse
This commit is contained in:
parent
fab4c81a11
commit
f28dfb6b81
@ -3,7 +3,6 @@ using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Windows.Forms;
|
||||
using System.Xml;
|
||||
|
||||
namespace Nikse.SubtitleEdit.Core.Dictionaries
|
||||
@ -899,28 +898,21 @@ namespace Nikse.SubtitleEdit.Core.Dictionaries
|
||||
|
||||
public void AddToWholeLineList(string fromLine, string toLine)
|
||||
{
|
||||
try
|
||||
var userDocument = LoadXmlReplaceListUserDocument();
|
||||
if (!_wholeLineReplaceList.ContainsKey(fromLine))
|
||||
_wholeLineReplaceList.Add(fromLine, toLine);
|
||||
XmlNode wholeWordsNode = userDocument.DocumentElement.SelectSingleNode("WholeLines");
|
||||
if (wholeWordsNode != null)
|
||||
{
|
||||
var userDocument = LoadXmlReplaceListUserDocument();
|
||||
if (!_wholeLineReplaceList.ContainsKey(fromLine))
|
||||
_wholeLineReplaceList.Add(fromLine, toLine);
|
||||
XmlNode wholeWordsNode = userDocument.DocumentElement.SelectSingleNode("WholeLines");
|
||||
if (wholeWordsNode != null)
|
||||
{
|
||||
XmlNode newNode = userDocument.CreateNode(XmlNodeType.Element, "Line", null);
|
||||
XmlAttribute aFrom = userDocument.CreateAttribute("from");
|
||||
XmlAttribute aTo = userDocument.CreateAttribute("to");
|
||||
aTo.InnerText = toLine;
|
||||
aFrom.InnerText = fromLine;
|
||||
newNode.Attributes.Append(aFrom);
|
||||
newNode.Attributes.Append(aTo);
|
||||
wholeWordsNode.AppendChild(newNode);
|
||||
userDocument.Save(_replaceListXmlFileName);
|
||||
}
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
MessageBox.Show(exception + Environment.NewLine + exception.StackTrace);
|
||||
XmlNode newNode = userDocument.CreateNode(XmlNodeType.Element, "Line", null);
|
||||
XmlAttribute aFrom = userDocument.CreateAttribute("from");
|
||||
XmlAttribute aTo = userDocument.CreateAttribute("to");
|
||||
aTo.InnerText = toLine;
|
||||
aFrom.InnerText = fromLine;
|
||||
newNode.Attributes.Append(aFrom);
|
||||
newNode.Attributes.Append(aTo);
|
||||
wholeWordsNode.AppendChild(newNode);
|
||||
userDocument.Save(_replaceListXmlFileName);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,6 @@
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
@ -5,7 +5,6 @@ using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Nikse.SubtitleEdit.Core
|
||||
{
|
||||
@ -130,7 +129,7 @@ namespace Nikse.SubtitleEdit.Core
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
MessageBox.Show(exception.Message);
|
||||
System.Diagnostics.Debug.WriteLine(exception.Message);
|
||||
encoding = Encoding.UTF8;
|
||||
return null;
|
||||
}
|
||||
@ -150,7 +149,7 @@ namespace Nikse.SubtitleEdit.Core
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
MessageBox.Show(exception.Message);
|
||||
System.Diagnostics.Debug.WriteLine(exception.Message);
|
||||
encoding = Encoding.UTF8;
|
||||
return null;
|
||||
}
|
||||
|
@ -30,6 +30,8 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
|
||||
// </SubtitleList
|
||||
//</dcst:SubtitleReel>
|
||||
|
||||
public string Errors { get; private set; }
|
||||
|
||||
private double _frameRate = 24;
|
||||
|
||||
public int Version { get; set; }
|
||||
@ -95,6 +97,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
|
||||
|
||||
public override string ToText(Subtitle subtitle, string title)
|
||||
{
|
||||
Errors = null;
|
||||
var ss = Configuration.Settings.SubtitleSettings;
|
||||
|
||||
if (!string.IsNullOrEmpty(ss.CurrentDCinemaEditRate))
|
||||
@ -469,8 +472,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
if (!BatchMode)
|
||||
System.Windows.Forms.MessageBox.Show("SMPTE-428-7-2007-DCST.xsd: " + exception.Message);
|
||||
Errors = "Error validating xml via SMPTE - 428 - 7 - 2007 - DCST.xsd: " + exception.Message;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
@ -30,6 +30,8 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
|
||||
// </SubtitleList
|
||||
//</dcst:SubtitleReel>
|
||||
|
||||
public string Errors { get; private set; }
|
||||
|
||||
private double _frameRate = 24;
|
||||
|
||||
public int Version { get; set; }
|
||||
@ -95,6 +97,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
|
||||
|
||||
public override string ToText(Subtitle subtitle, string title)
|
||||
{
|
||||
Errors = null;
|
||||
var ss = Configuration.Settings.SubtitleSettings;
|
||||
|
||||
if (!string.IsNullOrEmpty(ss.CurrentDCinemaEditRate))
|
||||
@ -469,8 +472,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
if (!BatchMode)
|
||||
System.Windows.Forms.MessageBox.Show("SMPTE-428-7-2010-DCST.xsd: " + exception.Message);
|
||||
Errors = "Error validating xml via SMPTE-428-7-2010-DCST.xsd: " + exception.Message;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
@ -3,7 +3,6 @@ using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Windows.Forms.VisualStyles;
|
||||
|
||||
namespace Nikse.SubtitleEdit.Core.SubtitleFormats
|
||||
{
|
||||
|
@ -12,7 +12,6 @@ using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using System.Xml;
|
||||
|
||||
namespace Nikse.SubtitleEdit.Core
|
||||
@ -53,9 +52,9 @@ namespace Nikse.SubtitleEdit.Core
|
||||
info.VideoCodec = videoCodec;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch (Exception)
|
||||
{
|
||||
MessageBox.Show(ex.Message);
|
||||
throw;
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
@ -2615,7 +2615,8 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
encoding = Encoding.UTF8;
|
||||
SetEncoding(encoding);
|
||||
|
||||
if (format.GetType() == typeof(SubStationAlpha))
|
||||
var formatType = format.GetType();
|
||||
if (formatType == typeof(SubStationAlpha))
|
||||
{
|
||||
string errors = AdvancedSubStationAlpha.CheckForErrors(_subtitle.Header);
|
||||
if (!string.IsNullOrEmpty(errors))
|
||||
@ -2624,7 +2625,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
if (!string.IsNullOrEmpty(errors))
|
||||
MessageBox.Show(this, errors, Title, MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
}
|
||||
else if (format.GetType() == typeof(AdvancedSubStationAlpha))
|
||||
else if (formatType == typeof(AdvancedSubStationAlpha))
|
||||
{
|
||||
string errors = AdvancedSubStationAlpha.CheckForErrors(_subtitle.Header);
|
||||
if (!string.IsNullOrEmpty(errors))
|
||||
@ -2633,18 +2634,32 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
if (!string.IsNullOrEmpty(errors))
|
||||
MessageBox.Show(this, errors, Title, MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
}
|
||||
else if (format.GetType() == typeof(SubRip))
|
||||
else if (formatType == typeof(SubRip))
|
||||
{
|
||||
string errors = (format as SubRip).Errors;
|
||||
if (!string.IsNullOrEmpty(errors))
|
||||
MessageBox.Show(this, errors, Title, MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
}
|
||||
else if (format.GetType() == typeof(MicroDvd))
|
||||
else if (formatType == typeof(MicroDvd))
|
||||
{
|
||||
string errors = (format as MicroDvd).Errors;
|
||||
if (!string.IsNullOrEmpty(errors))
|
||||
MessageBox.Show(this, errors, Title, MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
}
|
||||
else if (formatType == typeof(DCinemaSmpte2007))
|
||||
{
|
||||
format.ToText(_subtitle, string.Empty);
|
||||
string errors = (format as DCinemaSmpte2007).Errors;
|
||||
if (!string.IsNullOrEmpty(errors))
|
||||
MessageBox.Show(errors, Title, MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
}
|
||||
else if (formatType == typeof(DCinemaSmpte2010))
|
||||
{
|
||||
format.ToText(_subtitle, string.Empty);
|
||||
string errors = (format as DCinemaSmpte2010).Errors;
|
||||
if (!string.IsNullOrEmpty(errors))
|
||||
MessageBox.Show(errors, Title, MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -3406,11 +3421,12 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
if (format.HasStyleSupport && _networkSession == null)
|
||||
{
|
||||
var styles = new List<string>();
|
||||
if (format.GetType() == typeof(AdvancedSubStationAlpha) || format.GetType() == typeof(SubStationAlpha))
|
||||
var formatType = format.GetType();
|
||||
if (formatType == typeof(AdvancedSubStationAlpha) || formatType == typeof(SubStationAlpha))
|
||||
styles = AdvancedSubStationAlpha.GetStylesFromHeader(_subtitle.Header);
|
||||
else if (format.GetType() == typeof(TimedText10) || format.GetType() == typeof(ItunesTimedText))
|
||||
else if (formatType == typeof(TimedText10) || formatType == typeof(ItunesTimedText))
|
||||
styles = TimedText10.GetStylesFromHeader(_subtitle.Header);
|
||||
else if (format.GetType() == typeof(Sami) || format.GetType() == typeof(SamiModern))
|
||||
else if (formatType == typeof(Sami) || formatType == typeof(SamiModern))
|
||||
styles = Sami.GetStylesFromHeader(_subtitle.Header);
|
||||
else if (format.Name == "Nuendo")
|
||||
styles = GetNuendoStyles();
|
||||
@ -3421,9 +3437,9 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
p.Extra = styles[0];
|
||||
}
|
||||
|
||||
if (format.GetType() == typeof(Sami) || format.GetType() == typeof(SamiModern))
|
||||
if (formatType == typeof(Sami) || formatType == typeof(SamiModern))
|
||||
SubtitleListview1.ShowExtraColumn(_languageGeneral.Class);
|
||||
else if (format.GetType() == typeof(TimedText10) || format.GetType() == typeof(ItunesTimedText))
|
||||
else if (formatType == typeof(TimedText10) || formatType == typeof(ItunesTimedText))
|
||||
SubtitleListview1.ShowExtraColumn(_languageGeneral.StyleLanguage);
|
||||
else if (format.Name == "Nuendo")
|
||||
SubtitleListview1.ShowExtraColumn(_languageGeneral.Character);
|
||||
@ -4576,24 +4592,39 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
index++;
|
||||
}
|
||||
|
||||
if (format.GetType() == typeof(AdvancedSubStationAlpha) || format.GetType() == typeof(SubStationAlpha))
|
||||
var formatType = format.GetType();
|
||||
if (formatType == typeof(AdvancedSubStationAlpha) || formatType == typeof(SubStationAlpha))
|
||||
{
|
||||
string errors = AdvancedSubStationAlpha.CheckForErrors(_subtitle.Header);
|
||||
if (!string.IsNullOrEmpty(errors))
|
||||
MessageBox.Show(errors, Title, MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
}
|
||||
else if (format.GetType() == typeof(SubRip))
|
||||
else if (formatType == typeof(SubRip))
|
||||
{
|
||||
string errors = (format as SubRip).Errors;
|
||||
if (!string.IsNullOrEmpty(errors))
|
||||
MessageBox.Show(errors, Title, MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
}
|
||||
else if (format.GetType() == typeof(MicroDvd))
|
||||
else if (formatType == typeof(MicroDvd))
|
||||
{
|
||||
string errors = (format as MicroDvd).Errors;
|
||||
if (!string.IsNullOrEmpty(errors))
|
||||
MessageBox.Show(errors, Title, MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
}
|
||||
else if (formatType == typeof(DCinemaSmpte2007))
|
||||
{
|
||||
format.ToText(_subtitle, string.Empty);
|
||||
string errors = (format as DCinemaSmpte2007).Errors;
|
||||
if (!string.IsNullOrEmpty(errors))
|
||||
MessageBox.Show(errors, Title, MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
}
|
||||
else if (formatType == typeof(DCinemaSmpte2010))
|
||||
{
|
||||
format.ToText(_subtitle, string.Empty);
|
||||
string errors = (format as DCinemaSmpte2010).Errors;
|
||||
if (!string.IsNullOrEmpty(errors))
|
||||
MessageBox.Show(errors, Title, MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user