public void Read(long parentEndPosition, Encoding encoding, AdsBinaryReader reader) { long position = reader.BaseStream.Position; this.entryLength = reader.ReadUInt32(); long num2 = position + this.entryLength; this.indexGroup = reader.ReadUInt32(); this.indexOffset = reader.ReadUInt32(); this.size = reader.ReadUInt32(); this.dataType = reader.ReadUInt32(); ushort num3 = reader.ReadUInt16(); this.flags = (AdsSymbolFlags)num3; this.arrayDim = reader.ReadUInt16(); this.nameLength = reader.ReadUInt16(); this.typeLength = reader.ReadUInt16(); this.commentLength = reader.ReadUInt16(); this.name = reader.ReadPlcString(this.nameLength + 1, encoding); this.type = reader.ReadPlcString(this.typeLength + 1, encoding); this.comment = reader.ReadPlcString(this.commentLength + 1, encoding); this.array = SubStructureReader <AdsDatatypeArrayInfo> .Read(this.arrayDim, num2, encoding, reader); if (this.flags.HasFlag(AdsSymbolFlags.None | AdsSymbolFlags.TypeGuid)) { this.typeGuid = new Guid(reader.ReadBytes(0x10)); } if (this.flags.HasFlag(AdsSymbolFlags.Attributes)) { this.attributeCount = reader.ReadUInt16(); this.attributes = SubStructureReader <AdsAttributeEntry> .Read(this.attributeCount, num2, encoding, reader); } if (this.flags.HasFlag(AdsSymbolFlags.ExtendedFlags)) { this.extendedFlags = reader.ReadUInt32(); } if (reader.BaseStream.Position != num2) { if (reader.BaseStream.Position <= num2) { this.reserved = reader.ReadBytes((int)(num2 - reader.BaseStream.Position)); } else { object[] args = new object[] { this.name, this.type }; Module.Trace.TraceError("Reading Symbol entry for '{0}:{1}' failed!", args); reader.BaseStream.Position = num2; } } }
public void Read(long parentEndPosition, Encoding encoding, AdsBinaryReader reader) { long position = reader.BaseStream.Position; this.entryLength = reader.ReadUInt32(); long num2 = position + this.entryLength; this.version = reader.ReadUInt32(); this.vTableIndex = reader.ReadUInt32(); this.returnSize = reader.ReadUInt32(); this.returnAlignSize = reader.ReadUInt32(); this.reserved = reader.ReadUInt32(); this.returnTypeGuid = reader.ReadGuid(); this.returnDataType = reader.ReadUInt32(); this.flags = reader.ReadUInt32(); this.nameLength = reader.ReadUInt16(); this.returnTypeLength = reader.ReadUInt16(); this.commentLength = reader.ReadUInt16(); this.parameterCount = reader.ReadUInt16(); this.name = reader.ReadPlcString(this.nameLength + 1, encoding); this.returnType = reader.ReadPlcString(this.returnTypeLength + 1, encoding); this.comment = reader.ReadPlcString(this.commentLength + 1, encoding); this.parameters = SubStructureReader <AdsMethodParaInfo> .Read(this.parameterCount, num2, encoding, reader); if (reader.BaseStream.Position != num2) { if (reader.BaseStream.Position <= num2) { byte[] buffer = reader.ReadBytes((int)(num2 - reader.BaseStream.Position)); } else { reader.BaseStream.Position = num2; } } }
public void Read(long parentEndPosition, Encoding encoding, AdsBinaryReader reader) { long position = reader.BaseStream.Position; this.entryLength = reader.ReadUInt32(); long num2 = position + this.entryLength; this.version = reader.ReadUInt32(); this.hashValue = reader.ReadUInt32(); this.typeHashValue = reader.ReadUInt32(); this.size = reader.ReadUInt32(); this.offset = reader.ReadUInt32(); this.baseTypeId = (AdsDatatypeId)reader.ReadUInt32(); this.flags = (AdsDataTypeFlags)reader.ReadUInt32(); this.nameLength = reader.ReadUInt16(); this.typeLength = reader.ReadUInt16(); this.commentLength = reader.ReadUInt16(); this.arrayDim = reader.ReadUInt16(); this.subItems = reader.ReadUInt16(); this.entryName = reader.ReadPlcString(this.nameLength + 1, encoding); this.typeName = reader.ReadPlcString(this.typeLength + 1, encoding); this.comment = reader.ReadPlcString(this.commentLength + 1, encoding); this.arrayInfos = SubStructureReader <AdsDatatypeArrayInfo> .Read(this.arrayDim, num2, encoding, reader); this.subEntries = SubStructureReader <AdsFieldEntry> .Read(this.subItems, num2, encoding, reader); if ((this.subEntries != null) && (this.subEntries.Length != this.subItems)) { object[] args = new object[] { this.entryName, this.typeName, this.subItems, this.subEntries.Length }; Module.Trace.TraceWarning("Entry name '{0}', type '{1}' indicates {2} subentries but only {3} subentries found!", args); this.subItems = (ushort)this.subEntries.Length; } if (this.flags.HasFlag(AdsDataTypeFlags.None | AdsDataTypeFlags.TypeGuid)) { this.typeGuid = reader.ReadGuid(); } if (this.flags.HasFlag(AdsDataTypeFlags.CopyMask)) { this.copyMask = reader.ReadBytes((int)this.size); } if (this.flags.HasFlag(AdsDataTypeFlags.MethodInfos)) { this.methodCount = reader.ReadUInt16(); this.methods = SubStructureReader <AdsMethodEntry> .Read(this.methodCount, num2, encoding, reader); } if (this.flags.HasFlag(AdsDataTypeFlags.Attributes)) { this.attributeCount = reader.ReadUInt16(); this.attributes = SubStructureReader <AdsAttributeEntry> .Read(this.attributeCount, num2, encoding, reader); } if (this.flags.HasFlag(AdsDataTypeFlags.EnumInfos)) { this.enumInfoCount = reader.ReadUInt16(); this.enums = EnumSubStructureReader <AdsEnumInfoEntry> .Read(this.enumInfoCount, this.size, num2, encoding, reader); } if (reader.BaseStream.Position <= num2) { this.reserved = reader.ReadBytes((int)(num2 - reader.BaseStream.Position)); } else if (reader.BaseStream.Position > num2) { object[] args = new object[] { this.entryName }; Module.Trace.TraceError("Reading DataType entry for '{0}' failed!", args); reader.BaseStream.Position = num2; } }