Ejemplo n.º 1
0
        public void Serialize(SafeWriter writer)
        {
            var data = Export();

            writer.WriteInt32(CurrentVersion);
            writer.WriteBytes(data);
        }
Ejemplo n.º 2
0
 public void Serialize(SafeWriter w)
 {
     foreach (var color in Colors)
     {
         w.WriteColor3(color);
     }
 }
Ejemplo n.º 3
0
 public void Store <T>(string key, T item) where T : IArchiveItem <T>, new()
 {
     using (var stream = new MemoryStream())
         using (var writer = new SafeWriter(stream))
         {
             item.Serialize(writer);
             Items[key] = stream.GetBuffer();
         }
 }
Ejemplo n.º 4
0
        public void Serialize(SafeWriter w)
        {
            w.WriteInt32(PartFactorArray.Count);
            foreach (var t in PartFactorArray)
            {
                w.WriteFloat(t);
            }

            w.WriteInt32(PartColors.Count);
            foreach (var t in PartColors)
            {
                t.Serialize(w);
            }
        }
Ejemplo n.º 5
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());
            }
        }