コード例 #1
0
ファイル: IBMessages.cs プロジェクト: larytet/JQuant
		/// <summary>
		/// Splits zero delimitered array of bytes into map of information elements. 
		/// An information element is described by first and last byte in the array
		/// </summary>
		public static bool SplitArray(byte[] data, int offset, int size, out System.Collections.Generic.List<Utils.IEIndex> list, out int length)
		{
			list = new System.Collections.Generic.List<Utils.IEIndex>(10);
			length = 0;
			
			if (data[offset] == 0)
			{
				offset++;
			}
			int firstByte = 0;
			int lastByte;
			while (offset < size)
			{
				if (data[offset] == 0)
				{
					lastByte = offset;
					length = offset+1;
					IEIndex ieIndex = new IEIndex(firstByte, lastByte);
					list.Add(ieIndex);
					firstByte = lastByte + 1;
				}
				offset++;
			}
			
			
			return (length != 0);
		}
コード例 #2
0
ファイル: IBMessages.cs プロジェクト: sopnic/larytet-master
        /// <summary>
        /// Splits zero delimitered array of bytes into map of information elements. 
        /// An information element is described by first and last byte in the array
        /// </summary>
        public static bool SplitArray(byte[] data, int offset, int size, out System.Collections.Generic.List<Utils.IEIndex> list, out int length)
        {
            list = new System.Collections.Generic.List<Utils.IEIndex>(10);
            length = 0;

            if (data[offset] == 0)
            {
                offset++;
            }
            int firstByte = 0;
            int lastByte;
            while (offset < size)
            {
                if (data[offset] == 0)
                {
                    lastByte = offset;
                    length = offset+1;
                    IEIndex ieIndex = new IEIndex(firstByte, lastByte);
                    list.Add(ieIndex);
                    firstByte = lastByte + 1;
                }
                offset++;
            }

            return (length != 0);
        }