Пример #1
0
        protected virtual async Task <bool> VerifyGameClientAsync(string path, byte[] data)
        {
            var game = new HGame(data);

            game.Location = path;
            try
            {
                if (game.IsCompressed)
                {
                    SetState(TanjiState.DecompressingClient);

                    await Task.Factory.StartNew(game.Decompress)
                    .ConfigureAwait(false);
                }

                if (game.IsCompressed)
                {
                    return(false);
                }
                else
                {
                    UI.Game = game;
                }

                SetState(TanjiState.DisassemblingClient);
                UI.Game.Disassemble();

                SetState(TanjiState.GeneratingMessageHashes);
                UI.Game.GenerateMessageHashes();

                return(true);
            }
            catch (Exception ex)
            {
                WriteLog(ex);
                return(false);
            }
            finally
            {
                if (UI.Game != game)
                {
                    game.Dispose();
                }
            }
        }
Пример #2
0
        private async Task <bool> VerifyGameClientAsync(string path, byte[] data)
        {
            var game = new HGame(data);

            game.Location = path;
            try
            {
                if (game.IsCompressed)
                {
                    State = DECOMPRESSING_CLIENT;
                    await Task.Factory.StartNew(game.Decompress)
                    .ConfigureAwait(false);
                }

                if (game.IsCompressed)
                {
                    return(false);
                }
                else
                {
                    Master.Game = game;
                }

                State = DISASSEMBLING_CLIENT;
                Master.Game.Disassemble();

                State = GENERATING_MESSAGE_HASHES;
                Master.Game.GenerateMessageHashes();
                return(true);
            }
            catch (Exception ex)
            {
                Master.Log(ex);
                return(false);
            }
            finally
            {
                if (Master.Game != game)
                {
                    game.Dispose();
                }
            }
        }