Ejemplo n.º 1
0
 private static int ProcessNullItem(RLPCollection rlpCollection, int currentPosition)
 {
   var item = EMPTY_BYTE_ARRAY;
   var rlpItem = new RLPItem(item);
   rlpCollection.Add(rlpItem);
   currentPosition += 1;
   return currentPosition;
 }
Ejemplo n.º 2
0
 private static int ProcessSingleByteItem(byte[] msgData, RLPCollection rlpCollection, int currentPosition)
 {
   byte[] item = { msgData[currentPosition] };
   var rlpItem = new RLPItem(item);
   rlpCollection.Add(rlpItem);
   currentPosition += 1;
   return currentPosition;
 }
Ejemplo n.º 3
0
 private static int ProcessItemLessThan55Bytes(byte[] msgData, RLPCollection rlpCollection, int currentPosition)
 {
   var length = (byte)(msgData[currentPosition] - OFFSET_SHORT_ITEM);
   var item = new byte[length];
   Array.Copy(msgData, currentPosition + 1, item, 0, length);
   var rlpPrefix = new byte[2];
   Array.Copy(msgData, currentPosition, rlpPrefix, 0, 2);
   var rlpItem = new RLPItem(item);
   rlpCollection.Add(rlpItem);
   currentPosition += 1 + length;
   return currentPosition;
 }
Ejemplo n.º 4
0
 private static int ProcessItemBiggerThan55Bytes(byte[] msgData, RLPCollection rlpCollection,
     int currentPosition)
 {
   var lengthOfLength = (byte)(msgData[currentPosition] - OFFSET_LONG_ITEM);
   var length = CalculateLength(lengthOfLength, msgData, currentPosition);
   // now we can parse an item for data[1]..data[length]
   var item = new byte[length];
   Array.Copy(msgData, currentPosition + lengthOfLength + 1, item,
       0, length);
   var rlpPrefix = new byte[lengthOfLength + 1];
   Array.Copy(msgData, currentPosition, rlpPrefix, 0,
       lengthOfLength + 1);
   var rlpItem = new RLPItem(item);
   rlpCollection.Add(rlpItem);
   currentPosition += lengthOfLength + length + 1;
   return currentPosition;
 }