Exemplo n.º 1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     BaseLog log = new BaseLog("OfficialService");
     try
     {
         string result = "";
         int gameId;
         string gameParam = Request["gid"];
         if (!string.IsNullOrEmpty(gameParam) && int.TryParse(gameParam, out gameId))
         {
             result = DoComboWrite(gameId);
         }
         else
         {
             result = "FAILURE";
             log.SaveLog("OfficialService param error.");
         }
         Response.Write(result);
     }
     catch (Exception ex)
     {
         Response.Write("FAILURE");
         log.SaveLog(ex);
     }
 }
Exemplo n.º 2
0
 public static UserPlotPackage Get(string userId)
 {
     if (string.IsNullOrEmpty(userId))
     {
         throw new ArgumentNullException("UserID为空");
     }
     var cacheSet = new GameDataCacheSet<UserPlotPackage>();
     var data = cacheSet.FindKey(userId);
     if (data != null)
     {
         return data;
     }
     BaseLog log = new BaseLog();
     log.SaveLog(new NullReferenceException(string.Format("User:{0} UserPlot package is null.", userId)));
     return null;
 }
Exemplo n.º 3
0
        protected override void OnStartAffer()
        {
            //时间间隔更新库
            int     cacheInterval = 600;
            BaseLog log           = null;

            try
            {
                log = new BaseLog();
                GameEnvironment.ProductDesEnKey = "BF3856AD";
                GameEnvironment.ClientDesDeKey  = "SC3U9T8G";

                GameEnvironment.Start(cacheInterval, () =>
                {
                    SystemGlobal.Run();
                    PythonContext pythonContext;
                    PythonScriptManager.Current.TryLoadPython(@"Lib/action.py", out pythonContext);
                    RouteItem routeItem;
                    PythonScriptManager.Current.TryGetAction(1008, out routeItem);
                    return(true);
                });

                if (log != null)
                {
#if (DEBUG)
                    log.SaveLog(new Exception("系统正使用Debug版本"));
#else
                    log.SaveLog("系统正使用Release版本");
#endif
                }
            }
            catch (Exception ex)
            {
                if (log != null)
                {
                    log.SaveLog(ex);
                }
            }
        }
Exemplo n.º 4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            HttpResponse response = HttpContext.Current.Response;
            response.Charset = "unicode";// "unicode";
            HttpGet httpGet = new HttpGet(HttpContext.Current.Request);
            IGameResponse gameResponse = new HttpGameResponse(response);
            String ActionID = string.Empty;
            if (httpGet.GetString("ActionID", ref ActionID))
            {
                try
                {
                    string actionName = string.Concat("Action", ActionID);
                    string sname = string.Concat("ZyGames.DirCenter.Action." + actionName);
                    object[] args = new object[1];
                    args[0] = response;

                    BaseStruct obj = (BaseStruct) Activator.CreateInstance(Type.GetType(sname), new object[] { httpGet });
                    obj.DoInit();
                    if (obj.ReadUrlElement() && obj.DoAction() && !obj.GetError())
                    {
                        obj.BuildPacket();
                        obj.WriteAction(gameResponse);
                    }
                    else
                    {
                        obj.WriteErrorAction(gameResponse);
                        return;
                    }
                }
                catch (Exception ex)
                {
                    BaseLog oBaseLog = new BaseLog("DirCenterErrMain");
                    oBaseLog.SaveLog(ex);
                }
            }
        }
