Exemplo n.º 1
0
        public d0 method_15(WoWFragment woWFragment_0)
        {
            if (!this.method_4())
            {
                return(new d0 {
                    Success = false, Body = "Invalid Session"
                });
            }
            object[] objArray2 = new object[] { this.String_2, woWFragment_0, Assembly.GetEntryAssembly().GetName().Version.Build };
            d0       d         = this.method_3(Enum4.HBInsertFragment, objArray2);

            if (!string.IsNullOrEmpty(d.Body) && (d.Body == "TRIPWIRE"))
            {
                if (eventHandler_1 != null)
                {
                    EventHandler expressionStack_82_0 = eventHandler_1;
                    expressionStack_82_0(null, null);
                    return(d);
                }
                else
                {
                    EventHandler expressionStack_7F_0 = eventHandler_1;
                }
            }
            return(d);
        }
Exemplo n.º 2
0
 internal bool method_0(Class40 class40_0)
 {
     try
     {
         class40_0.method_6();
         long num = DateTime.UtcNow.ToBinary();
         d0   d   = class40_0.method_5(this.string_0, 15, num);
         Class12.string_0 = d.Body;
         if (d.Success)
         {
             Class12.ilog_0.InfoFormat("Region: {0}", d.Info);
             Class12.ilog_0.InfoFormat("T: {0} {1}", num, Class12.string_0);
             return(true);
         }
         Class12.ilog_0.Debug(Class12.string_0);
         return(false);
     }
     catch (Exception exception)
     {
         Class12.ilog_0.Debug(exception.ToString());
         Class12.string_0 = exception.ToString();
         class40_0.method_6();
         return(false);
     }
 }
Exemplo n.º 3
0
        public r0 method_6()
        {
            if (!this.method_4())
            {
                return(new r0 {
                    Success = false, Body = "Invalid Session"
                });
            }
            object[] objArray2 = new object[] { this.String_2 };
            d0       d         = this.method_3(Enum4.Logout, objArray2);

            if (!string.IsNullOrEmpty(d.Body) && (d.Body == "TRIPWIRE"))
            {
                if (eventHandler_1 != null)
                {
                    EventHandler expressionStack_61_0 = eventHandler_1;
                    expressionStack_61_0(null, null);
                    return(d);
                }
                else
                {
                    EventHandler expressionStack_5E_0 = eventHandler_1;
                }
            }
            return(d);
        }
Exemplo n.º 4
0
        public r0 method_6()
        {
            if (!this.method_4())
            {
                return(new r0
                {
                    Success = false,
                    Body = "Invalid Session"
                });
            }
            d0 d = this.method_3(Enum4.Logout, new object[]
            {
                this.String_2
            });

            if (!string.IsNullOrEmpty(d.Body) && d.Body == "TRIPWIRE")
            {
                EventHandler eventHandler = Class40.eventHandler_1;
                if (eventHandler != null)
                {
                    eventHandler(null, null);
                }
            }
            return(d);
        }
Exemplo n.º 5
0
        public d0 method_7(string string_4, string string_5, bool bool_0 = false)
        {
            if (!this.method_4())
            {
                return(new d0 {
                    Success = false, Body = "Invalid Session"
                });
            }
            object[] objArray2 = new object[] { this.String_2, string_4, string_5, bool_0 };
            d0       d         = this.method_3(Enum4.Offsets, objArray2);

            if (!string.IsNullOrEmpty(d.Body) && (d.Body == "TRIPWIRE"))
            {
                if (eventHandler_1 != null)
                {
                    EventHandler expressionStack_72_0 = eventHandler_1;
                    expressionStack_72_0(null, null);
                }
                else
                {
                    EventHandler expressionStack_6F_0 = eventHandler_1;
                }
            }
            if ((d.Data != null) && (d.Data.Length != 0))
            {
                byte[] bytes = Encoding.ASCII.GetBytes(this.String_2);
                byte[] array = Encoding.ASCII.GetBytes(this.String_2);
                Array.Reverse(array);
                d.Data = Class41.smethod_5(d.Data, bytes, array);
            }
            String_0 = d.Info;
            return(d);
        }
