/// <summary>
        ///     Uncompresses the <see cref="LogicCompressibleString" /> instance.
        /// </summary>
        public static void Uncompress(LogicCompressibleString str)
        {
            if (str.IsCompressed())
            {
                int    compressedLength   = str.GetCompressedLength();
                byte[] compressedData     = str.RemoveCompressed();
                int    uncompressedLength = ZLibHelper.DecompressInMySQLFormat(compressedData, compressedLength, out byte[] uncompressedData);

                if (uncompressedLength > 0)
                {
                    str.Set(LogicStringUtil.CreateString(uncompressedData, 0, uncompressedLength));
                }
            }
        }
Пример #2
0
        public static LogicClientAvatar LoadHomeOwnerAvatarFromHome(LogicClientHome home)
        {
            string json = home.GetCompressibleHomeJSON().Get();

            if (json == null)
            {
                ZLibHelper.DecompressInMySQLFormat(home.GetCompressibleHomeJSON().GetCompressed(), out byte[] output);
                json = LogicStringUtil.CreateString(output, 0, output.Length);
            }

            LogicClientAvatar logicClientAvatar = new LogicClientAvatar();

            logicClientAvatar.LoadForReplay(LogicJSONParser.ParseObject(json), true);
            return(logicClientAvatar);
        }
Пример #3
0
        private void OnLoginFailedMessageReceived(LoginFailedMessage message)
        {
            this.m_serverConnection.SetState(ServerConnectionState.LOGIN_FAILED);

            switch (message.GetErrorCode())
            {
            case LoginFailedMessage.ErrorCode.DATA_VERSION:
                ZLibHelper.DecompressInMySQLFormat(message.GetCompressedFingerprint(), out byte[] output);
                ResourceManager.DownloadDataUpdate(LogicStringUtil.CreateString(output, 0, output.Length), message.GetContentUrl());
                break;

            default:
                Debugger.Warning("MessageManager.onLoginFailedMessageReceived: error code: " + message.GetErrorCode());
                break;
            }
        }