Skip to content

Commit 2c90f37

Browse files
committed
Merge branch 'release/3.1.3'
2 parents 38be9e8 + 36580bb commit 2c90f37

File tree

7 files changed

+54
-457
lines changed

7 files changed

+54
-457
lines changed

bcf-toolkit.sln.DotSettings.user

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
<s:String x:Key="/Default/Environment/UnitTesting/UnitTestSessionStore/Sessions/=00488d9b_002Ddfb9_002D47fc_002Da7da_002D60da862eab61/@EntryIndexedValue">&lt;SessionState ContinuousTestingMode="0" Name="All tests from Solution #2" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session"&gt;
44
&lt;Solution /&gt;
55
&lt;/SessionState&gt;</s:String>
6+
<s:String x:Key="/Default/Environment/UnitTesting/UnitTestSessionStore/Sessions/=4dc5af78_002D6a8f_002D4f5b_002D8833_002Df0ff81e0c049/@EntryIndexedValue">&lt;SessionState ContinuousTestingMode="0" IsActive="True" Name="All tests from Solution #3" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session"&gt;
7+
&lt;Solution /&gt;
8+
&lt;/SessionState&gt;</s:String>
69

710

811
<s:String x:Key="/Default/Environment/UnitTesting/UnitTestSessionStore/Sessions/=64259359_002Daf01_002D4100_002Db5a8_002D06c7d51d9f83/@EntryIndexedValue">&lt;SessionState ContinuousTestingMode="0" Name="BuildMaximumInformationBcfFromStreamTest" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session"&gt;
@@ -35,9 +38,7 @@
3538
<s:String x:Key="/Default/Environment/UnitTesting/UnitTestSessionStore/Sessions/=87607a24_002D24bc_002D46e1_002Da035_002D28c18ba9b643/@EntryIndexedValue">&lt;SessionState ContinuousTestingMode="0" IsActive="True" Name="All tests from Solution" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session"&gt;
3639
&lt;Solution /&gt;
3740
&lt;/SessionState&gt;</s:String>
38-
<s:String x:Key="/Default/Environment/UnitTesting/UnitTestSessionStore/Sessions/=9b61e927_002Deb40_002D473c_002D8f88_002D4fda2fb23707/@EntryIndexedValue">&lt;SessionState ContinuousTestingMode="0" IsActive="True" Name="All tests from Solution #3" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session"&gt;
39-
&lt;Solution /&gt;
40-
&lt;/SessionState&gt;</s:String>
41+
4142

4243

4344

src/bcf-toolkit/Converter/Bcf21/SchemaConverterToBcf30.cs

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using System.IO;
44
using System.Linq;
55
using BcfToolkit.Builder.Bcf30;
6+
using BcfToolkit.Utils;
67

78
namespace BcfToolkit.Converter.Bcf21;
89

@@ -20,10 +21,13 @@ public static Model.Bcf30.Bcf Convert(Model.Bcf21.Bcf from) {
2021
var builder = new BcfBuilder();
2122
builder
2223
.AddMarkups(from.Markups.Select(ConvertMarkup).ToList(), true)
23-
.SetDocument(UpdateDocumentInfo(from.Markups
24-
.SelectMany(m => m.Topic.DocumentReference)
25-
.Where(r => !r.IsExternal)
26-
.ToList()));
24+
.SetDocument(dI => dI
25+
.AddDocuments(from.Markups
26+
.SelectMany(m => m.Topic.DocumentReference)
27+
.Where(r => !r.IsExternal)
28+
.ToList()
29+
.Select(ConvertDocument)
30+
.ToList()));
2731

2832
var project = from.Project;
2933

@@ -120,11 +124,15 @@ private static Model.Bcf30.DocumentReference ConvertDocumentReference(
120124
Model.Bcf21.TopicDocumentReference from) {
121125
var builder = new DocumentReferenceBuilder();
122126

127+
var guid = from.Guid ??= Guid.NewGuid().ToString();
123128
builder
124-
.SetGuid(from.Guid ??= Guid.NewGuid().ToString())
129+
.SetGuid(guid)
125130
.SetUrl(from.IsExternal ? from.ReferencedDocument : null)
126-
//TODO: generate guid based on guid and description
127-
.SetDocumentGuid(Guid.NewGuid().ToString());
131+
// pattern for document guid
132+
// {guid of the referenced document}{name of the referenced document}
133+
.SetDocumentGuid(!from.IsExternal
134+
? GuidUtils.NewGuidByContent($"{guid}{from.ReferencedDocument}")
135+
: null);
128136

129137
if (from.Description != string.Empty) {
130138
builder.SetDescription(from.Description);
@@ -336,7 +344,7 @@ private static Model.Bcf30.Bitmap ConvertBitmap(
336344
.Build();
337345
}
338346

339-
private static Action<DocumentInfoBuilder> UpdateDocumentInfo(
347+
private static Action<DocumentInfoBuilder> ConvertDocumentInfo(
340348
List<Model.Bcf21.TopicDocumentReference> docReferences) {
341349
return dI => dI
342350
.AddDocuments(docReferences.Select(ConvertDocument).ToList());
@@ -347,7 +355,10 @@ private static Model.Bcf30.Document ConvertDocument(
347355
var builder = new DocumentBuilder();
348356
builder
349357
.SetFileName(Path.GetFileName(docReference.ReferencedDocument))
350-
.SetGuid(docReference.Guid)
358+
// pattern for document guid
359+
// {guid of the referenced document}{name of the referenced document}
360+
.SetGuid(GuidUtils.NewGuidByContent(
361+
$"{docReference.Guid}{docReference.ReferencedDocument}"))
351362
.SetDocumentData(docReference.DocumentData);
352363

353364
if (docReference.Description != string.Empty) {

src/bcf-toolkit/LICENSE

Lines changed: 0 additions & 201 deletions
This file was deleted.

0 commit comments

Comments
 (0)