Skip to content

Commit

Permalink
Fixed issue with Asset formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
PatrickRitchie committed Dec 14, 2023
1 parent 74dc638 commit 76e0911
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
3 changes: 3 additions & 0 deletions libraries/MTConnect.NET-Common/Input/AssetInput.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ public AssetInput(IAsset asset)
if (asset != null)
{
AssetId = asset.AssetId;
Type = asset.Type;
Asset = asset;
}
}
Expand All @@ -79,6 +80,7 @@ public AssetInput(string deviceKey, IAsset asset)
{
DeviceKey = deviceKey;
AssetId = asset.AssetId;
Type = asset.Type;
Asset = asset;
}
}
Expand All @@ -89,6 +91,7 @@ public AssetInput(IAssetInput asset)
{
DeviceKey = asset.DeviceKey;
AssetId = asset.AssetId;
Type = asset.Type;
Asset = asset.Asset;
Timestamp = asset.Timestamp;
}
Expand Down
10 changes: 5 additions & 5 deletions libraries/MTConnect.NET-JSON/Input/JsonInputAssetGroup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ public JsonInputAssetGroup(IEnumerable<IAssetInput> assets)
{
foreach (var asset in assets)
{
if (asset != null)
if (asset != null && asset.Asset != null)
{
switch (asset.Type)
{
case ComponentConfigurationParametersAsset.TypeId:
var componentConfigurationParametersAsset = new JsonComponentConfigurationParametersAsset(asset as IComponentConfigurationParametersAsset);
var componentConfigurationParametersAsset = new JsonComponentConfigurationParametersAsset(asset.Asset as IComponentConfigurationParametersAsset);
if (componentConfigurationParametersAsset != null)
{
if (ComponentConfigurationParameters == null) ComponentConfigurationParameters = new List<JsonComponentConfigurationParametersAsset>();
Expand All @@ -53,7 +53,7 @@ public JsonInputAssetGroup(IEnumerable<IAssetInput> assets)
break;

case CuttingToolAsset.TypeId:
var cuttingToolAsset = new JsonCuttingToolAsset(asset as ICuttingToolAsset);
var cuttingToolAsset = new JsonCuttingToolAsset(asset.Asset as ICuttingToolAsset);
if (cuttingToolAsset != null)
{
if (CuttingTools == null) CuttingTools = new List<JsonCuttingToolAsset>();
Expand All @@ -62,7 +62,7 @@ public JsonInputAssetGroup(IEnumerable<IAssetInput> assets)
break;

case FileAsset.TypeId:
var fileAsset = new JsonFileAsset(asset as IFileAsset);
var fileAsset = new JsonFileAsset(asset.Asset as IFileAsset);
if (fileAsset != null)
{
if (Files == null) Files = new List<JsonFileAsset>();
Expand All @@ -71,7 +71,7 @@ public JsonInputAssetGroup(IEnumerable<IAssetInput> assets)
break;

case RawMaterialAsset.TypeId:
var rawMaterialAsset = new JsonRawMaterialAsset(asset as IRawMaterialAsset);
var rawMaterialAsset = new JsonRawMaterialAsset(asset.Asset as IRawMaterialAsset);
if (rawMaterialAsset != null)
{
if (RawMaterials == null) RawMaterials = new List<JsonRawMaterialAsset>();
Expand Down

0 comments on commit 76e0911

Please sign in to comment.