Exemple #1
0
            public virtual bool MoveNext()
            {
                TcAdsSymbolInfo symbol;
                int             curIndex;

                this.CheckValid();
                if (this.symbolCollection._owner == null)
                {
                    curIndex      = this.curIndex;
                    this.curIndex = curIndex + 1;
                    symbol        = this.symbolCollection._symbolParser.GetSymbol(curIndex);
                }
                else
                {
                    curIndex      = this.curIndex;
                    this.curIndex = curIndex + 1;
                    symbol        = this.symbolCollection._symbolParser.GetSubSymbol(this.symbolCollection._owner, curIndex, true);
                }
                if (symbol == null)
                {
                    this.isValid = false;
                }
                this.curSymbol = symbol;
                return(this.isValid);
            }
Exemple #2
0
        public TcAdsSymbolInfo GetSymbol(string name)
        {
            TcAdsSymbolInfo info = null;
            string          str;
            string          str2;
            IList <int[]>   list;
            StringComparer  ordinalIgnoreCase = StringComparer.OrdinalIgnoreCase;

            SymbolParser.ArrayIndexType standard = SymbolParser.ArrayIndexType.Standard;
            bool flag = SymbolParser.TryParseArrayElement(name, out str, out str2, out list, out standard);

            if (!flag)
            {
                str = name;
            }
            foreach (TcAdsSymbolInfo info2 in this)
            {
                if (ordinalIgnoreCase.Compare(info2.ShortName, str) == 0)
                {
                    info = !flag ? info2 : info2.symbolParser.GetSymbol(name);
                    break;
                }
            }
            return(info);
        }
Exemple #3
0
 public virtual void Reset()
 {
     if (!this.symbolLoader._isEnumerating)
     {
         throw new InvalidOperationException();
     }
     this.curSymbol = null;
     this.isValid   = true;
 }
Exemple #4
0
 internal TcAdsSymbolInfo(AdsParseSymbols symbolParser, TcAdsSymbolInfo parent, int subIndex)
 {
     if (symbolParser == null)
     {
         throw new ArgumentNullException("symbolParser");
     }
     id_counter++;
     this._id          = id_counter;
     this.symbolParser = symbolParser;
     this.parent       = parent;
     this.subIndex     = subIndex;
     this.subSymbols   = null;
 }
Exemple #5
0
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }
            if (base.GetType() != obj.GetType())
            {
                return(false);
            }
            TcAdsSymbolInfo info = (TcAdsSymbolInfo)obj;

            return(StringComparer.OrdinalIgnoreCase.Compare(this.instancePath, info.instancePath) == 0);
        }
Exemple #6
0
        public TcAdsSymbolInfo GetFirstSymbol(bool forceReload)
        {
            TcAdsSymbolInfo symbol = null;

            if (forceReload || (this._symbolParser == null))
            {
                this.onUploadSymbols();
            }
            if (this._symbolParser != null)
            {
                symbol = this._symbolParser.GetSymbol(0);
            }
            return(symbol);
        }
Exemple #7
0
 internal TcAdsSymbolInfo(AdsParseSymbols symbolParser, TcAdsSymbolInfo parent, int subIndex, AdsSymbolEntry symbolEntry, TcAdsDataType typeEntry) : this(symbolParser, parent, subIndex)
 {
     if (symbolEntry == null)
     {
         throw new ArgumentNullException("symbolEntry");
     }
     this.indexGroup  = symbolEntry.indexGroup;
     this.indexOffset = symbolEntry.indexOffset;
     this.size        = symbolEntry.size;
     this.dataTypeId  = (AdsDatatypeId)symbolEntry.dataType;
     if (typeEntry != null)
     {
         this.typeEntryFlags = typeEntry.Flags;
     }
     if (this.typeEntryFlags.HasFlag(AdsDataTypeFlags.None | AdsDataTypeFlags.Static))
     {
         this.indexGroup  = 0xf019;
         this.indexOffset = 0;
     }
     this.flags        = symbolEntry.flags;
     this.instancePath = symbolEntry.name;
     this.shortName    = symbolEntry.name;
     this.typeName     = symbolEntry.type;
     this.comment      = symbolEntry.comment;
     this.dataType     = typeEntry;
     if (((symbolEntry.array != null) || (typeEntry == null)) || !typeEntry.IsArray)
     {
         this.arrayInfo = symbolEntry.array;
     }
     else
     {
         this.arrayInfo = typeEntry.Dimensions.ToArray();
         if (typeEntry.Size != this.size)
         {
             this.size = (uint)typeEntry.Size;
         }
     }
     if (symbolEntry.attributes != null)
     {
         this.attributes = new TypeAttributeCollection(symbolEntry.attributes).AsReadOnly();
     }
     else
     {
         this.attributes = null;
     }
 }
