void Require(FbxValueType type) { if (Type != type) { throw Required(type); } }
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)); } }
Exception Required(FbxValueType type) { return new InvalidOperationException(typeof(FbxValueType).Name + " " + type + " is required, but the " + typeof(FbxValue).Name + " is " + Type + "."); }
void Require(FbxValueType type) { if (Type != type) throw Required(type); }
Exception Required(FbxValueType type) { return(new InvalidOperationException(typeof(FbxValueType).Name + " " + type + " is required, but the " + typeof(FbxValue).Name + " is " + Type + ".")); }