Exemple #1
0
 internal static T GetValueChecked <T>(this PacketConverter <T> converter, byte[] buffer, int offset, int length, bool check = false)
 {
     try
     {
         if (check && converter.Length > length)
         {
             throw PacketException.Overflow();
         }
         return(converter.GetValue(buffer, offset, length));
     }
     catch (Exception ex) when(PacketException.ReThrowFilter(ex))
     {
         throw PacketException.ConversionError(ex);
     }
 }
Exemple #2
0
 internal static T GetValue <T>(this PacketConverter <T> converter, Block block) => converter.GetValue(block.Buffer, block.Offset, block.Length);