mirror of
https://github.com/eliasstepanik/OSCADSharpDotnet7.git
synced 2026-01-23 11:18:27 +00:00
Removed IBindable and ICloneable
This commit is contained in:
parent
cf1a0f2cbc
commit
81408731aa
@ -1,19 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace OSCADSharp
|
|
||||||
{
|
|
||||||
internal interface IBindings
|
|
||||||
{
|
|
||||||
void Bind<T>(T obj, string property, Variable variable);
|
|
||||||
|
|
||||||
bool Contains(string openScadFieldName);
|
|
||||||
|
|
||||||
Binding Get(string propertyName);
|
|
||||||
|
|
||||||
void Synonym(string propertyName, string alternateName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,13 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace OSCADSharp
|
|
||||||
{
|
|
||||||
internal interface ICloneable<T>
|
|
||||||
{
|
|
||||||
T Clone();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -43,8 +43,6 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="BindableBoolean.cs" />
|
<Compile Include="BindableBoolean.cs" />
|
||||||
<Compile Include="IBindings.cs" />
|
|
||||||
<Compile Include="ICloneable.cs" />
|
|
||||||
<Compile Include="VariableCalculator.cs" />
|
<Compile Include="VariableCalculator.cs" />
|
||||||
<Compile Include="CompoundVariable.cs" />
|
<Compile Include="CompoundVariable.cs" />
|
||||||
<Compile Include="Dependencies.cs" />
|
<Compile Include="Dependencies.cs" />
|
||||||
|
|||||||
@ -14,25 +14,19 @@ namespace OSCADSharp
|
|||||||
{
|
{
|
||||||
private StringBuilder SB { get; set; } = new StringBuilder();
|
private StringBuilder SB { get; set; } = new StringBuilder();
|
||||||
private Bindings bindings = null;
|
private Bindings bindings = null;
|
||||||
private IBindings ibindings = null;
|
|
||||||
|
|
||||||
internal StatementBuilder(Bindings bindings)
|
internal StatementBuilder(Bindings bindings)
|
||||||
{
|
{
|
||||||
this.bindings = bindings;
|
this.bindings = bindings;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal StatementBuilder(IBindings ibindings)
|
|
||||||
{
|
|
||||||
this.ibindings = ibindings;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Special append method for conditionally adding value-pairs
|
/// Special append method for conditionally adding value-pairs
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="name">The Name of the value-pair</param>
|
/// <param name="name">The Name of the value-pair</param>
|
||||||
/// <param name="value">The value - if null this method does nothing</param>
|
/// <param name="value">The value - if null this method does nothing</param>
|
||||||
/// <param name="prefixWithComma">(optional) Flag indicating whether a comma should be added before the value-pair</param>
|
/// <param name="prefixWithComma">(optional) Flag indicating whether a comma should be added before the value-pair</param>
|
||||||
internal void AppendValuePairIfExists(string name, object value, bool prefixWithComma = false)
|
public void AppendValuePairIfExists(string name, object value, bool prefixWithComma = false)
|
||||||
{
|
{
|
||||||
bool useBinding = this.shouldUseBinding(name);
|
bool useBinding = this.shouldUseBinding(name);
|
||||||
|
|
||||||
@ -46,10 +40,9 @@ namespace OSCADSharp
|
|||||||
SB.Append(name);
|
SB.Append(name);
|
||||||
SB.Append(" = ");
|
SB.Append(" = ");
|
||||||
|
|
||||||
if(useBinding)
|
if (useBinding)
|
||||||
{
|
{
|
||||||
SB.Append(this.bindings?.Get(name).BoundVariable.Text);
|
SB.Append(this.bindings.Get(name).BoundVariable.Text);
|
||||||
SB.Append(this.ibindings?.Get(name).BoundVariable.Text);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -60,19 +53,18 @@ namespace OSCADSharp
|
|||||||
|
|
||||||
private bool shouldUseBinding(string name)
|
private bool shouldUseBinding(string name)
|
||||||
{
|
{
|
||||||
return (this.bindings != null && this.bindings.Contains(name))
|
return this.bindings != null && this.bindings.Contains(name);
|
||||||
|| (this.ibindings != null && this.ibindings.Contains(name));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Pass-through for StringBuilder.Append
|
/// Pass-through for StringBuilder.Append
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="text"></param>
|
/// <param name="text"></param>
|
||||||
internal void Append(string text)
|
public void Append(string text)
|
||||||
{
|
{
|
||||||
SB.Append(text);
|
SB.Append(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets this builder's full string
|
/// Gets this builder's full string
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user