Merge pull request #688 from ivandrofly/fix/patch-30

Fix/patch 30
This commit is contained in:
Nikolaj Olsson 2015-04-05 09:58:41 +02:00
commit 76a2e33bf2
2 changed files with 12 additions and 15 deletions

View File

@ -75,7 +75,7 @@
this.textBoxGeneral.Name = "textBoxGeneral"; this.textBoxGeneral.Name = "textBoxGeneral";
this.textBoxGeneral.ReadOnly = true; this.textBoxGeneral.ReadOnly = true;
this.textBoxGeneral.ScrollBars = System.Windows.Forms.ScrollBars.Both; this.textBoxGeneral.ScrollBars = System.Windows.Forms.ScrollBars.Both;
this.textBoxGeneral.Size = new System.Drawing.Size(693, 351); this.textBoxGeneral.Size = new System.Drawing.Size(694, 351);
this.textBoxGeneral.TabIndex = 0; this.textBoxGeneral.TabIndex = 0;
// //
// groupBoxMostUsed // groupBoxMostUsed
@ -122,14 +122,14 @@
this.textBoxMostUsedLines.Name = "textBoxMostUsedLines"; this.textBoxMostUsedLines.Name = "textBoxMostUsedLines";
this.textBoxMostUsedLines.ReadOnly = true; this.textBoxMostUsedLines.ReadOnly = true;
this.textBoxMostUsedLines.ScrollBars = System.Windows.Forms.ScrollBars.Both; this.textBoxMostUsedLines.ScrollBars = System.Windows.Forms.ScrollBars.Both;
this.textBoxMostUsedLines.Size = new System.Drawing.Size(367, 183); this.textBoxMostUsedLines.Size = new System.Drawing.Size(371, 183);
this.textBoxMostUsedLines.TabIndex = 3; this.textBoxMostUsedLines.TabIndex = 3;
// //
// textBoxMostUsedWords // textBoxMostUsedWords
// //
this.textBoxMostUsedWords.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) this.textBoxMostUsedWords.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left))); | System.Windows.Forms.AnchorStyles.Left)));
this.textBoxMostUsedWords.Location = new System.Drawing.Point(6, 43); this.textBoxMostUsedWords.Location = new System.Drawing.Point(9, 43);
this.textBoxMostUsedWords.Multiline = true; this.textBoxMostUsedWords.Multiline = true;
this.textBoxMostUsedWords.Name = "textBoxMostUsedWords"; this.textBoxMostUsedWords.Name = "textBoxMostUsedWords";
this.textBoxMostUsedWords.ReadOnly = true; this.textBoxMostUsedWords.ReadOnly = true;
@ -139,9 +139,10 @@
// //
// buttonExport // buttonExport
// //
this.buttonExport.Location = new System.Drawing.Point(534, 632); this.buttonExport.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonExport.Location = new System.Drawing.Point(532, 632);
this.buttonExport.Name = "buttonExport"; this.buttonExport.Name = "buttonExport";
this.buttonExport.Size = new System.Drawing.Size(102, 23); this.buttonExport.Size = new System.Drawing.Size(104, 21);
this.buttonExport.TabIndex = 2; this.buttonExport.TabIndex = 2;
this.buttonExport.Text = "Export"; this.buttonExport.Text = "Export";
this.buttonExport.UseVisualStyleBackColor = true; this.buttonExport.UseVisualStyleBackColor = true;

View File

@ -192,11 +192,11 @@ https://github.com/SubtitleEdit/subtitleedit
lastLine = lastLine.Replace("<U>", ""); lastLine = lastLine.Replace("<U>", "");
lastLine = lastLine.Replace("</U>", "."); lastLine = lastLine.Replace("</U>", ".");
var idx = lastLine.IndexOf("<font ", StringComparison.OrdinalIgnoreCase); var idx = lastLine.IndexOf("<font", StringComparison.OrdinalIgnoreCase);
var error = false; var error = false;
while (idx >= 0) while (idx >= 0)
{ {
var endIdx = lastLine.IndexOf('>', idx + 6); var endIdx = lastLine.IndexOf('>', idx + 5);
if (endIdx < idx) if (endIdx < idx)
{ {
error = !error; error = !error;
@ -204,7 +204,7 @@ https://github.com/SubtitleEdit/subtitleedit
} }
endIdx++; endIdx++;
lastLine = lastLine.Remove(idx, (endIdx - idx)); lastLine = lastLine.Remove(idx, (endIdx - idx));
idx = lastLine.IndexOf("<font ", StringComparison.OrdinalIgnoreCase); idx = lastLine.IndexOf("<font", StringComparison.OrdinalIgnoreCase);
} }
if (!error) if (!error)
lastLine = lastLine.Replace("</font>", "."); lastLine = lastLine.Replace("</font>", ".");
@ -249,8 +249,7 @@ https://github.com/SubtitleEdit/subtitleedit
lastLine = lastLine.Replace("...", "."); lastLine = lastLine.Replace("...", ".");
lastLine = lastLine.Replace("..", "."); lastLine = lastLine.Replace("..", ".");
lastLine = lastLine.Replace("-", " "); lastLine = lastLine.Replace("-", " ");
lastLine = lastLine.Replace(" ", " "); lastLine = lastLine.FixExtraSpaces();
lastLine = lastLine.Replace(" ", " ");
string[] lines = lastLine.Split('.'); string[] lines = lastLine.Split('.');
foreach (string line in lines) foreach (string line in lines)
@ -263,12 +262,9 @@ https://github.com/SubtitleEdit/subtitleedit
hits++; hits++;
hashtable[s] = hits.ToString(CultureInfo.InvariantCulture); hashtable[s] = hits.ToString(CultureInfo.InvariantCulture);
} }
else if (s.Length > 0) else if (s.Length > 0 && s.Contains(' '))
{ {
if (s.Contains(' ')) hashtable.Add(s, "1");
{
hashtable.Add(s, "1");
}
} }
} }
} }