Exemple #1
1
        private Int16 GetTagCanonicalType(string itemName)
        {
            const int ItemCanonicalDataTypeProperty = 1;

            TreeNode rootNode = uiGroupsTab_AllFoldersTreeView.SelectedNode;
            while (rootNode.Parent != null)
            {
                rootNode = rootNode.Parent;
            }

            var opcServer = Settings.OpcServers.Where(os => rootNode.FullPath == os.ServerName).Single();
            string urlstring = opcServer.URL;
            Server server = new Server(new Factory(), new URL(urlstring));
            server.Connect();

            ItemIdentifier [] itemIdentifiers = new ItemIdentifier[] {new ItemIdentifier(itemName)};
            PropertyID[] propertyIDs = new PropertyID[] { new PropertyID(ItemCanonicalDataTypeProperty) };

            var result = server.GetProperties(itemIdentifiers, propertyIDs, true);

            server.Disconnect();

            var resultType = result[0][0].Value.GetType();
            PropertyInfo nameProperty = resultType.GetProperty("Name");
            string name = nameProperty.GetValue(result[0][0].Value, null) as string;

            switch (name.ToLower())
            {
                case "string":
                case "char":
                    return 0;
                case "int16":
                case "int32":
                case "int64":
                case "uint16":
                case "uint32":
                case "uint64":
                    return 1;
                case "boolean":
                    return 2;
                case "decimal":
                case "double":
                    return 3;
                case "datetime":
                case "datetimeoffset":
                    return 4;
                default:
                    return 0;
            }
        }
 internal void AddNewPropertyID(PropertyID pid)
 {
     if (ContainsID(pid.ID))
         Argument.Throw("repeated id");
     stringIDs.Add(pid.ID);
     propertyIDs.Add(pid);
 }
        /// <summary>
        /// Splits an item identfier into its component parts.
        /// </summary>
        private bool ParseItemID(string itemID, out string baseItemID, out PropertyID propertyID)
        {
            // set default values.
            baseItemID = itemID;
            propertyID = Property.VALUE;

            // validate item id.
            if (itemID == null || itemID.Length == 0)
            {
                return false;
            }

            // check for a property id qualifier.
            int index = itemID.LastIndexOf(":");

            if (index == -1)
            {
                return true;
            }

            // extract base item id.
            baseItemID = itemID.Substring(0, index);

            // parse property id.
            try
            {
                int code = System.Convert.ToInt32(itemID.Substring(index+1));
                propertyID = new PropertyID(code);
            }
            catch
            {
                return false;
            }

            // item syntax is valid.
            return true;
        }
 protected double GetDoubleSetting(PropertyID propID, int inParam = 0);
 protected bool[] GetBoolArrSetting(PropertyID propID, int inParam = 0);
Exemple #6
0
 protected PropertyChange(BaseObject ob, PropertyID propertyID)
     : base(ob)
 {
     this.PropertyID = propertyID;
 }
Exemple #7
0
        protected void NotifyBool(PropertyID id, bool value)
        {
            Debug.Assert(this.IsInitialized);
            Debug.Assert(!this.IsDestructed);

            this.World.AddChange(new PropertyValueChange(this, id, value));
        }
 protected HasEffectProperty(PropertyID pid, int val, IEffectList effectList) : base(pid, val)
 {
     this.effectSupports = new List<EffectSupport>();
     this.effectList = effectList;
 }
 protected NonEffectProperty(PropertyID pid) : base(pid) { }
