Exemplo n.º 1
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);
            }
Exemplo n.º 2
0
 public AdsSymbolEnumerator(TcAdsSymbolInfoLoader symbolLoader)
 {
     this.symbolLoader = symbolLoader;
     this.isValid      = true;
     this.nextNavType  = AdsGetDynamicSymbolType.Child;
 }