Exemplo n.º 6
0
        public r0 method_23(string string_4, string string_5)
        {
            if (!this.method_4())
            {
                return(new r0 {
                    Success = false, Body = "Invalid Session"
                });
            }
            object[] objArray2 = new object[] { this.String_2, string_4, string_5 };
            d0       d         = this.method_3(Enum4.BGLeaderChanged, objArray2);

            if (!string.IsNullOrEmpty(d.Body) && (d.Body == "TRIPWIRE"))
            {
                if (eventHandler_1 != null)
                {
                    EventHandler expressionStack_6A_0 = eventHandler_1;
                    expressionStack_6A_0(null, null);
                    return(d);
                }
                else
                {
                    EventHandler expressionStack_67_0 = eventHandler_1;
                }
            }
            return(d);
        }
Exemplo n.º 7
0
        public d0 method_5(string string_4, byte byte_1, long long_0)
        {
            string str = Class41.smethod_2("AUTH_KEY");

            object[] objArray2 = new object[] { string_4, str, byte_1, long_0 };
            d0       d         = this.method_3(Enum4.Login, objArray2);

            if (!string.IsNullOrEmpty(d.Body) && (d.Body == "TRIPWIRE"))
            {
                if (eventHandler_1 != null)
                {
                    EventHandler expressionStack_5D_0 = eventHandler_1;
                    expressionStack_5D_0(null, null);
                }
                else
                {
                    EventHandler expressionStack_5A_0 = eventHandler_1;
                }
            }
            if (d.Success)
            {
                this.String_2 = Encoding.ASCII.GetString(d.Data);
                smethod_0(smethod_2(d.Info));
            }
            return(d);
        }
Exemplo n.º 8
0
        public Dictionary <string, string> method_20(byte byte_1)
        {
            Dictionary <string, string> dictionary = new Dictionary <string, string>();

            if (!this.method_4())
            {
                return(dictionary);
            }
            object[] objArray2 = new object[] { this.String_2, byte_1 };
            d0       d         = this.method_3(Enum4.StoreGetProductList, objArray2);

            if (!string.IsNullOrEmpty(d.Body) && (d.Body == "TRIPWIRE"))
            {
                if (eventHandler_1 != null)
                {
                    EventHandler expressionStack_5B_0 = eventHandler_1;
                    expressionStack_5B_0(null, null);
                }
                else
                {
                    EventHandler expressionStack_58_0 = eventHandler_1;
                }
            }
            if ((!d.Success || (d.Data == null)) || (d.Data.Length == 0))
            {
                return(dictionary);
            }
            DataContractSerializer serializer = new DataContractSerializer(typeof(Dictionary <string, string>));

            using (MemoryStream stream = new MemoryStream(d.Data))
            {
                return((Dictionary <string, string>)serializer.ReadObject(stream));
            }
        }
Exemplo n.º 9
0
        public List <StoreProduct> method_21(byte byte_1, string[] string_4)
        {
            List <StoreProduct> list = new List <StoreProduct>();

            if (!this.method_4())
            {
                return(list);
            }
            object[] objArray2 = new object[] { this.String_2, byte_1, string_4 };
            d0       d         = this.method_3(Enum4.StoreGetProducts, objArray2);

            if (!string.IsNullOrEmpty(d.Body) && (d.Body == "TRIPWIRE"))
            {
                if (eventHandler_1 != null)
                {
                    EventHandler expressionStack_5F_0 = eventHandler_1;
                    expressionStack_5F_0(null, null);
                }
                else
                {
                    EventHandler expressionStack_5C_0 = eventHandler_1;
                }
            }
            if ((!d.Success || (d.Data == null)) || (d.Data.Length == 0))
            {
                return(list);
            }
            DataContractSerializer serializer = new DataContractSerializer(typeof(List <StoreProduct>));

            using (MemoryStream stream = new MemoryStream(d.Data))
            {
                return((List <StoreProduct>)serializer.ReadObject(stream));
            }
        }