Exemple #10
0
        public override void SetProperty(PropertyID propertyID, object value)
        {
            switch (propertyID)
            {
                case PropertyID.HitPoints:
                    this.HitPoints = (int)value;
                    break;

                case PropertyID.MaxHitPoints:
                    this.MaxHitPoints = (int)value;
                    break;

                case PropertyID.SpellPoints:
                    this.SpellPoints = (int)value;
                    break;

                case PropertyID.MaxSpellPoints:
                    this.MaxSpellPoints = (int)value;
                    break;

                case PropertyID.Strength:
                    this.Strength = (int)value;
                    break;

                case PropertyID.Dexterity:
                    this.Dexterity = (int)value;
                    break;

                case PropertyID.Constitution:
                    this.Constitution = (int)value;
                    break;

                case PropertyID.Intelligence:
                    this.Intelligence = (int)value;
                    break;

                case PropertyID.Wisdom:
                    this.Wisdom = (int)value;
                    break;

                case PropertyID.Charisma:
                    this.Charisma = (int)value;
                    break;

                case PropertyID.Size:
                    this.Size = (int)value;
                    break;

                case PropertyID.NaturalArmorClass:
                    this.NaturalArmorClass = (int)value;
                    break;

                case PropertyID.VisionRange:
                    this.VisionRange = (int)value;
                    break;

                case PropertyID.Hunger:
                    this.Hunger = (int)value;
                    break;

                case PropertyID.Thirst:
                    this.Thirst = (int)value;
                    break;

                case PropertyID.Exhaustion:
                    this.Exhaustion = (int)value;
                    break;

                case PropertyID.Assignment:
                    this.ServerAssignment = (string)value;
                    break;

                case PropertyID.Gender:
                    this.Gender = (LivingGender)value;
                    break;

                default:
                    base.SetProperty(propertyID, value);
                    break;
            }
        }
        //======================================================================
        // GetProperties
        /// <summary>
        /// Returns the item properties for a set of items.
        /// </summary>
        /// <param name="itemIDs">A list of item identifiers.</param>
        /// <param name="propertyIDs">A list of properties to fetch for each item.</param>
        /// <param name="returnValues">Whether the property values should be returned with the properties.</param>
        /// <returns>A list of properties for each item.</returns>
        public ItemPropertyCollection[] GetProperties(
            ItemIdentifier[] itemIDs,
            PropertyID[]     propertyIDs,
            bool             returnValues)
        {
            if (itemIDs == null) throw new ArgumentNullException("itemIDs");

            lock (this)
            {
                ArrayList items = new ArrayList();

                foreach (ItemIdentifier itemID in itemIDs)
                {
                    ItemPropertyCollection properties = m_cache.GetProperties(itemID, propertyIDs, returnValues);

                    if (properties != null)
                    {
                        items.Add(properties);
                    }
                }

                return (ItemPropertyCollection[])items.ToArray(typeof(ItemPropertyCollection));
            }
        }
 public IProperty this[PropertyID key]
 {
     get { return properties[key.Index]; }
 }
Exemple #13
0
 public static ObjectVisibility GetPropertyVisibility(PropertyID id)
 {
     return s_visibilityArray[(int)id];
 }
 public override void SetProperty(PropertyID propertyID, object value)
 {
     throw new NotImplementedException();
 }
Exemple #15
0
        public override void SetProperty(PropertyID propertyID, object value)
        {
            switch (propertyID)
            {
                case PropertyID.Quality:
                    this.Quality = (int)value;
                    break;

                case PropertyID.NutritionalValue:
                    this.NutritionalValue = (int)value;
                    break;

                case PropertyID.RefreshmentValue:
                    this.RefreshmentValue = (int)value;
                    break;

                case PropertyID.ReservedByStr:
                    this.ServerReservedBy = (string)value;
                    break;

                case PropertyID.IsInstalled:
                    this.IsInstalled = (bool)value;
                    break;

                case PropertyID.IsClosed:
                    this.IsClosed = (bool)value;
                    break;

                case PropertyID.IsEquipped:
                    this.IsEquipped = (bool)value;
                    break;

                default:
                    base.SetProperty(propertyID, value);
                    break;
            }
        }
Exemple #16
0
 /// <summary>
 /// Reads the value of the specified item property.
 /// </summary>
 internal Opc.Da.ItemValueResult Read(PropertyID propertyID)
 {
     return(m_settings.Device.Read(m_settings.ItemIndex, propertyID));
 }
 public RestorableProperty(PropertyID pid, int val) : base(pid, val, new RestorableEffectList()) { }
