-
Notifications
You must be signed in to change notification settings - Fork 67
/
IDxfHasXData.cs
33 lines (30 loc) · 1.08 KB
/
IDxfHasXData.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
using System.Collections.Generic;
namespace IxMilia.Dxf
{
public interface IDxfHasXData
{
IList<DxfCodePairGroup> ExtensionDataGroups { get; }
IDictionary<string, DxfXDataApplicationItemCollection> XData { get; }
}
internal static class DxfXDataHelper
{
public static bool TrySetExtensionData<THasXData>(this THasXData hasXData, DxfCodePair pair, DxfCodePairBufferReader buffer)
where THasXData : IDxfHasXData
{
if (pair.Code == DxfCodePairGroup.GroupCodeNumber && pair.StringValue.StartsWith("{"))
{
buffer.Advance();
var groupName = DxfCodePairGroup.GetGroupName(pair.StringValue);
hasXData.ExtensionDataGroups.Add(DxfCodePairGroup.FromBuffer(buffer, groupName));
return true;
}
else if (pair.Code >= 1000)
{
buffer.Advance();
DxfXData.PopulateFromBuffer(buffer, hasXData.XData, pair.StringValue);
return true;
}
return false;
}
}
}