diff --git a/PlotDirector.NativeCompanion/DeveloperVersion.props b/PlotDirector.NativeCompanion/DeveloperVersion.props index 1de70159..dbf80feb 100644 --- a/PlotDirector.NativeCompanion/DeveloperVersion.props +++ b/PlotDirector.NativeCompanion/DeveloperVersion.props @@ -1 +1 @@ -1.0.0.25 +1.0.0.26 diff --git a/PlotDirector.NativeCompanion/Protocol/Manuscript/ChapterFingerprint.cs b/PlotDirector.NativeCompanion/Protocol/Manuscript/ChapterFingerprint.cs index f94067ee..176d4c15 100644 --- a/PlotDirector.NativeCompanion/Protocol/Manuscript/ChapterFingerprint.cs +++ b/PlotDirector.NativeCompanion/Protocol/Manuscript/ChapterFingerprint.cs @@ -79,7 +79,10 @@ public static class ChapterFingerprint } var rows=body.Descendants(w+"p").Where(p=>!p.Ancestors(w+"p").Any()).Select(p=>{ var text=new StringBuilder();foreach(var node in p.Descendants()){ - if(node.Name==w+"t")text.Append(node.Value);else if(node.Name==w+"tab")text.Append('\t');else if(node.Name==w+"br"||node.Name==w+"cr"){if((string?)node.Attribute(w+"type") is {} type&&type!="textWrapping")throw new ArgumentException("Page/column break requires measured Word extraction.");text.Append('\v');} + if(node.Name==w+"t")text.Append(node.Value);else if(node.Name==w+"tab")text.Append('\t');else if(node.Name==w+"br"||node.Name==w+"cr"){var type=(string?)node.Attribute(w+"type"); + if(type=="page")text.Append('\f'); + else if(type==null||type=="textWrapping")text.Append('\v'); + else throw new ArgumentException("Unsupported break requires measured Word extraction.");} }text.Append('\r'); var outline=Outline(p); return new ChapterParagraph{NativeId=WordParagraphIdentity.Normalise((string?)p.Attribute(w14+"paraId")),Text=text.ToString(),Length=text.Length,Outline=outline}; diff --git a/PlotDirector.NativeCompanion/Vsto/Properties/AssemblyInfo.cs b/PlotDirector.NativeCompanion/Vsto/Properties/AssemblyInfo.cs index e5b08f5c..b6f08ab3 100644 --- a/PlotDirector.NativeCompanion/Vsto/Properties/AssemblyInfo.cs +++ b/PlotDirector.NativeCompanion/Vsto/Properties/AssemblyInfo.cs @@ -3,6 +3,6 @@ using System.Runtime.InteropServices; [assembly: AssemblyTitle("PlotDirector Word Companion — Native development")] [assembly: AssemblyCompany("Nick Beckley")] [assembly: AssemblyProduct("PlotDirector")] -[assembly: AssemblyVersion("1.0.0.25")] -[assembly: AssemblyFileVersion("1.0.0.25")] +[assembly: AssemblyVersion("1.0.0.26")] +[assembly: AssemblyFileVersion("1.0.0.26")] [assembly: ComVisible(false)] diff --git a/PlotDirector.NativeCompanion/WindowsValidation/Setup/Release.json b/PlotDirector.NativeCompanion/WindowsValidation/Setup/Release.json index 5ddc2cae..094fe54a 100644 --- a/PlotDirector.NativeCompanion/WindowsValidation/Setup/Release.json +++ b/PlotDirector.NativeCompanion/WindowsValidation/Setup/Release.json @@ -1,7 +1,7 @@ { - "version": "1.0.0.25", - "msiVersion": "1.0.25", - "productCode": "{CF38BE16-F30A-46B0-9242-5A7B9197AEFD}", + "version": "1.0.0.26", + "msiVersion": "1.0.26", + "productCode": "{1C8B5834-0157-4E05-A31D-9E96C80FFBFF}", "upgradeCode": "{641A087B-9779-458C-B290-BCBBAD49319A}", "atlasBaseline": "c6cdfbc3b17107a8d269561c319d946c8e337835", "baselineProductCode": "{98F46939-764D-407F-BD1F-1D88315D010A}", diff --git a/PlotLine.Tests/ChapterSynchronisationTests.cs b/PlotLine.Tests/ChapterSynchronisationTests.cs index 4a150d74..771b33b5 100644 --- a/PlotLine.Tests/ChapterSynchronisationTests.cs +++ b/PlotLine.Tests/ChapterSynchronisationTests.cs @@ -66,6 +66,9 @@ internal static class ChapterSynchronisationTests Refused(() => ChapterFingerprint.ReadXml(withoutIds, exactText, liveIds.Substring(0, 8) + "00000001" + liveIds.Substring(16)), "Mismatched live paragraph span is refused"); Refused(() => ChapterFingerprint.ReadXml(withoutIds, exactText, liveIds.Substring(0, 16) + liveIds.Substring(0, 8) + liveIds.Substring(24)), "Duplicate live Word IDs are refused"); Refused(() => ChapterFingerprint.ReadXml(xml, exactText, "7FFFFFFF" + liveIds.Substring(8)), "Live Word IDs cannot overwrite contradictory XML IDs"); + var pageBreakXml = xml.Replace("Exact", "Exact"); + Check(ChapterFingerprint.ReadXml(pageBreakXml, "Chapter one\rExact\f\ttext\r").Length == 2, "Explicit page break uses the exact live Word form-feed position"); + Refused(() => ChapterFingerprint.ReadXml(pageBreakXml, exactText), "Page break cannot be ignored when the live Word text disagrees"); Refused(()=>ChapterFingerprint.ReadXml(xml,"Different\r"),"XML/range disagreement is refused rather than inventing paragraph offsets"); Refused(()=>ChapterFingerprint.ReadXml(xml.Replace("",""),"Chapter one\rExact\ttext\r"),"Complex Word tables require safe bounded fallback"); var presence=new PlotLine.Services.NativeCompanion.NativePresenceStore(TimeProvider.System);var instance=Guid.NewGuid();var session=Guid.NewGuid();presence.Put(7,"grant",DateTimeOffset.UtcNow.AddHours(1),instance,session,new(){BookId=12,ManuscriptId=state.ManuscriptId,CanChapterSync=true,CanCapture=true,CanParagraphSync=true,WordAvailable=true,WordSaved=true,Sequence=1,Revision=1});var lease=presence.Read(7,12).Single();presence.RecordChapterProgress(7,12,instance,session,1,new(){State="Synchronised",Total=2,Matching=2});var operation=Guid.NewGuid();Check(presence.RequestChapterRepair(7,lease,operation)&&presence.ChapterTransfer(7,12,instance,session)?.State=="pending","A repeated repair cannot inherit a previous green completion before fresh acceptance");