コード例 #1
0
        internal virtual void ClearBuffers()
        {
            if (HeaderUnpacker != null)
            {
                try {
                    HeaderUnpacker.Dispose();
                }
                catch (InvalidMessagePackStreamException) {
                    // Handles cleanup for corruppted stream.
                }

                HeaderUnpacker = null;
            }

            if (RootUnpacker != null)
            {
                try {
                    RootUnpacker.Dispose();
                }
                catch (InvalidMessagePackStreamException) {
                    // Handles cleanup for corruppted stream.
                }

                RootUnpacker = null;
            }

            if (UnpackingBuffer != null)
            {
                TruncateUsedReceivedData();
            }
        }
コード例 #2
0
ファイル: MsgUnPacker.cs プロジェクト: soulhez/RPG_JG
    public IDictionary <K, V> GetMapt <K, V>(int index)
    {
        MemoryStream s         = new MemoryStream(buff);
        Unpacker     _unpacker = Unpacker.Create(s);

        for (int i = 0; i < index; i++)
        {
            _unpacker.Skip();
        }

        long len = 0;

        if (!_unpacker.ReadMapLength(out len))
        {
            return(null);
        }
        IDictionary <K, V> dict = new Dictionary <K, V>();

        for (int i = 0; i < len; i++)
        {
            dict.Add(_unpacker.Unpack <K>(), _unpacker.Unpack <V>());
        }
        _unpacker.Dispose();
        s.Close();
        return(dict);
    }
コード例 #3
0
ファイル: MsgUnPacker.cs プロジェクト: soulhez/RPG_JG
    public T[] GetArray <T>(int index)
    {
        MemoryStream s         = new MemoryStream(buff);
        Unpacker     _unpacker = Unpacker.Create(s);

        for (int i = 0; i < index; i++)
        {
            _unpacker.Skip();
        }

        long len = 0;

        if (!_unpacker.ReadArrayLength(out len))
        {
            return(null);
        }
        T[] ts = new T[len];
        for (int i = 0; i < len; i++)
        {
            ts[i] = _unpacker.Unpack <T>();
        }
        _unpacker.Dispose();
        s.Close();
        return(ts);
    }
コード例 #4
0
ファイル: MsgUnPacker.cs プロジェクト: soulhez/RPG_JG
 public void Close()
 {
     unpacker.Dispose();
     if (stream.CanRead)
     {
         stream.Close();
     }
 }
コード例 #5
0
            protected void EndState(JsonToken state)

            {
                mReader.SetToken(state);

                mReader.mState = this.mPreviousState;

                mUnpacker.Dispose();
            }
コード例 #6
0
ファイル: MsgUnPacker.cs プロジェクト: soulhez/RPG_JG
    public T Get <T>(int index)
    {
        MemoryStream s         = new MemoryStream(buff);
        Unpacker     _unpacker = Unpacker.Create(s);

        for (int i = 0; i < index; i++)
        {
            _unpacker.Skip();
        }
        T t = _unpacker.Unpack <T>();

        _unpacker.Dispose();
        s.Close();
        return(t);
    }