feat: add p-rec-annot datalinks line-number read path
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
using Autodesk.ProcessPower.DataLinks;
|
||||
using PRecAnnot.Abstractions;
|
||||
namespace PRecAnnot.Plant3D2026;
|
||||
|
||||
internal sealed class PlantDataLinksPropertyReader(DataLinksManager dataLinks) : IDataLinksPropertyReader
|
||||
{
|
||||
public DataLinksPropertyReadResult ReadProperties(long rowId)
|
||||
{
|
||||
if (rowId <= 0) return new(false, new Dictionary<string, string?>(), "DATALINKS_ROW_ID_INVALID");
|
||||
try
|
||||
{
|
||||
var values = dataLinks.GetAllProperties((int)rowId, true)
|
||||
.GroupBy(x => x.Key, StringComparer.OrdinalIgnoreCase)
|
||||
.ToDictionary(x => x.Key, x => (string?)x.Last().Value, StringComparer.OrdinalIgnoreCase);
|
||||
return new(true, values);
|
||||
}
|
||||
catch (DLException) { return new(false, new Dictionary<string, string?>(), "DATALINKS_PROPERTY_READ_FAILED"); }
|
||||
catch (Exception) { return new(false, new Dictionary<string, string?>(), "DATALINKS_PROPERTY_READ_FAILED"); }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user