示例#1
0
        public Account(string email, string password, string battleTagName, int hashCode, UserLevels userLevel) // Account with **newly generated** persistent ID
            : base(StringHashHelper.HashIdentity(battleTagName + "#" + hashCode.ToString("D4")))
        {
            if (password.Length > 16)
            {
                password = password.Substring(0, 16);                       // make sure the password does not exceed 16 chars.
            }
            var salt             = SRP6a.GetRandomBytes(32);
            var passwordVerifier = SRP6a.CalculatePasswordVerifierForAccount(email, password, salt);

            this.SetFields(email, salt, passwordVerifier, battleTagName, hashCode, userLevel);
        }
示例#2
0
        /// <summary>
        /// Makes an RPC over remote client.
        /// </summary>
        /// <param name="method">The method to call.</param>
        /// <param name="controller">The rpc controller.</param>
        /// <param name="request">The request message.</param>
        /// <param name="responsePrototype">The response message.</param>
        /// <param name="done">Action to run when client responds RPC.</param>
        public void CallMethod(MethodDescriptor method, IRpcController controller, IMessage request, IMessage responsePrototype, Action <IMessage> done)
        {
            var serviceName = method.Service.FullName;
            var serviceHash = StringHashHelper.HashIdentity(serviceName);

            if (!this.Services.ContainsKey(serviceHash))
            {
                Logger.Error("Not bound to client service {0} [0x{1}] yet.", serviceName, serviceHash.ToString("X8"));
                return;
            }

            var serviceId = this.Services[serviceHash];
            var token     = this._tokenCounter++;

            RPCCallbacks.Add(token, new RPCCallback(done, responsePrototype.WeakToBuilder()));

            var packet = new PacketOut((byte)serviceId, MooNetRouter.GetMethodId(method), (uint)token, this._listenerId, request);

            this.Connection.Send(packet);
        }
示例#3
0
        public void CallMethod(MethodDescriptor method, IMessage request, ulong localObjectId)
        {
            var serviceName = method.Service.FullName;
            var serviceHash = StringHashHelper.HashIdentity(serviceName);

            if (!this.Services.ContainsKey(serviceHash))
            {
                Logger.Error("Not bound to client service {0} [0x{1}] yet.", serviceName, serviceHash.ToString("X8"));
                return;
            }

            var serviceId      = this.Services[serviceHash];
            var remoteObjectId = GetRemoteObjectID(localObjectId);

            Logger.Debug("Calling {0} localObjectId={1}, remoteObjectId={2}", method.FullName, localObjectId, remoteObjectId);

            var packet = new BNetPacket(
                new BNetHeader((byte)serviceId, (uint)(method.Index + 1), this._requestCounter++, (uint)request.SerializedSize, remoteObjectId),
                request.ToByteArray());

            this.Connection.Send(packet);
        }
示例#4
0
文件: Toon.cs 项目: rdavydov/d3sharp
 public Toon(string name, int classId, ToonFlags flags, byte level, Account account) // Toon with **newly generated** persistent ID
     : base(StringHashHelper.HashIdentity(name))
 {
     this.SetFields(name, GetClassByID(classId), flags, level, account);
 }
示例#5
0
 public ServiceAttribute(uint serviceID, string serviceName)
     : this(serviceID, StringHashHelper.HashIdentity(serviceName))
 {
 }
示例#6
0
 public Toon(string name, int hashCode, int classId, ToonFlags flags, byte level, GameAccount account) // Toon with **newly generated** persistent ID
     : base(StringHashHelper.HashIdentity(name + "#" + hashCode.ToString("D3")))
 {
     this.SetFields(name, hashCode, GetClassByID(classId), flags, level, account, 0);
 }
示例#7
0
文件: Toon.cs 项目: DZilli/mooege
 public Toon(string name, int hashCode, int classHash, ToonFlags flags, byte level, GameAccount account) // Toon with **newly generated** persistent ID
     : base(StringHashHelper.HashIdentity(name + "#" + hashCode.ToString("D3")))
 {
     this.HeroClassField.transformDelegate += HeroClassFieldTransform;
     this.SetFields(name, hashCode, Toon.GetClassFromHash(classHash), flags, level, account, 0, 0, new Dictionary <uint, Item>());
 }