Exemplo n.º 1
0
        public override void  OnClientDisconnected(RpcClientInfo Info)
        {
            Realm Rm = GetRealmByRpc(Info.RpcID);

            if (Rm != null && Rm.Info.RpcID == Info.RpcID)
            {
                Log.Error("Realm", "Realm offline : " + Rm.Name);
                Rm.Info = null;
            }
        }
Exemplo n.º 2
0
 public override void OnClientDisconnected(RpcClientInfo Info)
 {
     foreach (Realm Rm in GetRealms())
     {
         if (Rm.RpcInfo != null && Rm.RpcInfo.RpcID == Info.RpcID)
         {
             Log.Notice("AccountMgr", "Realm Offline : " + Rm.Name);
             Rm.RpcInfo = null;
         }
     }
 }
Exemplo n.º 3
0
 public override void OnClientDisconnected(RpcClientInfo Info)
 {
     foreach (MapServerInfo MapInfo in MapsInfo.ToArray())
     {
         if (MapInfo.RpcInfo.RpcID == Info.RpcID)
         {
             Log.Error("MapMgr", "MapServer disconnected : " + MapInfo.MapAdress);
             MapsInfo.Remove(MapInfo);
         }
     }
 }
Exemplo n.º 4
0
 public override void  OnClientDisconnected(RpcClientInfo Rpc)
 {
     Log.Info("CharMgr", "Déconnection de l'user : "******"CharMgr", "Déconnection du world : " + Info._Info.Name);
             Info.RpcID = 0;
         }
     }
 }
Exemplo n.º 5
0
        public override void OnClientDisconnected(RpcClientInfo Info)
        {
            Realm Rm = GetRealmByRpc(Info.RpcID);

            if (Rm != null && Rm.Info.RpcID == Info.RpcID)
            {
                Log.Error("Realm", "Realm offline : " + Rm.Name);
                Rm.Info   = null;
                Rm.Online = 0;
                Rm.Dirty  = true;
                Database.SaveObject(Rm);
            }
        }
Exemplo n.º 6
0
        public void RegisterMaps(MapServerInfo MapInfo, RpcClientInfo RpcInfo)
        {
            MapServerInfo Info = GetMapInfo(MapInfo.MapAdress);

            if (Info == null)
            {
                MapsInfo.Add(MapInfo);
            }
            else
            {
                Info.RpcInfo = RpcInfo;
            }

            MapInfo.RpcInfo = RpcInfo;
            Log.Success("MapMgr", "Map online : " + MapInfo.MapAdress);
        }
Exemplo n.º 7
0
        public bool UpdateRealm(RpcClientInfo Info, byte RealmId)
        {
            Realm Rm = GetRealm(RealmId);

            if (Rm != null)
            {
                Log.Success("Realm", "Realm (" + Rm.Name + ") online at " + Info.Ip + ":" + Info.Port);
                Rm.Info = Info;
            }
            else
            {
                Log.Error("UpdateRealm", "Realm (" + RealmId + ") missing : Please complete the table 'realm'");
                return(false);
            }

            return(true);
        }
Exemplo n.º 8
0
        public bool RegisterRealm(Realm Rm, RpcClientInfo Info)
        {
            Log.Debug("AccountMgr", "Realm Registering : " + Rm.Name);

            if (Rm == null)
            {
                return(false);
            }

            Rm.GenerateName();

            Realm Already = GetRealm(Rm.RealmId);

            if (Already == null)
            {
                Already = AccountDB.SelectObject <Realm>("RealmId=" + Rm.RealmId);
                if (Already == null)
                {
                    AccountDB.AddObject(Rm);
                }
            }

            if (Already != null)
            {
                Rm.ObjectId = Already.ObjectId;
                Realms.Remove(Already);
            }

            Rm.RpcInfo = Info;
            Rm.Dirty   = true;

            AccountDB.SaveObject(Rm);
            Realms.Add(Rm);

            if (Info != null)
            {
                Log.Success("AccountMgr", "Realm Online : " + Rm.Name);
            }
            else
            {
                Log.Success("AccountMgr", "Realm loaded : " + Rm.Name);
            }

            return(true);
        }
