Exemplo n.º 1
0
        /// <summary>
        /// Private helper used to read an int, short or byte (in reverse order) from the reader
        /// and return an int
        /// </summary>
        /// <param name="reader"></param>
        /// <param name="type"></param>
        /// <returns></returns>
        private int GetDataFromReader(BitStreamReader reader, GorillaEncodingType type)
        {
            switch (type)
            {
            case GorillaEncodingType.Int:
            {
                return((int)reader.ReadUInt32Reverse(Native.BitsPerInt));
            }

            case GorillaEncodingType.Short:
            {
                return((int)reader.ReadUInt16Reverse(Native.BitsPerShort));
            }

            case GorillaEncodingType.Byte:
            {
                return((int)reader.ReadByte(Native.BitsPerByte));
            }

            default:
            {
                throw new ArgumentException(StrokeCollectionSerializer.ISFDebugMessage("bogus GorillaEncodingType passed to GetDataFromReader"));
            }
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// Private helper used to read an int, short or byte (in reverse order) from the reader
 /// and return an int
 /// </summary>
 /// <param name="reader"></param>
 /// <param name="type"></param>
 /// <returns></returns>
 private int GetDataFromReader(BitStreamReader reader, GorillaEncodingType type)
 {
     switch (type)
     {
         case GorillaEncodingType.Int:
             {
                 return (int)reader.ReadUInt32Reverse(Native.BitsPerInt);
             }
         case GorillaEncodingType.Short:
             {
                 return (int)reader.ReadUInt16Reverse(Native.BitsPerShort);
             }
         case GorillaEncodingType.Byte:
             {
                 return (int)reader.ReadByte(Native.BitsPerByte);
             }
         default:
             {
                 throw new ArgumentException(StrokeCollectionSerializer.ISFDebugMessage("bogus GorillaEncodingType passed to GetDataFromReader"));
             }
     }
 }