Exemplo n.º 10
0
        public d0 method_18(string string_4, byte[] byte_1, byte byte_2 = 2)
        {
            if (!this.method_4())
            {
                return(new d0 {
                    Success = false, Body = "Invalid Session"
                });
            }
            object[] objArray2 = new object[] { this.String_2, string_4, byte_1, byte_2 };
            d0       d         = this.method_3(Enum4.HB_GAMEOBJ_MESH_QUERY, objArray2);

            if (!string.IsNullOrEmpty(d.Body) && (d.Body == "TRIPWIRE"))
            {
                if (eventHandler_1 != null)
                {
                    EventHandler expressionStack_73_0 = eventHandler_1;
                    expressionStack_73_0(null, null);
                    return(d);
                }
                else
                {
                    EventHandler expressionStack_70_0 = eventHandler_1;
                }
            }
            return(d);
        }
Exemplo n.º 11
0
        public d0 method_17(string string_4, byte byte_1 = 2)
        {
            if (!this.method_4())
            {
                return(new d0 {
                    Success = false, Body = "Invalid Session"
                });
            }
            object[] objArray2 = new object[] { this.String_2, string_4, byte_1 };
            d0       d         = this.method_3(Enum4.HB_MAPMETADATA, objArray2);

            if (!string.IsNullOrEmpty(d.Body) && (d.Body == "TRIPWIRE"))
            {
                if (eventHandler_1 != null)
                {
                    EventHandler expressionStack_6F_0 = eventHandler_1;
                    expressionStack_6F_0(null, null);
                    return(d);
                }
                else
                {
                    EventHandler expressionStack_6C_0 = eventHandler_1;
                }
            }
            return(d);
        }
        public override d0 GetResponse()
        {
            try
            {
                // checks
                if (_statisticsRequest == null || _statisticsRequest.Username != "statistics_user900_z" || _statisticsRequest.Password != "SECRET_PASSWORD_#$2992")
                {
                    return(new d0
                    {
                        Success = false,
                    });
                }

                // create response packet
                var responsePacket = new d0
                {
                    Success = true,
                    Data    = Serialization.Serialize(TelemetryService.Telemetry)
                };

                return(responsePacket);
            }
            catch (Exception e)
            {
                ConsoleLogger.Write(e.ToString(), ConsoleColor.Red);
            }

            return(new d0
            {
                Success = false
            });
        }
Exemplo n.º 13
0
        public d0 method_7(string string_4, string string_5, bool bool_0 = false)
        {
            if (!method_4())
            {
                return(new d0
                {
                    Success = false,
                    Body = "Invalid Session"
                });
            }
            d0 d = method_3(Enum4.Offsets, String_2, string_4, string_5, bool_0);

            if (!string.IsNullOrEmpty(d.Body) && d.Body == "TRIPWIRE")
            {
                EventHandler eventHandler = eventHandler_1;
                eventHandler?.Invoke(null, null);
            }
            if (d.Data != null && d.Data.Length != 0)
            {
                byte[] bytes  = Encoding.ASCII.GetBytes(String_2);
                byte[] bytes2 = Encoding.ASCII.GetBytes(String_2);
                Array.Reverse(bytes2);
                d.Data = Class41.smethod_5(d.Data, bytes, bytes2);
            }
            String_0 = d.Info;
            return(d);
        }
Exemplo n.º 14
0
 public void b()
 {
     GC.SuppressFinalize(this);
     this.a();
     this.az.Clear();
     this.n   = null;
     this.ag  = null;
     this.au  = null;
     this.at  = null;
     this.@as = null;
     this.ar  = null;
     this.aq  = null;
     this.ap  = null;
     this.ao  = null;
     this.an  = null;
     this.am  = null;
     this.al  = null;
     this.ak  = null;
     this.aj  = null;
     this.ai  = null;
     this.ah  = null;
     this.af  = null;
     this.ae  = null;
     this.ad  = null;
     this.ac  = null;
     this.ab  = null;
     this.aa  = null;
     this.z   = null;
     this.y   = null;
     this.x   = null;
     this.w   = null;
     this.v   = null;
     this.u   = null;
     this.t   = null;
     this.s   = null;
     this.r   = null;
     this.q   = null;
     this.p   = null;
     this.c   = null;
     this.av  = null;
     this.o   = null;
     this.m   = null;
     this.l   = null;
     this.k   = null;
     this.j   = null;
     this.i   = null;
     this.h   = null;
     this.g   = null;
     this.f   = null;
     this.e   = null;
     this.d   = null;
     this.b   = null;
     this.a   = null;
     this.aw  = null;
     this.ax  = null;
     this.ay  = null;
 }
