/* Copyright (C) 2014-2019 de4dot@gmail.com This file is part of dnSpy dnSpy is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. dnSpy is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with dnSpy. If not, see . */ using System; namespace dnSpy.Contracts.Hex.Files.DotNet { /// /// A /// public class GuidData : StructureData { const string NAME = "Guid"; /// /// Gets the fields /// protected override BufferField[] Fields { get; } /// Guid.A public StructField A { get; } /// Guid.B public StructField B { get; } /// Guid.C public StructField C { get; } /// Guid.D public StructField D { get; } /// Guid.E public StructField E { get; } /// Guid.F public StructField F { get; } /// Guid.G public StructField G { get; } /// Guid.H public StructField H { get; } /// Guid.I public StructField I { get; } /// Guid.J public StructField J { get; } /// Guid.K public StructField K { get; } /// /// Constructor /// /// Data span public GuidData(HexBufferSpan span) : base(NAME, span) { if (span.Length != 16) throw new ArgumentOutOfRangeException(nameof(span)); var buffer = span.Buffer; var pos = span.Span.Start; A = new StructField("A", new UInt32Data(buffer, pos)); B = new StructField("B", new UInt16Data(buffer, pos + 4)); C = new StructField("C", new UInt16Data(buffer, pos + 6)); D = new StructField("D", new ByteData(buffer, pos + 8)); E = new StructField("E", new ByteData(buffer, pos + 9)); F = new StructField("F", new ByteData(buffer, pos + 0x0A)); G = new StructField("G", new ByteData(buffer, pos + 0x0B)); H = new StructField("H", new ByteData(buffer, pos + 0x0C)); I = new StructField("I", new ByteData(buffer, pos + 0x0D)); J = new StructField("J", new ByteData(buffer, pos + 0x0E)); K = new StructField("K", new ByteData(buffer, pos + 0x0F)); Fields = new BufferField[] { A, B, C, D, E, F, G, H, I, J, K, }; } /// /// Constructor /// /// Buffer /// Position public GuidData(HexBuffer buffer, HexPosition position) : this(new HexBufferSpan(buffer, new HexSpan(position, 16))) { } } }