Пример #1
0
 // Token: 0x06000357 RID: 855 RVA: 0x00008E8C File Offset: 0x00007E8C
 public void UpdateDataFilter(Da.Server server, string filterValue)
 {
     if (this.m_unfilteredItemID == null)
     {
         throw new ApplicationException("Cannot update the data filter for this item.");
     }
     IdentifiedResult[] array = server.Write(new ItemValue[]
     {
         new ItemValue(this)
         {
             Value              = filterValue,
             Quality            = Quality.Bad,
             QualitySpecified   = false,
             Timestamp          = DateTime.MinValue,
             TimestampSpecified = false
         }
     });
     if (array == null || array.Length == 0)
     {
         throw new ApplicationException("Unexpected result from server.");
     }
     if (array[0].ResultID.Failed())
     {
         throw new ApplicationException("Could not update data filter.");
     }
     this.m_filterValue = filterValue;
 }
Пример #2
0
        // Token: 0x0600035A RID: 858 RVA: 0x00009020 File Offset: 0x00008020
        public void GetDataFilterItem(Da.Server server)
        {
            this.m_filterItem = null;
            if (this.m_unfilteredItemID != null)
            {
                return;
            }
            BrowsePosition browsePosition = null;

            try
            {
                ItemIdentifier itemID        = new ItemIdentifier(this);
                BrowseFilters  browseFilters = new BrowseFilters();
                browseFilters.ElementNameFilter    = "DataFilters";
                browseFilters.BrowseFilter         = browseFilter.all;
                browseFilters.ReturnAllProperties  = false;
                browseFilters.PropertyIDs          = null;
                browseFilters.ReturnPropertyValues = false;
                BrowseElement[] array;
                if (this.m_unconvertedItemID == null)
                {
                    browseFilters.ElementNameFilter = "CPX";
                    array = server.Browse(itemID, browseFilters, out browsePosition);
                    if (array == null || array.Length == 0)
                    {
                        return;
                    }
                    if (browsePosition != null)
                    {
                        browsePosition.Dispose();
                        browsePosition = null;
                    }
                    itemID = new ItemIdentifier(array[0].ItemPath, array[0].ItemName);
                    browseFilters.ElementNameFilter = "DataFilters";
                }
                array = server.Browse(itemID, browseFilters, out browsePosition);
                if (array != null && array.Length != 0)
                {
                    this.m_filterItem = new ItemIdentifier(array[0].ItemPath, array[0].ItemName);
                }
            }
            finally
            {
                if (browsePosition != null)
                {
                    browsePosition.Dispose();
                    browsePosition = null;
                }
            }
        }
Пример #3
0
        // Token: 0x06000355 RID: 853 RVA: 0x00008C14 File Offset: 0x00007C14
        public ComplexItem[] GetDataFilters(Da.Server server)
        {
            if (this.m_unfilteredItemID != null)
            {
                return(null);
            }
            if (this.m_filterItem == null)
            {
                return(null);
            }
            BrowsePosition browsePosition = null;

            ComplexItem[] result;
            try
            {
                BrowseFilters browseFilters = new BrowseFilters();
                browseFilters.ElementNameFilter    = null;
                browseFilters.BrowseFilter         = browseFilter.item;
                browseFilters.ReturnAllProperties  = false;
                browseFilters.PropertyIDs          = ComplexItem.CPX_PROPERTIES;
                browseFilters.ReturnPropertyValues = true;
                BrowseElement[] array = server.Browse(this.m_filterItem, browseFilters, out browsePosition);
                if (array == null || array.Length == 0)
                {
                    result = new ComplexItem[0];
                }
                else
                {
                    ArrayList arrayList = new ArrayList(array.Length);
                    foreach (BrowseElement element in array)
                    {
                        ComplexItem complexItem = new ComplexItem();
                        if (complexItem.Init(element))
                        {
                            arrayList.Add(complexItem);
                        }
                    }
                    result = (ComplexItem[])arrayList.ToArray(typeof(ComplexItem));
                }
            }
            finally
            {
                if (browsePosition != null)
                {
                    browsePosition.Dispose();
                    browsePosition = null;
                }
            }
            return(result);
        }
Пример #4
0
 // Token: 0x06000353 RID: 851 RVA: 0x00008A2C File Offset: 0x00007A2C
 public void Update(Da.Server server)
 {
     this.Clear();
     ItemPropertyCollection[] properties = server.GetProperties(new ItemIdentifier[]
     {
         this
     }, ComplexItem.CPX_PROPERTIES, true);
     if (properties == null || properties.Length != 1)
     {
         throw new ApplicationException("Unexpected results returned from server.");
     }
     if (!this.Init((ItemProperty[])properties[0].ToArray(typeof(ItemProperty))))
     {
         throw new ApplicationException("Not a valid complex item.");
     }
     this.GetDataFilterItem(server);
 }
