public int Deserialize() { // TODO: Handle dependencies // 2nd pass after this to resolve names etc? _ClassIndex = Data.ReadInt32(); ClassName = CurrentPCC.GetClassName(_ClassIndex); _SuperIndex = Data.ReadInt32(); _OuterIndex = Data.ReadInt32(); _ObjectNameRef = Data.ReadNameRef(); ObjectName = CurrentPCC.GetName(_ObjectNameRef); if (_ObjectNameRef.ModNumber > -1) ObjectName += "_" + _ObjectNameRef.ModNumber; // TODO: correct? _ArchetypeIndex = Data.ReadInt32(); ObjectFlags = (ObjectFlags)Data.ReadUInt64(); Size = Data.ReadUInt32(); FileOffset = Data.ReadUInt32(); ExportFlags = (ExportFlags)Data.ReadUInt32(); // TODO: save / figure these out! var netObjectCount = Data.ReadInt32(); // Skip netObjectCount Data.ReadRawData(netObjectCount * 4); // Skip netObjects Data.ReadRawData(16); // Skip package GUID's Data.ReadRawData(4); // Skip package flags return (int)SizeInBytes + 4 * netObjectCount; }
public NameReference ReadNameRef() { if (Position + 8 > Size) return new NameReference(); var NameRef = new NameReference(); NameRef.Index = BitConverter.ToInt32(_data, _position(4)); NameRef.ModNumber = BitConverter.ToInt32(_data, _position(4)) - 1; return NameRef; }
public bool Deserialize() { _PCCNameRef = Data.ReadNameRef(); SourcePCCName = CurrentPCC.GetName(_PCCNameRef); _ClassNameRef = Data.ReadNameRef(); ClassName = CurrentPCC.GetName(_ClassNameRef); _OuterIndex = Data.ReadInt32(); // Do in links or loadfromsource: //OuterName = CurrentPCC.GetObjectEntry(_OuterIndex).ObjectName; _ObjectNameRef = Data.ReadNameRef(); ObjectName = CurrentPCC.GetName(_ObjectNameRef); return true; }
public String GetName(NameReference reference) { /*if (reference.Index == 0 && reference.ModNumber >= 0) return String.Empty; // Error, weird mod number!*/ return reference.Index >= 0 && reference.Index < Names.Count ? Names[reference.Index] : String.Empty; }