Пример #1
0
 private void Entity_Closed(object sender, EventArgs e)
 {
     if (this.Service.PCRoomManager != null)
     {
         this.Service.PCRoomManager.RemoveUser(this);
     }
     if (this.valid)
     {
         if (this.Service.NxIDToEntityDic.ContainsKey(this.NexonID))
         {
             this.Service.NxIDToEntityDic.Remove(this.NexonID);
         }
         if (this.Service.SessionDic.ContainsKey(this.SessionNo))
         {
             this.Service.SessionDic.Remove(this.SessionNo);
         }
         this.Service.Logout(this.SessionNo, this.NexonID, this.CharacterID, this.RemoteAddress, this.CanTry);
         this.ReportCafeAuthLogout();
     }
     try
     {
         EntityDataContext entityDataContext = new EntityDataContext();
         entityDataContext.AcquireService(new long?((sender as IEntity).ID), this.Service.Category, new int?(-1), new int?(this.Service.ID));
     }
     catch (Exception ex)
     {
         Log <CafeAuth> .Logger.ErrorFormat("Entity_Closed [EntityID : {0}] [ServiceID : {1}] [Category : {2}] - {3} ", new object[]
         {
             (sender as IEntity).ID,
             this.Service.ID,
             this.Service.Category,
             ex
         });
     }
 }
Пример #2
0
        protected override IEntity MakeEntity(long id, string category)
        {
            IEntity entity = base.MakeEntity(id, category);

            entity.Tag   = new GRCClient(this, entity);
            entity.Used += delegate(object sender, EventArgs <IEntityAdapter> e)
            {
                if (entity.UseCount == 0)
                {
                    entity.Close();
                }
            };
            entity.Using += delegate(object sender, EventArgs <IEntityAdapter> e)
            {
                IEntityAdapter value = e.Value;
                if (entity.Tag == null)
                {
                    return;
                }
                if (value.RemoteCategory == "FrontendServiceCore.FrontendService")
                {
                    GRCClient grcclient = entity.Tag as GRCClient;
                    if (grcclient.FrontendConn != null)
                    {
                        grcclient.FrontendConn.Close();
                    }
                    grcclient.FrontendConn         = this.Connect(entity, new Location(value.RemoteID, value.RemoteCategory));
                    grcclient.FrontendConn.Closed += delegate(object _, EventArgs <IEntityProxy> __)
                    {
                        entity.Close();
                    };
                    grcclient.FrontendConn.OperationQueueOversized += delegate(object _, EventArgs <IEntityProxy> __)
                    {
                        entity.Close(true);
                    };
                }
            };
            entity.Closed += delegate(object sender, EventArgs e)
            {
                try
                {
                    EntityDataContext entityDataContext = new EntityDataContext();
                    entityDataContext.AcquireService(new long?((sender as IEntity).ID), base.Category, new int?(-1), new int?(base.ID));
                }
                catch (Exception ex)
                {
                    Log <GRCService> .Logger.ErrorFormat("Entity_Closed [EntityID : {0}] [ServiceID : {1}] [Category : {2}] - {3} ", new object[]
                    {
                        (sender as IEntity).ID,
                        base.ID,
                        base.Category,
                        ex
                    });
                }
            };
            Scheduler.Schedule(base.Thread, Job.Create(new Action((entity.Tag as GRCClient).MakeRequest)), this.NextMilliseconds());
            return(entity);
        }
Пример #3
0
        public override int CompareAndSwapServiceID(long id, string category, int beforeID)
        {
            if (category != base.Category)
            {
                return(-1);
            }
            int result;

            using (EntityDataContext entityDataContext = new EntityDataContext())
            {
                result = entityDataContext.AcquireService(new long?(id), base.Category, new int?(base.ID), new int?(beforeID));
            }
            return(result);
        }
Пример #4
0
        public int FindServiceID(long id, string category)
        {
            if (category != base.Category)
            {
                return(-1);
            }
            int result;

            using (EntityDataContext entityDataContext = new EntityDataContext())
            {
                result = entityDataContext.AcquireService(new long?(id), base.Category, new int?(-1), new int?(-1));
            }
            return(result);
        }
Пример #5
0
 private void Entity_Closed(object sender, EventArgs e)
 {
     try
     {
         EntityDataContext entityDataContext = new EntityDataContext();
         entityDataContext.AcquireService(new long?((sender as IEntity).ID), base.Category, new int?(-1), new int?(base.ID));
     }
     catch (Exception ex)
     {
         Log <GuildService> .Logger.ErrorFormat("Entity_Closed [EntityID : {0}] [ServiceID : {1}] [Category : {2}] - {3} ", new object[]
         {
             (sender as IEntity).ID,
             base.ID,
             base.Category,
             ex
         });
     }
 }
Пример #6
0
        protected override IEntity MakeEntity(long id, string category)
        {
            AntiCpXSvr.SafeClientHandle safeClientHandle = new AntiCpXSvr.SafeClientHandle(this.serverHandle);
            if (safeClientHandle.IsInvalid)
            {
                Log <HackShieldService> .Logger.WarnFormat("Error while making Hackshield handler : {0}", id);

                return(null);
            }
            IEntity entity = base.MakeEntity(id, category);

            entity.Tag    = new HackShieldClient(this, entity, safeClientHandle);
            entity.Using += delegate(object sender, EventArgs <IEntityAdapter> e)
            {
                IEntityAdapter value = e.Value;
                if (entity.Tag == null)
                {
                    return;
                }
                if (value.RemoteCategory == "FrontendServiceCore.FrontendService")
                {
                    HackShieldClient hackShieldClient = entity.Tag as HackShieldClient;
                    if (hackShieldClient.FrontendConn != null)
                    {
                        hackShieldClient.FrontendConn.Close();
                    }
                    hackShieldClient.FrontendConn         = this.Connect(entity, new Location(value.RemoteID, value.RemoteCategory));
                    hackShieldClient.FrontendConn.Closed += delegate(object _, EventArgs <IEntityProxy> __)
                    {
                        entity.Close();
                    };
                    hackShieldClient.FrontendConn.OperationQueueOversized += delegate(object _, EventArgs <IEntityProxy> __)
                    {
                        entity.Close(true);
                    };
                }
            };
            entity.Closed += delegate(object sender, EventArgs e)
            {
                try
                {
                    EntityDataContext entityDataContext = new EntityDataContext();
                    entityDataContext.AcquireService(new long?((sender as IEntity).ID), base.Category, new int?(-1), new int?(base.ID));
                }
                catch (Exception ex)
                {
                    Log <HackShieldService> .Logger.ErrorFormat("Entity_Closed [EntityID : {0}] [ServiceID : {1}] [Category : {2}] - {3} ", new object[]
                    {
                        (sender as IEntity).ID,
                        base.ID,
                        base.Category,
                        ex
                    });
                }
            };
            entity.Used += delegate(object sender, EventArgs <IEntityAdapter> e)
            {
                if (entity.UseCount == 0)
                {
                    entity.Close();
                }
            };
            if (!FeatureMatrix.IsEnable("HackShieldConnCheckOff"))
            {
                Scheduler.Schedule(base.Thread, Job.Create(new Action((entity.Tag as HackShieldClient).MakeRequest)), this.NextMilliseconds());
            }
            if (FeatureMatrix.IsEnable("TcProtect"))
            {
                Scheduler.Schedule(base.Thread, Job.Create(new Action((entity.Tag as HackShieldClient).MakeTcProtectRequest)), 0);
            }
            return(entity);
        }