internal void Parse(AdsStream symbolStream, AdsStream dataTypeStream, TcAdsClient adsClient) { this._subSymbolFactory = new SubSymbolFactory(this); this._defaultTypes = DataTypeInfoTable.GetDefaultTypes(this); this.OnTypesCreated(this._defaultTypes); object[] args = new object[] { adsClient.Address, symbolStream.Length, dataTypeStream.Length }; Module.Trace.TraceInformation("Client: {0}, SymbolStream: {1} bytes, DataTypeStream: {2} bytes", args); this._adsClient = adsClient; using (AdsBinaryReader reader = new AdsBinaryReader(symbolStream)) { using (AdsBinaryReader reader2 = new AdsBinaryReader(dataTypeStream)) { uint[] numArray; uint[] numArray2; int symbolCount = 0; symbolCount = this.countSymbols(reader); object[] objArray2 = new object[] { symbolCount }; Module.Trace.TraceInformation("SymbolCount: {0}", objArray2); this._symbolTable = this.fillSymbolTables(reader, symbolCount, out numArray); int dataTypeCount = this.countDataTypes(reader2); object[] objArray3 = new object[] { symbolCount }; Module.Trace.TraceInformation("DataTypeCount: {0}", objArray3); Dictionary <string, int> dictionary = this.fillDataTypeTables(reader2, dataTypeCount, out numArray2); this._dataTypes = this.collectDataTypes(dataTypeCount, numArray2, reader2); this.expandDataTypes(); } } }
internal static ReadOnlyTcAdsDataTypeCollection GetDefaultTypes(IDataTypeResolver resolver) { TcAdsDataTypeCollection types = new TcAdsDataTypeCollection(_defaultTypes); foreach (TcAdsDataType type in types) { type.SetResolver(resolver); } return(types.AsReadOnly()); }
private TcAdsDataTypeCollection collectDataTypes(int count, uint[] dataTypeOffsets, AdsBinaryReader dataTypeReader) { TcAdsDataTypeCollection types = new TcAdsDataTypeCollection(); types.AddRange(this._defaultTypes); AdsDataTypeEntry[] entryArray = new AdsDataTypeEntry[count]; for (int i = 0; i < count; i++) { entryArray[i] = this.GetDataTypeEntry(i, dataTypeOffsets, dataTypeReader); } for (int j = 0; j < count; j++) { if (!(this._streamIncludesBuildInTypes && this._defaultTypes.Contains(entryArray[j].entryName))) { TcAdsDataType item = new TcAdsDataType(entryArray[j], this); if (item.IsPointer || item.IsReference) { this.SetPlatformPointerSize(item.Size); Type managedType = typeof(ulong); if (item.Size == 4) { managedType = typeof(uint); } for (int k = 0; k < types.Count; k++) { ITcAdsDataType dataType = types[k]; if (dataType.Size <= 0) { if (dataType.Category == DataTypeCategory.Alias) { ITcAdsDataType type4 = types.ResolveType(dataType, DataTypeResolveStrategy.Alias); if ((type4 != null) && (type4.Category == DataTypeCategory.Pointer)) { ((TcAdsDataType)dataType).SetSize(item.Size, managedType); } } if (dataType.Category == DataTypeCategory.Pointer) { ((TcAdsDataType)dataType).SetSize(item.Size, managedType); } } } } types.Add(item); } } return(types); }