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(); } } }
private SymbolEntryCollection fillSymbolTables(AdsBinaryReader symbolReader, int symbolCount, out uint[] symbolEntryOffsets) { symbolEntryOffsets = new uint[symbolCount]; SymbolEntryCollection entrys = new SymbolEntryCollection(symbolCount); uint num = 0; AdsStream baseStream = (AdsStream)symbolReader.BaseStream; baseStream.Position = 0L; while (num < baseStream.Length) { AdsSymbolEntry item = new AdsSymbolEntry((long)num, this._symbolEncoding, symbolReader); num += item.entryLength; try { entrys.Add(item); } catch (Exception exception) { Module.Trace.TraceError($"Cannot add symbol '{item.name}'. {exception.Message}", exception); } } return(entrys); }