Exemple #18
0
            public void Parse(Stream hs)
            {
                NumFiles = hs.ReadDecodedUInt64();
                while (true)
                {
                    PropertyID propertyID = GetPropertyID(this, hs);
                    if (propertyID == PropertyID.kEnd)
                    {
                        break;
                    }

                    FileProperty property = null;
                    switch (propertyID)
                    {
                    case PropertyID.kEmptyStream:
                        property = new PropertyEmptyStream(NumFiles);
                        property.Parse(hs);
                        NumEmptyStreams = (property as PropertyEmptyStream).NumEmptyStreams;
                        break;

                    case PropertyID.kEmptyFile:
                        property = new PropertyEmptyFile(NumFiles, NumEmptyStreams);
                        property.Parse(hs);
                        break;

                    case PropertyID.kAnti:
                        property = new PropertyAnti(NumFiles, NumEmptyStreams);
                        property.Parse(hs);
                        break;

                    case PropertyID.kCTime:
                    case PropertyID.kATime:
                    case PropertyID.kMTime:
                        property = new PropertyTime(propertyID, NumFiles);
                        property.Parse(hs);
                        break;

                    case PropertyID.kName:
                        property = new PropertyName(NumFiles);
                        property.Parse(hs);
                        break;

                    case PropertyID.kWinAttributes:
                        property = new PropertyAttributes(NumFiles);
                        property.Parse(hs);
                        break;

                    case PropertyID.kDummy:
                        property = new PropertyDummy();
                        property.Parse(hs);
                        break;

                    default:
                        throw new NotImplementedException(propertyID.ToString());
                    }

                    if (property != null)
                    {
                        Properties.Add(property);
                    }
                }
            }
 public SimpleProperty(PropertyID pid) : base(pid) { }
Exemple #20
0
 public ArchiveProperty(PropertyID type)
 {
     this.Type = type;
     this.Size = 0;
     this.Data = new Byte[0];
 }
Exemple #21
0
        void HandlePropertyChange(ObjectID objectID, PropertyID propertyID, object value)
        {
            var ob = m_world.GetObject<BaseObject>(objectID);

            Debug.Assert(ob.IsInitialized);

            ob.SetProperty(propertyID, value);
        }
Exemple #22
0
 /// <summary>
 /// Helper function to read and ensure a specific PropertyID is next in header stream
 /// </summary>
 public static void ExpectPropertyID(IHeaderParser parser, Stream headerStream, PropertyID propertyID)
 {
     if (GetPropertyID(parser, headerStream) != propertyID)
     {
         throw new SevenZipException(parser.GetType().Name + $": Expected property ID = {propertyID}.");
     }
 }
Exemple #23
0
        protected void NotifyValue(PropertyID id, ValueType value)
        {
            Debug.Assert(this.IsInitialized);
            Debug.Assert(value.GetType().IsValueType);
            Debug.Assert(!this.IsDestructed);

            this.World.AddChange(new PropertyValueChange(this, id, value));
        }
Exemple #24
0
            public void Parse(Stream hs)
            {
                ExpectPropertyID(this, hs, PropertyID.kFolder);

                // Folders

                NumFolders = hs.ReadDecodedUInt64();
                External   = hs.ReadByteThrow();
                switch (External)
                {
                case 0:
                    Folders = new Folder[NumFolders];
                    for (ulong i = 0; i < NumFolders; ++i)
                    {
                        Folders[i] = new Folder();
                        Folders[i].Parse(hs);
                    }
                    break;

                case 1:
                    DataStreamsIndex = hs.ReadDecodedUInt64();
                    break;

                default:
                    throw new SevenZipException("External value must be `0` or `1`.");
                }

                ExpectPropertyID(this, hs, PropertyID.kCodersUnPackSize);

                // CodersUnPackSize (data stored in `Folder.UnPackSizes`)

                for (ulong i = 0; i < NumFolders; ++i)
                {
                    Folders[i].UnPackSizes = new UInt64[Folders[i].NumOutStreamsTotal];
                    for (ulong j = 0; j < Folders[i].NumOutStreamsTotal; ++j)
                    {
                        Folders[i].UnPackSizes[j] = hs.ReadDecodedUInt64();
                    }
                }

                // Optional: UnPackDigests (data stored in `Folder.UnPackCRC`)

                PropertyID propertyID = GetPropertyID(this, hs);

                var UnPackDigests = new Digests(NumFolders);

                if (propertyID == PropertyID.kCRC)
                {
                    UnPackDigests.Parse(hs);
                    propertyID = GetPropertyID(this, hs);
                }
                for (ulong i = 0; i < NumFolders; ++i)
                {
                    if (UnPackDigests.Defined(i))
                    {
                        Folders[i].UnPackCRC = UnPackDigests.CRCs[i];
                    }
                }

                // end of UnPackInfo

                if (propertyID != PropertyID.kEnd)
                {
                    throw new SevenZipException("Expected kEnd property.");
                }
            }