Exemple #8
0
 internal TcAdsSymbolInfo(AdsParseSymbols symbolParser, TcAdsSymbolInfo parent, int subIndex, TcAdsDataType typeEntry) : this(symbolParser, parent, subIndex)
 {
     if (typeEntry == null)
     {
         throw new ArgumentNullException("typeEntry");
     }
     this.indexGroup     = (uint)parent.IndexGroup;
     this.indexOffset    = (uint)parent.IndexOffset;
     this.size           = (uint)typeEntry.Size;
     this.dataTypeId     = typeEntry.DataTypeId;
     this.typeEntryFlags = typeEntry.Flags;
     this.flags          = DataTypeFlagConverter.Convert(typeEntry.Flags);
     this.instancePath   = parent.Name;
     this.shortName      = parent.ShortName;
     this.typeName       = typeEntry.Name;
     this.comment        = typeEntry.Comment;
     this.dataType       = typeEntry;
     this.arrayInfo      = typeEntry.ArrayInfo;
     this.attributes     = typeEntry.Attributes;
 }
Exemple #9
0
 internal TcAdsSymbolInfoCollection(TcAdsSymbolInfo owner)
 {
     this._owner        = owner;
     this._symbolParser = owner.symbolParser;
     this._count        = this._symbolParser.GetSubSymbolCount(owner);
 }
Exemple #10
0
 internal TcAdsSymbolInfoCollection(AdsParseSymbols symbolParser)
 {
     this._owner        = null;
     this._symbolParser = symbolParser;
     this._count        = symbolParser.SymbolCount;
 }
Exemple #11
0
            public virtual bool MoveNext()
            {
                this.CheckValid();
                if (this.curSymbol == null)
                {
                    this.curSymbol   = this.symbolLoader.GetFirstSymbol(false);
                    this.nextNavType = AdsGetDynamicSymbolType.Child;
                    if (this.curSymbol == null)
                    {
                        this.isValid = false;
                    }
                    return(this.isValid);
                }
                TcAdsSymbolInfo nextSymbol = null;

                if (this.symbolLoader._symbolParser != null)
                {
                    switch (this.nextNavType)
                    {
                    case AdsGetDynamicSymbolType.Sibling:
                        nextSymbol = this.curSymbol.NextSymbol;
                        break;

                    case AdsGetDynamicSymbolType.Child:
                        nextSymbol = this.curSymbol.GetFirstSubSymbol(this._dereference);
                        break;

                    case AdsGetDynamicSymbolType.Parent:
                        this.curSymbol = this.curSymbol.Parent;
                        nextSymbol     = this.curSymbol.NextSymbol;
                        break;

                    default:
                        break;
                    }
                    if (nextSymbol != null)
                    {
                        AdsGetDynamicSymbolType nextNavType = this.nextNavType;
                        if ((nextNavType == AdsGetDynamicSymbolType.Sibling) || (nextNavType == AdsGetDynamicSymbolType.Parent))
                        {
                            this.nextNavType = AdsGetDynamicSymbolType.Child;
                        }
                    }
                    else
                    {
                        switch (this.nextNavType)
                        {
                        case AdsGetDynamicSymbolType.Sibling:
                        case AdsGetDynamicSymbolType.Parent:
                            this.nextNavType = AdsGetDynamicSymbolType.Parent;
                            break;

                        case AdsGetDynamicSymbolType.Child:
                            this.nextNavType = AdsGetDynamicSymbolType.Sibling;
                            break;

                        default:
                            break;
                        }
                        if ((this.nextNavType != AdsGetDynamicSymbolType.Parent) || (this.curSymbol.Parent != null))
                        {
                            return(this.MoveNext());
                        }
                    }
                }
                if (nextSymbol == null)
                {
                    this.isValid = false;
                }
                this.curSymbol = nextSymbol;
                return(this.isValid);
            }