예제 #1
0
 void Require(FbxValueType type)
 {
     if (Type != type)
     {
         throw Required(type);
     }
 }
예제 #2
0
        public FbxValue(BinaryReader reader)
            : this()
        {
            Type = (FbxValueType)reader.ReadByte();
            switch (Type)
            {
            case FbxValueType.Double:
                ValueCombo.Double = reader.ReadDouble();
                break;

            case FbxValueType.DoubleArray:
                int doubleCount = reader.ReadInt32();
                reader.RequireZeroes(4);
                reader.Require(doubleCount * 8);
                ValueObject = reader.ReadArrayDouble(doubleCount);
                break;

            case FbxValueType.Int32:
                ValueCombo.Int32 = reader.ReadInt32();
                break;

            case FbxValueType.Int32Array:
                int int32Count = reader.ReadInt32();
                reader.RequireZeroes(4);
                reader.Require(int32Count * 4);
                ValueObject = reader.ReadArrayInt32(int32Count);
                break;

            case FbxValueType.String:
                int stringLength = reader.ReadInt32();
                ValueObject = reader.ReadString(stringLength, Encoding.UTF8);
                break;

            case FbxValueType.Data:
                int dataLength = reader.ReadInt32();
                ValueObject = reader.ReadBytes(dataLength);
                break;

            default:
                throw new NotImplementedException(string.Format("{0} {1:X2}h/'{2}' is not implemented.", typeof(FbxValueType).Name, (int)Type, (char)Type));
            }
        }
예제 #3
0
        public FbxValue(BinaryReader reader)
            : this()
        {
            Type = (FbxValueType)reader.ReadByte();
            switch (Type) {
                case FbxValueType.Double:
                    ValueCombo.Double = reader.ReadDouble();
                    break;

                case FbxValueType.DoubleArray:
                    int doubleCount = reader.ReadInt32();
                    reader.RequireZeroes(4);
                    reader.Require(doubleCount * 8);
                    ValueObject = reader.ReadArrayDouble(doubleCount);
                    break;

                case FbxValueType.Int32:
                    ValueCombo.Int32 = reader.ReadInt32();
                    break;

                case FbxValueType.Int32Array:
                    int int32Count = reader.ReadInt32();
                    reader.RequireZeroes(4);
                    reader.Require(int32Count * 4);
                    ValueObject = reader.ReadArrayInt32(int32Count);
                    break;

                case FbxValueType.String:
                    int stringLength = reader.ReadInt32();
                    ValueObject = reader.ReadString(stringLength, Encoding.UTF8);
                    break;

                case FbxValueType.Data:
                    int dataLength = reader.ReadInt32();
                    ValueObject = reader.ReadBytes(dataLength);
                    break;

                default:
                    throw new NotImplementedException(string.Format("{0} {1:X2}h/'{2}' is not implemented.", typeof(FbxValueType).Name, (int)Type, (char)Type));
            }
        }
예제 #4
0
 Exception Required(FbxValueType type)
 {
     return new InvalidOperationException(typeof(FbxValueType).Name + " " + type + " is required, but the " + typeof(FbxValue).Name + " is " + Type + ".");
 }
예제 #5
0
 void Require(FbxValueType type)
 {
     if (Type != type) throw Required(type);
 }
예제 #6
0
 Exception Required(FbxValueType type)
 {
     return(new InvalidOperationException(typeof(FbxValueType).Name + " " + type + " is required, but the " + typeof(FbxValue).Name + " is " + Type + "."));
 }