Exemple #25
0
 public PropertyStringChange(BaseObject ob, PropertyID propertyID, string value)
     : base(ob, propertyID)
 {
     this.Value = value;
 }
Exemple #26
0
            public void Parse(Stream hs)
            {
                PropertyID propertyID = GetPropertyID(this, hs);

                // Number of UnPack Streams per Folder

                if (propertyID == PropertyID.kNumUnPackStream)
                {
                    NumUnPackStreamsInFolders = new UInt64[unPackInfo.NumFolders];
                    NumUnPackStreamsTotal     = 0;
                    for (ulong i = 0; i < unPackInfo.NumFolders; ++i)
                    {
                        NumUnPackStreamsTotal += NumUnPackStreamsInFolders[i] = hs.ReadDecodedUInt64();
                    }

                    propertyID = GetPropertyID(this, hs);
                }
                else // If no records, assume `1` output stream per folder
                {
                    NumUnPackStreamsInFolders = Enumerable.Repeat((UInt64)1, (int)unPackInfo.NumFolders).ToArray();
                    NumUnPackStreamsTotal     = unPackInfo.NumFolders;
                }

                // UnPackSizes

                UnPackSizes = new List <UInt64>();
                if (propertyID == PropertyID.kSize)
                {
                    for (ulong i = 0; i < unPackInfo.NumFolders; ++i)
                    {
                        UInt64 num = NumUnPackStreamsInFolders[i];
                        if (num == 0)
                        {
                            continue;
                        }

                        UInt64 sum = 0;
                        for (ulong j = 1; j < num; ++j)
                        {
                            UInt64 size = hs.ReadDecodedUInt64();
                            sum += size;
                            UnPackSizes.Add(size);
                        }
                        UnPackSizes.Add(unPackInfo.Folders[i].GetUnPackSize() - sum);
                    }

                    propertyID = GetPropertyID(this, hs);
                }
                else // If no records, assume one unpack size per folder
                {
                    for (ulong i = 0; i < unPackInfo.NumFolders; ++i)
                    {
                        ulong num = NumUnPackStreamsInFolders[i];
                        if (num > 1)
                        {
                            throw new SevenZipException($"Invalid number of UnPackStreams `{num}` in Folder # `{i}`.");
                        }
                        if (num == 1)
                        {
                            UnPackSizes.Add(unPackInfo.Folders[i].GetUnPackSize());
                        }
                    }
                }

                // Digests [Number of Unknown CRCs]

                UInt64 numDigests = 0;

                for (UInt64 i = 0; i < unPackInfo.NumFolders; ++i)
                {
                    UInt64 numSubStreams = NumUnPackStreamsInFolders[i];
                    if (numSubStreams > 1 || unPackInfo.Folders[i].UnPackCRC == null)
                    {
                        numDigests += numSubStreams;
                    }
                }

                if (propertyID == PropertyID.kCRC)
                {
                    Digests = new Digests(numDigests);
                    Digests.Parse(hs);

                    propertyID = GetPropertyID(this, hs);
                }

                if (propertyID != PropertyID.kEnd)
                {
                    throw new SevenZipException("Expected `kEnd` property ID.");
                }
            }
 protected byte[] GetByteArrSetting(PropertyID propID, int inParam = 0);
Exemple #28
0
 public FileProperty(PropertyID PropertyID, UInt64 NumFiles)
 {
     this.PropertyID = PropertyID;
     this.NumFiles   = NumFiles;
     Size            = 0;
 }
 protected short GetInt16Setting(PropertyID propID, int inParam      = 0);
