-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* [BMSPT-174] refactored bcf extensions to utils * [BMSPT-174] refactoring of builder interfaces, distinct * [BMSPT-174] get version, added collection utils * [BMSPT-174] refactoring of worker and converter, added schema converter, upgrade 2.1 -> 3.0 * [BMSPT-174] updated tests * [BMSPT-174] added viewpoint converter, updated builders, small fixes * [BMSPT-174] fixed schema converter * [BMSPT-174] document update * [BMSPT-174] reformat BcfBuilder * [BMSPT-174] added saple tests * [BMSPT-174] refactoring, fixed comments, added project info conversion * [BMSPT-174] refactoring, JsonExtension static regex pattern * [BMSPT-174] fixed converter, get version from json, added different init of converter in worker, updated Readme
- Loading branch information
1 parent
943ca9e
commit 97153dc
Showing
150 changed files
with
2,918 additions
and
1,294 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation"> | ||
<s:Boolean x:Key="/Default/CodeEditing/SuppressNullableWarningFix/Enabled/@EntryValue">False</s:Boolean> | ||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=BCF/@EntryIndexedValue">BCF</s:String></wpf:ResourceDictionary> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,53 +1,45 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Threading.Tasks; | ||
using BcfToolkit.Converter; | ||
using BcfToolkit.Builder.Bcf21.Interfaces; | ||
using BcfToolkit.Builder.Interfaces; | ||
using BcfToolkit.Model; | ||
using BcfToolkit.Model.Bcf21; | ||
|
||
namespace BcfToolkit.Builder.Bcf21; | ||
|
||
public class BcfBuilder : IBcfBuilder< | ||
BcfBuilder, | ||
MarkupBuilder, | ||
ProjectBuilder>, | ||
public partial class BcfBuilder : IBcfBuilder< | ||
BcfBuilder, | ||
MarkupBuilder, | ||
ProjectExtensionBuilder>, | ||
IDefaultBuilder<BcfBuilder> { | ||
|
||
private readonly Bcf _bcf = new(); | ||
|
||
public BcfBuilder() { | ||
_bcf.Version = new VersionBuilder() | ||
.WithDefaults() | ||
.Build(); | ||
} | ||
|
||
public BcfBuilder AddMarkup(Action<MarkupBuilder> builder) { | ||
var markup = | ||
(Markup)BuilderUtils.BuildItem<MarkupBuilder, IMarkup>(builder); | ||
_bcf.Markups.Add(markup); | ||
return this; | ||
} | ||
|
||
public BcfBuilder AddMarkups(List<Markup> markups) { | ||
markups.ForEach(m => _bcf.Markups.Add(m)); | ||
return this; | ||
} | ||
|
||
public BcfBuilder SetProject(Action<ProjectBuilder> builder) { | ||
public BcfBuilder SetProject(Action<ProjectExtensionBuilder> builder) { | ||
var project = | ||
(ProjectExtension)BuilderUtils.BuildItem<ProjectBuilder, IProject>(builder); | ||
(ProjectExtension)BuilderUtils.BuildItem<ProjectExtensionBuilder, IProject>( | ||
builder); | ||
_bcf.Project = project; | ||
return this; | ||
} | ||
|
||
public BcfBuilder WithDefaults() { | ||
this | ||
.AddMarkup(m => m.WithDefaults()); | ||
this.AddMarkup(m => m.WithDefaults()); | ||
return this; | ||
} | ||
|
||
public async Task<IBcf> BuildFromStream(Stream source) { | ||
_bcf.Markups = await BcfConverter.ParseMarkups<Markup, VisualizationInfo>(source); | ||
_bcf.Project = await BcfConverter.ParseProject<ProjectExtension>(source); | ||
return BuilderUtils.ValidateItem(_bcf); | ||
} | ||
|
||
public IBcf Build() { | ||
public Bcf Build() { | ||
return BuilderUtils.ValidateItem(_bcf); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Threading.Tasks; | ||
using BcfToolkit.Model.Bcf21; | ||
using BcfToolkit.Utils; | ||
|
||
namespace BcfToolkit.Builder.Bcf21; | ||
|
||
public partial class BcfBuilder { | ||
public async Task<Bcf> BuildFromStream(Stream source) { | ||
_bcf.Markups = | ||
await BcfExtensions.ParseMarkups<Markup, VisualizationInfo>(source); | ||
_bcf.Project = await BcfExtensions.ParseProject<ProjectExtension>(source); | ||
return BuilderUtils.ValidateItem(_bcf); | ||
} | ||
|
||
public BcfBuilder AddMarkups(List<Markup> markups) { | ||
markups.ForEach(m => _bcf.Markups.Add(m)); | ||
return this; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.