Exemplo n.º 9
0
        private void RpcEntryPoint2(IntPtr pAsyncState, IntPtr clientHandle, uint szInput, IntPtr input, out uint szOutput, out IntPtr output)
        {
            Console.WriteLine("RpcEntryPoint2");

            output   = IntPtr.Zero;
            szOutput = 0;

            try
            {
                byte[] bytesIn = new byte[szInput];
                Marshal.Copy(input, bytesIn, 0, bytesIn.Length);

                byte[] bytesOut;
                using (RpcClientInfo client = new RpcClientInfo(clientHandle))
                {
                    bytesOut = ExecuteAsync(client, pAsyncState, bytesIn);
                }
                if (bytesOut == null)
                {
                    var result = (IntPtr)RpcError.RPC_S_NOT_LISTENING;
                    RpcApi.RpcAsyncCompleteCall(pAsyncState, ref result);
                    return;
                }

                szOutput = (uint)bytesOut.Length;
                output   = RpcApi.Alloc(szOutput);
                Marshal.Copy(bytesOut, 0, output, bytesOut.Length);

                var result2 = (IntPtr)RpcError.RPC_S_OK;
                RpcApi.RpcAsyncCompleteCall(pAsyncState, ref result2);
                return;
            }
            catch (Exception ex)
            {
                RpcApi.Free(output);
                output   = IntPtr.Zero;
                szOutput = 0;

                Log.Error(ex);
                var result = (IntPtr)RpcError.RPC_S_OK;
                RpcApi.RpcAsyncCompleteCall(pAsyncState, ref result);
                return;
            }
        }
Exemplo n.º 10
0
        private void RpcEntryPoint2(IntPtr pAsyncState, IntPtr clientHandle, uint szInput, IntPtr input, IntPtr szOutput, IntPtr output)
        {
            try
            {
                byte[] bytesIn = new byte[szInput];
                Marshal.Copy(input, bytesIn, 0, bytesIn.Length);
                var asyncContext = new AsyncContextImpl(pAsyncState, szOutput, output);
                try
                {
                    using (RpcClientInfo client = new RpcClientInfo(clientHandle))
                    {
                        ExecuteAsync(client, asyncContext, bytesIn);
                    }
                }
                catch (Exception e)
                {
                    if (asyncContext.status == AsyncContextStatus.InProgress)
                    {
                        asyncContext.completeCall((uint)RpcError.RPC_E_FAIL);
                    }
                }
            }
            catch (Exception ex)
            {
                if (IntPtr.Zero != output)
                {
                    RpcApi.Free(Marshal.ReadIntPtr(output));
                }
                Marshal.WriteIntPtr(output, IntPtr.Zero);
                Marshal.WriteInt32(szOutput, 0);

                Log.Error(ex);

                var result = (IntPtr)RpcError.RPC_E_FAIL;
                RpcApi.RpcAsyncCompleteCall(pAsyncState, ref result);
                return;
            }
        }
        private uint RpcEntryPoint(IntPtr clientHandle, uint szInput, IntPtr input, out uint szOutput, out IntPtr output)
        {
            output   = IntPtr.Zero;
            szOutput = 0;

            try
            {
                byte[] bytesIn = new byte[szInput];
                Marshal.Copy(input, bytesIn, 0, bytesIn.Length);

                byte[] bytesOut;
                using (RpcClientInfo client = new RpcClientInfo(clientHandle))
                {
                    bytesOut = Execute(client, bytesIn);
                }
                if (bytesOut == null)
                {
                    return((uint)RpcError.RPC_S_NOT_LISTENING);
                }

                szOutput = (uint)bytesOut.Length;
                output   = RpcApi.Alloc(szOutput);
                Marshal.Copy(bytesOut, 0, output, bytesOut.Length);

                return((uint)RpcError.RPC_S_OK);
            }
            catch (Exception ex)
            {
                RpcApi.Free(output);
                output   = IntPtr.Zero;
                szOutput = 0;

                Log.Error(ex);
                return((uint)RpcError.RPC_E_FAIL);
            }
        }
Exemplo n.º 12
0
        public bool UpdateRealm(RpcClientInfo Info, byte RealmId)
        {
            Realm Rm = GetRealm(RealmId);

            if (Rm != null)
            {
                Log.Success("Realm", "Realm (" + Rm.Name + ") online at " + Info.Ip + ":" + Info.Port);
                Rm.Info             = Info;
                Rm.Online           = 1;
                Rm.OrderCount       = 0;
                Rm.DestructionCount = 0;
                Rm.OnlineDate       = DateTime.Now;
                Rm.Dirty            = true;
                Rm.BootTime         = TCPManager.GetTimeStamp();
                Database.SaveObject(Rm);
            }
            else
            {
                Log.Error("UpdateRealm", "Realm (" + RealmId + ") missing : Please complete the table 'realm'");
                return(false);
            }

            return(true);
        }