public virtual void Read(hsStream s) { if (s.ReadByte() != kIoVersion) throw new NotSupportedException("Bad VarDescriptor IO Version"); fName = s.ReadSafeString(); string displayOptions = s.ReadStdString(); // TODO fCount = s.ReadInt(); fType = (plAtomicType)s.ReadByte(); Default = s.ReadSafeString(); fFlags = (Flags)s.ReadInt(); }
internal plSimpleVarDescriptor(string name, string type) : base(name) { string itype = type.ToUpper(); if (itype == "VECTOR3") { fAtomicCount = 3; fAtomicType = plAtomicType.kFloat; fType = plAtomicType.kVector3; } else if (itype == "POINT3") { fAtomicCount = 3; fAtomicType = plAtomicType.kFloat; fType = plAtomicType.kPoint3; } else if (itype == "RGB") { fAtomicCount = 3; fAtomicType = plAtomicType.kFloat; fType = plAtomicType.kRGB; } else if (itype == "RGBA") { fAtomicCount = 4; fAtomicType = plAtomicType.kFloat; fType = plAtomicType.kRGBA; } else if (itype == "RGB8") { fAtomicCount = 3; fAtomicType = plAtomicType.kByte; fType = plAtomicType.kRGB8; } else if (itype == "RGBA8") { fAtomicCount = 4; fAtomicType = plAtomicType.kByte; fType = plAtomicType.kRGBA8; } else if (itype == "QUAT" || itype == "QUATERNION") { fAtomicCount = 4; fAtomicType = plAtomicType.kFloat; fType = plAtomicType.kQuaternion; } else if (itype == "INT") fAtomicType = plAtomicType.kInt; else if (itype == "SHORT") fAtomicType = plAtomicType.kShort; else if (itype == "BYTE") fAtomicType = plAtomicType.kByte; else if (itype == "FLOAT") fAtomicType = plAtomicType.kFloat; else if (itype == "DOUBLE") fAtomicType = plAtomicType.kDouble; else if (itype == "TIME") fAtomicType = plAtomicType.kTime; else if (itype == "AGETIMEOFDAY") fAtomicType = plAtomicType.kAgeTimeOfDay; else if (itype == "BOOL") fAtomicType = plAtomicType.kBool; else if (itype == "STRING32") fAtomicType = plAtomicType.kString32; else if (itype == "PLKEY") fAtomicType = plAtomicType.kKey; else if (itype == "MESSAGE" || itype == "CREATABLE") fAtomicType = plAtomicType.kCreatable; else throw new plSDLException("Invalid SimpleVarDescriptor Type: " + type); if (fType == plAtomicType.kNone) fType = fAtomicType; }
internal plVarDescriptor(string name, string type) { if (name.EndsWith("[]")) { VariableLength = true; fName = name.Replace("[]", null); } else { string[] hack = name.Split(new char[] { '[' }); hack[1] = hack[1].Replace("]", null); fName = hack[0]; fCount = Convert.ToInt32(hack[1]); } string itype = type.ToUpper(); if (itype.StartsWith("$")) { fType = plAtomicType.kStateDescriptor; fDescName = type.Substring(1); fVersion = -1; } else if (itype == "VECTOR3") { fAtomicCount = 3; fAtomicType = plAtomicType.kFloat; fType = plAtomicType.kVector3; } else if (itype == "POINT3") { fAtomicCount = 3; fAtomicType = plAtomicType.kFloat; fType = plAtomicType.kPoint3; } else if (itype == "RGB") { fAtomicCount = 3; fAtomicType = plAtomicType.kFloat; fType = plAtomicType.kRGB; } else if (itype == "RGBA") { fAtomicCount = 4; fAtomicType = plAtomicType.kFloat; fType = plAtomicType.kRGBA; } else if (itype == "RGB8") { fAtomicCount = 3; fAtomicType = plAtomicType.kByte; fType = plAtomicType.kRGB8; } else if (itype == "RGBA8") { fAtomicCount = 4; fAtomicType = plAtomicType.kByte; fType = plAtomicType.kRGBA8; } else if (itype == "QUAT" || itype == "QUATERNION") { fAtomicCount = 4; fAtomicType = plAtomicType.kFloat; fType = plAtomicType.kQuaternion; } else if (itype == "INT") fAtomicType = plAtomicType.kInt; else if (itype == "SHORT") fAtomicType = plAtomicType.kShort; else if (itype == "BYTE") fAtomicType = plAtomicType.kByte; else if (itype == "FLOAT") fAtomicType = plAtomicType.kFloat; else if (itype == "DOUBLE") fAtomicType = plAtomicType.kDouble; else if (itype == "TIME") fAtomicType = plAtomicType.kTime; else if (itype == "AGETIMEOFDAY") fAtomicType = plAtomicType.kAgeTimeOfDay; else if (itype == "BOOL") fAtomicType = plAtomicType.kBool; else if (itype == "STRING32") fAtomicType = plAtomicType.kString32; else if (itype == "PLKEY") fAtomicType = plAtomicType.kKey; else if (itype == "MESSAGE" || itype == "CREATABLE") fAtomicType = plAtomicType.kCreatable; else throw new plSDLException("Invalid VarDescriptor Type: " + type); if (fType == plAtomicType.kNone) fType = fAtomicType; }
public virtual void Read(hsStream s) { if (s.ReadByte() != kIoVersion) throw new NotSupportedException("Bad VarDescriptor IO Version"); fName = s.ReadSafeString(); string displayOptions = s.ReadStdString(); // TODO fCount = s.ReadInt(); fType = (plAtomicType)s.ReadByte(); Default = s.ReadSafeString(); fFlags = (Flags)s.ReadInt(); // Derived class in Cyan's code, but this is cleaner if (IsStateDesc) { fDescName = s.ReadSafeString(); fVersion = (int)s.ReadShort(); } else { fAtomicCount = (int)s.ReadShort(); fAtomicType = (plAtomicType)s.ReadByte(); } }
internal plVarDescriptor(plAtomicType type) { fType = type; }