Exemple #30
0
 public DateTime?[] Times; // [NumFiles]
 public PropertyTime(PropertyID propertyID, UInt64 NumFiles)
     : base(propertyID, NumFiles)
 {
 }
 public static PropertyInfo getProperty(Type type, PropertyID id)
 {
     TypeMembers tmember = getMembers(type);
     var arr = tmember.properties;
     if (arr != null)
     {
         for (var i = -1; i < arr.Length; i++)
         {
             PropertyInfo curr;
             if (i == -1)
             {
                 if (id.index >= 0 && arr.Length > id.index)
                     curr = arr[id.index];
                 else
                     continue;
             }
             else
             {
                 curr = arr[i];
             }
             if (curr.Name == id.name)
             {
                 if (matchReturnType(curr.PropertyType, id.retTypeName, id.retTypeFlag) &&
                     matchParameters(curr.GetIndexParameters(), id.paramTypeNames, id.paramFlags))
                 {
                     if (i != -1)
                         id.index = i;
                     return curr;
                 }
             }
         }
     }
     Debug.LogError(new StringBuilder().AppendFormat("GenericTypeCache.getProperty({0}, {1}) fail", type.Name, id.name));
     return null;
 }
        public bool ContainsPropertyColumn(PropertyID propertyID, PropertyTypeName propertyTypeName)
        {
            int index = FindColumnIndexByPropertyTag(propertyID, propertyTypeName);

            return(index >= 0);
        }
Exemple #33
0
 /// <summary>
 /// Reads the value of the specified property.
 /// </summary>
 internal object ReadProperty(PropertyID propertyID)
 {
     return(ReadProperty(propertyID, m_settings.Device, m_settings.ItemIndex));
 }
        /// <summary>
        /// Add column to an empty table context.
        /// If this is a Contents Table, the caller should call UpdateMessage() afterwards.
        /// Similarly, for attachment table, the caller should call UpdateAttachment().
        /// </summary>
        public void AddPropertyColumn(PropertyID propertyID, PropertyTypeName propertyType)
        {
            TableColumnDescriptor newColumnDescriptor = new TableColumnDescriptor();

            newColumnDescriptor.PropertyID   = propertyID;
            newColumnDescriptor.PropertyType = propertyType;
            newColumnDescriptor.iBit         = (byte)m_tcInfo.ColumnCount;
            newColumnDescriptor.cbData       = (byte)GetPropertyDataLength(propertyType);

            // Set the ibData:
            // http://social.msdn.microsoft.com/Forums/en-US/os_binaryfile/thread/a5f9c653-40f5-4638-85d3-00c54607d984/
            // PidTagLtpRowId and PidTagLtpRowVer must not be relocated
            if (newColumnDescriptor.DataLengthGroup == TableContextInfo.TCI_4b)
            {
                newColumnDescriptor.ibData = m_tcInfo.rgib[TableContextInfo.TCI_4b];
            }
            else if (newColumnDescriptor.DataLengthGroup == TableContextInfo.TCI_2b)
            {
                newColumnDescriptor.ibData = m_tcInfo.rgib[TableContextInfo.TCI_2b];
            }
            else
            {
                newColumnDescriptor.ibData = m_tcInfo.rgib[TableContextInfo.TCI_1b];
            }

            // We call GetRedistributedRows() before adding the new column:
            List <byte[]> rows = GetRedistributedRows(newColumnDescriptor.ibData, newColumnDescriptor.cbData);

            // add the new column
            m_tcInfo.rgTCOLDESC.Add(newColumnDescriptor);

            // redistribute column descriptions
            ushort offset = (ushort)(newColumnDescriptor.ibData + newColumnDescriptor.cbData);

            for (int groupIndex = newColumnDescriptor.DataLengthGroup + 1; groupIndex < 3; groupIndex++)
            {
                for (int index = 0; index < m_tcInfo.rgTCOLDESC.Count; index++)
                {
                    TableColumnDescriptor descriptor = m_tcInfo.rgTCOLDESC[index];

                    if (groupIndex == descriptor.DataLengthGroup)
                    {
                        // changes to descriptor will be saved when calling UpdateTableContextInfo()
                        descriptor.ibData = offset;
                        offset           += descriptor.cbData;
                    }
                }
            }

            // update the group ending offset
            m_tcInfo.UpdateDataLayout();
            m_rowsPerBlock = (int)Math.Floor((double)DataBlock.MaximumDataLength / RowLength);

            // Update the rows data
            if (!m_tcInfo.hnidRows.IsEmpty)
            {
                if (m_tcInfo.hnidRows.IsHeapID)
                {
                    m_heap.RemoveItemFromHeap(m_tcInfo.hnidRows.HeapID);
                    CreateSubnodeForRows();
                }
                else
                {
                    if (m_subnodeRows == null)
                    {
                        m_subnodeRows = m_subnodeBTree.GetSubnode(m_tcInfo.hnidRows.NodeID);
                    }
                    m_subnodeRows.Delete(); // this will set the subnode data-tree to null
                    // New data tree will be created when the first row will be added
                    m_subnodeBTree.UpdateSubnodeEntry(m_tcInfo.hnidRows.NodeID, null, null);
                }

                for (int index = 0; index < rows.Count; index++)
                {
                    AddRowToSubnode(index, rows[index]);
                }
            }

            UpdateTableContextInfo();
        }
 public UnrecoverableProperty(PropertyID pid, int val) : base(pid, val, new UnrecoverableEffectList()) { }
        public Nullable <bool> GetBooleanProperty(int rowIndex, PropertyID propertyID)
        {
            int columnIndex = GetColumnIndexByPropertyTag(propertyID, PropertyTypeName.PtypBoolean);

            return(GetBooleanProperty(rowIndex, columnIndex));
        }
 protected NonEffectProperty(PropertyID pid, int val) : base(pid, val) { }
        public Nullable <short> GetInt16Property(int rowIndex, PropertyID propertyID)
        {
            int columnIndex = GetColumnIndexByPropertyTag(propertyID, PropertyTypeName.PtypInteger16);

            return(GetInt16Property(rowIndex, columnIndex));
        }
 public SimpleProperty(PropertyID pid, int val) : base(pid, val) { }
        public Nullable <long> GetInt64Property(int rowIndex, PropertyID propertyID)
        {
            int columnIndex = GetColumnIndexByPropertyTag(propertyID, PropertyTypeName.PtypInteger64);

            return(GetInt64Property(rowIndex, columnIndex));
        }
 public RestorableProperty(PropertyID pid) : base(pid, new RestorableEffectList()) { }
        public Nullable <DateTime> GetDateTimeProperty(int rowIndex, PropertyID propertyID)
        {
            int columnIndex = GetColumnIndexByPropertyTag(propertyID, PropertyTypeName.PtypTime);

            return(GetDateTimeProperty(rowIndex, columnIndex));
        }
