ReadSingle() public method

public ReadSingle ( ) : float
return float
Esempio n. 1
0
        NbtTag ReadValueAsTag()
        {
            if (!atValue)
            {
                // Should never happen
                throw new InvalidOperationException(NoValueToReadError);
            }
            atValue = false;
            switch (TagType)
            {
            case NbtTagType.Byte:
                return(new NbtByte(TagName, reader.ReadByte()));

            case NbtTagType.Short:
                return(new NbtShort(TagName, reader.ReadInt16()));

            case NbtTagType.Int:
                return(new NbtInt(TagName, reader.ReadInt32()));

            case NbtTagType.Long:
                return(new NbtLong(TagName, reader.ReadInt64()));

            case NbtTagType.Float:
                return(new NbtFloat(TagName, reader.ReadSingle()));

            case NbtTagType.Double:
                return(new NbtDouble(TagName, reader.ReadDouble()));

            case NbtTagType.String:
                return(new NbtString(TagName, reader.ReadString()));

            case NbtTagType.ByteArray:
                byte[] value = reader.ReadBytes(TagLength);
                if (value.Length < TagLength)
                {
                    throw new EndOfStreamException();
                }
                return(new NbtByteArray(TagName, value));

            case NbtTagType.IntArray:
                var ints = new int[TagLength];
                for (int i = 0; i < TagLength; i++)
                {
                    ints[i] = reader.ReadInt32();
                }
                return(new NbtIntArray(TagName, ints));

            case NbtTagType.LongArray:
                var longs = new long[TagLength];
                for (int i = 0; i < TagLength; i++)
                {
                    longs[i] = reader.ReadInt64();
                }

                return(new NbtLongArray(TagName, longs));

            default:
                throw new InvalidOperationException(NonValueTagError);
            }
        }
Esempio n. 2
0
 internal override bool ReadTag(NbtBinaryReader readStream)
 {
     if (readStream.Selector != null && !readStream.Selector(this)) {
         readStream.ReadSingle();
         return false;
     }
     Value = readStream.ReadSingle();
     return true;
 }
Esempio n. 3
0
 internal override bool ReadTag(NbtBinaryReader readStream)
 {
     if (readStream.Selector != null && !readStream.Selector(this))
     {
         readStream.ReadSingle();
         return(false);
     }
     Value = readStream.ReadSingle();
     return(true);
 }
Esempio n. 4
0
        NbtTag ReadValueAsTag()
        {
            if (!atValue)
            {
                throw new InvalidOperationException(NoValueToReadError);
            }
            atValue = false;
            switch (TagType)
            {
            case NbtTagType.Byte:
                return(new NbtByte(TagName, reader.ReadByte()));

            case NbtTagType.Short:
                return(new NbtShort(TagName, reader.ReadInt16()));

            case NbtTagType.Int:
                return(new NbtInt(TagName, reader.ReadInt32()));

            case NbtTagType.Long:
                return(new NbtLong(TagName, reader.ReadInt64()));

            case NbtTagType.Float:
                return(new NbtFloat(TagName, reader.ReadSingle()));

            case NbtTagType.Double:
                return(new NbtDouble(TagName, reader.ReadDouble()));

            case NbtTagType.String:
                return(new NbtString(TagName, reader.ReadString()));

            case NbtTagType.ByteArray:
                return(new NbtByteArray(TagName, reader.ReadBytes(TagLength)));

            case NbtTagType.IntArray:
                int[] ints = new int[TagLength];
                for (int i = 0; i < TagLength; i++)
                {
                    ints[i] = reader.ReadInt32();
                }
                return(new NbtIntArray(TagName, ints));

            default:
                throw new InvalidOperationException(NonValueTagError);
            }
        }
Esempio n. 5
0
 internal override void SkipTag(NbtBinaryReader readStream)
 {
     readStream.ReadSingle();
 }
Esempio n. 6
0
 internal override void SkipTag(NbtBinaryReader readStream)
 {
     readStream.ReadSingle();
 }
Esempio n. 7
0
 internal override void ReadTag(NbtBinaryReader readStream)
 {
     Value = readStream.ReadSingle();
 }