mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-22 03:02:35 +01:00
Use html encoding for text in "Networking" mode
git-svn-id: https://subtitleedit.googlecode.com/svn/trunk@202 99eadd0c-20b8-1223-b5c4-2a2b2df33de2
This commit is contained in:
parent
e07f7f4427
commit
101221d700
@ -1,6 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using System.Web;
|
||||||
|
|
||||||
namespace Nikse.SubtitleEdit.Logic.Networking
|
namespace Nikse.SubtitleEdit.Logic.Networking
|
||||||
{
|
{
|
||||||
@ -59,7 +60,7 @@ namespace Nikse.SubtitleEdit.Logic.Networking
|
|||||||
{
|
{
|
||||||
StartMilliseconds = (int)p.StartTime.TotalMilliseconds,
|
StartMilliseconds = (int)p.StartTime.TotalMilliseconds,
|
||||||
EndMilliseconds = (int)p.EndTime.TotalMilliseconds,
|
EndMilliseconds = (int)p.EndTime.TotalMilliseconds,
|
||||||
Text = p.Text.Replace(Environment.NewLine, "<br />")
|
Text = Utilities.HtmlEncode(p.Text.Replace(Environment.NewLine, "<br />"))
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -72,7 +73,7 @@ namespace Nikse.SubtitleEdit.Logic.Networking
|
|||||||
{
|
{
|
||||||
StartMilliseconds = (int)p.StartTime.TotalMilliseconds,
|
StartMilliseconds = (int)p.StartTime.TotalMilliseconds,
|
||||||
EndMilliseconds = (int)p.EndTime.TotalMilliseconds,
|
EndMilliseconds = (int)p.EndTime.TotalMilliseconds,
|
||||||
Text = p.Text.Replace(Environment.NewLine, "<br />")
|
Text = Utilities.HtmlEncode(p.Text.Replace(Environment.NewLine, "<br />"))
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -103,7 +104,7 @@ namespace Nikse.SubtitleEdit.Logic.Networking
|
|||||||
DateTime updateTime;
|
DateTime updateTime;
|
||||||
Subtitle = new Subtitle();
|
Subtitle = new Subtitle();
|
||||||
foreach (var sequence in _seWs.GetSubtitle(sessionKey, out tempFileName, out updateTime))
|
foreach (var sequence in _seWs.GetSubtitle(sessionKey, out tempFileName, out updateTime))
|
||||||
Subtitle.Paragraphs.Add(new Paragraph(sequence.Text.Replace("<br />", Environment.NewLine), sequence.StartMilliseconds, sequence.EndMilliseconds));
|
Subtitle.Paragraphs.Add(new Paragraph(HttpUtility.HtmlDecode(sequence.Text).Replace("<br />", Environment.NewLine), sequence.StartMilliseconds, sequence.EndMilliseconds));
|
||||||
FileName = tempFileName;
|
FileName = tempFileName;
|
||||||
|
|
||||||
OriginalSubtitle = new Subtitle();
|
OriginalSubtitle = new Subtitle();
|
||||||
@ -111,7 +112,7 @@ namespace Nikse.SubtitleEdit.Logic.Networking
|
|||||||
if (sequences != null)
|
if (sequences != null)
|
||||||
{
|
{
|
||||||
foreach (var sequence in sequences)
|
foreach (var sequence in sequences)
|
||||||
OriginalSubtitle.Paragraphs.Add(new Paragraph(sequence.Text.Replace("<br />", Environment.NewLine), sequence.StartMilliseconds, sequence.EndMilliseconds));
|
OriginalSubtitle.Paragraphs.Add(new Paragraph(HttpUtility.HtmlDecode(sequence.Text).Replace("<br />", Environment.NewLine), sequence.StartMilliseconds, sequence.EndMilliseconds));
|
||||||
}
|
}
|
||||||
|
|
||||||
SessionId = sessionKey;
|
SessionId = sessionKey;
|
||||||
@ -155,7 +156,7 @@ namespace Nikse.SubtitleEdit.Logic.Networking
|
|||||||
var sequences = _seWs.GetSubtitle(SessionId, out FileName, out _seWsLastUpdate);
|
var sequences = _seWs.GetSubtitle(SessionId, out FileName, out _seWsLastUpdate);
|
||||||
foreach (var sequence in sequences)
|
foreach (var sequence in sequences)
|
||||||
{
|
{
|
||||||
Paragraph p = new Paragraph(sequence.Text.Replace("<br />", Environment.NewLine), sequence.StartMilliseconds, sequence.EndMilliseconds);
|
Paragraph p = new Paragraph(HttpUtility.HtmlDecode(sequence.Text).Replace("<br />", Environment.NewLine), sequence.StartMilliseconds, sequence.EndMilliseconds);
|
||||||
Subtitle.Paragraphs.Add(p);
|
Subtitle.Paragraphs.Add(p);
|
||||||
}
|
}
|
||||||
Subtitle.Renumber(1);
|
Subtitle.Renumber(1);
|
||||||
@ -166,7 +167,7 @@ namespace Nikse.SubtitleEdit.Logic.Networking
|
|||||||
public void Log(string text)
|
public void Log(string text)
|
||||||
{
|
{
|
||||||
string timestamp = DateTime.Now.ToLongTimeString();
|
string timestamp = DateTime.Now.ToLongTimeString();
|
||||||
_log.AppendLine(timestamp + ": " + text.TrimEnd() .Replace(Environment.NewLine, Configuration.Settings.General.ListViewLineSeparatorString));
|
_log.AppendLine(timestamp + ": " + text.TrimEnd().Replace(Environment.NewLine, Configuration.Settings.General.ListViewLineSeparatorString));
|
||||||
}
|
}
|
||||||
|
|
||||||
public string GetLog()
|
public string GetLog()
|
||||||
@ -176,7 +177,7 @@ namespace Nikse.SubtitleEdit.Logic.Networking
|
|||||||
|
|
||||||
public void SendChatMessage(string message)
|
public void SendChatMessage(string message)
|
||||||
{
|
{
|
||||||
_seWs.SendMessage(SessionId, message.Replace(Environment.NewLine, "<br />"), CurrentUser);
|
_seWs.SendMessage(SessionId, Utilities.HtmlEncode(message.Replace(Environment.NewLine, "<br />")), CurrentUser);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void UpdateLine(int index, Paragraph paragraph)
|
internal void UpdateLine(int index, Paragraph paragraph)
|
||||||
@ -185,7 +186,7 @@ namespace Nikse.SubtitleEdit.Logic.Networking
|
|||||||
{
|
{
|
||||||
StartMilliseconds = (int)paragraph.StartTime.TotalMilliseconds,
|
StartMilliseconds = (int)paragraph.StartTime.TotalMilliseconds,
|
||||||
EndMilliseconds = (int)paragraph.EndTime.TotalMilliseconds,
|
EndMilliseconds = (int)paragraph.EndTime.TotalMilliseconds,
|
||||||
Text = paragraph.Text.Replace(Environment.NewLine, "<br />")
|
Text = Utilities.HtmlEncode(paragraph.Text.Replace(Environment.NewLine, "<br />"))
|
||||||
}, CurrentUser);
|
}, CurrentUser);
|
||||||
AddToWsUserLog(CurrentUser, index, "UPD", true);
|
AddToWsUserLog(CurrentUser, index, "UPD", true);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user