Exemplo n.º 5
0
        protected override void OnStartAffer()
        {
            //时间间隔更新库
            int cacheInterval = 600;
            BaseLog log = null;
            try
            {
                GameEnvironment.ClientDesDeKey = "j6=9=1ac";
                log = new BaseLog();
                var assembly = Assembly.Load("ZyGames.Doudizhu.Model");
                GameEnvironment.Start(cacheInterval, () =>
                {
                    ScriptEngines.AddReferencedAssembly(new string[] {
                        "ZyGames.Doudizhu.Lang.dll",
                        "ZyGames.Doudizhu.Model.dll",
                        "ZyGames.Doudizhu.Bll.dll"
                    });
                    ActionFactory.SetActionIgnoreAuthorize(1012, 9001, 9203);

                    AppstoreClientManager.Current.InitConfig();
                    LoadUnlineUser();
                    InitRanking();

                    ////todo 广播
                    //var list = new ShareCacheStruct<GameNotice>().FindAll(
                    //    s => (s.IsBroadcast &&
                    //            (s.ExpiryDate <= MathUtils.SqlMinDate) ||
                    //                (s.ExpiryDate > MathUtils.SqlMinDate && s.ExpiryDate >= DateTime.Now))
                    //          );
                    //foreach (var notice in list)
                    //{
                    //    DdzBroadcastService.Send(notice.Content);
                    //}
                    return true;
                }, 600, assembly);

                //HttpGet httpGet = new HttpGet("d=", "11", "127.0.0.1");
                //var script = (CSharpFileInfo)ScriptEngines.LoadScript("action1004.cs");
                //var scriptType = script.Assembly.GetType("ZyGames.Doudizhu.Script.Action.Action1004", false, true);
                //if (scriptType.CreateInstance<BaseStruct>(httpGet) == null)
                //{

                //}
                //todo test
                //CacheFactory.RemoveToDatabase("ZyGames.Doudizhu.Model.UserNickName_1380003");
                //UserNickName u = new ShareCacheStruct<UserNickName>().FindKey(1380003);
                //if (u == null)
                //{

                //}
            }
            catch (Exception ex)
            {
                if (log != null)
                {
                    log.SaveLog(ex);
                }
            }
        }
Exemplo n.º 6
0
        protected override void OnStartAffer()
        {
            //时间间隔更新库
            int cacheInterval = 600;
            BaseLog log = null;
            try
            {
                GameEnvironment.ClientDesDeKey = "j6=9=1ac";
                log = new BaseLog();
                var assembly = Assembly.Load("ZyGames.Doudizhu.Model");
                GameEnvironment.Start(cacheInterval, () =>
                {
                    PythonContext pythonContext;
                    PythonScriptManager.Current.TryLoadPython(@"Lib/action.py", out pythonContext);
                    PythonScriptManager.Current.TryLoadPython(@"Lib/lang.py", out pythonContext);
                    PythonScriptManager.Current.TryLoadPython(@"Logic/cardAILogic.py", out pythonContext);

                    AppstoreClientManager.Current.InitConfig();
                    RouteItem routeItem;
                    PythonScriptManager.Current.TryGetAction(1008, out routeItem);
                    PythonScriptManager.Current.TryGetAction(9202, out routeItem);
                    LoadUnlineUser();
                    InitRanking();

                    ////todo 广播
                    //var list = new ShareCacheStruct<GameNotice>().FindAll(
                    //    s => (s.IsBroadcast &&
                    //            (s.ExpiryDate <= MathUtils.SqlMinDate) ||
                    //                (s.ExpiryDate > MathUtils.SqlMinDate && s.ExpiryDate >= DateTime.Now))
                    //          );
                    //foreach (var notice in list)
                    //{
                    //    DdzBroadcastService.Send(notice.Content);
                    //}
                    return true;
                }, 600, assembly);

                //todo test
                //CacheFactory.RemoveToDatabase("ZyGames.Doudizhu.Model.UserNickName_1380003");
                //UserNickName u = new ShareCacheStruct<UserNickName>().FindKey(1380003);
                //if (u == null)
                //{

                //}
            }
            catch (Exception ex)
            {
                if (log != null)
                {
                    log.SaveLog(ex);
                }
            }
        }
Exemplo n.º 7
0
 /// <summary>
 /// Saves the debu log.
 /// </summary>
 /// <param name="aUseLog">A use log.</param>
 protected void SaveDebuLog(String aUseLog)
 {
     if (oBaseLog == null)
     {
         oBaseLog = new BaseLog();
     }
     oBaseLog.SaveDebugLog(aUseLog);
 }