Exemple #43
0
        /// <summary>
        /// Returns the set of elements in the address space that meet the specified criteria.
        /// </summary>
        public Opc.Da.BrowseElement[] Browse(
            ItemIdentifier itemID,
            BrowseFilters filters,
            ref Opc.Da.BrowsePosition position)
        {
            lock (this)
            {
                if (m_disposed)
                {
                    throw new ObjectDisposedException("Opc.Da.Cache");
                }

                BrowseElement element = m_addressSpace;

                // find desired element.
                string browsePath = (itemID != null) ? itemID.ItemName : null;

                if (browsePath != null && browsePath.Length > 0)
                {
                    element = m_addressSpace.Find(browsePath);

                    if (element == null)
                    {
                        // check if browsing a property item.
                        PropertyID property = Property.VALUE;

                        string rootID = LookupProperty(browsePath, out property);

                        if (rootID != null)
                        {
                            element = m_addressSpace.Find(rootID);
                        }

                        if (element == null)
                        {
                            throw new ResultIDException(ResultID.Da.E_UNKNOWN_ITEM_NAME);
                        }

                        // property items never contain children.
                        return(new Opc.Da.BrowseElement[0]);
                    }
                }

                // check if no elements exist.
                if (element.Count == 0)
                {
                    return(new Opc.Da.BrowseElement[0]);
                }

                // determine start position.
                int start = 0;

                if (position != null)
                {
                    start = ((BrowsePosition)position).Index;
                    position.Dispose();
                    position = null;
                }

                // process child nodes.
                ArrayList results = new ArrayList();

                for (int ii = start; ii < element.Count; ii++)
                {
                    BrowseElement child = element.Child(ii);

                    // exclude elements without children.
                    if (filters.BrowseFilter == browseFilter.branch && child.Count == 0)
                    {
                        continue;
                    }

                    // check if an element is an item.
                    CacheItem item = (CacheItem)m_items[child.ItemID];

                    // exclude elements which are not items.
                    if (filters.BrowseFilter == browseFilter.item && item == null)
                    {
                        continue;
                    }

                    // apply name filter (using the SQL LIKE operator).
                    if (filters.ElementNameFilter != null && filters.ElementNameFilter.Length > 0)
                    {
                        if (!Opc.Convert.Match(child.Name, filters.ElementNameFilter, true))
                        {
                            continue;
                        }
                    }

                    // add element to list of results.
                    Opc.Da.BrowseElement result = new Opc.Da.BrowseElement();

                    result.Name        = child.Name;
                    result.ItemName    = child.ItemID;
                    result.ItemPath    = null;
                    result.IsItem      = item != null;
                    result.HasChildren = child.Count > 0;
                    result.Properties  = null;

                    // add properties to results.
                    if (filters.ReturnAllProperties || filters.PropertyIDs != null)
                    {
                        result.Properties = GetProperties(item, (filters.ReturnAllProperties) ? null : filters.PropertyIDs, filters.ReturnPropertyValues);
                    }

                    results.Add(result);

                    // check if max elements exceeded.
                    if (filters.MaxElementsReturned > 0 && results.Count >= filters.MaxElementsReturned)
                    {
                        if (ii + 1 < element.Count)
                        {
                            position = new BrowsePosition(itemID, filters);
                            ((BrowsePosition)position).Index = ii + 1;
                        }

                        break;
                    }
                }
                // return results.
                return((Opc.Da.BrowseElement[])results.ToArray(typeof(Opc.Da.BrowseElement)));
            }
        }
        public string GetStringProperty(int rowIndex, PropertyID propertyID)
        {
            int columnIndex = GetColumnIndexByPropertyTag(propertyID, PropertyTypeName.PtypString);

            return(GetStringProperty(rowIndex, columnIndex));
        }
