Exemple #1
0
        async Task <TResponse> Deserialize()
        {
            var bytes = await inner.ResponseAsync.ConfigureAwait(false);

            return(LZ4MessagePackSerializer.Deserialize <TResponse>(bytes, resolver));
        }
Exemple #2
0
 public static Keypair FromMessagePack(byte[] msgPack)
 {
     return(LZ4MessagePackSerializer.Deserialize <Keypair>(msgPack));
 }
Exemple #3
0
        protected override void OnReload(GameMode currentGameMode, bool maintainState)
        {
            foreach (var modifier in Modifiers)
            {
                modifier.Reset();
            }

            // Stop baseline collection if it's running
            StopAllCoroutines();
            _baselineKnown = false;

            if (!maintainState && (GUI.KKABMX_GUI.LoadBody || GUI.KKABMX_GUI.LoadFace))
            {
                var newModifiers = new List <BoneModifier>();
                var data         = GetExtendedData();
                if (data != null)
                {
                    try
                    {
                        switch (data.version)
                        {
                        case 2:
                            newModifiers = LZ4MessagePackSerializer.Deserialize <List <BoneModifier> >((byte[])data.data[ExtDataBoneDataKey]);
                            break;

                        default:
                            throw new NotSupportedException($"Save version {data.version} is not supported");
                        }
                    }
                    catch (Exception ex)
                    {
                        Logger.Logger.LogError("[KKABMX] Failed to load extended data - " + ex);
                    }
                }

                if (GUI.KKABMX_GUI.LoadBody && GUI.KKABMX_GUI.LoadFace)
                {
                    Modifiers = newModifiers;
                }
                else
                {
                    var headRoot  = transform.FindLoop("cf_j_head");
                    var headBones = new HashSet <string>(headRoot.GetComponentsInChildren <Transform>().Select(x => x.name));
                    headBones.Add(headRoot.name);
                    if (GUI.KKABMX_GUI.LoadFace)
                    {
                        Modifiers.RemoveAll(x => headBones.Contains(x.BoneName));
                        Modifiers.AddRange(newModifiers.Where(x => headBones.Contains(x.BoneName)));
                    }
                    else if (GUI.KKABMX_GUI.LoadBody)
                    {
                        var bodyBones = new HashSet <string>(transform.FindLoop("BodyTop").GetComponentsInChildren <Transform>().Select(x => x.name).Except(headBones));

                        Modifiers.RemoveAll(x => bodyBones.Contains(x.BoneName));
                        Modifiers.AddRange(newModifiers.Where(x => bodyBones.Contains(x.BoneName)));
                    }
                }
            }

            StartCoroutine(OnDataChangedCo());
        }
 public static T FromCompressBinary <T>(this byte[] binaryData)
 {
     return(LZ4MessagePackSerializer.Deserialize <T>(binaryData));
 }
Exemple #5
0
        public Transaction GetTransaction(long id, string coinName)
        {
            var trBytes = _db.Get(LZ4MessagePackSerializer.Serialize(id), GetColFamily(coinName + ":tx"));

            return(trBytes == null ? null : LZ4MessagePackSerializer.Deserialize <Transaction>(trBytes));
        }
Exemple #6
0
        public Block GetBlock(BigInteger number, string BlockChain)
        {
            var blockBytes = _db.Get(LZ4MessagePackSerializer.Serialize(number), GetColFamily(BlockChain));

            return(blockBytes == null ? null : LZ4MessagePackSerializer.Deserialize <Block>(blockBytes));
        }