Exemplo n.º 8
0
 /// <summary>
 /// 保存日志到文本文件
 /// </summary>
 /// <param name="aUseLog"></param>
 /// <param name="aExObj"></param>
 protected void SaveLog(String aUseLog, Exception aExObj)
 {
     if (oBaseLog == null)
     {
         oBaseLog = new BaseLog("Action" + this.actionId.ToString());
     }
     oBaseLog.SaveLog(aUseLog, aExObj);
 }
Exemplo n.º 9
0
 /// <summary>
 /// 保存日志到文本文件
 /// 日志格式:
 /// 1.请求串
 /// 2.发生日期
 /// 3.错误描述
 /// 4.错误栈详细
 /// 5.分隔线
 /// </summary>
 /// <param name="aUseLog">日志内容</param>
 protected void SaveLog(String aUseLog) {
     if (baseLog == null) {
         baseLog = new BaseLog();
     }
     baseLog.SaveLog(aUseLog);
 }
Exemplo n.º 10
0
        protected override void OnStartAffer()
        {
            //时间间隔更新库
            int cacheInterval = 600;
            BaseLog log = null;
            try
            {
                log = new BaseLog();
                GameEnvironment.ProductDesEnKey = "BF3856AD";
                GameEnvironment.ClientDesDeKey = "SC3U9T8G";

                GameEnvironment.Start(cacheInterval, () =>
                {
                    SystemGlobal.Run();
                    PythonContext pythonContext;
                    PythonScriptManager.Current.TryLoadPython(@"Lib/action.py", out pythonContext);
                    RouteItem routeItem;
                    PythonScriptManager.Current.TryGetAction(1008, out routeItem);
                    return true;
                });

                if (log != null)
                {
            #if(DEBUG)
                    log.SaveLog(new Exception("系统正使用Debug版本"));
            #else
                    log.SaveLog("系统正使用Release版本");
            #endif
                }
            }
            catch (Exception ex)
            {
                if (log != null)
                {
                    log.SaveLog(ex);
                }
            }
        }
Exemplo n.º 11
0
        protected override void OnStartAffer()
        {
            //时间间隔更新库
            int cacheInterval = 600;
            BaseLog log = null;
            try
            {
                log = new BaseLog();
                var assembly = Assembly.Load("ZyGames.Doudizhu.Model");
                GameEnvironment.Start(cacheInterval, () =>
                {
                    PythonContext pythonContext;
                    PythonScriptManager.Current.TryLoadPython(@"Lib/action.py", out pythonContext);
                    AppstoreClientManager.Current.InitConfig();
                    //RouteItem routeItem;
                    //PythonScriptManager.Current.TryGetAction(1008, out routeItem);
                    LoadUnlineUser();
                    InitRanking();

                    ////todo 广播
                    //var list = new ShareCacheStruct<GameNotice>().FindAll(
                    //    s => (s.IsBroadcast &&
                    //            (s.ExpiryDate <= MathUtils.SqlMinDate) ||
                    //                (s.ExpiryDate > MathUtils.SqlMinDate && s.ExpiryDate >= DateTime.Now))
                    //          );
                    //foreach (var notice in list)
                    //{
                    //    DdzBroadcastService.Send(notice.Content);
                    //}
                    return true;
                }, 600, assembly);

                if (log != null)
                {
            #if(DEBUG)
                    log.SaveLog(new Exception("系统正使用Debug版本"));
            #else
                    log.SaveLog("系统正使用Release版本");
            #endif
                }
            }
            catch (Exception ex)
            {
                if (log != null)
                {
                    log.SaveLog(ex);
                }
            }
        }
