コード例 #1
0
ファイル: CenterServer.cs プロジェクト: vancourt/BaseGunnyII
        protected void ScanAuctionProc(object sender)
        {
            try
            {
                int startTick = Environment.TickCount;
                if (log.IsInfoEnabled)
                {
                    log.Info("Saving Record...");
                    log.Debug("Save ThreadId=" + Thread.CurrentThread.ManagedThreadId);
                }

                ThreadPriority oldprio = Thread.CurrentThread.Priority;
                Thread.CurrentThread.Priority = ThreadPriority.Lowest;

                string noticeUserID = "";
                using (PlayerBussiness db = new PlayerBussiness())
                {
                    db.ScanAuction(ref noticeUserID);
                }
                string[] userIDs = noticeUserID.Split(',');

                foreach (string s in userIDs)
                {
                    if (string.IsNullOrEmpty(s))
                        continue;
                    GSPacketIn pkg = new GSPacketIn((byte)ePackageType.MAIL_RESPONSE);
                    pkg.WriteInt(int.Parse(s));
                    pkg.WriteInt((int)eMailRespose.Receiver);
                    SendToALL(pkg);
                }

                Thread.CurrentThread.Priority = oldprio;

                startTick = Environment.TickCount - startTick;
                if (log.IsInfoEnabled)
                {
                    log.Info("Scan Auction complete!");
                }
                if (startTick > 2 * 60 * 1000)
                {
                    log.WarnFormat("Scan all Auction  in {0} ms", startTick);
                }
            }
            catch (Exception e1)
            {
                if (log.IsErrorEnabled)
                    log.Error("ScanAuctionProc", e1);
            }
        }