Пример #5
0
        // Token: 0x06000359 RID: 857 RVA: 0x00008FA4 File Offset: 0x00007FA4
        public string GetTypeDescription(Da.Server server)
        {
            ItemPropertyCollection[] properties = server.GetProperties(new ItemIdentifier[]
            {
                this.m_typeItemID
            }, new PropertyID[]
            {
                Property.TYPE_DESCRIPTION
            }, true);
            if (properties == null || properties.Length == 0 || properties[0].Count == 0)
            {
                return(null);
            }
            ItemProperty itemProperty = properties[0][0];

            if (!itemProperty.ResultID.Succeeded())
            {
                return(null);
            }
            return((string)itemProperty.Value);
        }
Пример #6
0
        // Token: 0x06000356 RID: 854 RVA: 0x00008D00 File Offset: 0x00007D00
        public ComplexItem CreateDataFilter(Da.Server server, string filterName, string filterValue)
        {
            if (this.m_unfilteredItemID != null)
            {
                return(null);
            }
            if (this.m_filterItem == null)
            {
                return(null);
            }
            BrowsePosition browsePosition = null;
            ComplexItem    result;

            try
            {
                ItemValue     itemValue     = new ItemValue(this.m_filterItem);
                StringWriter  stringWriter  = new StringWriter();
                XmlTextWriter xmlTextWriter = new XmlTextWriter(stringWriter);
                xmlTextWriter.WriteStartElement("DataFilters");
                xmlTextWriter.WriteAttributeString("Name", filterName);
                xmlTextWriter.WriteString(filterValue);
                xmlTextWriter.WriteEndElement();
                xmlTextWriter.Close();
                itemValue.Value              = stringWriter.ToString();
                itemValue.Quality            = Quality.Bad;
                itemValue.QualitySpecified   = false;
                itemValue.Timestamp          = DateTime.MinValue;
                itemValue.TimestampSpecified = false;
                IdentifiedResult[] array = server.Write(new ItemValue[]
                {
                    itemValue
                });
                if (array == null || array.Length == 0)
                {
                    throw new ApplicationException("Unexpected result from server.");
                }
                if (array[0].ResultID.Failed())
                {
                    throw new ApplicationException("Could not create new data filter.");
                }
                BrowseFilters browseFilters = new BrowseFilters();
                browseFilters.ElementNameFilter    = filterName;
                browseFilters.BrowseFilter         = browseFilter.item;
                browseFilters.ReturnAllProperties  = false;
                browseFilters.PropertyIDs          = ComplexItem.CPX_PROPERTIES;
                browseFilters.ReturnPropertyValues = true;
                BrowseElement[] array2 = server.Browse(this.m_filterItem, browseFilters, out browsePosition);
                if (array2 == null || array2.Length == 0)
                {
                    throw new ApplicationException("Could not browse to new data filter.");
                }
                ComplexItem complexItem = new ComplexItem();
                if (!complexItem.Init(array2[0]))
                {
                    throw new ApplicationException("Could not initialize to new data filter.");
                }
                result = complexItem;
            }
            finally
            {
                if (browsePosition != null)
                {
                    browsePosition.Dispose();
                    browsePosition = null;
                }
            }
            return(result);
        }
Пример #7
0
        // Token: 0x06000354 RID: 852 RVA: 0x00008AA0 File Offset: 0x00007AA0
        public ComplexItem[] GetTypeConversions(Da.Server server)
        {
            if (this.m_unconvertedItemID != null || this.m_unfilteredItemID != null)
            {
                return(null);
            }
            BrowsePosition browsePosition = null;

            ComplexItem[] result;
            try
            {
                BrowseFilters browseFilters = new BrowseFilters();
                browseFilters.ElementNameFilter    = "CPX";
                browseFilters.BrowseFilter         = browseFilter.branch;
                browseFilters.ReturnAllProperties  = false;
                browseFilters.PropertyIDs          = null;
                browseFilters.ReturnPropertyValues = false;
                BrowseElement[] array = server.Browse(this, browseFilters, out browsePosition);
                if (array == null || array.Length == 0)
                {
                    result = null;
                }
                else
                {
                    if (browsePosition != null)
                    {
                        browsePosition.Dispose();
                        browsePosition = null;
                    }
                    ItemIdentifier itemID = new ItemIdentifier(array[0].ItemPath, array[0].ItemName);
                    browseFilters.ElementNameFilter    = null;
                    browseFilters.BrowseFilter         = browseFilter.item;
                    browseFilters.ReturnAllProperties  = false;
                    browseFilters.PropertyIDs          = ComplexItem.CPX_PROPERTIES;
                    browseFilters.ReturnPropertyValues = true;
                    array = server.Browse(itemID, browseFilters, out browsePosition);
                    if (array == null || array.Length == 0)
                    {
                        result = new ComplexItem[0];
                    }
                    else
                    {
                        ArrayList arrayList = new ArrayList(array.Length);
                        foreach (BrowseElement browseElement in array)
                        {
                            if (browseElement.Name != "DataFilters")
                            {
                                ComplexItem complexItem = new ComplexItem();
                                if (complexItem.Init(browseElement))
                                {
                                    complexItem.GetDataFilterItem(server);
                                    arrayList.Add(complexItem);
                                }
                            }
                        }
                        result = (ComplexItem[])arrayList.ToArray(typeof(ComplexItem));
                    }
                }
            }
            finally
            {
                if (browsePosition != null)
                {
                    browsePosition.Dispose();
                    browsePosition = null;
                }
            }
            return(result);
        }