Exemplo n.º 1
0
        internal static bool TryParseArray(string typeName, out AdsDatatypeArrayInfo[] dims, out string baseType)
        {
            Match match = arrayExpression.Match(typeName);

            dims     = null;
            baseType = null;
            if (!match.Success)
            {
                return(false);
            }
            baseType = match.get_Groups().get_Item("elementType").Value;
            Group group  = match.get_Groups().get_Item("ub");
            Group group2 = match.get_Groups().get_Item("lb");
            int   count  = group.get_Captures().Count;

            dims = new AdsDatatypeArrayInfo[count];
            for (int i = 0; i < count; i++)
            {
                object obj2       = group2.get_Captures().get_Item(i);
                int    lowerBound = int.Parse(group2.get_Captures().get_Item(i).Value);
                int    num4       = int.Parse(group.get_Captures().get_Item(i).Value);
                int    elements   = (num4 - lowerBound) + 1;
                dims[i] = new AdsDatatypeArrayInfo(lowerBound, elements);
            }
            return(true);
        }
Exemplo n.º 2
0
 internal AdsDatatypeArrayInfo[] ToArray()
 {
     AdsDatatypeArrayInfo[] infoArray = null;
     if (this._list.Count > 0)
     {
         infoArray = new AdsDatatypeArrayInfo[this.Count];
         for (int i = 0; i < this._list.Count; i++)
         {
             IDimension dimension = this[i];
             infoArray[i] = new AdsDatatypeArrayInfo(dimension.LowerBound, dimension.ElementCount);
         }
     }
     return(infoArray);
 }
Exemplo n.º 3
0
        internal DimensionCollection(AdsDatatypeArrayInfo[] arrayInfos)
        {
            this._list = new List <IDimension>();
            if (arrayInfos == null)
            {
                throw new ArgumentNullException("arrayInfos");
            }
            int length = arrayInfos.GetLength(0);

            for (int i = 0; i < length; i++)
            {
                AdsDatatypeArrayInfo info = arrayInfos[i];
                Dimension            item = new Dimension(info.LowerBound, info.Elements);
                this._list.Add(item);
            }
        }