diff --git a/src/Ubiety.Dns.Core/Common/Extensions/EnumExtensions.cs b/src/Ubiety.Dns.Core/Common/Extensions/EnumExtensions.cs index 9d8ff0f..4e0540d 100644 --- a/src/Ubiety.Dns.Core/Common/Extensions/EnumExtensions.cs +++ b/src/Ubiety.Dns.Core/Common/Extensions/EnumExtensions.cs @@ -31,18 +31,12 @@ public static class EnumExtensions /// /// Type of record to get. /// Resource reader to create record with. - /// Length of the record. /// A instance for the given type. - public static Record GetRecord(this RecordType type, RecordReader reader, int length = 0) + public static Record GetRecord(this RecordType type, RecordReader reader) { var fieldInfo = type.GetType().GetField(type.ToString()); var recordAttr = fieldInfo.GetCustomAttribute(); - if (type == RecordType.TXT) - { - return (Record)Activator.CreateInstance(recordAttr.RecordType, reader, length); - } - return (Record)Activator.CreateInstance(recordAttr.RecordType, reader); } } diff --git a/src/Ubiety.Dns.Core/Records/RecordTxt.cs b/src/Ubiety.Dns.Core/Records/RecordTxt.cs index be4d432..42f7352 100644 --- a/src/Ubiety.Dns.Core/Records/RecordTxt.cs +++ b/src/Ubiety.Dns.Core/Records/RecordTxt.cs @@ -45,16 +45,13 @@ public record RecordTxt : Record /// Initializes a new instance of the class. /// /// for the record data. - /// Record length. - public RecordTxt(RecordReader reader, int length) + public RecordTxt(RecordReader reader) : base(reader) { - var position = Reader.Position; - Text = new List(); - while ((Reader.Position - position) < length) + Text = new List { - Text.Add(Reader.ReadString()); - } + Reader.ReadString() + }; } ///