Exemplo n.º 12
0
        /// <summary>
        /// 使用物品
        /// </summary>
        /// <param name="userID"></param>
        /// <param name="itemID"></param>
        /// <param name="itemNum"></param>
        /// <returns>false:物品不够</returns>
        public static bool UseUserItem(string userID, int itemID, int itemNum)
        {
            var loger = new BaseLog();
            bool result = false;
            ItemBaseInfo itemInfo = new ConfigCacheSet<ItemBaseInfo>().FindKey(itemID);
            if (itemInfo == null) return result;
            var package = UserItemPackage.Get(userID);

            AddItemLog(userID, itemID, itemNum, 1, 2, itemID.ToString());

            int packNum = itemNum / itemInfo.PackMaxNum;
            int num = itemNum % itemInfo.PackMaxNum;

            var itemList = new List<UserItemInfo>();
            if (IsEnoughBeiBaoItem(userID, itemID, itemNum))
            {
                itemList = package.ItemPackage.FindAll(m => !m.IsRemove && m.ItemID == itemID && m.IsNotUsed && m.ItemStatus == ItemStatus.BeiBao);
            }
            else
            {
                itemList = package.ItemPackage.FindAll(m => !m.IsRemove && m.ItemID == itemID && m.IsNotUsed && m.ItemStatus != ItemStatus.Sell);
            }

            List<UserItemInfo> removeItem = new List<UserItemInfo>();
            List<UserItemInfo> updateItem = new List<UserItemInfo>();
            UserItemInfo packItem = null;
            foreach (UserItemInfo item in itemList)
            {
                if (packNum > 0 && item.Num == itemInfo.PackMaxNum)
                {
                    //删除整包的
                    item.Num = 0;
                    package.SaveItem(item);
                    removeItem.Add(item);
                    //package.ItemPackage.UpdateChildren(item, obj =>
                    //{
                    //    obj.Num = 0;
                    //    removeItem.Add(obj);
                    //});
                    packNum--;
                }
                else if (num > 0 && item.Num < itemInfo.PackMaxNum)
                {
                    //删除散的
                    if (item.Num > num)
                    {
                        item.Num = MathUtils.Subtraction(item.Num, num, 0);
                        num = 0;
                        updateItem.Add(item);
                        package.SaveItem(item);
                    }
                    else
                    {
                        num = MathUtils.Subtraction(num, item.Num, 0);
                        item.Num = 0;
                        removeItem.Add(item);
                        package.SaveItem(item);
                    }
                }
                else if (item.Num == itemInfo.PackMaxNum)
                {
                    //取剩余第一个整包
                    if (packItem == null)
                    {
                        packItem = item;
                    }
                }
            }
            //若散的不足再从整包中扣除
            if (num > 0 && packItem != null)
            {
                packItem.Num = MathUtils.Subtraction(packItem.Num, num, 0);
                num = 0;
                package.SaveItem(packItem);
                updateItem.Add(packItem);
            }

            if (packNum == 0 && num == 0)
            {
                foreach (UserItemInfo item in removeItem)
                {
                    package.RemoveItem(item);
                }

                //foreach (UserItemInfo item in updateItem)
                //{
                //    package.DelayChange();
                //}
                result = true;
            }

            return result;
        }
Exemplo n.º 13
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="identityID">标识ID</param>
        /// <param name="providerType">数据驱动连接提供者类型</param>
        /// <param name="connectingStr"></param>
        /// <param name="aCommandType"></param>
        /// <param name="aCommandText"></param>
        /// <param name="aParamters"></param>
        public void SendSqlCmd(int identityID, string providerType, string connectingStr, CommandType aCommandType, String aCommandText, DbParameter[] aParamters)
        {
            try
            {
                if (System.Threading.Monitor.TryEnter(SourceText.StLockMsmq, 3000))
                {

                    try
                    {
                        this.msmqCmd = MSMQCmd.SendSQLCmd;
                        this.oSqlMessageQueue = new SqlMessageQueue();
                        this.oSqlMessageQueue.CreateBody(identityID, providerType, connectingStr, aCommandType, aCommandText, aParamters);
                        this.SendMessage(MSMQCmd.SendSQLCmd, this.oSqlMessageQueue);
                    }
                    finally
                    {
                        System.Threading.Monitor.Exit(SourceText.StLockMsmq);
                    }
                }
                else
                {
                    throw new Exception("SendTimeOut");
                }
            }
            catch (Exception ex)
            {
                BaseLog baselog = new BaseLog("ActionMsmq");
                baselog.SaveLog(aCommandText, ex);
            }
        }