Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove DefaultValue from all Attributes #91

Merged
merged 1 commit into from
Jan 24, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 6 additions & 12 deletions NodeSetToAML.cs
Original file line number Diff line number Diff line change
Expand Up @@ -841,7 +841,7 @@ private AttributeType AddModifyAttribute(AttributeSequence seq, string name, str
case BuiltInType.UInteger:
case BuiltInType.Enumeration:
{
a.DefaultAttributeValue = a.AttributeValue = val;
a.AttributeValue = val;
break;
}

Expand All @@ -851,13 +851,7 @@ private AttributeType AddModifyAttribute(AttributeSequence seq, string name, str
if ( bytes != null )
{
string encoded = Convert.ToBase64String( bytes, 0, bytes.Length );
a.DefaultAttributeValue = a.AttributeValue = new Variant( encoded.ToString() );
//StringBuilder stringBuilder = new StringBuilder();
//for( int index = 0; index < bytes.Length; index++ )
//{
// stringBuilder.Append( (char)bytes[ index ] );
//}
//a.DefaultAttributeValue = a.AttributeValue = new Variant( stringBuilder.ToString() );
a.AttributeValue = new Variant( encoded.ToString() );
}

break;
Expand All @@ -880,7 +874,7 @@ private AttributeType AddModifyAttribute(AttributeSequence seq, string name, str

if ( nodeId != null )
{
a.DefaultAttributeValue = a.AttributeValue = nodeId;
a.AttributeValue = nodeId;
AttributeType rootNodeId = a.Attribute[ "RootNodeId" ];
if ( rootNodeId != null )
{
Expand Down Expand Up @@ -955,14 +949,14 @@ private AttributeType AddModifyAttribute(AttributeSequence seq, string name, str
case BuiltInType.StatusCode:
{
StatusCode statusCode = (StatusCode)val.Value;
a.DefaultAttributeValue = a.AttributeValue = statusCode.Code;
a.AttributeValue = statusCode.Code;

break;
}

case BuiltInType.QualifiedName:
{
a.DefaultAttributeValue = a.AttributeValue = val;
a.AttributeValue = val;

QualifiedName qualifiedName = val.Value as QualifiedName;
if( qualifiedName != null )
Expand All @@ -983,7 +977,7 @@ private AttributeType AddModifyAttribute(AttributeSequence seq, string name, str
Opc.Ua.LocalizedText localizedText = (Opc.Ua.LocalizedText)val.Value;
if( localizedText != null && localizedText.Text != null )
{
a.DefaultAttributeValue = a.AttributeValue = localizedText.Text;
a.AttributeValue = localizedText.Text;
if ( !string.IsNullOrEmpty( localizedText.Locale ) )
{
AddModifyAttribute(a.Attribute, localizedText.Locale,
Expand Down
Loading