/// <summary> /// Read a parameter from a file /// </summary> /// <param name="FS"></param> public virtual void Read(Stream FS) { byte[] Read = new byte[3]; FS.Read(Read, 0, 3); // if (Encoding.ASCII.GetString(Read) != Identifier) // throw new Exception( //$@"Database Error at Spotlight.ObjectParameterDatabase.cs in ABSTRACT CLASS: Parameter. //Database Read Exception => File Offset 0x{FS.Position.ToString("X2").PadLeft(8, '0')} //Got {Encoding.ASCII.GetString(Read)}, Expected {Identifier}"); Identifier = Encoding.ASCII.GetString(Read); ObjList = (ObjList)FS.ReadByte(); ClassName = FS.ReadString(); FS.Read(Read, 0, 2); int ObjectNameCount = BitConverter.ToInt16(Read, 0); for (int i = 0; i < ObjectNameCount; i++) { ObjectNames.Add(FS.ReadString()); } while (FS.Position % 4 != 0) { FS.Position++; } FS.Read(Read, 0, 2); int ModelNameCount = BitConverter.ToInt16(Read, 0); for (int i = 0; i < ModelNameCount; i++) { ModelNames.Add(FS.ReadString()); } while (FS.Position % 4 != 0) { FS.Position++; } FS.Read(Read, 0, 2); int ParamNameCount = BitConverter.ToInt16(Read, 0); for (int i = 0; i < ParamNameCount; i++) { Properties.Add(new KeyValuePair <string, string>(FS.ReadString(), FS.ReadString())); } while (FS.Position % 4 != 0) { FS.Position++; } FS.Read(Read, 0, 2); int LinkNameCount = BitConverter.ToInt16(Read, 0); for (int i = 0; i < LinkNameCount; i++) { LinkNames.Add(FS.ReadString()); } while (FS.Position % 4 != 0) { FS.Position++; } }