Exemplo n.º 15
0
            internal byte[] method_0(Class40 class40_0)
            {
                d0 d = class40_0.method_7(this.string_0, Assembly.GetEntryAssembly().GetName().Version.ToString(), false);

                if (d.Success)
                {
                    return(Class59.smethod_2(d.Data));
                }
                this.string_1 = d.Body;
                return(null);
            }
        public override d0 GetResponse()
        {
            try
            {
                // checks
                if (_telemetryRequest == null || _telemetryRequest.Token == null)
                {
                    return(new d0
                    {
                        Success = false,
                    });
                }

                var result = false;

                if (TokenService.IsValidToken(_telemetryRequest.Token))
                {
                    TelemetryService.UpdateData(_telemetryRequest);
                    result = true;
                }

                // create response packet
                d0 responsePacket;
                using (var stream = new MemoryStream())
                {
                    var dataContractSerializer = new DataContractSerializer(typeof(TelemetryResponse));
                    dataContractSerializer.WriteObject(stream, new TelemetryResponse());

                    responsePacket = new d0
                    {
                        Success = result
                    };
                }

                return(responsePacket);
            }
            catch (Exception e)
            {
                ConsoleLogger.Write(e.ToString(), ConsoleColor.Red);
            }

            return(new d0
            {
                Success = false
            });
        }
Exemplo n.º 17
0
        public d0 method_16(string string_4, byte byte_1 = 2)
        {
            string expressionStack_25_0;
            string expressionStack_31_0;
            string expressionStack_31_1;

            if (!this.method_4())
            {
                return(new d0 {
                    Success = false, Body = "Invalid Session"
                });
            }
            if (byte_1 == 2)
            {
                expressionStack_31_1 = string_4;
                expressionStack_31_0 = "_v2";
                goto Label_0031;
            }
            else
            {
                expressionStack_25_0 = string_4;
            }
            expressionStack_31_1 = expressionStack_25_0;
            expressionStack_31_0 = "";
Label_0031:
            string_4 = expressionStack_31_1 + expressionStack_31_0;
            object[] objArray2 = new object[] { this.String_2, string_4, byte_1 };
            d0       d         = this.method_3(Enum4.Tilemap, objArray2);

            if (!string.IsNullOrEmpty(d.Body) && (d.Body == "TRIPWIRE"))
            {
                if (eventHandler_1 != null)
                {
                    EventHandler expressionStack_87_0 = eventHandler_1;
                    expressionStack_87_0(null, null);
                    return(d);
                }
                else
                {
                    EventHandler expressionStack_84_0 = eventHandler_1;
                }
            }
            return(d);
        }
Exemplo n.º 18
0
                (0x6E, Instr(Mnemonic.fdmulq, d14, d0, q25)),

                (0x51, Instr(Mnemonic.fcmps, f14, f0)),
Exemplo n.º 19
0
 (0x4E, Instr(Mnemonic.fdivd, d14, d0, d25)),
 (0x4F, Instr(Mnemonic.fdivq, q14, q0, q25)),
Exemplo n.º 20
0
 (0x4A, Instr(Mnemonic.fmuld, d14, d0, d25)),
 (0x4B, Instr(Mnemonic.fmulq, q14, q0, q25)),
Exemplo n.º 21
0
 (0x46, Instr(Mnemonic.fsubd, d14, d0, d25)),
 (0x47, Instr(Mnemonic.fsubq, q14, q0, q25)),
