Exemple #1
0
        /// <summary>
        /// Deserializes a session parameter object from packet format
        /// </summary>
        private EncryptedChatSessionParameters DeserializeSessionParameters(DEncodeList serializedParameters)
        {
            var parameters = new EncryptedChatSessionParameters
                {
                    MasterKeyUpdateInterval = (int) ((DEncodeInt) serializedParameters.Items.ElementAt(0)).Value,
                    PingInterval = (int)((DEncodeInt)serializedParameters.Items.ElementAt(1)).Value
                };

            return parameters;
        }
Exemple #2
0
        private void Write(DEncodeList value)
        {
            _writer.Write((byte)'L');
            EncodeVariableLengthInteger((ulong)value.Items.Count);

            foreach (var item in value.Items)
            {
                Write(item);
            }
        }
Exemple #3
0
        /// <summary>
        /// Deserializes an user list in the packet format back to .NET format
        /// </summary>
        private IEnumerable<ChatUser> ConvertUserListToNormalFormat(DEncodeList users)
        {
            var list = new List<ChatUser>();

            int i = 0;

            string currentSkypeHandle = "";
            foreach (var currentValue in users.Items)
            {
                if (i%2 == 0)
                {
                    currentSkypeHandle = ((DEncodeString) currentValue).Value;
                }
                else
                {
                  list.Add(new ChatUser(currentSkypeHandle, ((DEncodeArray)currentValue).Value, null));
                }
                i++;
            }

            return list;
        }
Exemple #4
0
        private DEncodeValue ReadList()
        {
            var count = (int)DecodeVariableLengthInteger();

            var result = new DEncodeList();

            for (int i = 0; i < count; i++)
            {
                result.Items.Add(Read());
            }

            return result;
        }