Exemplo n.º 1
0
 /// <summary>
 /// Gets the size of a string if it was to be written to the encoder
 /// </summary>
 /// <param name="str">The string to check the size of</param>
 /// <returns>The size the string would take on the encoder</returns>
 public int GetStringSize(string str)
 {
     if (ProtoRev < 0x0300u)
     {
         int len = str.Length;
         if (len > 0xffff)
         {
             len = 0xffff;
         }
         return(2 + len);
     }
     return(Leb128.SizeUleb128((ulong)str.Length) + str.Length);
 }
Exemplo n.º 2
0
 /// <summary>
 /// Gets the size of a raw array if it was to be written to the encoder
 /// </summary>
 /// <param name="raw">The raw array to check the size of</param>
 /// <returns>The size the raw array would take on the encoder</returns>
 public int GetRawSize(byte[] raw)
 {
     return(Leb128.SizeUleb128((ulong)raw.Length) + raw.Length);
 }