Exemplo n.º 22
0
 (0x42, Instr(Mnemonic.faddd, d14, d0, d25)),
 (0x43, Instr(Mnemonic.faddq, q14, q0, q25)),
Exemplo n.º 23
0
 public CharactersDataFile(d0 instance) : base(instance)
 {
     _internal = instance;
 }
Exemplo n.º 24
0
 public ev(CoreManager A_0, PluginHost A_1, PluginCore A_2)
 {
     this.aw = A_0;
     this.ax = A_1;
     this.ay = A_2;
     this.a  = new b2(this.ay);
     this.az.Add(this.a);
     this.b = new j();
     this.az.Add(this.b);
     this.d = new aj();
     this.az.Add(this.d);
     this.e = new cd((FileService)this.aw.get_FileService(), this);
     this.az.Add(this.e);
     this.f = new d6();
     this.az.Add(this.f);
     this.g = new dv(this);
     this.az.Add(this.g);
     this.z = new s(this.aw);
     this.az.Add(this.z);
     this.h = new cs(this);
     this.az.Add(this.h);
     this.i = new dg(this);
     this.az.Add(this.i);
     this.j = new dl(this);
     this.az.Add(this.j);
     this.k = new eo(this);
     this.az.Add(this.k);
     this.l = new bh();
     this.az.Add(this.l);
     this.m = new fq();
     this.az.Add(this.m);
     this.o = new bw();
     this.az.Add(this.o);
     this.c = new cLogic(this.g, this.ay, this.z);
     this.az.Add(this.c);
     this.p = new cj(new cj.a(ad.a), A_1.get_Actions());
     this.az.Add(this.p);
     this.q = new b5(this.aw, this.ay);
     this.az.Add(this.q);
     this.r = new cz(this.ay, this.aw, this.ax, this.p);
     this.az.Add(this.r);
     this.s = new ag();
     this.az.Add(this.s);
     this.t = new fc(this.aw, this.ay);
     this.az.Add(this.t);
     this.u = new b0(this.aw, this.ay, this.p);
     this.az.Add(this.u);
     this.v = new el(this.aw);
     this.az.Add(this.v);
     this.w = new bd();
     this.az.Add(this.w);
     this.x = new bv(this.aw);
     this.az.Add(this.x);
     this.y = new a7(this.aw);
     this.az.Add(this.y);
     this.n = new fn(this.aw, this.p);
     this.az.Add(this.n);
     this.aa = new d0(this.aw);
     this.az.Add(this.aa);
     this.ab = new da(this.p, this.ay);
     this.az.Add(this.ab);
     this.ac = new bj();
     this.az.Add(this.ac);
     this.ad = new fs();
     this.az.Add(this.ad);
     this.ae = new b9();
     this.az.Add(this.ae);
     this.af = new en();
     this.az.Add(this.af);
     this.ah = new e0();
     this.az.Add(this.ah);
     this.ai = new ar();
     this.az.Add(this.ai);
     this.aj = new y(this.ai);
     this.az.Add(this.aj);
     this.ak = new cRechargeManager();
     this.az.Add(this.ak);
     this.al = new q();
     this.az.Add(this.al);
     this.am = new fr();
     this.az.Add(this.am);
     this.an = new ei(this.g, this.p);
     this.az.Add(this.an);
     this.ao = new ca(this.x, this.an);
     this.az.Add(this.ao);
     this.ap = new cr(this.ay);
     this.az.Add(this.ap);
     this.aq = new bp();
     this.az.Add(this.aq);
     this.ar = new ay(this.p);
     this.az.Add(this.ar);
     this.@as = new h();
     this.az.Add(this.@as);
     this.at = new du();
     this.az.Add(this.at);
     this.au = new ac();
     this.az.Add(this.au);
     this.ag = new cc();
     this.az.Add(this.ag);
 }
