Skip to content

Commit 51acc78

Browse files
committed
Resolve merge conflict, keep version 0.9.3-dev
2 parents 3045b89 + 1cb4709 commit 51acc78

File tree

5 files changed

+10
-9
lines changed

5 files changed

+10
-9
lines changed

SparklerNet.Tests/Core/Model/DataSetTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ public void RowCount_Returns_Correct_Value_With_TryGetValue()
142142
var dataSet = new DataSet
143143
{
144144
Columns = ["Column1", "Column2"]
145-
// ColumnData intentionally aren't initialized with Column1 to test TryGetValue
145+
// ColumnData intentionally isn't initialized with Column1 to test TryGetValue
146146
};
147147
Assert.Equal(0, dataSet.RowCount);
148148
// Add data to Column1

SparklerNet/Core/Model/Conversion/MetricConverter.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public static ProtoMetric ToProtoMetric(this Metric metric)
5252
? Convert.ToUInt64(value)
5353
: throw new NotSupportedException("Value for DateTime type must be long"),
5454
DataType.String or DataType.Text or DataType.UUID =>
55-
() => protoMetric.StringValue = metric.Value!.ToString(),
55+
() => protoMetric.StringValue = metric.Value!.ToString()!,
5656
DataType.Bytes or DataType.File => () => protoMetric.BytesValue = metric.Value is byte[] bytes
5757
? CopyFrom(bytes)
5858
: throw new NotSupportedException("Value for Bytes/File type must be byte[]"),
@@ -127,8 +127,8 @@ public static Metric ToMetric(this ProtoMetric protoMetric)
127127
DataType.DateTime => (long)protoMetric.LongValue,
128128
DataType.String or DataType.Text or DataType.UUID => protoMetric.StringValue,
129129
DataType.Bytes or DataType.File => protoMetric.BytesValue!.ToByteArray(),
130-
DataType.DataSet => protoMetric.DatasetValue!.ToDataSet(),
131-
DataType.Template => protoMetric.TemplateValue!.ToTemplate(),
130+
DataType.DataSet => protoMetric.DatasetValue?.ToDataSet(),
131+
DataType.Template => protoMetric.TemplateValue?.ToTemplate(),
132132
DataType.Int8Array => DeserializeArray<sbyte>(protoMetric.BytesValue!.ToByteArray()),
133133
DataType.UInt8Array => DeserializeArray<byte>(protoMetric.BytesValue!.ToByteArray()),
134134
DataType.Int16Array => DeserializeArray<short>(protoMetric.BytesValue!.ToByteArray()),

SparklerNet/Core/Model/Conversion/PropertyConverter.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ public static ProtoPropertyValue ToProtoPropertyValue(this PropertyValue propert
3737
DataType.Float => () => protoProperty.FloatValue = Convert.ToSingle(property.Value),
3838
DataType.Double => () => protoProperty.DoubleValue = Convert.ToDouble(property.Value),
3939
DataType.Boolean => () => protoProperty.BooleanValue = Convert.ToBoolean(property.Value),
40-
DataType.DateTime => () => protoProperty.LongValue = property.Value is long value
41-
? Convert.ToUInt64(value)
40+
DataType.DateTime => () => protoProperty.LongValue = property.Value is long
41+
? Convert.ToUInt64(property.Value)
4242
: throw new NotSupportedException("Value for DateTime type must be long"),
4343
DataType.String or DataType.Text => () => protoProperty.StringValue = property.Value!.ToString()!,
4444
DataType.PropertySet when property.Value is PropertySet propertySet =>

SparklerNet/Core/Topics/SparkplugTopicParser.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using System.Text.RegularExpressions;
1+
using System.Globalization;
2+
using System.Text.RegularExpressions;
23
using SparklerNet.Core.Constants;
34

45
namespace SparklerNet.Core.Topics;
@@ -66,6 +67,6 @@ public static (SparkplugVersion version, string? groupId, SparkplugMessageType m
6667
// Pattern 2 (STATE messages): <namespace>/STATE/<host_id>
6768
[GeneratedRegex(
6869
"^(?<namespace>[^/]+)/(?<groupId>[^/]+)/(?<messageType>[^/]+)/(?<edgeNodeId>[^/]+)(/(?<deviceId>[^/]+))?$|^(?<namespace>[^/]+)/(STATE)/(?<hostId>[^/]+)$",
69-
RegexOptions.IgnoreCase | RegexOptions.Compiled, "zh-CN")]
70+
RegexOptions.IgnoreCase | RegexOptions.Compiled)]
7071
private static partial Regex TopicRegex();
7172
}

SparklerNet/HostApplication/SparkplugHostApplication.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public SparkplugHostApplication(MqttClientOptions mqttOptions, SparkplugClientOp
6262
// MQTT Client
6363
public IMqttClient MqttClient { get; }
6464

65-
[GeneratedRegex(@"[+/\\#]")]
65+
[GeneratedRegex(@"[+/#]", RegexOptions.Compiled)]
6666
private static partial Regex HostApplicationIdRegex();
6767

6868
public event Func<EdgeNodeMessageEventArgs, Task> EdgeNodeBirthReceivedAsync

0 commit comments

Comments
 (0)