Exemple #45
0
        protected void NotifyString(PropertyID id, string value)
        {
            Debug.Assert(this.IsInitialized);
            Debug.Assert(!this.IsDestructed);

            this.World.AddChange(new PropertyStringChange(this, id, value));
        }
        public byte[] GetBytesProperty(int rowIndex, PropertyID propertyID)
        {
            int columnIndex = GetColumnIndexByPropertyTag(propertyID, PropertyTypeName.PtypBinary);

            return(GetBytesProperty(rowIndex, columnIndex));
        }
Exemple #47
0
        /// <returns>True if property column was added</returns>
        public bool AddPropertyColumnIfNotExist(PropertyName propertyName, PropertyTypeName propertyType)
        {
            PropertyID propertyID = m_map.ObtainIDFromName(propertyName);

            return(AddPropertyColumnIfNotExist(propertyID, propertyType));
        }
        /// <param name="value">set value to null to mark the row as in use</param>
        public void SetBytesProperty(int rowIndex, PropertyID propertyID, byte[] value)
        {
            int columnIndex = GetColumnIndexByPropertyTag(propertyID, PropertyTypeName.PtypBinary);

            SetPropertyValue(rowIndex, columnIndex, value);
        }
Exemple #49
0
 public PropertyIntChange(BaseObject ob, PropertyID propertyID, int value)
     : base(ob, propertyID)
 {
     this.Value = value;
 }
        /// <summary>
        /// For discovery purposes
        /// </summary>
        public List <string> ListTable()
        {
            List <string> result = new List <string>();

            result.Add("Number of Columns: " + this.ColumnCount);
            for (int index = 0; index < m_tcInfo.rgTCOLDESC.Count; index++)
            {
                TableColumnDescriptor descriptor = m_tcInfo.rgTCOLDESC[index];
                result.Add(String.Format("Column {0}, Property Type: {1}, PropertyName: {2}, Data Length: {3}, Offset: {4}, iBit: {5}", index, descriptor.PropertyType, GetPropertyIDString((ushort)descriptor.PropertyID), descriptor.cbData, descriptor.ibData, descriptor.iBit));
            }

            result.Add("Number of Rows: " + m_rowIndex.Count);
            result.Add("4-byte entries length: " + (m_tcInfo.rgib[TableContextInfo.TCI_4b]));
            result.Add("2-byte entries length: " + (m_tcInfo.rgib[TableContextInfo.TCI_2b] - m_tcInfo.rgib[TableContextInfo.TCI_4b]));
            result.Add("1-byte entries length: " + (m_tcInfo.rgib[TableContextInfo.TCI_1b] - m_tcInfo.rgib[TableContextInfo.TCI_2b]));
            result.Add("Row length (net): " + m_tcInfo.rgib[TableContextInfo.TCI_1b]);
            result.Add("Row length: " + this.RowLength);
            for (int rowIndex = 0; rowIndex < m_rowIndex.Count; rowIndex++)
            {
                result.Add("--------------------------------------------------------------------------------");
                result.Add("Row ID: " + m_rowIndex[rowIndex].dwRowID);
                result.Add("Data Length: " + m_rowIndex[rowIndex].DataLength);
                result.Add("Row Index: " + m_rowIndex[rowIndex].dwRowIndex);
                for (int columnIndex = 0; columnIndex < m_tcInfo.rgTCOLDESC.Count; columnIndex++)
                {
                    TableColumnDescriptor descriptor   = m_tcInfo.rgTCOLDESC[columnIndex];
                    PropertyTypeName      propertyType = descriptor.PropertyType;
                    PropertyID            propertyID   = descriptor.PropertyID;
                    string value;
                    if (IsCellInUse(rowIndex, propertyID, propertyType))
                    {
                        if (propertyType == PropertyTypeName.PtypBoolean)
                        {
                            bool boolValue = GetBooleanProperty(rowIndex, propertyID).Value;
                            value = boolValue.ToString();
                        }
                        else if (propertyType == PropertyTypeName.PtypInteger16)
                        {
                            value = GetInt16Property(rowIndex, propertyID).ToString() + " (Int16)";
                        }
                        else if (propertyType == PropertyTypeName.PtypInteger32)
                        {
                            value = GetInt32Property(rowIndex, propertyID).ToString();
                        }
                        else if (propertyType == PropertyTypeName.PtypInteger64)
                        {
                            value = GetInt64Property(rowIndex, propertyID).ToString() + " (Int64)";
                        }
                        else if (propertyType == PropertyTypeName.PtypTime)
                        {
                            value = GetDateTimeProperty(rowIndex, propertyID).ToString();
                        }
                        else if (propertyType == PropertyTypeName.PtypString)
                        {
                            value = GetStringProperty(rowIndex, propertyID);
                        }
                        else if (propertyType == PropertyTypeName.PtypBinary)
                        {
                            value = StringHelper.GetByteArrayString(GetBytesProperty(rowIndex, propertyID));
                        }
                        else
                        {
                            value = "-" + propertyType.ToString();
                        }
                    }
                    else
                    {
                        value = "(Unused)";
                    }

                    result.Add(GetPropertyIDString((ushort)propertyID) + ": " + value);
                }
            }

            return(result);
        }