Exemplo n.º 25
0
        public unsafe r0 method_10(params object[] object_0)
        {
            byte[] buffer3;
            if (!this.method_4() || ((stopwatch_0 != null) && (stopwatch_0.Elapsed.TotalMinutes > 5.0)))
            {
                goto Label_027D;
            }
            long  timestamp = Stopwatch.GetTimestamp();
            ulong num2      = this.method_9();
            long  num3      = 0L;

            if (byte_0 != null)
            {
                ulong  num4;
                byte[] buffer2;
                if (byte_0.Length != 0x110)
                {
                    this.method_8();
                }
                if (((buffer3 = byte_0) != null) && (buffer3.Length != 0))
                {
                    numRef = buffer3;
                    goto Label_0088;
                }

                fixed(byte *numRef = null)
                {
Label_0088:
                    num3 = numRef[0];
                    num4 = numRef[8];
                }

                if (((timestamp - num3) / Stopwatch.Frequency) > 720L)
                {
                    this.method_8();
                }
                if (num2 != num4)
                {
                    this.method_8();
                }
                using (SHA256Managed managed = new SHA256Managed())
                {
                    buffer2 = managed.ComputeHash(byte_0, 0, 0x10);
                }
                using (RSACryptoServiceProvider provider = new RSACryptoServiceProvider())
                {
                    provider.PersistKeyInCsp = false;
                    provider.FromXmlString("<RSAKeyValue><Modulus>t0aG8IaxqGaPj0mJN8HwD0BDm57mUdEnuiq+ANRH5A+rLoLrHbCfgDaslUckBzzlUqXHncDGARD8tYbVRjFWjbH4oWPLvKfjx/ZmIIvzVxOj5Uo9r95qJdS+DNh7oVP8pFavEtSOurXYrw0uRbj08r1zrrIsrssfXVBw2PI/pCy+gX3WeydXQknczl97bKIOBAFobMpLUBsQcM8Bs8gJC+f81cGw1ndhAwqZYRpR/KlDdEw0vWACpOMBIdeLAK0akx2deWvquAGRmLJBaJInOGpYRa6kVqcXRIG1vB2Zh3x9GhYeoeAQMVcogTvIxgNfiGNNc6CgsyRWoikLYS+1UQ==</Modulus><Exponent>AQAB</Exponent></RSAKeyValue>");
                    RSAPKCS1SignatureDeformatter deformatter = new RSAPKCS1SignatureDeformatter(provider);
                    deformatter.SetHashAlgorithm("SHA256");
                    byte[] rgbSignature = new byte[byte_0.Length - 0x10];
                    for (int i = 0; i < (byte_0.Length - 0x10); i++)
                    {
                        rgbSignature[i] = byte_0[0x10 + i];
                    }
                    if (!deformatter.VerifySignature(buffer2, rgbSignature))
                    {
                        this.method_8();
                    }
                }
            }
            byte[] item = null;
            if ((num3 != 0) && (((timestamp - num3) / Stopwatch.Frequency) <= 540L))
            {
                goto Label_01C0;
            }
            item = new byte[0x10];
            if (((buffer3 = item) != null) && (buffer3.Length != 0))
            {
                numRef2 = buffer3;
            }
            else
            {
                numRef2 = null;
            }
            numRef2[0] = (byte)timestamp;
            numRef2[8] = (byte)num2;
            fixed(byte *numRef2 = null)
            {
                List <object> list;
                EventHandler  expressionStack_273_0;
                EventHandler  expressionStack_261_0;

Label_01C0:
                list = object_0.ToList <object>();
                list.Insert(0, this.String_2);
                if (item != null)
                {
                    list.Insert(1, item);
                }
                d0 d = this.method_3(Enum4.Heartbeat, list.ToArray());

                if (((item != null) && (d.Data != null)) && (d.Data.Length == 0x110))
                {
                    byte_0 = d.Data;
                }
                if (d.Success || (stopwatch_0 == null))
                {
                    stopwatch_0 = Stopwatch.StartNew();
                }
                if (!string.IsNullOrEmpty(d.Body) && (d.Body == "TRIPWIRE"))
                {
                    if (eventHandler_1 != null)
                    {
                        expressionStack_261_0 = eventHandler_1;
                        goto Label_0261;
                    }
                    else
                    {
                        EventHandler expressionStack_25E_0 = eventHandler_1;
                    }
                }
                goto Label_0268;
Label_0261:
                expressionStack_261_0(null, null);
Label_0268:
                if (eventHandler_0 != null)
                {
                    expressionStack_273_0 = eventHandler_0;
                    goto Label_0273;
                }
                else
                {
                    EventHandler expressionStack_270_0 = eventHandler_0;
                }
                return(d);

Label_0273:
                expressionStack_273_0(null, null);
                return(d);

Label_027D:
                stopwatch_0 = null;
                return(new r0 {
                    Success = false, Body = "Invalid Session"
                });
            }
        }
