Exemple #1
0
 public MetaData.Game.StoneStack.StoneDelegateBuyOrderInfo[] GetFinishedDelegateBuyStoneOrders(string token, MetaData.MyDateTime myBeginCreateTime, MetaData.MyDateTime myEndCreateTime, int pageItemCount, int pageIndex)
 {
     if (RSAProvider.LoadRSA(token))
     {
         string userName = "";
         try
         {
             userName = ClientManager.GetClientUserName(token);
             if (string.IsNullOrEmpty(userName))
             {
                 return(null);
             }
             return(DBProvider.StoneStackDBProvider.GetAllFinishedStoneDelegateBuyOrderInfoByPlayer(userName, myBeginCreateTime, myEndCreateTime, pageItemCount, pageIndex));
         }
         catch (Exception exc)
         {
             LogHelper.Instance.AddErrorLog("玩家[" + userName + "] GetFinishedDelegateBuyStoneOrders Exception", exc);
             return(null);
         }
     }
     else
     {
         throw new Exception();
     }
 }
Exemple #2
0
        public AgentUserInfo GetAgentUserInfo(string token, string userName)
        {
            if (RSAProvider.LoadRSA(token))
            {
                try
                {
                    var playerInfo = PlayerController.Instance.GetPlayerInfoByUserName(userName);
                    if (playerInfo == null)
                    {
                        return(null);
                    }

                    return(DBProvider.AgentUserInfoDBProvider.GetAgentUserInfo(playerInfo));
                }
                catch (Exception exc)
                {
                    LogHelper.Instance.AddErrorLog("GetAgentUserInfo Exception. userName: " + userName, exc);

                    return(null);
                }
            }
            else
            {
                throw new Exception();
            }
        }
 public PlayerRaiderRoundHistoryRecordInfo[] GetPlayerRaiderRoundHistoryRecordInfo(string token, int pageItemCount, int pageIndex)
 {
     if (RSAProvider.LoadRSA(token))
     {
         string userName = "";
         try
         {
             userName = ClientManager.GetClientUserName(token);
             var player = PlayerController.Instance.GetPlayerInfoByUserName(userName);
             if (player == null)
             {
                 return(null);
             }
             return(DBProvider.GameRaiderofLostArkDBProvider.GetPlayerRaiderRoundHistoryRecordInfo(player.SimpleInfo.UserID, pageItemCount, pageIndex));
         }
         catch (Exception exc)
         {
             LogHelper.Instance.AddErrorLog("GetPlayerRaiderRoundHistoryRecordInfo Exception UserName: " + userName, exc);
             return(null);
         }
     }
     else
     {
         throw new Exception();
     }
 }
Exemple #4
0
        public TradeOperResult BuyMine(string token, string userName, int minesCount, int payType)
        {
#if Delay
            Thread.Sleep(5000);
#endif

            if (RSAProvider.LoadRSA(token))
            {
                try
                {
                    TradeOperResult result = new TradeOperResult();
                    result.PayType = payType;
                    if (minesCount <= 0)
                    {
                        return(result);
                    }

                    return(OrderController.Instance.MineOrderController.BuyMine(userName, minesCount, payType));
                }
                catch (Exception exc)
                {
                    LogHelper.Instance.AddErrorLog("玩家[" + userName + "] 购买矿山异常,购买矿山数为:" + minesCount + ",支付类型为:" + ((PayType)payType).ToString(), exc);
                    return(null);
                }
            }
            else
            {
                throw new Exception();
            }
        }
