More changes to fit as library

git-svn-id: https://subtitleedit.googlecode.com/svn/trunk@1503 99eadd0c-20b8-1223-b5c4-2a2b2df33de2
This commit is contained in:
niksedk 2012-11-22 08:07:30 +00:00
parent c6c970eb24
commit dc487bf855
5 changed files with 41 additions and 40 deletions

View File

@ -178,7 +178,7 @@ namespace Nikse.SubtitleEdit.Logic
return FileName; return FileName;
} }
internal string ToText(SubtitleFormat format) public string ToText(SubtitleFormat format)
{ {
return format.ToText(this, Path.GetFileNameWithoutExtension(FileName)); return format.ToText(this, Path.GetFileNameWithoutExtension(FileName));
} }
@ -254,7 +254,7 @@ namespace Nikse.SubtitleEdit.Logic
} }
} }
internal void ChangeFramerate(double oldFramerate, double newFramerate) public void ChangeFramerate(double oldFramerate, double newFramerate)
{ {
foreach (Paragraph p in Paragraphs) foreach (Paragraph p in Paragraphs)
{ {
@ -279,7 +279,7 @@ namespace Nikse.SubtitleEdit.Logic
} }
} }
internal void AdjustDisplayTimeUsingPercent(double percent, System.Windows.Forms.ListView.SelectedIndexCollection selectedIndexes) public void AdjustDisplayTimeUsingPercent(double percent, System.Windows.Forms.ListView.SelectedIndexCollection selectedIndexes)
{ {
for (int i = 0; i < _paragraphs.Count; i++) for (int i = 0; i < _paragraphs.Count; i++)
{ {
@ -298,7 +298,7 @@ namespace Nikse.SubtitleEdit.Logic
} }
} }
internal void AdjustDisplayTimeUsingSeconds(double seconds, System.Windows.Forms.ListView.SelectedIndexCollection selectedIndexes) public void AdjustDisplayTimeUsingSeconds(double seconds, System.Windows.Forms.ListView.SelectedIndexCollection selectedIndexes)
{ {
for (int i = 0; i < _paragraphs.Count; i++) for (int i = 0; i < _paragraphs.Count; i++)
{ {
@ -327,7 +327,7 @@ namespace Nikse.SubtitleEdit.Logic
} }
} }
internal void RecalculateDisplayTimes(double maxCharactersPerSecond, System.Windows.Forms.ListView.SelectedIndexCollection selectedIndexes) public void RecalculateDisplayTimes(double maxCharactersPerSecond, System.Windows.Forms.ListView.SelectedIndexCollection selectedIndexes)
{ {
for (int i = 0; i < _paragraphs.Count; i++) for (int i = 0; i < _paragraphs.Count; i++)
{ {
@ -354,8 +354,7 @@ namespace Nikse.SubtitleEdit.Logic
} }
} }
public void Renumber(int startNumber)
internal void Renumber(int startNumber)
{ {
int i = startNumber; int i = startNumber;
foreach (Paragraph p in _paragraphs) foreach (Paragraph p in _paragraphs)
@ -365,7 +364,7 @@ namespace Nikse.SubtitleEdit.Logic
} }
} }
internal int GetIndex(Paragraph p) public int GetIndex(Paragraph p)
{ {
if (p == null) if (p == null)
return -1; return -1;
@ -389,7 +388,7 @@ namespace Nikse.SubtitleEdit.Logic
return -1; return -1;
} }
internal Paragraph GetFirstAlike(Paragraph p) public Paragraph GetFirstAlike(Paragraph p)
{ {
foreach (Paragraph item in _paragraphs) foreach (Paragraph item in _paragraphs)
{ {
@ -401,7 +400,7 @@ namespace Nikse.SubtitleEdit.Logic
return null; return null;
} }
internal Paragraph GetFirstParagraphByLineNumber(int number) public Paragraph GetFirstParagraphByLineNumber(int number)
{ {
foreach (Paragraph p in _paragraphs) foreach (Paragraph p in _paragraphs)
{ {
@ -411,7 +410,7 @@ namespace Nikse.SubtitleEdit.Logic
return null; return null;
} }
internal int RemoveEmptyLines() public int RemoveEmptyLines()
{ {
int count = 0; int count = 0;
if (_paragraphs.Count > 0) if (_paragraphs.Count > 0)
@ -506,7 +505,7 @@ namespace Nikse.SubtitleEdit.Logic
} }
} }
internal void InsertParagraphInCorrectTimeOrder(Paragraph newParagraph) public void InsertParagraphInCorrectTimeOrder(Paragraph newParagraph)
{ {
for (int i=0; i<Paragraphs.Count; i++) for (int i=0; i<Paragraphs.Count; i++)
{ {

View File

@ -217,7 +217,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
{ {
if (buffer[i + 0] == 0xEA && if (buffer[i + 0] == 0xEA &&
buffer[i + 1] == 0x22 && buffer[i + 1] == 0x22 &&
buffer[i + 2] == 0x01) buffer[i + 2] < 3)
return true; return true;
} }
} }

View File

@ -15,12 +15,12 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
{ {
static readonly Regex RegExpr = new Regex(@"^[a-f0-9]{6}$", RegexOptions.Compiled); static readonly Regex RegExpr = new Regex(@"^[a-f0-9]{6}$", RegexOptions.Compiled);
internal EbuGeneralSubtitleInformation Header; public EbuGeneralSubtitleInformation Header;
/// <summary> /// <summary>
/// GSI block (1024 bytes) /// GSI block (1024 bytes)
/// </summary> /// </summary>
internal class EbuGeneralSubtitleInformation public class EbuGeneralSubtitleInformation
{ {
public string CodePageNumber { get; set; } // 0..2 public string CodePageNumber { get; set; } // 0..2
public string DiskFormatCode { get; set; } // 3..10 public string DiskFormatCode { get; set; } // 3..10
@ -174,7 +174,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
CommentFlag = 0; CommentFlag = 0;
} }
internal byte[] GetBytes(EbuGeneralSubtitleInformation header) public byte[] GetBytes(EbuGeneralSubtitleInformation header)
{ {
byte[] buffer = new byte[128]; // Text and Timing Information (TTI) block consists of 128 bytes byte[] buffer = new byte[128]; // Text and Timing Information (TTI) block consists of 128 bytes

View File

@ -18,7 +18,7 @@ namespace Nikse.SubtitleEdit.Logic
{ {
public static class Utilities public static class Utilities
{ {
internal const string WinXp2kUnicodeFontName = "Times New Roman"; public const string WinXp2kUnicodeFontName = "Times New Roman";
public static byte[] ReadAllBytes(String path) public static byte[] ReadAllBytes(String path)
{ {
@ -184,7 +184,7 @@ namespace Nikse.SubtitleEdit.Logic
return false; return false;
} }
internal static SubtitleFormat GetSubtitleFormatByFriendlyName(string friendlyName) public static SubtitleFormat GetSubtitleFormatByFriendlyName(string friendlyName)
{ {
foreach (SubtitleFormat format in SubtitleFormat.AllSubtitleFormats) foreach (SubtitleFormat format in SubtitleFormat.AllSubtitleFormats)
{ {
@ -720,7 +720,7 @@ namespace Nikse.SubtitleEdit.Logic
return RemoveHtmlFontTag(s); return RemoveHtmlFontTag(s);
} }
internal static string RemoveHtmlFontTag(string s) public static string RemoveHtmlFontTag(string s)
{ {
s = s.Replace("</font>", string.Empty); s = s.Replace("</font>", string.Empty);
s = s.Replace("</FONT>", string.Empty); s = s.Replace("</FONT>", string.Empty);
@ -737,7 +737,7 @@ namespace Nikse.SubtitleEdit.Logic
return s; return s;
} }
internal static string RemoveParagraphTag(string s) public static string RemoveParagraphTag(string s)
{ {
s = s.Replace("</p>", string.Empty); s = s.Replace("</p>", string.Empty);
s = s.Replace("</P>", string.Empty); s = s.Replace("</P>", string.Empty);
@ -1575,7 +1575,7 @@ namespace Nikse.SubtitleEdit.Logic
} }
} }
internal static void GetLineLengths(Label label, string text) public static void GetLineLengths(Label label, string text)
{ {
label.ForeColor = Color.Black; label.ForeColor = Color.Black;
string cleanText = Utilities.RemoveHtmlTags(text).Replace(Environment.NewLine, "|"); string cleanText = Utilities.RemoveHtmlTags(text).Replace(Environment.NewLine, "|");
@ -1609,7 +1609,7 @@ namespace Nikse.SubtitleEdit.Logic
label.Text = sb.ToString(); label.Text = sb.ToString();
} }
//internal static void DisplayLineLengths(Panel panelSingleLine, string text) //public static void DisplayLineLengths(Panel panelSingleLine, string text)
//{ //{
// string cleanText = RemoveHtmlTags(text).Replace(Environment.NewLine, "|"); // string cleanText = RemoveHtmlTags(text).Replace(Environment.NewLine, "|");
// string[] lines = cleanText.Split('|'); // string[] lines = cleanText.Split('|');
@ -1761,7 +1761,7 @@ namespace Nikse.SubtitleEdit.Logic
} }
internal static void LoadGlobalNamesEtc(List<string> namesEtcList, List<string> namesEtcMultiWordList) public static void LoadGlobalNamesEtc(List<string> namesEtcList, List<string> namesEtcMultiWordList)
{ {
// Load names etc list (names/noise words) // Load names etc list (names/noise words)
var namesEtcDoc = new XmlDocument(); var namesEtcDoc = new XmlDocument();
@ -1800,7 +1800,7 @@ namespace Nikse.SubtitleEdit.Logic
} }
} }
internal static void LoadGlobalNamesEtc(HashSet<string> namesEtcList, HashSet<string> namesEtcMultiWordList) public static void LoadGlobalNamesEtc(HashSet<string> namesEtcList, HashSet<string> namesEtcMultiWordList)
{ {
// Load names etc list (names/noise words) // Load names etc list (names/noise words)
var namesEtcDoc = new XmlDocument(); var namesEtcDoc = new XmlDocument();
@ -1840,7 +1840,7 @@ namespace Nikse.SubtitleEdit.Logic
} }
internal static string LoadLocalNamesEtc(List<string> namesEtcList, List<string> namesEtcMultiWordList, string languageName) public static string LoadLocalNamesEtc(List<string> namesEtcList, List<string> namesEtcMultiWordList, string languageName)
{ {
string userNamesEtcXmlFileName = DictionaryFolder + languageName + "_names_etc.xml"; string userNamesEtcXmlFileName = DictionaryFolder + languageName + "_names_etc.xml";
if (languageName.Length == 2) if (languageName.Length == 2)
@ -1872,7 +1872,7 @@ namespace Nikse.SubtitleEdit.Logic
return userNamesEtcXmlFileName; return userNamesEtcXmlFileName;
} }
internal static string LoadLocalNamesEtc(HashSet<string> namesEtcList, HashSet<string> namesEtcMultiWordList, string languageName) public static string LoadLocalNamesEtc(HashSet<string> namesEtcList, HashSet<string> namesEtcMultiWordList, string languageName)
{ {
string userNamesEtcXmlFileName = DictionaryFolder + languageName + "_names_etc.xml"; string userNamesEtcXmlFileName = DictionaryFolder + languageName + "_names_etc.xml";
if (languageName.Length == 2) if (languageName.Length == 2)
@ -1905,7 +1905,7 @@ namespace Nikse.SubtitleEdit.Logic
} }
internal static bool IsInNamesEtcMultiWordList(List<string> namesEtcMultiWordList, string line, string word) public static bool IsInNamesEtcMultiWordList(List<string> namesEtcMultiWordList, string line, string word)
{ {
string text = line.Replace(Environment.NewLine, " "); string text = line.Replace(Environment.NewLine, " ");
text = text.Replace(" ", " "); text = text.Replace(" ", " ");
@ -1923,7 +1923,7 @@ namespace Nikse.SubtitleEdit.Logic
return false; return false;
} }
internal static bool IsInNamesEtcMultiWordList(HashSet<string> namesEtcMultiWordList, string line, string word) public static bool IsInNamesEtcMultiWordList(HashSet<string> namesEtcMultiWordList, string line, string word)
{ {
string text = line.Replace(Environment.NewLine, " "); string text = line.Replace(Environment.NewLine, " ");
text = text.Replace(" ", " "); text = text.Replace(" ", " ");
@ -1999,7 +1999,7 @@ namespace Nikse.SubtitleEdit.Logic
return sb.ToString(); return sb.ToString();
} }
internal static Color GetColorFromUserName(string userName) public static Color GetColorFromUserName(string userName)
{ {
if (string.IsNullOrEmpty(userName)) if (string.IsNullOrEmpty(userName))
return Color.Pink; return Color.Pink;
@ -2037,7 +2037,7 @@ namespace Nikse.SubtitleEdit.Logic
} }
} }
internal static int GetNumber0To7FromUserName(string userName) public static int GetNumber0To7FromUserName(string userName)
{ {
if (string.IsNullOrEmpty(userName)) if (string.IsNullOrEmpty(userName))
return 0; return 0;
@ -2050,7 +2050,7 @@ namespace Nikse.SubtitleEdit.Logic
return (int)(number % 8); return (int)(number % 8);
} }
internal static string GetRegExGroup(string regEx) public static string GetRegExGroup(string regEx)
{ {
int start = regEx.IndexOf("(?<"); int start = regEx.IndexOf("(?<");
if (start >= 0 && regEx.IndexOf(")", start) > start) if (start >= 0 && regEx.IndexOf(")", start) > start)
@ -2066,7 +2066,7 @@ namespace Nikse.SubtitleEdit.Logic
return null; return null;
} }
internal static string LowerCaseVowels public static string LowerCaseVowels
{ {
get get
{ {
@ -2074,7 +2074,7 @@ namespace Nikse.SubtitleEdit.Logic
} }
} }
internal static void SetButtonHeight(Control control, int newHeight, int level) public static void SetButtonHeight(Control control, int newHeight, int level)
{ {
if (level > 6) if (level > 6)
return; return;
@ -2093,7 +2093,7 @@ namespace Nikse.SubtitleEdit.Logic
control.Height = newHeight; control.Height = newHeight;
} }
internal static int CountTagInText(string text, string tag) public static int CountTagInText(string text, string tag)
{ {
int count = 0; int count = 0;
int index = text.IndexOf(tag); int index = text.IndexOf(tag);
@ -2105,7 +2105,7 @@ namespace Nikse.SubtitleEdit.Logic
return count; return count;
} }
internal static string FixInvalidItalicTags(string text) public static string FixInvalidItalicTags(string text)
{ {
const string beginTag = "<i>"; const string beginTag = "<i>";
const string endTag = "</i>"; const string endTag = "</i>";
@ -2218,7 +2218,7 @@ namespace Nikse.SubtitleEdit.Logic
return text; return text;
} }
internal static Paragraph GetOriginalParagraph(int index, Paragraph paragraph, List<Paragraph> originalParagraphs) public static Paragraph GetOriginalParagraph(int index, Paragraph paragraph, List<Paragraph> originalParagraphs)
{ {
if (index < 0) if (index < 0)
return null; return null;
@ -2246,7 +2246,7 @@ namespace Nikse.SubtitleEdit.Logic
/// </summary> /// </summary>
/// <param name="text">Text string to encode</param> /// <param name="text">Text string to encode</param>
/// <returns>HTML-encoded text</returns> /// <returns>HTML-encoded text</returns>
internal static string HtmlEncode(string text) public static string HtmlEncode(string text)
{ {
if (text == null) if (text == null)
return string.Empty; return string.Empty;
@ -2284,7 +2284,7 @@ namespace Nikse.SubtitleEdit.Logic
/// </summary> /// </summary>
/// <param name="text">Text string to encode</param> /// <param name="text">Text string to encode</param>
/// <returns>HTML-decoded text</returns> /// <returns>HTML-decoded text</returns>
internal static string HtmlDecode(string text) public static string HtmlDecode(string text)
{ {
if (text == null) if (text == null)
return string.Empty; return string.Empty;
@ -2611,7 +2611,7 @@ namespace Nikse.SubtitleEdit.Logic
return System.Uri.UnescapeDataString(text); return System.Uri.UnescapeDataString(text);
} }
internal static bool IsWordInUserPhrases(List<string> userPhraseList, int index, string[] words) public static bool IsWordInUserPhrases(List<string> userPhraseList, int index, string[] words)
{ {
string current = words[index]; string current = words[index];
string prev = "-"; string prev = "-";
@ -2630,7 +2630,7 @@ namespace Nikse.SubtitleEdit.Logic
return false; return false;
} }
internal static void CheckAutoWrap(TextBox textBox, KeyEventArgs e, int numberOfNewLines) public static void CheckAutoWrap(TextBox textBox, KeyEventArgs e, int numberOfNewLines)
{ {
if (e.Modifiers == Keys.None && e.KeyCode != Keys.Enter && numberOfNewLines < 1 && textBox.Text.Length >= Configuration.Settings.General.SubtitleLineMaximumLength) if (e.Modifiers == Keys.None && e.KeyCode != Keys.Enter && numberOfNewLines < 1 && textBox.Text.Length >= Configuration.Settings.General.SubtitleLineMaximumLength)
{ {

View File

@ -837,6 +837,8 @@
<Compile Include="Logic\SubtitleFormats\UnknownSubtitle38.cs" /> <Compile Include="Logic\SubtitleFormats\UnknownSubtitle38.cs" />
<Compile Include="Logic\SubtitleFormats\UnknownSubtitle39.cs" /> <Compile Include="Logic\SubtitleFormats\UnknownSubtitle39.cs" />
<Compile Include="Logic\SubtitleFormats\UnknownSubtitle40.cs" /> <Compile Include="Logic\SubtitleFormats\UnknownSubtitle40.cs" />
<Compile Include="Logic\SubtitleFormats\UnknownSubtitle41.cs" />
<Compile Include="Logic\SubtitleFormats\UnknownSubtitle42.cs" />
<Compile Include="Logic\SubtitleFormats\UnknownSubtitle5.cs" /> <Compile Include="Logic\SubtitleFormats\UnknownSubtitle5.cs" />
<Compile Include="Logic\SubtitleFormats\OpenDvt.cs" /> <Compile Include="Logic\SubtitleFormats\OpenDvt.cs" />
<Compile Include="Logic\SubtitleFormats\AbcIViewer.cs" /> <Compile Include="Logic\SubtitleFormats\AbcIViewer.cs" />