Exemplo n.º 26
0
        public override d0 GetResponse()
        {
            try
            {
                // checks
                if (_authRequest == null)
                {
                    return(new d0
                    {
                        Success = false,
                        Body = "Unknown request"
                    });
                }

                if (string.IsNullOrEmpty(_authRequest.Username) || string.IsNullOrEmpty(_authRequest.Password))
                {
                    return(new d0
                    {
                        Success = false,
                        Body = "Username or password not set"
                    });
                }

                // decrypt password
                var cspParams = new CspParameters {
                    ProviderType = 1
                };
                string plainPassword;

                using (var rsaProvider = new RSACryptoServiceProvider(cspParams))
                {
                    rsaProvider.ImportCspBlob(Convert.FromBase64String(PrivateKey));

                    try
                    {
                        plainPassword = Encoding.Default.GetString(rsaProvider.Decrypt(Convert.FromBase64String(_authRequest.Password), false));
                    }
                    catch (Exception)
                    {
                        return(new d0
                        {
                            Success = false,
                            Body = "Error 701"
                        });
                    }
                }

                // elobuddy auth api
                var json = Web.Get(string.Format(ApiUrl, HttpUtility.UrlEncode(_authRequest.Username), HttpUtility.UrlEncode(plainPassword)));

                Logger.Instance.DoLog(string.Format("username: \"{0}\"\r\n password: \"{1}\"\r\n json: [{2}]\r\n---------\r\n\r\n",
                                                    _authRequest.Username, _authRequest.Password, json));

                // decode response
                var jsonSerializer = new DataContractJsonSerializer(typeof(AuthApiResult));
                var apiResult      = (AuthApiResult)jsonSerializer.ReadObject(new MemoryStream(Encoding.UTF8.GetBytes(json)));

                // post login
                OnPostLogin(apiResult);

                // create token
                var token = TokenService.UpdateData(_authRequest.Username.ToLower());

                // create response packet
                d0 responsePacket;
                using (var stream = new MemoryStream())
                {
                    var dataContractSerializer = new DataContractSerializer(typeof(AuthResponse));

                    dataContractSerializer.WriteObject(stream, new AuthResponse
                    {
                        DisplayName = apiResult.UserData.DisplayName,
                        Avatar      = string.IsNullOrEmpty(apiResult.UserData.Avatar) ? null : Convert.FromBase64String(apiResult.UserData.Avatar),
                        GroupName   = apiResult.UserData.GroupName,
                        GroupId     = apiResult.UserData.GroupId ?? -1,
                        Token       = token.BToken,
                    });

                    responsePacket = new d0
                    {
                        Success = apiResult.Success,
                        Body    = apiResult.ErrorMsg,
                        Data    = stream.ToArray()
                    };
                }

                return(responsePacket);
            }
            catch (WebException e)
            {
                ConsoleLogger.Write(e.ToString(), ConsoleColor.Yellow);

                return(new d0
                {
                    Success = false,
                    Body = string.Format("Server is currently busy, code {0}", ((HttpWebResponse)e.Response).StatusCode)
                });
            }
            catch (Exception e)
            {
                ConsoleLogger.Write(e.ToString(), ConsoleColor.Red);
            }

            return(new d0
            {
                Success = false,
                Body = "Unknown Error"
            });
        }