Example #1
0
        public override IEnumerable <object> Run()
        {
            DSEntity ds = this.service.GetDSEntity(base.Operation.DSID);

            if (ds != null)
            {
                if (base.Operation.PvpID == -1L)
                {
                    ds.StopDS();
                }
                else
                {
                    ds.StartPvpDS(base.Operation.PvpID, base.Operation.PvpBSP, base.Operation.Config, base.Operation.GameInfo);
                }
                base.Finished = true;
                yield return(ds.Entity.ID);
            }
            else
            {
                Log <LaunchDSProcessor> .Logger.ErrorFormat("GetDsEntity is null DSID {0}", base.Operation.DSID);

                base.Finished = true;
                yield return(new FailMessage("[LaunchPvpDSProcessor] ds"));
            }
            yield break;
        }
Example #2
0
 public void InitializeEntity(int idStart, int count)
 {
     using (IEnumerator <int> enumerator = Enumerable.Range(idStart, count).GetEnumerator())
     {
         while (enumerator.MoveNext())
         {
             int key = enumerator.Current;
             base.BeginGetEntity(base.MakeEntityID().Ticks, base.Category, delegate(IEntity resultEntity, BindEntityResult result)
             {
                 if (resultEntity != null)
                 {
                     DSEntity dsentity = resultEntity.Tag as DSEntity;
                     if (dsentity != null)
                     {
                         this.DSEntities.Add(key, dsentity);
                         dsentity.DSID      = key;
                         dsentity.PortIndex = key - idStart;
                         Log <DSService> .Logger.InfoFormat("DS Entity Initialized : {0}", key);
                     }
                 }
             });
         }
     }
     base.BeginGetEntity(base.MakeEntityID().Ticks, base.Category, delegate(IEntity resultEntity, BindEntityResult result)
     {
         if (resultEntity != null)
         {
             resultEntity.Tag     = null;
             this.DSServiceEntity = resultEntity;
             Log <DSService> .Logger.Info("DS ServiceEntity Initialized");
             return;
         }
         Log <DSService> .Logger.Fatal("DS ServiceEntity Initialize Failed");
     });
 }
Example #3
0
        protected override IEntity MakeEntity(long id, string category)
        {
            IEntity  entity   = base.MakeEntity(id, category);
            DSEntity dsentity = new DSEntity();

            entity.Tag      = dsentity;
            dsentity.Entity = entity;
            entity.Closed  += delegate(object sender, EventArgs e)
            {
                Log <DSService> .Logger.FatalFormat("<GID : {0}> DSEntity closed...", entity.ID);
            };
            entity.Closed += this.Entity_Closed;
            return(entity);
        }
Example #4
0
        public override IEnumerable <object> Run()
        {
            DSEntity ds = this.service.GetDSEntity(base.Operation.DSID);

            if (ds != null)
            {
                ds.StartQuestDS(base.Operation.QuestID, base.Operation.MicroPlayID, base.Operation.PartyID, base.Operation.FrontendID, base.Operation.IsGiantRaid, base.Operation.IsAdultMode);
                base.Finished = true;
                yield return(new OkMessage());
            }
            else
            {
                Log <LaunchDSProcessor> .Logger.ErrorFormat("GetDsEntity is null DSID {0}", base.Operation.DSID);

                base.Finished = true;
                yield return(new FailMessage("[LaunchDSProcessor] ds"));
            }
            yield break;
        }
Example #5
0
        public static void AddLog(DSEntity ds, string action, string arg)
        {
            if (FeatureMatrix.IsEnable("DisableLogging"))
            {
                return;
            }
            if (DSLog.Context == null)
            {
                DSLog.Context = new DSLogDataContext();
            }
            try
            {
                DSLog.Context.AddDSLog(new int?(DSService.Instance.ID), new int?(ds.DSID), ds.QuestID ?? "", new long?(ds.PartyID), new long?(ds.MicroPlayID), new int?(-1), action ?? "", arg ?? "");
            }
            catch (Exception ex)
            {
                Log <DSLog> .Logger.Error("error while logging", ex);

                DSLog.Context = null;
            }
        }
Example #6
0
 public void MakeDSEntity(int dsID)
 {
     if (this.DSEntities.TryGetValue(dsID) != null)
     {
         return;
     }
     base.BeginGetEntity(base.MakeEntityID().Ticks, base.Category, delegate(IEntity resultEntity, BindEntityResult result)
     {
         if (resultEntity != null)
         {
             DSEntity dsentity = resultEntity.Tag as DSEntity;
             if (dsentity != null)
             {
                 this.DSEntities.Add(dsID, dsentity);
                 dsentity.DSID      = dsID;
                 dsentity.PortIndex = dsID;
                 Log <DSService> .Logger.InfoFormat("Make DS Entity : {0}", dsID);
             }
         }
     });
 }
Example #7
0
        public void ProcessMessage(object message)
        {
            if (message is DSHostConnectionEstablish)
            {
                DSHostConnectionEstablish dshostConnectionEstablish = message as DSHostConnectionEstablish;
                Log <TcpClientHolder> .Logger.InfoFormat("Process DSHostConnectionEstablish Message", new object[0]);

                DSEntity dsentity = null;
                foreach (DSEntity dsentity2 in DSService.Instance.DSEntities.Values)
                {
                    if (dsentity2.Process != null && dsentity2.DSID == dshostConnectionEstablish.DSID)
                    {
                        dsentity = dsentity2;
                        break;
                    }
                }
                if (dsentity != null)
                {
                    if (dsentity.PvpConfig == null)
                    {
                        dsentity.RegisterConnection(this.TcpClient);
                    }
                    else
                    {
                        dsentity.RegisterConnectionPvp(this.TcpClient);
                    }
                    this.HasTransfered = true;
                }
                else
                {
                    string text = string.Format("[Peer {0}:{1}]", this.TcpClient.LocalEndPoint.Address.ToString(), this.TcpClient.LocalEndPoint.Port.ToString());
                    Log <DSService> .Logger.ErrorFormat("{0} has no target DS Entity!", text);

                    DSLog.AddLog(-1, null, -1L, -1, "No DSEntity", string.Format("{0} dsid{1}", text, dshostConnectionEstablish.DSID));
                    this.DisconnectTcpClient();
                }
                this.UnBindTcpClient();
            }
        }