Ejemplo n.º 1
0
        private void OnWriteAnyValue(object managedValue, int timeout)
        {
            DateTime time;

            if (!this.HasValue)
            {
                throw new CannotAccessVirtualSymbolException(this);
            }
            IAccessorValueAny valueAccessor = this.ValueAccessor as IAccessorValueAny;

            if (valueAccessor == null)
            {
                throw new ValueAccessorException($"Accessor '{this.ValueAccessor}' doesn't support IValueAnyAccessor", this.ValueAccessor);
            }
            int num = 0;
            IAccessorConnection connection = valueAccessor as IAccessorConnection;

            if ((timeout >= 0) && (connection != null))
            {
                using (new AdsTimeoutSetter(connection.Connection, timeout))
                {
                    num = valueAccessor.TryWriteAnyValue(this, managedValue, out time);
                    goto TR_0004;
                }
            }
            num = valueAccessor.TryWriteAnyValue(this, managedValue, out time);
TR_0004:
            if (num != 0)
            {
                throw new SymbolException($"Cannot write (any) of Symbol '{this.InstancePath}'! Error: {num}", this);
            }
        }
Ejemplo n.º 2
0
        private void OnWriteAnyValue(object managedValue)
        {
            DateTime time;

            if (!this.HasValue)
            {
                throw new CannotAccessVirtualSymbolException(this);
            }
            IAccessorValueAny valueAccessor = this.ValueAccessor as IAccessorValueAny;

            if (valueAccessor == null)
            {
                throw new ValueAccessorException($"Accessor '{this.ValueAccessor}' doesn't support IValueAnyAccessor", this.ValueAccessor);
            }
            int num = valueAccessor.TryWriteAnyValue(this, managedValue, out time);

            if (num != 0)
            {
                throw new SymbolException($"Cannot write (any) of Symbol '{this.InstancePath}'! Error: {num}", this);
            }
        }
Ejemplo n.º 3
0
        private object OnUpdateAnyValue(object valueObject)
        {
            DateTime time;

            if (!this.HasValue)
            {
                throw new CannotAccessVirtualSymbolException(this);
            }
            IAccessorValueAny valueAccessor = this.ValueAccessor as IAccessorValueAny;

            if (valueAccessor == null)
            {
                throw new ValueAccessorException($"Accessor '{this.ValueAccessor}' doesn't support IValueAnyAccessor", this.ValueAccessor);
            }
            int num = valueAccessor.TryUpdateAnyValue(this, ref valueObject, out time);

            if (num != 0)
            {
                throw new SymbolException($"Cannot read (any) of Symbol '{this.InstancePath}'! Error: {num}", this);
            }
            return(valueObject);
        }
Ejemplo n.º 4
0
        protected virtual object OnReadAnyValue(Type managedType)
        {
            DateTime time;
            object   obj2;

            if (!this.HasValue)
            {
                throw new CannotAccessVirtualSymbolException(this);
            }
            IAccessorValueAny valueAccessor = this.ValueAccessor as IAccessorValueAny;

            if (valueAccessor == null)
            {
                throw new ValueAccessorException($"Accessor '{this.ValueAccessor}' doesn't support IValueAnyAccessor", this.ValueAccessor);
            }
            int num = valueAccessor.TryReadAnyValue(this, managedType, out obj2, out time);

            if (num != 0)
            {
                throw new SymbolException($"Cannot read (any) of Symbol '{this.InstancePath}'! Error: {num}", this.symbol);
            }
            return(obj2);
        }