Exemple #51
0
 public PropertyValueChange(BaseObject ob, PropertyID propertyID, ValueType value)
     : base(ob, propertyID)
 {
     this.Value = value;
 }
Exemple #52
0
 private void MainCamera_PropertyChanged(Camera sender, PropertyEventID eventID, PropertyID propID, int parameter)
 {
     if (sendToUnity != null)
     {
         sendToUnity.Invoke("{\"" + eventID + "\":\"" + propID + "\"}");
     }
 }
 protected bool GetBoolSetting(PropertyID propID, int inParam      = 0);
 /// <summary>
 /// Returns the specified properties for the item.
 /// </summary>
 public Opc.Da.ItemPropertyCollection GetAvailableProperties(
     PropertyID[] propertyIDs,
     bool         returnValues)
 {
     return m_device.GetAvailableProperties(m_itemID, propertyIDs, returnValues);
 }
 protected byte GetByteSetting(PropertyID propID, int inParam      = 0);
 /// <summary>
 /// Reads the value of the specified item property.
 /// </summary>
 public Opc.Da.ItemValueResult Read(PropertyID propertyID)
 {
     return m_device.Read(m_itemID, propertyID);
 }
 protected void GetHistogram(PropertyID propID, IntPtr evfImageRef, uint[] histogram);
        /// <summary>
        /// Reads the value of the specified property.
        /// </summary>
        public object ReadProperty(PropertyID propertyID)
        {
            ItemValueResult result = m_device.Read(m_itemID, propertyID);

            if (result == null || result.ResultID.Failed())
            {
                return null;
            }

            return result.Value;
        }
 protected int[] GetInt32ArrSetting(PropertyID propID, int inParam = 0);
 /// <summary>
 /// Writes the value of the specified item property.
 /// </summary>
 public Opc.IdentifiedResult Write(
     string           itemID,
     PropertyID       propertyID,
     Opc.Da.ItemValue value)
 {
     return null;
 }