Exemple #5
0
        public int ChangePlayerSimpleInfo(string token, string alipayAccount, string alipayRealName, string IDCardNo, string email, string qq)
        {
#if Delay
            Thread.Sleep(5000);
#endif

            if (RSAProvider.LoadRSA(token))
            {
                try
                {
                    if (string.IsNullOrEmpty(alipayAccount) || string.IsNullOrEmpty(alipayRealName))
                    {
                        return(OperResult.RESULTCODE_PARAM_INVALID);
                    }
                    string userName = ClientManager.GetClientUserName(token);
                    int    value    = PlayerController.Instance.ChangePlayerSimpleInfo(userName, alipayAccount, alipayRealName, IDCardNo, email, qq);
                    if (value == OperResult.RESULTCODE_TRUE)
                    {
                        LogHelper.Instance.AddInfoLog("玩家[" + userName + "]修改了用户信息,修改后支付宝账户为:" + alipayAccount + ",实名为:" + alipayRealName + ",邮箱为:" + email + ", QQ为:" + qq);
                    }

                    return(value);
                }
                catch (Exception exc)
                {
                    LogHelper.Instance.AddErrorLog("ChangePlayerSimpleInfo", exc);
                    return(OperResult.RESULTCODE_FALSE);
                }
            }
            else
            {
                throw new Exception();
            }
        }
Exemple #6
0
        public TradeOperResult GoldCoinRecharge(string token, string userName, int goldCoinCount, int payType)
        {
#if Delay
            Thread.Sleep(5000);
#endif

            if (RSAProvider.LoadRSA(token))
            {
                try
                {
                    TradeOperResult result = new TradeOperResult();
                    result.PayType   = payType;
                    result.TradeType = (int)AlipayTradeInType.BuyGoldCoin;

                    if (ClientManager.GetClientUserName(token) != userName)
                    {
                        result.ResultCode = OperResult.RESULTCODE_USER_NOT_EXIST;
                    }

                    int valueRMB = (int)Math.Ceiling(goldCoinCount / GlobalConfig.GameConfig.RMB_GoldCoin);
                    return(OrderController.Instance.GoldCoinOrderController.RechargeGoldCoin(userName, valueRMB, goldCoinCount, payType));
                }
                catch (Exception exc)
                {
                    LogHelper.Instance.AddErrorLog("玩家[" + userName + "] 金币充值异常,充值金币数为:" + goldCoinCount + ",支付类型为:" + ((PayType)payType).ToString(), exc);
                    return(null);
                }
            }
            else
            {
                throw new Exception();
            }
        }
