Beispiel #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ChunkSplit"/> class.
 /// </summary>
 /// <param name="data">The data to read from.</param>
 /// <param name="index">The index at which to start reading from.</param>
 internal ChunkSplit(byte[] data, int index)
 {
     _start1 = ChunkMarker.ConvertFromString(ByteArrayHelper.ToString(data, ref index));
     _end1   = ChunkMarker.ConvertFromString(ByteArrayHelper.ToString(data, ref index));
     _start2 = ChunkMarker.ConvertFromString(ByteArrayHelper.ToString(data, ref index));
     _end2   = ChunkMarker.ConvertFromString(ByteArrayHelper.ToString(data, ref index));
 }
Beispiel #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ChunkTransfer"/> class.
        /// </summary>
        /// <param name="data">The data to read from.</param>
        /// <param name="index">The index at which to start reading from.</param>
        internal ChunkTransfer(byte[] data, int index)
        {
            string node = ByteArrayHelper.ToString(data, ref index);

            _node  = new NodeDefinition(node.Split(':')[0], int.Parse(node.Split(':')[1]));
            _start = ChunkMarker.ConvertFromString(ByteArrayHelper.ToString(data, ref index));
            _end   = ChunkMarker.ConvertFromString(ByteArrayHelper.ToString(data, ref index));
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="ChunkListResponse"/> class.
        /// </summary>
        /// <param name="data">The data to read from.</param>
        /// <param name="index">The index at which to start reading from.</param>
        internal ChunkListResponse(byte[] data, int index)
        {
            _chunks = new List <ChunkDefinition>();
            string s = ByteArrayHelper.ToString(data, ref index);

            string[] defs = s.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
            foreach (var item in defs)
            {
                string[]       def     = item.Split(',');
                NodeDefinition nodeDef = new NodeDefinition(def[2].Split(':')[0], int.Parse(def[2].Split(':')[1]));
                _chunks.Add(new ChunkDefinition(ChunkMarker.ConvertFromString(def[0]), ChunkMarker.ConvertFromString(def[1]), nodeDef));
            }
        }
Beispiel #4
0
        /// <summary>
        /// Gets a list of the chunks from the internal document.
        /// </summary>
        /// <returns>A list of the chunks from the internal document.</returns>
        private List <ChunkDefinition> GetList()
        {
            List <ChunkDefinition> returnValue = new List <ChunkDefinition>();

            for (int i = 0; i < _chunkList.Count; ++i)
            {
                var array = _chunkList[i.ToString()].ValueAsArray;
                var start = ChunkMarker.ConvertFromString(array[0].ValueAsString);
                var end   = ChunkMarker.ConvertFromString(array[1].ValueAsString);
                var node  = new NodeDefinition(array[2].ValueAsString.Split(':')[0], int.Parse(array[2].ValueAsString.Split(':')[1]));
                returnValue.Add(new ChunkDefinition(start, end, node));
            }

            return(returnValue);
        }
Beispiel #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ChunkMerge"/> class.
 /// </summary>
 /// <param name="data">The data to read from.</param>
 /// <param name="index">The index at which to start reading from.</param>
 internal ChunkMerge(byte[] data, int index)
 {
     _start = ChunkMarker.ConvertFromString(ByteArrayHelper.ToString(data, ref index));
     _end   = ChunkMarker.ConvertFromString(ByteArrayHelper.ToString(data, ref index));
 }