Beispiel #1
0
        public void Serialize(SafeWriter writer)
        {
            var data = Export();

            writer.WriteInt32(CurrentVersion);
            writer.WriteBytes(data);
        }
Beispiel #2
0
        private byte[] Export()
        {
            using (MemoryStream memoryStream = new MemoryStream(500))
            {
                using (SafeWriter w = new SafeWriter(memoryStream))
                {
                    w.WriteIntList(DLCRequire);
                    var byteArray = PlayerIdentity.Guid.ToByteArray();
                    w.WriteBytes(byteArray);
                    w.WriteInt64(PlayerIdentity.CreationTime.Ticks);
                    w.WriteNullableString(PlayerName);
                    w.WriteInt32((int)PlayerGender);
                    w.WriteInt32(PlayerLevel);
                    w.WriteInt32(PlayerMoney);
                    w.WriteBool(WorkshopNameSet);
                    w.WriteNullableString(WorkshopName);
                    w.WriteInt32(appearUnitsEquipPaths.Length);
                    foreach (var path in appearUnitsEquipPaths)
                    {
                        w.WriteNullableString(path);
                    }
                    w.WriteInt32(appearUnitsNudePaths.Length);
                    foreach (var path in appearUnitsNudePaths)
                    {
                        w.WriteNullableString(path);
                    }
                    foreach (var id in SubModelIds)
                    {
                        w.WriteInt32(id);
                    }

                    appearData.Serialize(w);
                    w.WriteNullableString(Tattoo);
                    w.WriteString(WorkshopLevel);
                    w.WriteInt64(GameTime);
                    w.WriteInt64(SystemTime.Ticks);
                    w.WriteInt64(PlayedTime.Ticks);
                    w.WriteBool(IsMainStoryDone);
                    w.WriteBytes(figurePreviewData != null ? figurePreviewData.ToBytes() : new byte[0]);
                    w.WriteBytes(new byte[0]);
                }

                return(memoryStream.ToArray());
            }
        }