Exemple #7
0
        public MakeAVowToGodResult MakeAVowToGod(string token, string userName)
        {
            if (RSAProvider.LoadRSA(token))
            {
                MakeAVowToGodResult result = new MakeAVowToGodResult();

                try
                {
                    if (ClientManager.GetClientUserName(token) != userName)
                    {
                        result.OperResultCode = OperResult.RESULTCODE_USER_NOT_EXIST;
                        return(result);
                    }
                    result = PlayerController.Instance.MakeAVowToGod(userName);
                    return(result);
                }
                catch (Exception exc)
                {
                    LogHelper.Instance.AddErrorLog("玩家[" + userName + "] 神灵许愿异常", exc);
                    result.OperResultCode = OperResult.RESULTCODE_EXCEPTION;
                    return(result);
                }
            }
            else
            {
                throw new Exception();
            }
        }
        public bool ReleaseLockOrder(string token, string orderNumber)
        {
#if Delay
            Thread.Sleep(5000);
#endif

            if (RSAProvider.LoadRSA(token))
            {
                string userName = "";
                try
                {
                    //userName = ClientManager.GetClientUserName(token);
                    //return OrderController.Instance.StoneOrderController.ReleaseLockSellOrder(orderNumber);
                    return(false);
                }
                catch (Exception exc)
                {
                    LogHelper.Instance.AddErrorLog("玩家[" + userName + "] 解除锁定订单" + orderNumber + ",异常", exc);
                    return(false);
                }
            }
            else
            {
                throw new Exception();
            }
        }
        /// <summary>
        /// RESULTCODE_USER_NOT_EXIST; RESULTCODE_ORDER_NOT_EXIST; RESULTCODE_EXCEPTION; RESULTCODE_ORDER_NOT_BE_LOCKED; RESULTCODE_ORDER_NOT_BELONE_CURRENT_PLAYER; RESULTCODE_TRUE; RESULTCODE_FALSE;
        /// </summary>
        /// <param name="token"></param>
        /// <param name="orderNumber"></param>
        /// <returns></returns>
        public int SetStoneOrderPayException(string token, string orderNumber)
        {
#if Delay
            Thread.Sleep(5000);
#endif

            if (RSAProvider.LoadRSA(token))
            {
                return(OperResult.RESULTCODE_FALSE);

                //string userName = "";
                //try
                //{
                //    userName = ClientManager.GetClientUserName(token);
                //    if (string.IsNullOrEmpty(userName))
                //    {
                //        return OperResult.RESULTCODE_USER_NOT_EXIST;
                //    }

                //    return OrderController.Instance.StoneOrderController.SetStoneOrderPayException(userName, orderNumber);
                //}
                //catch (Exception exc)
                //{
                //    LogHelper.Instance.AddErrorLog("玩家[" + userName + "] 申诉矿石订单" + orderNumber + ",异常", exc);
                //    return OperResult.RESULTCODE_EXCEPTION;
                //}
            }
            else
            {
                throw new Exception();
            }
        }
        public LockSellStonesOrder LockSellStone(string token, string userName, string orderNumber)
        {
#if Delay
            Thread.Sleep(5000);
#endif

            if (RSAProvider.LoadRSA(token))
            {
                try
                {
                    //if (ClientManager.GetClientUserName(token) != userName)
                    //{
                    return(null);
                    //}

                    //if (OrderController.Instance.StoneOrderController.CheckUserHasNotPayOrder(userName))
                    //{
                    //    return null;
                    //}

                    //return OrderController.Instance.StoneOrderController.LockSellStone(userName, orderNumber);
                }
                catch (Exception exc)
                {
                    LogHelper.Instance.AddErrorLog("玩家[" + userName + "] 锁定矿石订单异常", exc);
                    return(null);
                }
            }
            else
            {
                throw new Exception();
            }
        }
        public bool CheckUserHasNotPayOrder(string token)
        {
#if Delay
            Thread.Sleep(5000);
#endif

            if (RSAProvider.LoadRSA(token))
            {
                try
                {
                    return(false);

                    //    string userName = ClientManager.GetClientUserName(token);
                    //    return OrderController.Instance.StoneOrderController.CheckUserHasNotPayOrder(userName);
                }
                catch (Exception exc)
                {
                    LogHelper.Instance.AddErrorLog("检查玩家是否存在未支付的订单异常", exc);
                    return(true);
                }
            }
            else
            {
                throw new Exception();
            }
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="token"></param>
        /// <param name="userName"></param>
        /// <param name="buyStonesCount"></param>
        /// <returns></returns>
        public LockSellStonesOrder AutoMatchLockSellStone(string token, string userName, int buyStonesCount)
        {
#if Delay
            Thread.Sleep(5000);
#endif

            if (RSAProvider.LoadRSA(token))
            {
                //if (ClientManager.GetClientUserName(token) != userName)
                //{
                return(null);
                //}

                //if (OrderController.Instance.StoneOrderController.CheckUserHasNotPayOrder(userName))
                //{
                //    return null;
                //}

                //return OrderController.Instance.StoneOrderController.AutoMatchLockSellStone(userName, buyStonesCount);
            }
            else
            {
                throw new Exception();
            }
        }
        public LockSellStonesOrder GetOrderLockedBySelf(string token)
        {
#if Delay
            Thread.Sleep(5000);
#endif

            if (RSAProvider.LoadRSA(token))
            {
                string userName = "";
                try
                {
                    return(null);
                    //userName = ClientManager.GetClientUserName(token);
                    //return OrderController.Instance.StoneOrderController.GetLockedOrderByUserName(userName);
                }
                catch (Exception exc)
                {
                    LogHelper.Instance.AddErrorLog("玩家[" + userName + "] 获取自己锁定订单异常", exc);
                    return(null);
                }
            }
            else
            {
                throw new Exception();
            }
        }
        /// <summary>
        /// RESULTCODE_ORDER_NOT_EXIST; RESULTCODE_USER_NOT_EXIST; RESULTCODE_EXCEPTION; RESULTCODE_ORDER_NOT_EXIST; RESULTCODE_ORDER_NOT_BELONE_CURRENT_PLAYER; RESULTCODE_ORDER_BE_LOCKED; RESULTCODE_TRUE; RESULTCODE_FALSE
        /// </summary>
        /// <param name="token"></param>
        /// <param name="userName"></param>
        /// <param name="orderNumber"></param>
        /// <returns></returns>
        public int CancelSellStone(string token, string userName, string orderNumber)
        {
#if Delay
            Thread.Sleep(5000);
#endif

            if (RSAProvider.LoadRSA(token))
            {
                if (string.IsNullOrEmpty(orderNumber))
                {
                    return(OperResult.RESULTCODE_ORDER_NOT_EXIST);
                }
                if (ClientManager.GetClientUserName(token) != userName)
                {
                    return(OperResult.RESULTCODE_USER_NOT_EXIST);
                }

                try
                {
                    //return OrderController.Instance.StoneOrderController.CancelSellOrder(userName, orderNumber);
                    return(OperResult.RESULTCODE_FALSE);
                }
                catch (Exception exc)
                {
                    string errMessage = "玩家: " + userName + " 取消矿石出售订单: " + orderNumber + " 异常.";
                    LogHelper.Instance.AddErrorLog(errMessage, exc);
                    return(OperResult.RESULTCODE_EXCEPTION);
                }
            }
            else
            {
                throw new Exception();
            }
        }
Exemple #15
0
        private void Decrypt_button_Click(object sender, EventArgs e)
        {
            try
            {
                string      msg     = Encrmsg_richTextBox.Text;
                var         tmp     = Regex.Matches(msg, @"\d+").Cast <Match>().Select(x => x.ToString()).ToArray();
                List <long> encrmsg = new List <long>();
                foreach (string i in tmp)
                {
                    encrmsg.Add(long.Parse(i));
                }

                byte[] decrmsg = new byte[encrmsg.Count()];
                for (int i = 0; i < decrmsg.Length; i++)
                {
                    decrmsg[i] = (byte)RSAProvider.Decrypt(encrmsg[i],
                                                           long.Parse(PrivateKeyToDecr_textBox.Text),
                                                           long.Parse(ModToDecr_textBox.Text));
                }
                Encrmsg_richTextBox.Text = Encoding.Default.GetString(decrmsg);
            }
            catch
            {
                MessageBox.Show("smthing wrong");
            }
        }
        public BuyStonesOrder[] SearchUserBuyStoneOrders(string token, string sellerUserName, string orderNumber, string buyUserName, int orderState, MyDateTime myBeginCreateTime, MyDateTime myEndCreateTime, MyDateTime myBeginBuyTime, MyDateTime myEndBuyTime, int pageItemCount, int pageIndex)
        {
#if Delay
            Thread.Sleep(5000);
#endif

            if (RSAProvider.LoadRSA(token))
            {
                try
                {
                    if (ClientManager.GetClientUserName(token) != buyUserName)
                    {
                        return(null);
                    }

                    return(DBProvider.StoneOrderDBProvider.GetBuyStonesOrderList(sellerUserName, orderNumber, buyUserName, orderState, myBeginCreateTime, myEndCreateTime, myBeginBuyTime, myEndBuyTime, pageItemCount, pageIndex));
                }
                catch (Exception exc)
                {
                    LogHelper.Instance.AddErrorLog("玩家[" + buyUserName + "] 查询矿石购买历史订单异常", exc);
                    return(null);
                }
            }
            else
            {
                throw new Exception();
            }
        }
        public NoticeInfo[] GetNotices(string token, int year, int month, int day, int hour, int minute, int second)
        {
#if Delay
            Thread.Sleep(5000);
#endif

            if (RSAProvider.LoadRSA(token))
            {
                try
                {
                    return(NoticeController.Instance.GetAllNotices());
                }
                catch (Exception exc)
                {
                    LogHelper.Instance.AddErrorLog("GetNotices Exception. ClientIP=" + ClientManager.GetClientIP(token)
                                                   + ", year=" + year.ToString() + ", month=" + month.ToString() + ", day=" + day.ToString()
                                                   + ", hour=" + hour.ToString() + ", minute=" + minute.ToString() + ", second=" + second.ToString(),
                                                   exc);
                    return(null);
                }
            }
            else
            {
                throw new Exception();
            }
        }
        public bool SaveRouletteLargeWinMultiple(string token, decimal multiple)
        {
            if (RSAProvider.LoadRSA(token))
            {
                string adminUserName = "";
                try
                {
                    if (multiple < 1)
                    {
                        return(false);
                    }
                    adminUserName = AdminManager.GetClientUserName(token);

                    GlobalConfig.RouletteConfig.RouletteLargeWinMultiple = multiple;
                    bool isOK = DBProvider.SystemDBProvider.SaveRouletteConfig(GlobalConfig.RouletteConfig);
                    LogHelper.Instance.AddInfoLog("管理员[" + adminUserName + "]修改了幸运大转盘中奖倍数为:" + multiple);

                    return(isOK);
                }
                catch (Exception exc)
                {
                    LogHelper.Instance.AddErrorLog("SaveRouletteLargeWinMultiple Exception. adminUserName:" + adminUserName, exc);
                    return(false);
                }
            }
            else
            {
                throw new Exception();
            }
        }
Exemple #19
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="token"></param>
        /// <param name="userName"></param>
        /// <param name="stones">-1表示清空临时产出</param>
        /// <returns></returns>
        public int GatherStones(string token, string userName, decimal stones)
        {
#if Delay
            Thread.Sleep(5000);
#endif

            if (RSAProvider.LoadRSA(token))
            {
                try
                {
                    if (ClientManager.GetClientUserName(token) != userName)
                    {
                        return(OperResult.RESULTCODE_USER_NOT_EXIST);
                    }
                    if (stones == 0)
                    {
                        return(OperResult.RESULTCODE_LACK_OF_BALANCE);
                    }
                    GatherTempOutputStoneResult result = PlayerController.Instance.GatherStones(userName, stones);
                    return(result.OperResult);
                }
                catch (Exception exc)
                {
                    LogHelper.Instance.AddErrorLog("玩家[" + userName + "] 收取矿石异常,矿石数为:" + stones, exc);
                    return(OperResult.RESULTCODE_EXCEPTION);
                }
            }
            else
            {
                throw new Exception();
            }
        }
Exemple #20
0
        public GambleStonePlayerBetRecord[] GetLastMonthGambleStonePlayerBetRecord(string token)
        {
            if (RSAProvider.LoadRSA(token))
            {
                string userName = null;
                try
                {
                    userName = ClientManager.GetClientUserName(token);
                    var player = PlayerController.Instance.GetPlayerInfoByUserName(userName);
                    if (player == null)
                    {
                        return(null);
                    }

                    return(DBProvider.GambleStoneDBProvider.GetLastMonthGambleStonePlayerBetRecord(player.SimpleInfo.UserID));
                }
                catch (Exception exc)
                {
                    LogHelper.Instance.AddErrorLog("玩家[ " + userName + " ] GetGambleStoneInningInfo 异常。", exc);
                    return(null);
                }
            }
            else
            {
                throw new Exception();
            }
        }
Exemple #21
0
        /// <summary>
        /// RESULTCODE_USER_NOT_EXIST; RESULTCODE_FALSE
        /// </summary>
        /// <param name="token"></param>
        /// <param name="userName"></param>
        /// <param name="minersCount"></param>
        /// <returns></returns>
        public int BuyMiner(string token, string userName, int minersCount)
        {
#if Delay
            Thread.Sleep(5000);
#endif

            if (RSAProvider.LoadRSA(token))
            {
                try
                {
                    if (minersCount <= 0)
                    {
                        return(OperResult.RESULTCODE_FALSE);
                    }

                    if (ClientManager.GetClientUserName(token) != userName)
                    {
                        return(OperResult.RESULTCODE_USER_NOT_EXIST);
                    }

                    return(PlayerController.Instance.BuyMiner(userName, minersCount));
                }
                catch (Exception exc)
                {
                    LogHelper.Instance.AddErrorLog("玩家[" + userName + "] 购买矿工异常,购买矿工数为:" + minersCount, exc);
                    return(OperResult.RESULTCODE_EXCEPTION);
                }
            }
            else
            {
                throw new Exception();
            }
        }
        public int TakeRouletteAward(string token, string userName, int recordID, string info1, string info2)
        {
            if (RSAProvider.LoadRSA(token))
            {
                string currentUserName = ClientManager.GetClientUserName(token);
                if (currentUserName != userName)
                {
                    return(OperResult.RESULTCODE_USER_NOT_EXIST);
                }

                try
                {
                    return(RouletteAwardController.Instance.TakeAward(userName, recordID, info1, info2));
                }
                catch (Exception exc)
                {
                    LogHelper.Instance.AddErrorLog(userName + " TakeRouletteAward Exception", exc);
                    return(OperResult.RESULTCODE_FALSE);
                }
            }
            else
            {
                throw new Exception();
            }
        }
Exemple #23
0
        public PlayerInfo GetPlayerInfo(string token)
        {
#if Delay
            Thread.Sleep(5000);
#endif

            if (RSAProvider.LoadRSA(token))
            {
                try
                {
                    string     userName = ClientManager.GetClientUserName(token);
                    PlayerInfo user     = PlayerController.Instance.GetPlayerInfoByUserName(userName);
                    return(user);
                }
                catch (Exception exc)
                {
                    LogHelper.Instance.AddErrorLog("GetPlayerInfo", exc);
                    return(null);
                }
            }
            else
            {
                throw new Exception();
            }
        }
        public RouletteWinnerRecord[] GetAllWinAwardRecords(string token, string userName, int RouletteAwardItemID, MyDateTime BeginWinTime, MyDateTime EndWinTime, int IsGot, int IsPay, int pageItemCount, int pageIndex)
        {
            if (RSAProvider.LoadRSA(token))
            {
                try
                {
                    //string currentUserName = ClientManager.GetClientUserName(token);
                    //if (currentUserName != userName)
                    //{
                    //    return null;
                    //}

                    return(RouletteAwardController.Instance.GetAllPayWinAwardRecords(userName, RouletteAwardItemID, false, BeginWinTime, EndWinTime, IsGot, IsPay, pageItemCount, pageIndex));
                }
                catch (Exception exc)
                {
                    LogHelper.Instance.AddErrorLog("ServiceToClient.GetAllPayWinAwardRecords Exception.", exc);
                    return(null);
                }
            }
            else
            {
                throw new Exception();
            }
        }
Exemple #25
0
        /// <summary>
        /// -2表示参数无效,-1表示异常,0,表示不存在,1表示存在
        /// </summary>
        /// <param name="alipayAccount"></param>
        /// <param name="alipayRealName"></param>
        /// <returns></returns>
        public int CheckUserAlipayExist(string token, string alipayAccount, string alipayRealName)
        {
#if Delay
            Thread.Sleep(5000);
#endif

            if (RSAProvider.LoadRSA(token))
            {
                try
                {
                    if (string.IsNullOrEmpty(alipayAccount) || string.IsNullOrEmpty(alipayRealName))
                    {
                        return(-2);
                    }
                    int result = PlayerController.Instance.CheckUserAlipayAccountExist(alipayAccount);
                    if (result == OperResult.RESULTCODE_TRUE)
                    {
                        return(result);
                    }
                    result = PlayerController.Instance.CheckUserAlipayRealNameExist(alipayRealName);
                    return(result);
                }
                catch (Exception exc)
                {
                    LogHelper.Instance.AddErrorLog("CheckUserAlipayExist Exception. alipayAccount: " + alipayAccount
                                                   + ", alipayRealName: " + alipayRealName, exc);

                    return(-1);
                }
            }
            else
            {
                throw new Exception();
            }
        }
        public MetaData.Game.Roulette.RouletteWinAwardResult StartRoulette(string token, string userName)
        {
            if (RSAProvider.LoadRSA(token))
            {
                string currentUserName = ClientManager.GetClientUserName(token);
                if (currentUserName != userName)
                {
                    return(null);
                }

                try
                {
                    return(RouletteAwardController.Instance.Start(userName));
                }
                catch (Exception exc)
                {
                    LogHelper.Instance.AddErrorLog(userName + " StartRoulette Exception", exc);
                    return(null);
                }
            }
            else
            {
                throw new Exception();
            }
        }
Exemple #27
0
        public int UpdateAddress(string token, PostAddress newAddress)
        {
            if (RSAProvider.LoadRSA(token))
            {
                try
                {
                    var playerUserName = ClientManager.GetClientUserName(token);
                    var player         = PlayerController.Instance.GetPlayerInfoByUserName(playerUserName);
                    if (player.SimpleInfo.UserID != newAddress.UserID)
                    {
                        return(OperResult.RESULTCODE_USER_NOT_EXIST);
                    }
                    return(DBProvider.UserDBProvider.UpdateAddress(newAddress));
                }
                catch (Exception exc)
                {
                    LogHelper.Instance.AddErrorLog("UpdateAddress Exception. ", exc);

                    return(OperResult.RESULTCODE_EXCEPTION);
                }
            }
            else
            {
                throw new Exception();
            }
        }
Exemple #28
0
        private void Encrypt_button_Click(object sender, EventArgs e)
        {
            try
            {
                long mod = long.Parse(ModToEncr_textBox.Text);
                if (mod < 128)
                {
                    MessageBox.Show("small mod");
                    return;
                }
                long        e_       = long.Parse(PublicKeyToEncr_textBox.Text);
                var         msg      = Encoding.Default.GetBytes(message_richTextBox.Text);
                List <long> encrrmsg = new List <long>();

                string tmp = string.Empty;
                foreach (byte i in msg)
                {
                    long encrblock = RSAProvider.Encrypt(i, e_, mod);
                    encrrmsg.Add(encrblock);
                    tmp += encrblock.ToString() + "\t";
                }

                message_richTextBox.Text = tmp;
            }
            catch
            {
                MessageBox.Show("smthing wrong");
            }
        }
Exemple #29
0
        private string Sign(IDictionary <string, string> requestParams)
        {
            var signedParams = BuildSignParams(requestParams);
            var sign         = RSAProvider.GenerateSignature(this.PrivateKey, signedParams.ToString());

            return(sign);
        }
Exemple #30
0
 public MetaData.Game.StoneStack.StoneDelegateBuyOrderInfo[] GetNotFinishedDelegateBuyStoneOrders(string token)
 {
     if (RSAProvider.LoadRSA(token))
     {
         string userName = "";
         try
         {
             userName = ClientManager.GetClientUserName(token);
             var playerInfo = PlayerController.Instance.GetPlayerInfoByUserName(userName);
             if (playerInfo == null)
             {
                 return(null);
             }
             return(DBProvider.StoneStackDBProvider.GetNotFinishedStoneDelegateBuyOrderInfoByPlayer(playerInfo.SimpleInfo.UserID));
         }
         catch (Exception exc)
         {
             LogHelper.Instance.AddErrorLog("玩家[" + userName + "] GetFinishedDelegateBuyStoneOrders Exception", exc);
             return(null);
         }
     }
     else
     {
         throw new Exception();
     }
 }