protected virtual void Dispose(bool disposing) { if (disposing) { if (this._timerWebService != null) { this._timerWebService.Dispose(); this._timerWebService = null; } if (this._seWs != null) { this._seWs.Dispose(); this._seWs = null; } } }
public void StartServer(string webServiceUrl, string sessionKey, string userName, string fileName, out string message) { this.SessionId = sessionKey; this.UserName = userName; this.FileName = fileName; List<SeSequence> list = new List<SeSequence>(); foreach (Paragraph p in this.Subtitle.Paragraphs) { list.Add(new SeSequence { StartMilliseconds = (int)p.StartTime.TotalMilliseconds, EndMilliseconds = (int)p.EndTime.TotalMilliseconds, Text = WebUtility.HtmlEncode(p.Text.Replace(Environment.NewLine, "<br />")) }); } List<SeSequence> originalSubtitle = new List<SeSequence>(); if (this.OriginalSubtitle != null) { foreach (Paragraph p in this.OriginalSubtitle.Paragraphs) { originalSubtitle.Add(new SeSequence { StartMilliseconds = (int)p.StartTime.TotalMilliseconds, EndMilliseconds = (int)p.EndTime.TotalMilliseconds, Text = WebUtility.HtmlEncode(p.Text.Replace(Environment.NewLine, "<br />")) }); } } this._seWs = new SeService(); this._seWs.Url = webServiceUrl; this._seWs.Proxy = Utilities.GetProxy(); SeUser user = this._seWs.Start(sessionKey, userName, list.ToArray(), originalSubtitle.ToArray(), fileName, out message); this.CurrentUser = user; this.Users = new List<SeUser>(); this.Users.Add(user); if (message == "OK") { this._timerWebService.Start(); } }
public bool Join(string webServiceUrl, string userName, string sessionKey, out string message) { this.SessionId = sessionKey; this._seWs = new SeService(); this._seWs.Url = webServiceUrl; this._seWs.Proxy = Utilities.GetProxy(); this.Users = new List<SeUser>(); SeUser[] users = this._seWs.Join(sessionKey, userName, out message); if (message != "OK") { return false; } string tempFileName; DateTime updateTime; this.Subtitle = new Subtitle(); foreach (SeSequence sequence in this._seWs.GetSubtitle(sessionKey, out tempFileName, out updateTime)) { this.Subtitle.Paragraphs.Add(new Paragraph(WebUtility.HtmlDecode(sequence.Text).Replace("<br />", Environment.NewLine), sequence.StartMilliseconds, sequence.EndMilliseconds)); } this.FileName = tempFileName; this.OriginalSubtitle = new Subtitle(); SeSequence[] sequences = this._seWs.GetOriginalSubtitle(sessionKey); if (sequences != null) { foreach (SeSequence sequence in sequences) { this.OriginalSubtitle.Paragraphs.Add(new Paragraph(WebUtility.HtmlDecode(sequence.Text).Replace("<br />", Environment.NewLine), sequence.StartMilliseconds, sequence.EndMilliseconds)); } } this.SessionId = sessionKey; this.CurrentUser = users[users.Length - 1]; // me foreach (SeUser user in users) { this.Users.Add(user); } this.ReloadFromWs(); this._timerWebService.Start(); return true; }