diff --git a/src/Forms/Main.cs b/src/Forms/Main.cs index caebee28c..97956c27e 100644 --- a/src/Forms/Main.cs +++ b/src/Forms/Main.cs @@ -3015,12 +3015,12 @@ namespace Nikse.SubtitleEdit.Forms var indexes = new List(); foreach (ListViewItem item in SubtitleListview1.SelectedItems) indexes.Add(item.Index); - int firstIndex = SubtitleListview1.SelectedItems[0].Index; + int firstIndex = SubtitleListview1.SelectedItems[0].Index; if (_networkSession != null) { _networkSession.TimerStop(); - NetworkGetSendUpdates(indexes, 0, null); + NetworkGetSendUpdates(indexes, 0, null); } else { @@ -7375,10 +7375,11 @@ namespace Nikse.SubtitleEdit.Forms SubtitleListview1.SelectedIndexChanged -= SubtitleListview1_SelectedIndexChanged; string message = string.Empty; + int numberOfLines = 0; List updates = null; try { - updates = _networkSession.GetUpdates(out message); + updates = _networkSession.GetUpdates(out message, out numberOfLines); } catch (Exception exception) { @@ -7541,6 +7542,18 @@ namespace Nikse.SubtitleEdit.Forms } } } + if (numberOfLines != _subtitle.Paragraphs.Count) + { + _subtitle = _networkSession.ReloadSubtitle(); + SubtitleListview1.Fill(_subtitle, _subtitleAlternate); + UpdateListviewWithUserLogEntries(); + _networkSession.LastSubtitle = new Subtitle(_subtitle); + _oldSelectedParagraph = null; + SubtitleListview1.SelectedIndexChanged += SubtitleListview1_SelectedIndexChanged; + _networkSession.TimerStart(); + RefreshSelectedParagraph(); + return; + } if (deleteIndices.Count > 0) { deleteIndices.Sort(); @@ -7564,8 +7577,6 @@ namespace Nikse.SubtitleEdit.Forms doReFill = true; } _networkSession.CheckForAndSubmitUpdates(updates); // updates only (no inserts/deletes) - - //TODO: do some compare lines count... and reload if no match! } else { diff --git a/src/Forms/NetworkJoin.Designer.cs b/src/Forms/NetworkJoin.Designer.cs index 5788ee190..57fae5738 100644 --- a/src/Forms/NetworkJoin.Designer.cs +++ b/src/Forms/NetworkJoin.Designer.cs @@ -43,7 +43,7 @@ // labelStatus // this.labelStatus.AutoSize = true; - this.labelStatus.Location = new System.Drawing.Point(35, 197); + this.labelStatus.Location = new System.Drawing.Point(35, 173); this.labelStatus.Name = "labelStatus"; this.labelStatus.Size = new System.Drawing.Size(59, 13); this.labelStatus.TabIndex = 18; @@ -60,13 +60,13 @@ // // labelWebServiceUrl // - this.labelWebServiceUrl.AutoSize = true; this.labelWebServiceUrl.ImeMode = System.Windows.Forms.ImeMode.NoControl; - this.labelWebServiceUrl.Location = new System.Drawing.Point(9, 138); + this.labelWebServiceUrl.Location = new System.Drawing.Point(2, 112); this.labelWebServiceUrl.Name = "labelWebServiceUrl"; - this.labelWebServiceUrl.Size = new System.Drawing.Size(81, 13); + this.labelWebServiceUrl.Size = new System.Drawing.Size(92, 21); this.labelWebServiceUrl.TabIndex = 16; this.labelWebServiceUrl.Text = "Web service url"; + this.labelWebServiceUrl.TextAlign = System.Drawing.ContentAlignment.TopRight; // // comboBoxWebServiceUrl // @@ -74,7 +74,7 @@ this.comboBoxWebServiceUrl.Items.AddRange(new object[] { "http://www.nikse.dk/se/SeService.asmx", "http://nikse555.brinkster.net/SeService.asmx"}); - this.comboBoxWebServiceUrl.Location = new System.Drawing.Point(96, 131); + this.comboBoxWebServiceUrl.Location = new System.Drawing.Point(96, 107); this.comboBoxWebServiceUrl.Name = "comboBoxWebServiceUrl"; this.comboBoxWebServiceUrl.Size = new System.Drawing.Size(290, 21); this.comboBoxWebServiceUrl.TabIndex = 2; @@ -82,7 +82,7 @@ // buttonCancel // this.buttonCancel.ImeMode = System.Windows.Forms.ImeMode.NoControl; - this.buttonCancel.Location = new System.Drawing.Point(311, 173); + this.buttonCancel.Location = new System.Drawing.Point(311, 149); this.buttonCancel.Name = "buttonCancel"; this.buttonCancel.Size = new System.Drawing.Size(75, 21); this.buttonCancel.TabIndex = 4; @@ -92,7 +92,7 @@ // // textBoxUserName // - this.textBoxUserName.Location = new System.Drawing.Point(96, 79); + this.textBoxUserName.Location = new System.Drawing.Point(96, 55); this.textBoxUserName.Name = "textBoxUserName"; this.textBoxUserName.Size = new System.Drawing.Size(290, 20); this.textBoxUserName.TabIndex = 0; @@ -100,7 +100,7 @@ // buttonJoin // this.buttonJoin.ImeMode = System.Windows.Forms.ImeMode.NoControl; - this.buttonJoin.Location = new System.Drawing.Point(230, 173); + this.buttonJoin.Location = new System.Drawing.Point(230, 149); this.buttonJoin.Name = "buttonJoin"; this.buttonJoin.Size = new System.Drawing.Size(75, 21); this.buttonJoin.TabIndex = 3; @@ -110,36 +110,36 @@ // // labelUserName // - this.labelUserName.AutoSize = true; this.labelUserName.ImeMode = System.Windows.Forms.ImeMode.NoControl; - this.labelUserName.Location = new System.Drawing.Point(35, 82); + this.labelUserName.Location = new System.Drawing.Point(-1, 55); this.labelUserName.Name = "labelUserName"; - this.labelUserName.Size = new System.Drawing.Size(55, 13); + this.labelUserName.Size = new System.Drawing.Size(91, 20); this.labelUserName.TabIndex = 11; this.labelUserName.Text = "Username"; + this.labelUserName.TextAlign = System.Drawing.ContentAlignment.TopRight; // // textBoxSessionKey // - this.textBoxSessionKey.Location = new System.Drawing.Point(96, 105); + this.textBoxSessionKey.Location = new System.Drawing.Point(96, 81); this.textBoxSessionKey.Name = "textBoxSessionKey"; this.textBoxSessionKey.Size = new System.Drawing.Size(290, 20); this.textBoxSessionKey.TabIndex = 1; // // labelSessionKey // - this.labelSessionKey.AutoSize = true; this.labelSessionKey.ImeMode = System.Windows.Forms.ImeMode.NoControl; - this.labelSessionKey.Location = new System.Drawing.Point(35, 108); + this.labelSessionKey.Location = new System.Drawing.Point(2, 81); this.labelSessionKey.Name = "labelSessionKey"; - this.labelSessionKey.Size = new System.Drawing.Size(25, 13); + this.labelSessionKey.Size = new System.Drawing.Size(88, 20); this.labelSessionKey.TabIndex = 19; this.labelSessionKey.Text = "Key"; + this.labelSessionKey.TextAlign = System.Drawing.ContentAlignment.TopRight; // // NetworkJoin // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(408, 214); + this.ClientSize = new System.Drawing.Size(408, 191); this.Controls.Add(this.textBoxSessionKey); this.Controls.Add(this.labelSessionKey); this.Controls.Add(this.labelStatus); diff --git a/src/Forms/NetworkLogAndInfo.Designer.cs b/src/Forms/NetworkLogAndInfo.Designer.cs index f0d735cd5..514cab760 100644 --- a/src/Forms/NetworkLogAndInfo.Designer.cs +++ b/src/Forms/NetworkLogAndInfo.Designer.cs @@ -49,13 +49,13 @@ // // labelSessionKey // - this.labelSessionKey.AutoSize = true; this.labelSessionKey.ImeMode = System.Windows.Forms.ImeMode.NoControl; - this.labelSessionKey.Location = new System.Drawing.Point(87, 19); + this.labelSessionKey.Location = new System.Drawing.Point(12, 19); this.labelSessionKey.Name = "labelSessionKey"; - this.labelSessionKey.Size = new System.Drawing.Size(64, 13); + this.labelSessionKey.Size = new System.Drawing.Size(139, 17); this.labelSessionKey.TabIndex = 21; this.labelSessionKey.Text = "Session key"; + this.labelSessionKey.TextAlign = System.Drawing.ContentAlignment.TopRight; // // labelLog // @@ -75,6 +75,7 @@ this.textBoxLog.Multiline = true; this.textBoxLog.Name = "textBoxLog"; this.textBoxLog.ReadOnly = true; + this.textBoxLog.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; this.textBoxLog.Size = new System.Drawing.Size(543, 179); this.textBoxLog.TabIndex = 4; // @@ -92,13 +93,13 @@ // // labelWebServiceUrl // - this.labelWebServiceUrl.AutoSize = true; this.labelWebServiceUrl.ImeMode = System.Windows.Forms.ImeMode.NoControl; - this.labelWebServiceUrl.Location = new System.Drawing.Point(70, 71); + this.labelWebServiceUrl.Location = new System.Drawing.Point(12, 71); this.labelWebServiceUrl.Name = "labelWebServiceUrl"; - this.labelWebServiceUrl.Size = new System.Drawing.Size(81, 13); + this.labelWebServiceUrl.Size = new System.Drawing.Size(139, 17); this.labelWebServiceUrl.TabIndex = 29; this.labelWebServiceUrl.Text = "Web service url"; + this.labelWebServiceUrl.TextAlign = System.Drawing.ContentAlignment.TopRight; // // textBoxUserName // @@ -110,13 +111,13 @@ // // labelUserName // - this.labelUserName.AutoSize = true; this.labelUserName.ImeMode = System.Windows.Forms.ImeMode.NoControl; - this.labelUserName.Location = new System.Drawing.Point(96, 45); + this.labelUserName.Location = new System.Drawing.Point(12, 45); this.labelUserName.Name = "labelUserName"; - this.labelUserName.Size = new System.Drawing.Size(55, 13); + this.labelUserName.Size = new System.Drawing.Size(139, 17); this.labelUserName.TabIndex = 28; this.labelUserName.Text = "Username"; + this.labelUserName.TextAlign = System.Drawing.ContentAlignment.TopRight; // // textBoxWebServiceUrl // diff --git a/src/Forms/NetworkStart.Designer.cs b/src/Forms/NetworkStart.Designer.cs index 5e565a408..5d787b8a1 100644 --- a/src/Forms/NetworkStart.Designer.cs +++ b/src/Forms/NetworkStart.Designer.cs @@ -71,13 +71,13 @@ // // labelUserName // - this.labelUserName.AutoSize = true; this.labelUserName.ImeMode = System.Windows.Forms.ImeMode.NoControl; - this.labelUserName.Location = new System.Drawing.Point(36, 86); + this.labelUserName.Location = new System.Drawing.Point(2, 86); this.labelUserName.Name = "labelUserName"; - this.labelUserName.Size = new System.Drawing.Size(55, 13); + this.labelUserName.Size = new System.Drawing.Size(89, 13); this.labelUserName.TabIndex = 3; this.labelUserName.Text = "Username"; + this.labelUserName.TextAlign = System.Drawing.ContentAlignment.TopRight; // // comboBoxWebServiceUrl // @@ -92,13 +92,13 @@ // // labelWebServiceUrl // - this.labelWebServiceUrl.AutoSize = true; this.labelWebServiceUrl.ImeMode = System.Windows.Forms.ImeMode.NoControl; - this.labelWebServiceUrl.Location = new System.Drawing.Point(10, 112); + this.labelWebServiceUrl.Location = new System.Drawing.Point(2, 109); this.labelWebServiceUrl.Name = "labelWebServiceUrl"; - this.labelWebServiceUrl.Size = new System.Drawing.Size(81, 13); + this.labelWebServiceUrl.Size = new System.Drawing.Size(89, 16); this.labelWebServiceUrl.TabIndex = 8; this.labelWebServiceUrl.Text = "Web service url"; + this.labelWebServiceUrl.TextAlign = System.Drawing.ContentAlignment.TopRight; // // labelInfo // @@ -120,13 +120,13 @@ // // labelSessionKey // - this.labelSessionKey.AutoSize = true; this.labelSessionKey.ImeMode = System.Windows.Forms.ImeMode.NoControl; - this.labelSessionKey.Location = new System.Drawing.Point(26, 60); + this.labelSessionKey.Location = new System.Drawing.Point(-1, 60); this.labelSessionKey.Name = "labelSessionKey"; - this.labelSessionKey.Size = new System.Drawing.Size(65, 13); + this.labelSessionKey.Size = new System.Drawing.Size(92, 17); this.labelSessionKey.TabIndex = 11; this.labelSessionKey.Text = "Session Key"; + this.labelSessionKey.TextAlign = System.Drawing.ContentAlignment.TopRight; // // textBoxSessionKey // diff --git a/src/Logic/Networking/NikseWebServiceSession.cs b/src/Logic/Networking/NikseWebServiceSession.cs index 43999e522..c4ecba55c 100644 --- a/src/Logic/Networking/NikseWebServiceSession.cs +++ b/src/Logic/Networking/NikseWebServiceSession.cs @@ -140,17 +140,33 @@ namespace Nikse.SubtitleEdit.Logic.Networking _timerWebService.Start(); } - public List GetUpdates(out string message) + public List GetUpdates(out string message, out int numberOfLines) { List list = new List(); DateTime newUpdateTime; - var updates = _seWs.GetUpdates(SessionId, CurrentUser.UserName, _seWsLastUpdate, out message, out newUpdateTime); + var updates = _seWs.GetUpdates(SessionId, CurrentUser.UserName, _seWsLastUpdate, out message, out newUpdateTime, out numberOfLines); foreach (var update in updates) list.Add(update); _seWsLastUpdate = newUpdateTime; return list; } + public Subtitle ReloadSubtitle() + { + Subtitle.Paragraphs.Clear(); + string tempFileName; + DateTime updateTime; + var sequences = _seWs.GetSubtitle(SessionId, out tempFileName, out updateTime); + FileName = tempFileName; + _seWsLastUpdate = updateTime; + if (sequences != null) + { + foreach (var sequence in sequences) + Subtitle.Paragraphs.Add(new Paragraph(HttpUtility.HtmlDecode(sequence.Text).Replace("
", Environment.NewLine), sequence.StartMilliseconds, sequence.EndMilliseconds)); + } + return Subtitle; + } + private void ReloadFromWs() { if (_seWs != null) diff --git a/src/Web References/SeNetworkService/Reference.cs b/src/Web References/SeNetworkService/Reference.cs index 75775103d..80d3399f2 100644 --- a/src/Web References/SeNetworkService/Reference.cs +++ b/src/Web References/SeNetworkService/Reference.cs @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:4.0.30319.1 +// Runtime Version:4.0.30319.208 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -9,7 +9,7 @@ //------------------------------------------------------------------------------ // -// This source code was auto-generated by Microsoft.VSDesigner, Version 4.0.30319.1. +// This source code was auto-generated by Microsoft.VSDesigner, Version 4.0.30319.208. // #pragma warning disable 1591 @@ -359,13 +359,14 @@ namespace Nikse.SubtitleEdit.SeNetworkService { /// [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/GetUpdates", RequestNamespace="http://tempuri.org/", ResponseNamespace="http://tempuri.org/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] - public SeUpdate[] GetUpdates(string sessionId, string userName, System.DateTime lastUpdateTime, out string message, out System.DateTime newUpdateTime) { + public SeUpdate[] GetUpdates(string sessionId, string userName, System.DateTime lastUpdateTime, out string message, out System.DateTime newUpdateTime, out int numberOfLines) { object[] results = this.Invoke("GetUpdates", new object[] { sessionId, userName, lastUpdateTime}); message = ((string)(results[1])); newUpdateTime = ((System.DateTime)(results[2])); + numberOfLines = ((int)(results[3])); return ((SeUpdate[])(results[0])); } @@ -472,7 +473,7 @@ namespace Nikse.SubtitleEdit.SeNetworkService { } /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.0.30319.1")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.0.30319.208")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -529,7 +530,7 @@ namespace Nikse.SubtitleEdit.SeNetworkService { } /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.0.30319.1")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.0.30319.208")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -622,7 +623,7 @@ namespace Nikse.SubtitleEdit.SeNetworkService { } /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.0.30319.1")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.0.30319.208")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -882,6 +883,14 @@ namespace Nikse.SubtitleEdit.SeNetworkService { return ((System.DateTime)(this.results[2])); } } + + /// + public int numberOfLines { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[3])); + } + } } /// diff --git a/src/Web References/SeNetworkService/SeService.wsdl b/src/Web References/SeNetworkService/SeService.wsdl index 6c2e55f6b..ebf85de97 100644 --- a/src/Web References/SeNetworkService/SeService.wsdl +++ b/src/Web References/SeNetworkService/SeService.wsdl @@ -161,6 +161,7 @@ +