Ejemplo n.º 1
0
        public override void Read(hsStream s, hsResMgr mgr)
        {
            base.Read(s, mgr);

            fCommand = (Cmd)s.ReadInt();
            fString = s.ReadStdString();
        }
Ejemplo n.º 2
0
 public KeyData(string dataStr)
 {
     string[] str = dataStr.Split('#');
     this.cmd = (Cmd)int.Parse(str[0]);
     this.data = str[1];
     this.roleId = int.Parse(str[2]);
 }
Ejemplo n.º 3
0
 public Form1()
 {
     InitializeComponent();
     shapes = new List<Shape>();
     mode = Mode.IDLE;
     cmd = Cmd.SELECT;
     graphic = pictureBox1.CreateGraphics();
 }
Ejemplo n.º 4
0
        public ScanLocalViewModel()
        {
            CmdOK = new Cmd(ExecuteOK);
            CmdCancel = new Cmd(ExecuteCancel);
            CmdPickDirectory = new Cmd(PickDirCmd);

            Tags = string.Empty;
            Extensions = "*.pdf";
            Dir = @"c:\usr\shared\Микросхемы";
        }
Ejemplo n.º 5
0
        public MainViewModel()
        {
            CmdEdit = new Cmd<CheckListItem>(EditItem, IsCanEditItem);
            CmdRefresh = new Cmd<object>(RefreshItems);
            CmdNew = new Cmd<object>(CreateNew);

            _groupedView = new ObservableViewSource();
            _groupedView.ItemPropertyChanged += items_PropertyChanged;

            _groupedView.GroupDescriptions.Add(new PropertyGroupDescription("IsCompleted"));
        }
Ejemplo n.º 6
0
 static void Main()
 {
     Cmd[] cmds = new Cmd[3];
     cmds[0] = new Cmd_A();
     cmds[1] = new Cmd_B();
     cmds[2] = new Cmd_A();
     int i;
     for (i = 0; i < 3; i++)
         cmds[i].run();
     System.Console.Write("\n");
 }
Ejemplo n.º 7
0
        public EditViewModel(int id)
        {
            CmdOK = new Cmd(ExecuteOK);
            CmdCancel = new Cmd(ExecuteCancel);

            Item = (from i in _db.Items
                    where i.DocItemId == id
                    select i).Single();

            var tags = from i in _db.Tags
                        where i.Items.Select(x => x.DocItemId).Contains(Item.DocItemId)
                        select i.Name;

            Tags = DocItemView.FormatTags(tags);
        }
Ejemplo n.º 8
0
        public MainViewModel()
        {
            Search = new Cmd<string>(CmdSearch);

            AddNew = new Cmd(AddNewImpl);

            AddNewLocalDir = new Cmd(AddNewLocalDirImpl);

            Open = new Cmd<DocItemView>(OpenDocument);

            Edit = new Cmd<DocItemView>(EditDocument);

            ChangeRating = new Cmd<DocItemView>(ChangeRateImpl);

            UpdateGroups();
        }
Ejemplo n.º 9
0
        public AddFileViewModel()
        {
            CmdOK = new Cmd(ExecuteOK);
            CmdCancel = new Cmd(ExecuteCancel);
            PickFile = new Cmd(PickFileCmd);

            Param = new NewItem()
            {
                Name = "ATMega16",
                Uri = "http://www.atmel.com/images/doc2466.pdf",
                KeepLocalCopy = false,
                Tags = "ATMega16 Atmel ATMega"

                //Name = "Name",
                //Uri = string.Empty,
                //KeepLocalCopy = false,
                //Tags = string.Empty,
            };
        }
Ejemplo n.º 10
0
 public void DoCmd(Cmd cmd, string param, int roleId)
 {
     switch(cmd)
     {
         case Cmd.UseSkill:
             for (int i = 0; i < gameObjList.Count; ++i)
             {
                 if(gameObjList[i].mCharData.roleId == roleId)
                 {
                     (gameObjList[i] as Player).DoSkill(int.Parse(param));
                 }
             }
             break;
         case Cmd.Move:
             break;
         case Cmd.Turn:
             break;
         default:
             Debug.LogError("无效命令");
             break;
     }
 }
Ejemplo n.º 11
0
 private static void DanMu_OutPut(Cmd cmd, string Msg)
 {
     Console.WriteLine(Msg);
 }
 string Directions(Cmd[] list)
 {
     string s = "";
       for (int i = 0; i < 28; i++)
     s += list[i].ToString() + (i==11 || i==19 || i==27 ? "\n" : ",");
       return s;
 }
        void TryPath(Cmd[] f)
        {
            tries++;
              Reset();

              int index = 0;
              List<int> stacki = new List<int>();
              bool done = false;
              do
              {
            Cmd c = f[index];

            // call other functions
            if (c == Cmd.Call1)
            {
              stacki.Add(index);
              index = 12;
            }
            if (c == Cmd.Call2)
            {
              stacki.Add(index);
              index = 20;
            }
            if (c != Cmd.Call1 && c != Cmd.Call2)
            {
              // run it
              Exec(c);

              // move next
              index++;

              while (index == 20 || index == 28) // finished f1 or f2
              {
            // pop
            index = stacki[stacki.Count - 1] + 1;
            stacki.RemoveAt(stacki.Count - 1);
              }
              if (index == 12) done = true; // did it just end?
            }
              } while (!done && stacki.Count < 10);

              if (stacki.Count >= 10) l1 = l2 = false; // if it looped then
        }
Ejemplo n.º 14
0
		public int Exec(ref Guid pguidCmdGroup, uint nCmdID, uint nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut)
		{
			var cmd = new Cmd(pguidCmdGroup, nCmdID);
			if (VsShellUtilities.IsInAutomationFunction(Services.VsServiceProvider))
			{
				return nextCommandHandler.Exec(ref pguidCmdGroup, nCmdID, nCmdexecopt, pvaIn, pvaOut);
			}
			//make a copy of this so we can look at it after forwarding some commands
			char ch = char.MinValue;
			//make sure the input is a char before getting it
			if (cmd == TypeCharCmd)
			{
				ch = (char)(ushort)Marshal.GetObjectForNativeVariant(pvaIn);
			}

			if ((ch == '"' || ch == '\'') && textView.Caret.Position.BufferPosition.GetChar() == ch)
			{
				textView.Caret.MoveToNextCaretPosition();
                return VSConstants.S_OK;
			}

			// check for commit character for current completion
			var session = listener.CompletionBroker.GetSessions(textView).FirstOrDefault(r => !r.IsDismissed);
			if (session != null)
			{
				if (cmd == ReturnCmd
					|| cmd == TabCmd
					|| char.IsWhiteSpace(ch)
					|| ch == '>'
					|| ch == '.'
					|| ch == '=')
				{
                    var selectionStatus = session.SelectedCompletionSet.SelectionStatus;

                    if (selectionStatus.IsSelected)
					{
						Action complete = () =>
						{
							var endPoint = session.SelectedCompletionSet.ApplicableTo.GetEndPoint(session.TextView.TextSnapshot);
							var endChar = endPoint.GetChar();
							session.Commit();
							if (endChar == '"' || endChar == '\'')
								session.TextView.Caret.MoveToNextCaretPosition();
                            if (ch == '.'
                                || (cmd == ReturnCmd && selectionStatus.Completion.InsertionText.EndsWith("."))) // property element
                            {
                                TriggerCompletion();
                            }
                        };
						if (cmd == ReturnCmd || cmd == TabCmd || ch == '.')
						{
							Eto.Forms.Application.Instance.AsyncInvoke(complete);
							return VSConstants.S_OK;
						}
						complete();
					}
					else
						session.Dismiss();
				}
				else if (cmd == CompleteWordCmd || ch == '<' || ch == '.')
				{
					session.Dismiss();
				}
			}

			if (cmd == CompleteWordCmd
				|| char.IsLetterOrDigit(ch)
				|| ch == '.'
				|| ch == ' '
				|| ch == '='
			)
			{
				int retVal = VSConstants.S_OK;
				if (cmd != CompleteWordCmd)
					retVal = nextCommandHandler.Exec(ref pguidCmdGroup, nCmdID, nCmdexecopt, pvaIn, pvaOut);
				if (session == null || session.IsDismissed)
					Eto.Forms.Application.Instance.AsyncInvoke(TriggerCompletion);

				return retVal;
			}

			return nextCommandHandler.Exec(ref pguidCmdGroup, nCmdID, nCmdexecopt, pvaIn, pvaOut);
		}
Ejemplo n.º 15
0
        private void EditGlobalSettingFile(object sender, RoutedEventArgs e)
        {
            var configpath = System.IO.Path.Combine(XJK.ENV.BaseDirectory, Env.GlobalSettingFileName);

            Cmd.RunAsInvoker(configpath, "");
        }
Ejemplo n.º 16
0
		public Status SendCmd(Cmd aCmd)
		{
			return SendCmd(aCmd, true);
		}
 public Task Handle(Cmd message, IMessageHandlerContext context)
 {
     return(Task.FromResult(0));
 }
Ejemplo n.º 18
0
 private void cmdButtonOval_Click(object sender, EventArgs e)
 {
     cmd = Cmd.OVAL;
     mode = Mode.IDLE;
     update_status_line();
 }
Ejemplo n.º 19
0
 private void cmdButtonLine_Click(object sender, EventArgs e)
 {
     cmd = Cmd.LINE;
     mode = Mode.IDLE;
     update_status_line();
 }
Ejemplo n.º 20
0
 void addToMenu(MenuItem menu, string text, Cmd cmd, Shortcut key)
 {
     menu.MenuItems.Add(new MenuItem(text, cmdHandler(cmd), key));
 }
        public void Put(byte[] buff, int size)
        {
            //byte[] test = new byte[size];
            //Array.Copy( buff, 0, test, 0, size );
            //System.Console.WriteLine( "Read Buffer : {0}", BitConverter.ToString( test ) );
            //System.Console.WriteLine();

            for (int dataIdx = 0; dataIdx < buff.Length; dataIdx++)
            {
                byte recvByte = buff[dataIdx];

                switch (step)
                {
                case 0:
                    if (recvByte == Const.CMD_PRIFIX_1)
                    {
                        step = 1;
                    }
                    else
                    {
                        step = 0;
                    }
                    break;

                case 1:
                    if (recvByte == Const.CMD_PRIFIX_2)
                    {
                        step = 2;
                    }
                    else
                    {
                        step = 0;
                    }
                    break;

                case 2:
                    if (recvByte == Const.CMD_PRIFIX_3)
                    {
                        step       = 3;
                        commandIdx = 0;
                        //command[commandIdx++] = recvByte;

                        reqDataLen   = 0;
                        m_rawDataCnt = 0;

                        builder = new UsbPacket.Builder();
                    }
                    else
                    {
                        step = 0;
                    }
                    break;

                case 3:
                    if (recvByte != Const.CMD_DELIMITER_RESPONSE && recvByte != Const.CMD_DELIMITER_EVENT)
                    {
                        command[commandIdx++] = recvByte;
                    }
                    else
                    {
                        string cmdstring = System.Text.Encoding.Default.GetString(command, 0, commandIdx).Trim('\0').Trim();
                        Cmd    cmd       = (Cmd)Enum.Parse(typeof(Cmd), cmdstring);
                        builder.Cmd(cmd);
                        if (recvByte == Const.CMD_DELIMITER_RESPONSE)
                        {
                            //Req
                            builder.Type(PacketType.Response);
                            step = 4;
                        }
                        else if (recvByte == Const.CMD_DELIMITER_EVENT)
                        {
                            //Event
                            builder.Type(PacketType.Event);
                            step = 5;
                        }
                    }
                    break;

                case 4:
                    builder.PacketNumber(recvByte);
                    step = 6;
                    break;

                case 5:
                    builder.PacketNumber(recvByte);
                    step = 7;
                    break;

                case 6:
                    builder.ErrorNumber(recvByte);
                    step = 7;
                    break;

                case 7:
                    length[0] = recvByte;
                    step      = 8;
                    break;

                case 8:
                    length[1]  = recvByte;
                    reqDataLen = BitConverter.ToUInt16(length, 0);
                    step       = 9;
                    break;

                case 9:
                    if (recvByte == Const.CMD_DELIMITER_DATA)
                    {
                        step = 10;
                    }
                    else
                    {
                        step = 0;
                    }
                    break;

                case 10:
                    builder.Put(recvByte);
                    if ((m_rawDataCnt++ == reqDataLen - 1) || (reqDataLen == 0))
                    {
                        step = 0;     //초기화
                        PacketCreated(this, new UsbPacketEventArgs(builder.Build()));
                    }
                    break;

                default:
                    break;
                }
            }
        }
Ejemplo n.º 22
0
        public ActionResult MemberManagementForDetails(Dictionary <string, string> queryvalues)
        {
            string _Value = queryvalues.ContainsKey("Value") ? queryvalues["Value"] : "0";

            //   string _SearchExt = queryvalues.ContainsKey("SearchExt") ? queryvalues["SearchExt"].ToString() : "";
            ViewData["Value"] = _Value;
            Role model = new Role();
            long a     = 0;

            if (long.TryParse(_Value, out a) == false)
            {
                return(View(model));
            }
            model = RoleBLL.GetVRoleByString(new Role()
            {
                ID = long.Parse(_Value)
            });
            if (model == null)
            {
                return(View(model));
            }
            else
            {
                Role role = RoleBLL.GetGiftByString(new Role {
                    ID = long.Parse(_Value)
                });
                model.Gift       = role.Gift;
                model.GiftExpire = role.GiftExpire;

                if (model.ExtInfo == null)
                {
                    return(View(model));
                }
                else
                {
                    //SystemType

                    if (SystemType == "2")
                    {
                        ////////////////////////////////底层修改///////////////////////////////////

                        BExtInfo BExtInfo = BExtInfo.ParseFrom(model.ExtInfo);

                        model.VipGrade   = BExtInfo.VipInfo.Grade;                   //VIP等级
                        model.VipPoint   = BExtInfo.VipInfo.Current;                 //VIP点数
                        model.LevelGrade = BExtInfo.LevelInfo.Level;                 //玩家等级
                        model.ItemCount  = BExtInfo.ToolsInfo.ListToolsList.Count(); //道具


                        //IList<GameInfo> gameInfoList = BExtInfo.UserExData.ListInfoList;
                        //德州扑克
                        //GameInfo game15 = gameInfoList.Where(m => m.GameID == 15).FirstOrDefault();
                        //gameinfo g15 = new gameinfo();
                        //if (game15 != null)
                        //{
                        //    g15.dwWin = Convert.ToInt32(game15.DwWin);
                        //    g15.dwTotal = Convert.ToInt32(game15.DwTotal);
                        //    g15.maxWinChip = game15.MaxWinChip;
                        //}
                        //else
                        //{
                        //    g15.dwWin = 0;
                        //    g15.dwTotal = 0;
                        //    g15.maxWinChip = 0;
                        //}

                        //model.GameInfo15 = g15;
                        ////中发白
                        //GameInfo game13 = gameInfoList.Where(m => m.GameID == 15).FirstOrDefault();
                        //gameinfo g13 = new gameinfo();
                        //if (game13 != null)
                        //{
                        //    g13.dwWin = Convert.ToInt32(game13.DwWin);
                        //    g13.dwTotal = Convert.ToInt32(game13.DwTotal);
                        //    g13.maxWinChip = game13.MaxWinChip;
                        //}
                        //else
                        //{
                        //    g13.dwWin = 0;
                        //    g13.dwTotal = 0;
                        //    g13.maxWinChip = 0;
                        //}

                        //model.GameInfo13 = g13;
                        //十二生肖
                        //GameInfo game14 = gameInfoList.Where(m => m.GameID == 15).FirstOrDefault();
                        //gameinfo g14 = new gameinfo();
                        //if (game14 != null)
                        //{
                        //    g14.dwWin = Convert.ToInt32(game14.DwWin);
                        //    g14.dwTotal = Convert.ToInt32(game14.DwTotal);
                        //    g14.maxWinChip = game14.MaxWinChip;
                        //}
                        //else
                        //{
                        //    g14.dwWin = 0;
                        //    g14.dwTotal = 0;
                        //    g14.maxWinChip = 0;
                        //}

                        //model.GameInfo14 = g14;


                        model.Friend = (short)BExtInfo.UserExData.WMaxFriend;

                        uint     lastLoginTime = BExtInfo.UserExData.LastLoginTime;
                        DateTime dtStart       = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1));
                        long     lTime         = long.Parse(lastLoginTime + "0000000");
                        TimeSpan toNow         = new TimeSpan(lTime);
                        dtStart             = dtStart.Add(toNow);
                        model.LastLoginTime = dtStart;

                        model.lastMoney = BExtInfo.UserExData.LastMoney;
                    }
                    else if (SystemType == "1")
                    {
                        int    indexData = 4;
                        byte[] numData   = new byte[4];
                        Array.Copy(model.ExtInfo, indexData, numData, 0, 4);
                        int num = System.BitConverter.ToInt32(numData, 0);
                        indexData = indexData + 4;

                        byte[] DataInfo = new byte[num];
                        Array.Copy(model.ExtInfo, 0, DataInfo, 0, num);
                        while (indexData < num)
                        {
                            //类型ID
                            int typeid = System.BitConverter.ToInt32(DataInfo, indexData);
                            indexData = indexData + 4;
                            int datanum = System.BitConverter.ToInt32(DataInfo, indexData);
                            indexData = indexData + 4;


                            //VIP等级
                            if (typeid == 1)
                            {
                                model.VipGrade = System.BitConverter.ToInt32(DataInfo, indexData);
                                model.VipPoint = System.BitConverter.ToInt32(DataInfo, indexData + 4);
                                indexData      = indexData + datanum;
                            }
                            //玩家等级
                            else if (typeid == 2)
                            {
                                model.LevelGrade = System.BitConverter.ToInt32(DataInfo, indexData);
                                indexData        = indexData + datanum;
                            }
                            //道具
                            else if (typeid == 4)
                            {
                                model.ItemCount = datanum / 24;
                                indexData       = indexData + datanum;
                            }
                            //牌局
                            else if (typeid == 9)
                            {
                                int flag = indexData + datanum;
                                model.Friend = System.BitConverter.ToInt16(DataInfo, indexData);

                                uint     lastLoginTime = System.BitConverter.ToUInt32(DataInfo, indexData + 4);
                                DateTime dtStart       = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1));
                                long     lTime         = long.Parse(lastLoginTime + "0000000");
                                TimeSpan toNow         = new TimeSpan(lTime);
                                dtStart             = dtStart.Add(toNow);
                                model.LastLoginTime = dtStart;

                                //long lastMoney = System.BitConverter.ToInt32(DataInfo, indexData + 16);
                                //model.lastMoney = lastMoney;

                                indexData = indexData + 32;
                                while (indexData < flag)
                                {
                                    short gameid = System.BitConverter.ToInt16(DataInfo, indexData);
                                    indexData = indexData + 4;
                                    switch (gameid)
                                    {
                                    case 15:      //德州
                                        gameinfo gameinfo15 = new gameinfo();
                                        gameinfo15.dwWin      = System.BitConverter.ToInt32(DataInfo, indexData);
                                        gameinfo15.dwTotal    = System.BitConverter.ToInt32(DataInfo, indexData + 4);
                                        gameinfo15.maxWinChip = System.BitConverter.ToInt32(DataInfo, indexData + 8);
                                        model.GameInfo15      = gameinfo15;
                                        indexData             = indexData + 12;
                                        break;

                                    case 13:      //中发白
                                        gameinfo gameinfo13 = new gameinfo();
                                        gameinfo13.dwWin      = System.BitConverter.ToInt32(DataInfo, indexData);
                                        gameinfo13.dwTotal    = System.BitConverter.ToInt32(DataInfo, indexData + 4);
                                        gameinfo13.maxWinChip = System.BitConverter.ToInt32(DataInfo, indexData + 8);
                                        model.GameInfo13      = gameinfo13;
                                        indexData             = indexData + 12;
                                        break;

                                    case 14:      //十二生肖
                                        gameinfo gameinfo14 = new gameinfo();
                                        gameinfo14.dwWin      = System.BitConverter.ToInt32(DataInfo, indexData);
                                        gameinfo14.dwTotal    = System.BitConverter.ToInt32(DataInfo, indexData + 4);
                                        gameinfo14.maxWinChip = System.BitConverter.ToInt32(DataInfo, indexData + 8);
                                        model.GameInfo14      = gameinfo14;
                                        indexData             = indexData + 12;
                                        break;

                                    default:
                                        indexData = flag;
                                        break;
                                    }
                                }
                            }
                            else
                            {
                                indexData = indexData + datanum;
                            }
                        }
                    }
                    else
                    {
                    }
                }

                // 计算在线状态
                UserStateReq UserStateReq;
                // model.Minu 传一个时间长短给服务器
                UserStateReq = UserStateReq.CreateBuilder()
                               .SetUserId(Convert.ToInt32(model.ID))
                               .Build();



                Bind tbind = Cmd.runClient(new Bind(ServiceCmd.SC_USER_STATE, UserStateReq.ToByteArray()));


                switch ((CenterCmd)tbind.header.CommandID)
                {
                case CenterCmd.CS_USER_STATE:
                    UserStateRes UserStateRes = UserStateRes.ParseFrom(tbind.body.ToBytes());
                    int          state        = UserStateRes.State;
                    int          roomId       = UserStateRes.RoomId;
                    int          roomtype     = UserStateRes.RoomType;
                    model.IsOnLine = state > 0 ? IsOnLine.在线 : IsOnLine.离线;
                    model.RoomID   = roomId;
                    model.RoomType = (gameID)roomtype;
                    break;

                case CenterCmd.CS_CONNECT_ERROR:
                    break;
                }
                BaseDataView vbd = new BaseDataView
                {
                    StartDate      = DateTime.Now.AddDays(-10).Date.ToString(),
                    ExpirationDate = DateTime.Now.AddDays(1).Date.ToString(),
                    //Channels = _Channels,
                    SearchExt = _Value
                };

                IEnumerable <BaseDataInfo> ibd = BaseDataBLL.GetGameProfit(vbd);
                foreach (BaseDataInfo m in ibd)
                {
                    model.tenDayYinkui = m.ProfitAdd1 + m.ProfitDel1 +
                                         m.ProfitAdd2 + m.ProfitDel2 +
                                         m.ProfitAdd3 + m.ProfitDel3 +
                                         m.ProfitAdd4 + m.ProfitDel4 +
                                         m.ProfitAdd5 + m.ProfitDel5 +
                                         m.ProfitAdd6 + m.ProfitDel6 +
                                         m.ProfitAdd7 + m.ProfitDel7 +
                                         m.ProfitAdd8 + m.ProfitDel8 +
                                         m.ProfitAdd9 + m.ProfitDel9 +
                                         m.ProfitAdd10 + m.ProfitDel10;
                }
                foreach (BaseDataInfo m in ibd)
                {
                    model.tenDayChanchu = m.ProfitAdd1 + m.ProfitAdd2 + m.ProfitAdd3 + m.ProfitAdd4 + m.ProfitAdd5 + m.ProfitAdd6 + m.ProfitAdd7 + m.ProfitAdd8 + m.ProfitAdd9 + m.ProfitAdd10;
                }
                foreach (BaseDataInfo m in ibd)
                {
                    model.tenDayXiaohao = m.ProfitDel1 + m.ProfitDel2 + m.ProfitDel3 + m.ProfitDel4 + m.ProfitDel5 + m.ProfitDel6 + m.ProfitDel7 + m.ProfitDel8 + m.ProfitDel9 + m.ProfitDel10;
                }
                model.RemarksName = MemberCenterBLL.GetRemarksNameByID(_Value);
            }
            BaseDataView vbd2 = new BaseDataView
            {
                StartDate      = DateTime.Now.Date.ToString(),
                ExpirationDate = DateTime.Now.AddDays(1).Date.ToString(),
                //Channels = _Channels,
                SearchExt = _Value
            };

            if (_Value != "")
            {
                //ViewData["DetailProfit"] = BaseDataBLL.GetGameOutputDetailUser(vbd);
                ViewData["GameProfit"] = BaseDataBLL.GetGameProfit(vbd2);
            }
            else
            {
                ViewData["GameProfit"] = "";
            }
            Role rl = RoleBLL.GetModelByID(new Role {
                ID = Convert.ToInt64(_Value)
            });

            if (rl != null)
            {
                string nikeName = rl.NickName;
            }
            model.SendEmailCount = MemberCenterBLL.GetSendEmailCount(_Value);
            int            fishCount = 0;
            GameRecordView grv       = new GameRecordView {
                SearchExt = _Value, StartDate = DateTime.Now.AddDays(-1).Date.ToString(), ExpirationDate = DateTime.Now.AddDays(1).Date.ToString()
            };
            IEnumerable <UserFishInfo> Fishmodel = FishInfoBLL.GetUserInfo(grv);

            foreach (GL.Data.Model.UserFishInfo m in Fishmodel)
            {
                fishCount = fishCount + m.Fish1 * 200000;
                fishCount = fishCount + m.Fish2 * 1000000;
                fishCount = fishCount + m.Fish3 * 2000000;
                fishCount = fishCount + m.Fish4 * 5000000;
                fishCount = fishCount + m.Fish5 * 100000;
                fishCount = fishCount + m.Fish6 * 50000;
            }


            return(View(model));
        }
Ejemplo n.º 23
0
 public KeyData(Cmd cmd, string data, int roleId)
 {
     this.cmd = cmd;
     this.data = data;
     this.roleId = roleId;
 }
Ejemplo n.º 24
0
 public int SendDebugCommand(DebugCommand cmd, string param)
 {
     cursid++;
     Cmd c = new Cmd();
     c.sid = cursid;
     c.cmd = cmd;
     c.param = param;
     return cursid;
 }
Ejemplo n.º 25
0
        public override bool Execute(params string[] args)
        {
            Cmd.Exec(Application.SetupDir.CombinePath("Test4.exe"));

            return(true);
        }
Ejemplo n.º 26
0
 public virtual void issued_write_cmd(Cmd cmd)
 {
 }
Ejemplo n.º 27
0
 private Shape get_shape(Cmd cmd)
 {
     switch(cmd)
     {
         case Cmd.LINE: return new Line();
         case Cmd.BOX: return new Box();
         case Cmd.OVAL: return new Oval();
         default: return new Box();
     }
 }
Ejemplo n.º 28
0
 public KeyData(Cmd cmd, string data, int clientID)
 {
     this.cmd      = cmd;
     this.data     = data;
     this.clientId = clientID;
 }
Ejemplo n.º 29
0
 public void InputCmd(Cmd cmd, string param)
 {
     KeyData keyData = new KeyData(cmd, param, curRoleId);
     _netManager.AddKeyPack(keyData);
 }
Ejemplo n.º 30
0
        // hasPredicatedRegion is true iff the block or its targets are predicated
        // (i.e. we enter, stay within or exit a predicated region).
        void PredicateTransferCmd(Expr p, Block src, List <Cmd> cmdSeq, TransferCmd cmd, out bool hasPredicatedRegion)
        {
            hasPredicatedRegion = predMap.ContainsKey(src);

            if (cmd is GotoCmd)
            {
                var gCmd = (GotoCmd)cmd;

                hasPredicatedRegion = hasPredicatedRegion ||
                                      gCmd.labelTargets.Cast <Block>().Any(b => predMap.ContainsKey(b));

                if (gCmd.labelTargets.Count == 1)
                {
                    if (defMap.ContainsKey(gCmd.labelTargets[0]))
                    {
                        PredicateCmd(p, cmdSeq,
                                     Cmd.SimpleAssign(Token.NoToken,
                                                      Expr.Ident(predMap[gCmd.labelTargets[0]]), Expr.True));
                    }
                }
                else
                {
                    Debug.Assert(gCmd.labelTargets.Count > 1);
                    Debug.Assert(gCmd.labelTargets.Cast <Block>().All(t => uni.IsUniform(impl.Name, t) ||
                                                                      partInfo.ContainsKey(t)));
                    foreach (Block target in gCmd.labelTargets)
                    {
                        if (!partInfo.ContainsKey(target))
                        {
                            continue;
                        }

                        var part = partInfo[target];
                        if (defMap.ContainsKey(part.realDest))
                        {
                            PredicateCmd(p, cmdSeq,
                                         Cmd.SimpleAssign(Token.NoToken,
                                                          Expr.Ident(predMap[part.realDest]), part.pred));
                        }
                        var predsExitingLoop = new Dictionary <Block, List <Expr> >();
                        foreach (Block exit in LoopsExited(src, target))
                        {
                            List <Expr> predList;
                            if (!predsExitingLoop.ContainsKey(exit))
                            {
                                predList = predsExitingLoop[exit] = new List <Expr>();
                            }
                            else
                            {
                                predList = predsExitingLoop[exit];
                            }
                            predList.Add(part.pred);
                        }
                        foreach (var pred in predsExitingLoop)
                        {
                            PredicateCmd(p, cmdSeq,
                                         Cmd.SimpleAssign(Token.NoToken,
                                                          Expr.Ident(predMap[pred.Key]),
                                                          Expr.Not(pred.Value.Aggregate(Expr.Or))));
                        }
                    }
                }
            }
            else if (cmd is ReturnCmd)
            {
                // Blocks which end in a return will never share a predicate with a block
                // which appears after it.  Furthermore, such a block cannot be part of a
                // loop.  So it is safe to do nothing here.
            }
            else
            {
                Console.WriteLine("Unsupported cmd: " + cmd.GetType().ToString());
            }
        }
Ejemplo n.º 31
0
 /// <summary>
 /// Sends the specified command (with ThrowOnError=true).
 /// </summary>
 /// <param name="aCmd">The command to send.</param>
 /// <returns>The device status.</returns>
 internal Status SendCmd(Cmd aCmd)
 {
     return SendCmd(aCmd, true);
 }
Ejemplo n.º 32
0
        private void PredicateBlock(Expr pExpr, Block block, List <Block> newBlocks, ref Block prevBlock)
        {
            var firstBlock = block;

            var oldCmdSeq = block.Cmds;

            block.Cmds = new List <Cmd>();
            newBlocks.Add(block);
            if (prevBlock != null && !((prevBlock.TransferCmd is ReturnCmd) && uni != null && uni.IsUniform(impl.Name, block)))
            {
                prevBlock.TransferCmd = new GotoCmd(Token.NoToken, new List <Block> {
                    block
                });
            }

            if (parentMap.ContainsKey(block))
            {
                var parent = parentMap[block];
                if (predMap.ContainsKey(parent))
                {
                    var parentPred = predMap[parent];
                    if (parentPred != null)
                    {
                        block.Cmds.Add(new AssertCmd(Token.NoToken,
                                                     pExpr != null ? (Expr)Expr.Imp(pExpr, Expr.Ident(parentPred))
                                                        : Expr.Ident(parentPred)));
                    }
                }
            }

            var transferCmd = block.TransferCmd;

            foreach (Cmd cmd in oldCmdSeq)
            {
                PredicateCmd(pExpr, newBlocks, block, cmd, out block);
            }

            if (ownedMap.ContainsKey(firstBlock))
            {
                var owned = ownedMap[firstBlock];
                foreach (var v in owned)
                {
                    block.Cmds.Add(Cmd.SimpleAssign(Token.NoToken, Expr.Ident(v), Expr.False));
                }
            }

            bool hasPredicatedRegion;

            PredicateTransferCmd(pExpr, block, block.Cmds, transferCmd, out hasPredicatedRegion);

            if (hasPredicatedRegion)
            {
                prevBlock = block;
            }
            else
            {
                prevBlock = null;
            }

            doneBlocks.Add(block);
        }
Ejemplo n.º 33
0
        bool BruteForceCmd(Block b, int startidx, int endidx, Variable reachvar,
                           Implementation impl, VerifierCallback callback)
        {
            Contract.Requires(b != null);
            Contract.Requires(reachvar != null);
            Contract.Requires(impl != null);
            Contract.Requires(callback != null);
            #region Modify Cmds
            List <Cmd> backup = b.Cmds;
            Contract.Assert(backup != null);
            List <Cmd> cs = new List <Cmd>();
            for (int i = 0; i < startidx; i++)
            {
                cs.Add(b.Cmds[i]);
            }
            for (int i = startidx; i <= endidx; i++)
            {
                Cmd c = b.Cmds[i];
                if (ContainsReachVariable(c))
                {
                    cs.Add(c);
                    continue;
                }
                cs.Add(new AssertCmd(c.tok, Expr.True));
            }
            for (int i = endidx + 1; i < b.Cmds.Length; i++)
            {
                cs.Add(b.Cmds[i]);
            }

            b.Cmds = cs;
            #endregion

            #region Recheck
            ProverInterface.Outcome outcome = ProverInterface.Outcome.Undetermined;
            if (!ReCheckImpl(reachvar, impl, callback, out outcome))
            {
                b.Cmds = backup;
                return(false);
            }
            #endregion

            if (outcome == ProverInterface.Outcome.Valid)
            {
                return(true);
            }
            else if (outcome == ProverInterface.Outcome.Invalid)
            {
                b.Cmds = backup;
                if (startidx >= endidx)
                {
                    if (!ContainsReachVariable(b.Cmds[endidx]))
                    {
                        //                    Console.Write("   Witness (");
                        //
                        //                    ConsoleColor col = Console.ForegroundColor;
                        //                    Console.ForegroundColor = ConsoleColor.White;
                        //                    Console.Write("{0};{1}", b.Cmds[endidx].tok.line, b.Cmds[endidx].tok.col );
                        //                    Console.ForegroundColor = col;
                        //                    Console.Write("):   ");
                        //                    Console.ForegroundColor = ConsoleColor.Yellow;
                        //                    b.Cmds[endidx].Emit(new TokenTextWriter("<console>", Console.Out, false), 0);
                        //                    Console.ForegroundColor = col;

                        m_doomedCmds.Add(b.Cmds[endidx]);
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
                else
                {
                    int mid = startidx + (endidx - startidx) / 2;
                    BruteForceCmd(b, startidx, mid, reachvar, impl, callback);
                    BruteForceCmd(b, mid + 1, endidx, reachvar, impl, callback);
                    return(false); // This is pure random
                }
            }
            else
            {
                b.Cmds = backup;
                return(false);
            }
        }
Ejemplo n.º 34
0
        void PredicateCmd(Expr p, List <Cmd> cmdSeq, Cmd cmd)
        {
            if (cmd is CallCmd)
            {
                var cCmd = (CallCmd)cmd;
                Debug.Assert(useProcedurePredicates(cCmd.Proc));
                cCmd.Ins.Insert(0, p != null ? p : Expr.True);
                cmdSeq.Add(cCmd);
            }
            else if (p == null)
            {
                cmdSeq.Add(cmd);
            }
            else if (cmd is AssignCmd)
            {
                var aCmd = (AssignCmd)cmd;
                cmdSeq.Add(new AssignCmd(Token.NoToken, aCmd.Lhss,
                                         new List <Expr>(aCmd.Lhss.Zip(aCmd.Rhss, (lhs, rhs) =>
                                                                       new NAryExpr(Token.NoToken,
                                                                                    new IfThenElse(Token.NoToken),
                                                                                    new List <Expr> {
                    p, rhs, lhs.AsExpr
                })))));
            }
            else if (cmd is AssertCmd)
            {
                var  aCmd    = (AssertCmd)cmd;
                Expr newExpr = new EnabledReplacementVisitor(p).VisitExpr(aCmd.Expr);
                aCmd.Expr = QKeyValue.FindBoolAttribute(aCmd.Attributes, "do_not_predicate") ? newExpr : Expr.Imp(p, newExpr);
                cmdSeq.Add(aCmd);
            }
            else if (cmd is AssumeCmd)
            {
                var  aCmd    = (AssumeCmd)cmd;
                Expr newExpr = new EnabledReplacementVisitor(p).VisitExpr(aCmd.Expr);
                aCmd.Expr = QKeyValue.FindBoolAttribute(aCmd.Attributes, "do_not_predicate") ? newExpr : Expr.Imp(p, newExpr);
                cmdSeq.Add(aCmd);
            }
            else if (cmd is HavocCmd)
            {
                var hCmd = (HavocCmd)cmd;
                foreach (IdentifierExpr v in hCmd.Vars)
                {
                    Microsoft.Boogie.Type type = v.Decl.TypedIdent.Type;
                    Contract.Assert(type != null);

                    IdentifierExpr havocTempExpr;
                    if (havocVars.ContainsKey(type))
                    {
                        havocTempExpr = havocVars[type];
                    }
                    else
                    {
                        var havocVar = new LocalVariable(Token.NoToken,
                                                         new TypedIdent(Token.NoToken,
                                                                        "_HAVOC_" + type.ToString(), type));
                        impl.LocVars.Add(havocVar);
                        havocVars[type] = havocTempExpr =
                            new IdentifierExpr(Token.NoToken, havocVar);
                    }
                    cmdSeq.Add(new HavocCmd(Token.NoToken,
                                            new List <IdentifierExpr> {
                        havocTempExpr
                    }));
                    cmdSeq.Add(Cmd.SimpleAssign(Token.NoToken, v,
                                                new NAryExpr(Token.NoToken,
                                                             new IfThenElse(Token.NoToken),
                                                             new List <Expr> {
                        p, havocTempExpr, v
                    })));
                }
            }
            else if (cmd is CommentCmd)
            {
                // skip
            }
            else if (cmd is StateCmd)
            {
                var sCmd      = (StateCmd)cmd;
                var newCmdSeq = new List <Cmd>();
                foreach (Cmd c in sCmd.Cmds)
                {
                    PredicateCmd(p, newCmdSeq, c);
                }
                sCmd.Cmds = newCmdSeq;
                cmdSeq.Add(sCmd);
            }
            else
            {
                Console.WriteLine("Unsupported cmd: " + cmd.GetType().ToString());
            }
        }
Ejemplo n.º 35
0
 private void OpenAppSettingFolder(object sender, RoutedEventArgs e)
 {
     Cmd.RunAsInvoker("explorer", Env.GetAppFolder());
 }
Ejemplo n.º 36
0
        public ActionResult MemberUpdateForVIP(Dictionary <string, string> queryvalues)
        {
            int  _type  = queryvalues.ContainsKey("Type") ? Convert.ToInt32(queryvalues["Type"]) : 0;
            int  _id    = queryvalues.ContainsKey("ID") ? Convert.ToInt32(queryvalues["ID"]) : 0;
            int  _level = queryvalues.ContainsKey("Grade") ? Convert.ToInt32(queryvalues["Grade"]) : 0;
            int  _point = queryvalues.ContainsKey("Point") ? Convert.ToInt32(queryvalues["Point"]) : 0;
            Role model  = new Role();

            model = RoleBLL.GetRoleByString(new Role()
            {
                ID = _id
            });
            if (model == null)
            {
                return(View(model));
            }
            model.UpdateProperty = _type;
            //数据修改操作
            if (Request.IsAjaxRequest())
            {
                //没有封号不能修改
                if (model.IsFreeze == isSwitch.开)
                {
                    return(Content("-1"));
                }
                if (_type == 3)     //绑定俱乐部
                {
                    //检查是不是俱乐部,不是俱乐部,不让绑定
                    IEnumerable <ClubInfo> clubs = ClubBLL.GetClubInfo(_level);
                    if (clubs != null && clubs.Count() > 0)
                    {
                    }
                    else
                    {
                        return(Content("4"));//不是俱乐部
                    }


                    Beland_Club_C BelandlubC;
                    // model.Minu 传一个时间长短给服务器
                    BelandlubC = Beland_Club_C.CreateBuilder()
                                 .SetClubID((uint)_level)
                                 .SetDwUserID((uint)_id)
                                 .Build();



                    Bind tbind = Cmd.runClient(new Bind(ServiceCmd.SC_BELAND_CLUB, BelandlubC.ToByteArray()));


                    switch ((CenterCmd)tbind.header.CommandID)
                    {
                    case CenterCmd.CS_BELAND_CLUB:
                        Beland_Club_S BelandClubS = Beland_Club_S.ParseFrom(tbind.body.ToBytes());
                        bool          res         = BelandClubS.Suc;
                        if (res)
                        {
                            return(Content("5"));
                        }
                        else
                        {
                            return(Content("6"));
                        }

                    case CenterCmd.CS_CONNECT_ERROR:
                        break;
                    }

                    return(Content("6"));



                    //model.ClubID = _level;
                    //int res = RoleBLL.UpdateRoleClub(model);
                    //if(res == 1)    //绑定不是俱乐部ID
                    //{
                    //    return Content("4");
                    //}
                    //else
                    //{
                    //    return Content(res.ToString());
                    //}
                }
                //玩家数据为空
                if (model.ExtInfo == null)
                {
                    return(Content("-2"));
                }
                else
                {
                    /////////////////////////////////////////////////////////////////////////////////

                    if (SystemType == "2")//万人德州
                    {
                        BExtInfo BExtInfo = BExtInfo.ParseFrom(model.ExtInfo);
                        if (_type == 1)  //修改VIP等级
                        {
                            VipInfo VipInfo22;

                            VipInfo22 = VipInfo.CreateBuilder(BExtInfo.VipInfo)
                                        .SetGrade((int)_level)
                                        .SetCurrent((int)_point)
                                        .Build();


                            BExtInfo = BExtInfo.CreateBuilder(BExtInfo)
                                       .SetVipInfo(VipInfo22)
                                       .Build();
                        }
                        else if (_type == 2) //修改等级
                        {
                            LevelInfo LevelInfo22;

                            LevelInfo22 = LevelInfo.CreateBuilder(BExtInfo.LevelInfo)
                                          .SetLevel(_level)
                                          .SetExp(_point)
                                          .Build();


                            BExtInfo = BExtInfo.CreateBuilder(BExtInfo)
                                       .SetLevelInfo(LevelInfo22)
                                       .Build();
                        }
                        byte[] bs = BExtInfo.ToByteArray();
                        model.ExtInfo = bs;
                        return(Content(RoleBLL.UpdateRole(model).ToString()));
                    }
                    else if (SystemType == "1")
                    {
                        byte[] Data = new byte[4];
                        Array.Copy(model.ExtInfo, 4, Data, 0, 4);
                        int    num   = System.BitConverter.ToInt32(Data, 0);
                        byte[] Grade = System.BitConverter.GetBytes(_level);
                        byte[] Point = System.BitConverter.GetBytes(_point);
                        for (int j = 0; j < 4; j++)
                        {
                            if (_type == 1)  //修改VIP等级
                            {
                                model.ExtInfo[16 + j] = Grade[j];
                                model.ExtInfo[20 + j] = Point[j];
                            }
                            else if (_type == 2) //修改等级
                            {
                                model.ExtInfo[36 + j] = Grade[j];
                                model.ExtInfo[40 + j] = Point[j];
                            }
                        }
                        return(Content(RoleBLL.UpdateRole(model).ToString()));
                    }
                    else
                    {
                    }
                }
            }
            //数据查询操作
            if (model.ExtInfo == null)
            {
                return(View(model));
            }
            else
            {
                if (SystemType == "2")
                {
                    BExtInfo BExtInfo = BExtInfo.ParseFrom(model.ExtInfo);
                    model.VipGrade   = BExtInfo.VipInfo.Grade;   //VIP等级
                    model.VipPoint   = BExtInfo.VipInfo.Current; //VIP等级
                    model.LevelGrade = BExtInfo.LevelInfo.Level; //玩家等级
                    model.LevelPoint = BExtInfo.LevelInfo.Exp;   //玩家等级
                    return(View(model));
                }
                else
                {
                    int    indexData = 4;
                    byte[] numData   = new byte[4];
                    Array.Copy(model.ExtInfo, indexData, numData, 0, 4);
                    int num = System.BitConverter.ToInt32(numData, 0);
                    indexData = indexData + 4;

                    byte[] DataInfo = new byte[num];
                    Array.Copy(model.ExtInfo, 0, DataInfo, 0, num);
                    while (indexData < num)
                    {
                        //类型ID
                        int typeid = System.BitConverter.ToInt32(DataInfo, indexData);
                        indexData = indexData + 4;
                        //数据长度
                        int datanum = System.BitConverter.ToInt32(DataInfo, indexData);
                        indexData = indexData + 4;
                        //VIP等级
                        if (typeid == 1)
                        {
                            model.VipGrade = System.BitConverter.ToInt32(DataInfo, indexData);
                            model.VipPoint = System.BitConverter.ToInt32(DataInfo, indexData + 4);
                            indexData      = indexData + datanum;
                        }
                        //玩家等级
                        else if (typeid == 2)
                        {
                            model.LevelGrade = System.BitConverter.ToInt32(DataInfo, indexData);
                            model.LevelPoint = System.BitConverter.ToInt32(DataInfo, indexData + 4);
                            indexData        = indexData + datanum;
                        }
                        else
                        {
                            indexData = indexData + datanum;
                        }
                    }
                    return(View(model));
                }
            }
        }
Ejemplo n.º 37
0
 private void AdminUninstall()
 {
     Cmd.RunAsInvoker(Env.GetSrmPath(), "uninstall ShellCommand.exe");
     Util.Reg.DeleteSubKey();
 }
Ejemplo n.º 38
0
        //[HttpPost]
        public ActionResult AppStore(Dictionary <string, string> queryvalues)
        {
//#if Debug
//            queryvalues = new Dictionary<string, string>();
//            queryvalues.Add("transtime", "1472653281");
//            queryvalues.Add("productid", "Chip_3");
//            queryvalues.Add("identityid", "403278");
//            queryvalues.Add("othertype", "2");
//            queryvalues.Add("other", "8B58253C-9B85-4D13-93EF-0F9D21162895");
//            queryvalues.Add("customsign", "7fa5c658db8804a14879c972f271d58d");

//            queryvalues.Add("transactionid", "440000246529282");
//            queryvalues.Add("isfirstrecharge", "0");
//            queryvalues.Add("transactionreceipt", "ewoJInNpZ25hdHVyZSIgPSAiQXhvZGJkQlFNWnBVUkhKbXQvdWw4MExza2RuWDZlaXVzaGl4ZzI4WFNOM0ROZTdBbFp3K2NPVDhENEo5Q0dUMlJUS0d4TlZCeVFnRjNzb3YrL2FISS9VWEZUL29rMUhtVXowcmRSVmhzaTErUmFvdVdDNmpqNzUydGR0WTQzb3FhQ0pPcnJ1VCs1ckI1VTl0aXFwNVRJR1BEbnRVTzhkeERuM2MwVjM0Qk5JcWt5aUQ4UmlOd1M3ZW55Wk04RkUxeGtMWm56ZW82MjNXRU9tU0Y2QTVVK2ZHMDBRQlcvUysweGZhUEU1TjN4WEk4bzVFNDl0UXlybUVRUWFKVGhBWFJLamJqMjJOTlRDMkZML0tOM2M1eU1mNkkrVU9WcE1sREUxZUVxalhOREZVRmZYYmFWVHJVaEtKTmo1Y1BWZ2Jid0laeW1kZlFpZU9rSzcwNDdvVU0vVUFBQVdBTUlJRmZEQ0NCR1NnQXdJQkFnSUlEdXRYaCtlZUNZMHdEUVlKS29aSWh2Y05BUUVGQlFBd2daWXhDekFKQmdOVkJBWVRBbFZUTVJNd0VRWURWUVFLREFwQmNIQnNaU0JKYm1NdU1Td3dLZ1lEVlFRTERDTkJjSEJzWlNCWGIzSnNaSGRwWkdVZ1JHVjJaV3h2Y0dWeUlGSmxiR0YwYVc5dWN6RkVNRUlHQTFVRUF3dzdRWEJ3YkdVZ1YyOXliR1IzYVdSbElFUmxkbVZzYjNCbGNpQlNaV3hoZEdsdmJuTWdRMlZ5ZEdsbWFXTmhkR2x2YmlCQmRYUm9iM0pwZEhrd0hoY05NVFV4TVRFek1ESXhOVEE1V2hjTk1qTXdNakEzTWpFME9EUTNXakNCaVRFM01EVUdBMVVFQXd3dVRXRmpJRUZ3Y0NCVGRHOXlaU0JoYm1RZ2FWUjFibVZ6SUZOMGIzSmxJRkpsWTJWcGNIUWdVMmxuYm1sdVp6RXNNQ29HQTFVRUN3d2pRWEJ3YkdVZ1YyOXliR1IzYVdSbElFUmxkbVZzYjNCbGNpQlNaV3hoZEdsdmJuTXhFekFSQmdOVkJBb01Da0Z3Y0d4bElFbHVZeTR4Q3pBSkJnTlZCQVlUQWxWVE1JSUJJakFOQmdrcWhraUc5dzBCQVFFRkFBT0NBUThBTUlJQkNnS0NBUUVBcGMrQi9TV2lnVnZXaCswajJqTWNqdUlqd0tYRUpzczl4cC9zU2cxVmh2K2tBdGVYeWpsVWJYMS9zbFFZbmNRc1VuR09aSHVDem9tNlNkWUk1YlNJY2M4L1cwWXV4c1FkdUFPcFdLSUVQaUY0MWR1MzBJNFNqWU5NV3lwb041UEM4cjBleE5LaERFcFlVcXNTNCszZEg1Z1ZrRFV0d3N3U3lvMUlnZmRZZUZScjZJd3hOaDlLQmd4SFZQTTNrTGl5a29sOVg2U0ZTdUhBbk9DNnBMdUNsMlAwSzVQQi9UNXZ5c0gxUEttUFVockFKUXAyRHQ3K21mNy93bXYxVzE2c2MxRkpDRmFKekVPUXpJNkJBdENnbDdaY3NhRnBhWWVRRUdnbUpqbTRIUkJ6c0FwZHhYUFEzM1k3MkMzWmlCN2o3QWZQNG83UTAvb21WWUh2NGdOSkl3SURBUUFCbzRJQjF6Q0NBZE13UHdZSUt3WUJCUVVIQVFFRU16QXhNQzhHQ0NzR0FRVUZCekFCaGlOb2RIUndPaTh2YjJOemNDNWhjSEJzWlM1amIyMHZiMk56Y0RBekxYZDNaSEl3TkRBZEJnTlZIUTRFRmdRVWthU2MvTVIydDUrZ2l2Uk45WTgyWGUwckJJVXdEQVlEVlIwVEFRSC9CQUl3QURBZkJnTlZIU01FR0RBV2dCU0lKeGNKcWJZWVlJdnM2N3IyUjFuRlVsU2p0ekNDQVI0R0ExVWRJQVNDQVJVd2dnRVJNSUlCRFFZS0tvWklodmRqWkFVR0FUQ0IvakNCd3dZSUt3WUJCUVVIQWdJd2diWU1nYk5TWld4cFlXNWpaU0J2YmlCMGFHbHpJR05sY25ScFptbGpZWFJsSUdKNUlHRnVlU0J3WVhKMGVTQmhjM04xYldWeklHRmpZMlZ3ZEdGdVkyVWdiMllnZEdobElIUm9aVzRnWVhCd2JHbGpZV0pzWlNCemRHRnVaR0Z5WkNCMFpYSnRjeUJoYm1RZ1kyOXVaR2wwYVc5dWN5QnZaaUIxYzJVc0lHTmxjblJwWm1sallYUmxJSEJ2YkdsamVTQmhibVFnWTJWeWRHbG1hV05oZEdsdmJpQndjbUZqZEdsalpTQnpkR0YwWlcxbGJuUnpMakEyQmdnckJnRUZCUWNDQVJZcWFIUjBjRG92TDNkM2R5NWhjSEJzWlM1amIyMHZZMlZ5ZEdsbWFXTmhkR1ZoZFhSb2IzSnBkSGt2TUE0R0ExVWREd0VCL3dRRUF3SUhnREFRQmdvcWhraUc5Mk5rQmdzQkJBSUZBREFOQmdrcWhraUc5dzBCQVFVRkFBT0NBUUVBRGFZYjB5NDk0MXNyQjI1Q2xtelQ2SXhETUlKZjRGelJqYjY5RDcwYS9DV1MyNHlGdzRCWjMrUGkxeTRGRkt3TjI3YTQvdncxTG56THJSZHJqbjhmNUhlNXNXZVZ0Qk5lcGhtR2R2aGFJSlhuWTR3UGMvem83Y1lmcnBuNFpVaGNvT0FvT3NBUU55MjVvQVE1SDNPNXlBWDk4dDUvR2lvcWJpc0IvS0FnWE5ucmZTZW1NL2oxbU9DK1JOdXhUR2Y4YmdwUHllSUdxTktYODZlT2ExR2lXb1IxWmRFV0JHTGp3Vi8xQ0tuUGFObVNBTW5CakxQNGpRQmt1bGhnd0h5dmozWEthYmxiS3RZZGFHNllRdlZNcHpjWm04dzdISG9aUS9PamJiOUlZQVlNTnBJcjdONFl0UkhhTFNQUWp2eWdhWndYRzU2QWV6bEhSVEJoTDhjVHFBPT0iOwoJInB1cmNoYXNlLWluZm8iID0gImV3b0pJbTl5YVdkcGJtRnNMWEIxY21Ob1lYTmxMV1JoZEdVdGNITjBJaUE5SUNJeU1ERTJMVEE0TFRNeElEQTNPakl4T2pFNUlFRnRaWEpwWTJFdlRHOXpYMEZ1WjJWc1pYTWlPd29KSW5CMWNtTm9ZWE5sTFdSaGRHVXRiWE1pSUQwZ0lqRTBOekkyTlRNeU56azBNamtpT3dvSkluVnVhWEYxWlMxcFpHVnVkR2xtYVdWeUlpQTlJQ0prWmpnMVpUUTBOekkxTm1RNU16SXhNR1F4WWpOak1tRTNaV1psTURCalptRmlOalptTWpJMElqc0tDU0p2Y21sbmFXNWhiQzEwY21GdWMyRmpkR2x2YmkxcFpDSWdQU0FpTkRRd01EQXdNalEyTlRJNU1qZ3lJanNLQ1NKaWRuSnpJaUE5SUNJNUlqc0tDU0poY0hBdGFYUmxiUzFwWkNJZ1BTQWlNVEExTkRNeE1qZzFOaUk3Q2draWRISmhibk5oWTNScGIyNHRhV1FpSUQwZ0lqUTBNREF3TURJME5qVXlPVEk0TWlJN0Nna2ljWFZoYm5ScGRIa2lJRDBnSWpFaU93b0pJbTl5YVdkcGJtRnNMWEIxY21Ob1lYTmxMV1JoZEdVdGJYTWlJRDBnSWpFME56STJOVE15TnprME1qa2lPd29KSW5WdWFYRjFaUzEyWlc1a2IzSXRhV1JsYm5ScFptbGxjaUlnUFNBaU1VTkJOVVkyUlRBdE1FVkVPQzAwTkVZeExUazRNVE10T1VNNE9ERXlNa1E1UXpoQklqc0tDU0pwZEdWdExXbGtJaUE5SUNJeE1EVTBNekl4T1RnMElqc0tDU0oyWlhKemFXOXVMV1Y0ZEdWeWJtRnNMV2xrWlc1MGFXWnBaWElpSUQwZ0lqZ3hPRFUxTnpRM09TSTdDZ2tpY0hKdlpIVmpkQzFwWkNJZ1BTQWlkM2wzWDBOb2FYQmZPQ0k3Q2draWNIVnlZMmhoYzJVdFpHRjBaU0lnUFNBaU1qQXhOaTB3T0Mwek1TQXhORG95TVRveE9TQkZkR012UjAxVUlqc0tDU0p2Y21sbmFXNWhiQzF3ZFhKamFHRnpaUzFrWVhSbElpQTlJQ0l5TURFMkxUQTRMVE14SURFME9qSXhPakU1SUVWMFl5OUhUVlFpT3dvSkltSnBaQ0lnUFNBaVkyOXRMbWRoYldVMU1UVXVkM2wzWkdWNmFHOTFJanNLQ1NKd2RYSmphR0Z6WlMxa1lYUmxMWEJ6ZENJZ1BTQWlNakF4Tmkwd09DMHpNU0F3TnpveU1Ub3hPU0JCYldWeWFXTmhMMHh2YzE5QmJtZGxiR1Z6SWpzS2ZRPT0iOwoJInBvZCIgPSAiNDQiOwoJInNpZ25pbmctc3RhdHVzIiA9ICIwIjsKfQ==");
//#endif



            string _transtime  = queryvalues.ContainsKey("transtime") ? queryvalues["transtime"] : string.Empty;
            string _productid  = queryvalues.ContainsKey("productid") ? queryvalues["productid"] : string.Empty;
            int    _identityid = queryvalues.ContainsKey("identityid") ? Convert.ToInt32(queryvalues["identityid"]) : 0;
            int    _othertype  = queryvalues.ContainsKey("othertype") ? Convert.ToInt32(queryvalues["othertype"]) : 0;
            string _other      = queryvalues.ContainsKey("other") ? queryvalues["other"] : string.Empty;
            string _customSign = queryvalues.ContainsKey("customsign") ? queryvalues["customsign"] : string.Empty;

            string Key = _key;

            string _transactionid      = queryvalues.ContainsKey("transactionid") ? queryvalues["transactionid"] : string.Empty;
            int    _isfirstrecharge    = queryvalues.ContainsKey("isfirstrecharge") ? Convert.ToInt32(queryvalues["isfirstrecharge"]) : 0;
            string _transactionreceipt = queryvalues.ContainsKey("transactionreceipt") ? queryvalues["transactionreceipt"] : string.Empty;
            string md5 = Utils.MD5(string.Concat(_transtime, _identityid, _othertype, _other, _productid, Key));

            if (!_customSign.Equals(md5))
            {
                log.Error("AppStore 参数不正确");
                return(Json(new { result = 10001, msg = "AppStore 参数不正确" }));
            }


            //Convert.FromBase64String(System.Text.Encoding.ASCII.GetBytes(_transactionreceipt))
            var res = System.Text.Encoding.ASCII.GetString(Convert.FromBase64String(_transactionreceipt));

            //(JObject)JsonConvert.DeserializeObject


            ReceiptManager receiptManager = new ReceiptManager();
            var            env            = Environments.Production;



            if (res.IndexOf("Sandbox") > 0)
            {
                env = Environments.Sandbox;
            }



            var response = receiptManager.ValidateReceipt(env, res);

            log.Info("response.Status=" + response.Status);
            log.Info("Environments.Sandbox" + res.IndexOf("Sandbox"));


            if (response.Status > 0)
            {
                log.Error("AppStore ReceiptVerifier Error Status :" + response.Status);
                return(Json(new { result = response.Status }));
            }


            if (!(response.Receipt.BundleIdentifier == "com.game515.wywdezhou" || response.Receipt.BundleIdentifier == "com.game515.515dezhou" || response.Receipt.BundleIdentifier == "com.gamehk.wanrendezhou" || response.Receipt.BundleIdentifier == "com.gamehk.wanrenqlunpan"))
            {
                log.Error("AppStore ReceiptVerifier Error bid :" + response.Receipt.BundleIdentifier);
                return(Json(new { result = 10006, msg = "AppStore ReceiptVerifier Error bid :" + response.Receipt.BundleIdentifier }));
            }


            try
            {
                //RechargeCheck rc = RechargeCheckBLL.GetModelBySerialNo(new RechargeCheck { SerialNo = out_trade_no });

                //if (rc == null)
                //{
                //    log.Error(" AppStore 订单[" + out_trade_no + "]不存在");
                //    return Content("fail");
                //}
                Recharge rc = RechargeBLL.GetModelByBillNo(new Recharge {
                    BillNo = _transactionid
                });
                if (rc != null)
                {
                    log.Error(" AppStore 订单[" + _transactionid + "]已存在");
                    return(Json(new { result = 1, msg = "AppStore 订单[" + _transactionid + "]已存在" }));
                }


                Role user = RoleBLL.GetModelByID(new Role {
                    ID = _identityid
                });
                if (user == null)
                {
                    log.Error(" AppStore 用户[" + _identityid + "]不存在");
                    return(Json(new { result = 10002, msg = "AppStore 用户[" + _identityid + "]不存在" }));
                }
                IAPProduct iap = IAPProductBLL.GetModelByID(_productid);
                if (iap == null)
                {
                    log.Error(" AppStore 支付配表出错");
                    return(Json(new { result = 10003, msg = "AppStore 支付配表出错" }));
                }


                isFirst  iF = iap.product_id.Split('_')[0].Equals("firstCharge") ? isFirst.是 : isFirst.否;
                chipType ct = iF == isFirst.是 ? chipType.首冲礼包 : (chipType)iap.goodsType;



                bool firstGif = iF == isFirst.是;



                Recharge recharge = RechargeBLL.GetFirstModelListByUserID(new Recharge {
                    UserID = _identityid
                });
                if (recharge != null)//首冲过
                {
                    if (firstGif == true)
                    {//又是首冲,则改变其为不首冲
                        firstGif      = false;
                        ct            = (chipType)1;
                        iF            = isFirst.否;
                        iap.goodsType = 1;
                        log.Error(" 多次首冲,修改firstGif值");
                    }
                }

                RechargeCheckBLL.AddOrderIP(new UserIpInfo {
                    UserID = _identityid, OrderID = _transactionid, CreateTime = DateTime.Now, ChargeType = (int)raType.AppStore, OrderIP = GetClientIp()
                });
                RechargeIP ipmodel = GetCallBackClientIp();
                RechargeCheckBLL.AddCallBackOrderIP(new UserIpInfo {
                    CallBackUserID = _identityid, OrderID = _transactionid, Method = ipmodel.Method, CallBackIP = ipmodel.IP, CallBackTime = DateTime.Now, CallBackChargeType = (int)raType.AppStore
                });



                uint gold = iap.goodsType == 1 ? (uint)iap.goods : 0;
                uint dia  = iap.goodsType == 2 ? (uint)iap.goods : 0;
                if (firstGif)
                {
                    gold = (uint)(iap.goods + iap.attach_chip);
                    dia  = (uint)iap.attach_5b;
                }
                string list = iap.attach_props;
                list = list.Trim(',') + (gold > 0 ? ",10000:" + gold + "," : "");
                list = list.Trim(',') + (dia > 0 ? ",20000:" + dia + "," : "");
                list = list.Trim(',') + ",";
                uint rmb = (uint)iap.price;
                log.Info(" 分 :" + rmb * 100);
                // rmb = rmb * 100;//将元单位转换为分的单位转给游戏服务器



                RechargeBLL.Add(new Recharge {
                    BillNo = _transactionid, OpenID = response.Receipt.UniqueIdentifier, UserID = _identityid, Money = (rmb * 100), CreateTime = DateTime.Now, Chip = gold, Diamond = dia, ChipType = ct, IsFirst = iF, NickName = iap.productname, PayItem = iap.product_id, PF = raType.AppStore, UserAccount = user.NickName, ActualMoney = (rmb * 100), ProductNO = list.Trim(',')
                });


                log.Info(" 开始给服务器发送消息_identityid=" + _identityid + ",list=" + list + ",rmb*100=" + rmb * 100 + ",firstGif=" + firstGif + ",_transactionid=" + _transactionid);


                normal ServiceNormalS = normal.CreateBuilder()
                                        .SetUserID((uint)_identityid)
                                        .SetList(list)
                                        .SetRmb(rmb * 100)//将元单位转换为分的单位转给游戏服务器
                                        .SetRmbActual(rmb * 100)
                                        .SetFirstGif(firstGif)
                                        .SetBillNo(_transactionid)
                                        .Build();

                Bind tbind = Cmd.runClient(new Bind(BR_Cmd.BR_NORMAL, ServiceNormalS.ToByteArray()));
                switch ((CenterCmd)tbind.header.CommandID)
                {
                case CenterCmd.CS_NORMAL:


                    log.Info("CenterCmd.CS_NORMAL:");

                    normalRep ServiceNormalC = normalRep.ParseFrom(tbind.body.ToBytes());
                    log.Info(" AppStore ServiceResult : " + ServiceNormalC.Suc);
                    if (ServiceNormalC.Suc)
                    {
                        log.Info(" AppStore ServiceResult [" + _transactionid + "] : " + ServiceNormalC.Suc);

                        RechargeBLL.UpdateReachTime(_transactionid);
                        //RechargeCheckBLL.Delete(new RechargeCheck { SerialNo = rc.SerialNo });
                    }

                    //Response.Redirect("mobilecall://fail?suc=" + ServiceNormalC.Suc);
                    break;

                case CenterCmd.CS_CONNECT_ERROR:


                    log.Info(" CenterCmd.CS_CONNECT_ERROR:");


                    break;
                }


                log.Info(" AppStore Process Success[" + _transactionid + "]: " + Utils.GetUrl() + "?" + Core.CreateLinkStringUrlencode(queryvalues, Encoding.UTF8));

                return(Json(new
                {
                    result = 0,
                    productid = _productid,
                    transactionid = _transactionid,
                    isfirstrecharge = _isfirstrecharge
                }));


                //log.Error(" AppStore fail : q " + Utils.GetUrl() + Utils.CreateLinkStringUrlencode(queryvalues, Encoding.UTF8));
                //return Json(new { result = 10004, msg = "AppStore 服务器发货失败" });
            }
            catch (Exception err)
            {
                log.Error(" AppStore fail : q " + Utils.GetUrl() + Utils.CreateLinkStringUrlencode(queryvalues, Encoding.UTF8), err);
                return(Json(new { result = 10005, msg = "AppStore 服务器发货失败 err:" + err.Message }));
            }
        }
 void Exec(Cmd c)
 {
     int oldx = rx;
       int oldy = ry;
       int oldht = Height();
       if (c == Cmd.Forwards)
       {
     Move();
     Clip();
     // can't climb/fall
     if (oldht != Height())
     {
       rx = oldx;
       ry = oldy;
     }
       }
       if (c == Cmd.Jump)
       {
     Move();
     Clip();
     // must climb one level or fall any levels
     int newht = Height();
     if (!(newht == oldht + 1 || newht < oldht))
     {
       rx = oldx;
       ry = oldy;
     }
       }
       if (c == Cmd.Left)
       {
     ra--;
     if (ra < 0) ra = 3;
       }
       if (c == Cmd.Right)
       {
     ra++;
     if (ra > 3) ra = 0;
       }
       if (c == Cmd.Light)
       {
     if (l1x == rx && l1y == ry) l1 = !l1;
     if (l2x == rx && l2y == ry) l2 = !l2;
       }
 }
Ejemplo n.º 40
0
 protected override IList <string> ParseParameters()
 {
     return(Cmd.ParseParameters());
 }
        public void Go()
        {
            Console.WriteLine("Begin: " + DateTime.Now.ToString());

              Random r = new Random();
              int update_counter = 0;
              bool done = false;
              int i, j, morphs, successrate, morphcount, freshrate, morphrate, spreadrate;
              Cmd[] morphgood = new Cmd[28];

              Cmd[][] f;
              f = new Cmd[1000][]; // 1000 members of this generation
              for (j = 0; j < 1000; j++) f[j] = new Cmd[28];

              // Start with a random generation
              for (j = 0; j < 1000; j++)
              {
            for (i = 0; i < 27; i++)
            {
              f[j][i] = (Cmd)r.Next(8);
            }
              }

              bool[] goodones = new bool[1000]; // which ones in that generation were any good

              do
              { // Loop through a single generation

            // Go through all members of this generation
            successrate = 0;
            for (j = 0; j < 1000; j++)
            {
              // try it
              TryPath(f[j]);

              goodones[j] = (l1 || l2); // is this one any good?

              if (l1 || l2) // It's a half winner
              {
            successrate++;
              }

              if (l1 && l2) // Found a winner!
              {
            done = true;
            Console.WriteLine("\nWINNER:\n{0}", Directions(f[j]));
              }
            }

            // Randomise the generation
            morphcount = 0;
            freshrate = 0;
            morphrate = 0;
            spreadrate = 0;
            for (j = 0; j < 1000; j++)
            {
              if (goodones[j])
              { // If it's half good, then morph it
            // before i morph it, copy it for later morphing
            Array.Copy(f[j], morphgood, 28);

            morphs = r.Next(4); // how many fields to morph
            for (i = 0; i < morphs; i++) // morph X entries
            {
              f[j][r.Next(28)] = (Cmd)r.Next(8);
            }
            morphrate++;
            morphcount = 10; // morph this one over the next 10 crap ones
              }
              else // If its crap, then overwrite it
              {
            // Shall i spread and morph a previous half-good one into this slot?
            if (morphcount > 0)
            {
              Array.Copy(morphgood, f[j], 28); // copy it into this slot
              morphs = r.Next(4); // how many fields to morph
              for (i = 0; i < morphs; i++) // morph X entries
              {
                f[j][r.Next(28)] = (Cmd)r.Next(8);
              }
              morphcount--;
              spreadrate++;
            }
            else
            { // just totally regenerate it
              for (i = 0; i < 27; i++)
              {
                f[j][i] = (Cmd)r.Next(8);
              }
              freshrate++;
            }
              }
            }

            // Update the user
            update_counter++;
            if (update_counter >= 100)
            {
              update_counter = 0;
              Console.Write("\rTries: {0:#,0} Halfway: {1} Fresh: {2} Morphed: {3} Spread: {4} ", tries, successrate, freshrate, morphrate, spreadrate);
            }

              } while (!done);

              Console.WriteLine("End: " + DateTime.Now.ToString());
              Console.WriteLine("Press enter");
              Console.ReadLine();
        }
Ejemplo n.º 42
0
        private void UpdateImageConfig(ImageV1 image)
        {
            var config         = image.config;
            var historyStrings = new List <string>();

            // do git labels before other labels, to enable users to overwrite them
            if (GitLabels.HasValue())
            {
                IDictionary <string, string> gitLabels = null;
                try
                {
                    gitLabels = Utils.GitLabels.GetLabels(GitLabels.Value(), GitLabelsPrefix.Value());
                }
                catch (Exception ex)
                {
                    _logger.LogWarning($"Failed to read git labels: {ex.Message}");
                }

                if (gitLabels != null)
                {
                    foreach (var l in gitLabels)
                    {
                        config.Labels        = config.Labels ?? new Dictionary <string, string>();
                        config.Labels[l.Key] = l.Value;
                        historyStrings.Add($"--gitLabels {l.Key}={l.Value}");
                    }
                }
            }

            foreach (var label in Label.Values)
            {
                config.Labels = config.Labels ?? new Dictionary <string, string>();
                var split = label.Split('=', 2);
                if (split.Length != 2)
                {
                    throw new Exception($"Invalid label {label}");
                }

                config.Labels[split[0]] = split[1];
                historyStrings.Add($"--label {split[0]}={split[1]}");
            }

            foreach (var var in Env.Values)
            {
                config.Env = config.Env ?? new List <string>();
                config.Env.Add(var);
                historyStrings.Add($"--env {var}");
            }

            if (WorkDir.HasValue())
            {
                config.WorkingDir = WorkDir.Value();
                historyStrings.Add($"--workdir {WorkDir.Value()}");
            }

            if (User.HasValue())
            {
                config.User = User.Value();
                historyStrings.Add($"--user {User.Value()}");
            }

            if (Cmd.HasValue())
            {
                config.Cmd = SplitCmd(Cmd.Value()).ToList();
                var cmdString = string.Join(", ", config.Cmd.Select(c => $"\"{c}\""));
                historyStrings.Add($"--cmd {cmdString}");
            }

            if (Entrypoint.HasValue())
            {
                config.Entrypoint = SplitCmd(Entrypoint.Value()).ToList();
                var epString = string.Join(", ", config.Entrypoint.Select(c => $"\"{c}\""));
                historyStrings.Add($"--entrypoint {epString}");
            }

            if (historyStrings.Any())
            {
                image.history.Add(ImageV1History.Create(string.Join(", ", historyStrings), true));
            }

            foreach (var h in historyStrings)
            {
                _logger.LogDebug(h);
            }
        }
Ejemplo n.º 43
0
	void Foo (Cmd cmd)
	{
		cmd ();
	}
Ejemplo n.º 44
0
 /// <summary>
 /// Displays the argument length error.
 /// </summary>
 /// <param name="c">The command args</param>
 public async Task DisplayArgLengthError(Cmd c)
 {
     StatusMessage = GetArgLengthErrorMessage(c);
     await SendServerTell(c, StatusMessage);
 }
Ejemplo n.º 45
0
 private void cmdButtonSelect_Click(object sender, EventArgs e)
 {
     cmd  = Cmd.SELECT;
     mode = Mode.IDLE;
     update_status_line();
 }
Ejemplo n.º 46
0
            private void IntroduceIntermediateVars()
            {
                var oldSub = Substituter.SubstitutionFromHashtable(GetPreStateVars().
                                                                   ToDictionary <Variable, Variable, Expr>(v => v, v => Expr.Ident(varCopies[0][v])));

                newCmds = new List <Cmd>();
                for (int k = 0; k < cmds.Count; k++)
                {
                    if (IsJoint() && k == transitionRelationComputer.transferIndex)
                    {
                        PopulateIntermediateFrameCopy();
                        oldSub = Substituter.SubstitutionFromHashtable(GetPreStateVars().
                                                                       ToDictionary <Variable, Variable, Expr>(v => v, v => Expr.Ident(varCopies[varLastCopyId[v]][v])));
                    }
                    Cmd cmd = cmds[k];
                    if (cmd is AssignCmd)
                    {
                        AssignCmd assignCmd = ((AssignCmd)cmd).AsSimpleAssignCmd;
                        var       preState  = GetVarCopiesFromIds(varLastCopyId);
                        foreach (var v in assignCmd.Lhss)
                        {
                            MakeNewCopy(v.DeepAssignedVariable);
                        }
                        var postState = GetVarCopiesFromIds(varLastCopyId);

                        Dictionary <Variable, Variable> lhsMap = postState, rhsMap = preState;
                        if (QKeyValue.FindBoolAttribute(assignCmd.Attributes, CivlAttributes.BACKWARD))
                        {
                            lhsMap = preState;
                            rhsMap = postState;
                        }

                        var rhsSub = Substituter.SubstitutionFromHashtable(
                            rhsMap.ToDictionary(
                                kvp => kvp.Key, kvp => Expr.Ident(kvp.Value) as Expr
                                ));

                        List <AssignLhs> lhss = assignCmd.Lhss.Select(x => (AssignLhs) new SimpleAssignLhs(Token.NoToken,
                                                                                                           new IdentifierExpr(Token.NoToken, lhsMap[x.DeepAssignedVariable]))).ToList();
                        List <Expr> rhss = assignCmd.Rhss.Select(x =>
                                                                 Substituter.ApplyReplacingOldExprs(rhsSub, oldSub, x)).ToList();

                        newCmds.Add(new AssignCmd(Token.NoToken, lhss, rhss, assignCmd.Attributes));
                    }
                    else if (cmd is AssumeCmd)
                    {
                        var sub = Substituter.SubstitutionFromHashtable(
                            GetVarCopiesFromIds(varLastCopyId).ToDictionary(
                                kvp => kvp.Key, kvp => Expr.Ident(kvp.Value) as Expr
                                ));
                        newCmds.Add(new AssumeCmd(cmd.tok,
                                                  Substituter.ApplyReplacingOldExprs(sub, oldSub, ((AssumeCmd)cmd).Expr)));
                    }
                    else if (cmd is HavocCmd havocCmd)
                    {
                        foreach (var v in havocCmd.Vars)
                        {
                            MakeNewCopy(v.Decl);
                        }
                    }
                    else
                    {
                        Debug.Assert(false);
                    }
                }
                // TODO: Add note on this
                if (!IsJoint() || cmds.Count == transitionRelationComputer.transferIndex)
                {
                    PopulateIntermediateFrameCopy();
                }
            }
Ejemplo n.º 47
0
        private void SoundnessCheck(HashSet <List <Block> /*!*/> /*!*/ cache, Block /*!*/ orig,
                                    List <Block /*!*/> /*!*/ copies)
        {
            Contract.Requires(cce.NonNull(cache));
            Contract.Requires(orig != null);
            Contract.Requires(copies != null);
            {
                var t = new List <Block> {
                    orig
                };
                foreach (Block b in copies)
                {
                    Contract.Assert(b != null);
                    t.Add(b);
                }

                if (cache.Contains(t))
                {
                    return;
                }

                cache.Add(t);
            }

            for (int i = 0; i < orig.Cmds.Count; ++i)
            {
                Cmd cmd = orig.Cmds[i];
                if (cmd is AssertCmd)
                {
                    int found = 0;
                    foreach (Block c in copies)
                    {
                        Contract.Assert(c != null);
                        if (c.Cmds[i] == cmd)
                        {
                            found++;
                        }
                    }

                    if (found == 0)
                    {
                        throw new System.Exception(string.Format("missing assertion: {0}({1})", cmd.tok.filename, cmd.tok.line));
                    }
                }
            }

            foreach (Block exit in orig.Exits())
            {
                Contract.Assert(exit != null);
                List <Block> newcopies = new List <Block>();
                foreach (Block c in copies)
                {
                    foreach (Block cexit in c.Exits())
                    {
                        Contract.Assert(cexit != null);
                        if (cexit.Label == exit.Label)
                        {
                            newcopies.Add(cexit);
                        }
                    }
                }

                if (newcopies.Count == 0)
                {
                    throw new System.Exception("missing exit " + exit.Label);
                }

                SoundnessCheck(cache, exit, newcopies);
            }
        }
Ejemplo n.º 48
0
 /// <summary>
 /// Gets the argument length error message.
 /// </summary>
 /// <param name="c">The command argument information.</param>
 /// <returns>
 /// The argument length error message, correctly color-formatted depending on its destination.
 /// </returns>
 /// <remarks>Not implemented because the cmd in this class requires no args.</remarks>
 public string GetArgLengthErrorMessage(Cmd c)
 {
     return(string.Empty);
 }
Ejemplo n.º 49
0
 public void ShouldBeAbleToChooseADifferentShell()
 {
     dynamic cmd = new Cmd(Shell.Cmd);
 }
Ejemplo n.º 50
0
 public MessageV04(Cmd cmd, long mid, params string[] payload)
 {
     this.cmd     = cmd;
     this.mid     = mid;
     this.payload = payload;
 }
Ejemplo n.º 51
0
        public byte Command(Cmd cmd)
        {
            m_writeCmd[0] = (byte)cmd;
            lock (_spi)
            {
                _spi.WriteRead(m_writeCmd, m_readCmd);
            }

            return m_readCmd[0];
        }
Ejemplo n.º 52
0
 public void ShouldBeAbleToChooseADifferentShell()
 {
     dynamic cmd = new Cmd(Shell.Cmd);
 }
Ejemplo n.º 53
0
		public Status SendCmd(Cmd aCmd, bool aThrowOnError)
		{
			IO.Command.Byte = (byte)aCmd;
			Status xStatus;
			do
			{
				Wait();
				xStatus = (Status)IO.Status.Byte;
			} while ((xStatus & Status.Busy) != 0);

			// Error occurred
			if (aThrowOnError && (xStatus & Status.Error) != 0)
			{
				// TODO: Read error port
			    Debug("ATA Error in SendCmd.");
			    DebugHex("Cmd", (byte)aCmd);
			    DebugHex("Status", (byte)xStatus);
				throw new Exception("ATA Error");
			}
			return xStatus;
		}
Ejemplo n.º 54
0
        public ActionResult GetStrongPushAD(Dictionary <string, string> queryvalues)
        {
            int Platform = queryvalues.ContainsKey("Platform") ? Convert.ToInt32(queryvalues["Platform"]) : 1; //设备
            int Channels = queryvalues.ContainsKey("Channels") ? Convert.ToInt32(queryvalues["Channels"]) : 0; //设备

            LoginRegisterDataView model = new LoginRegisterDataView();

            model.Channels = Channels;
            model.Platform = Platform;
            bool Mark  = false;
            Bind tbind = Cmd.runClient(new Bind(ServiceCmd.SC_QUERY_SERVERSTATUS, new byte[0] {
            }));

            switch ((CenterCmd)tbind.header.CommandID)
            {
            case CenterCmd.CS_QUERY_SERVERSTATUS:
            {
                Service_Query_ServerStatus_S ServiceQueryServerStatusS = Service_Query_ServerStatus_S.ParseFrom(tbind.body.ToBytes());

                if (ServiceQueryServerStatusS.Close == true)
                {
                    Mark = true;
                }
            }
            break;

            case CenterCmd.CS_CONNECT_ERROR:
                Mark = true;
                break;
            }


            if (Mark == true)
            {
                StrongPushAD enti = StrongPushADBLL.GetStrongPushAD(model);
                if (enti == null)
                {
                    model.Url  = "";
                    model.Type = -1;

                    return(Json(new
                    {
                        ret = 0,
                        Url = "",
                        Type = -1,
                    }, JsonRequestBehavior.AllowGet));
                }
                else
                {
                    return(Json(new
                    {
                        ret = 1,
                        Url = enti.Url,
                        Type = enti.Type,
                    }, JsonRequestBehavior.AllowGet));
                }
            }
            else
            {
                return(Json(new
                {
                    ret = 0,
                    Url = "",
                    Type = -1,
                }, JsonRequestBehavior.AllowGet));
            }
        }
Ejemplo n.º 55
0
        /// <summary>
        /// Sends the specified command.
        /// </summary>
        /// <param name="aCmd">The command to send.</param>
        /// <param name="aThrowOnError">
        /// Whether to throw an exception if the device reports 
        /// an error status.
        /// </param>
        /// <returns>The device status.</returns>
        internal Status SendCmd(Cmd aCmd, bool aThrowOnError)
        {
            IO.Command.Write_Byte((byte)aCmd);
            Status xStatus;
            int timeout = 20000000;
            do
            {
                Wait();
                xStatus = (Status)IO.Control.Read_Byte();
            } while ((xStatus & Status.Busy) != 0 &&
                     (xStatus & Status.Error) == 0 &&
                     timeout-- > 0);

            // Error occurred
            if (aThrowOnError && ((xStatus & Status.Error) != 0 || timeout == 0))
            {
                #region Throw Exception 

                FOS_System.String cmdName = "";
                switch (aCmd)
                {
                    case Cmd.CacheFlush:
                        cmdName = "CacheFlush";
                        break;
                    case Cmd.CacheFlushExt:
                        cmdName = "CacheFlushExt";
                        break;
                    case Cmd.Eject:
                        cmdName = "Eject";
                        break;
                    case Cmd.Identify:
                        cmdName = "Identify";
                        break;
                    case Cmd.IdentifyPacket:
                        cmdName = "IdentifyPacket";
                        break;
                    case Cmd.Packet:
                        cmdName = "Packet";
                        break;
                    case Cmd.Read:
                        cmdName = "Read";
                        break;
                    case Cmd.ReadDma:
                        cmdName = "ReadDma";
                        break;
                    case Cmd.ReadDmaExt:
                        cmdName = "ReadDmaExt";
                        break;
                    case Cmd.ReadPio:
                        cmdName = "ReadPio";
                        break;
                    case Cmd.ReadPioExt:
                        cmdName = "ReadPioExt";
                        break;
                    case Cmd.WriteDma:
                        cmdName = "WriteDma";
                        break;
                    case Cmd.WriteDmaExt:
                        cmdName = "WriteDmaExt";
                        break;
                    case Cmd.WritePio:
                        cmdName = "WritePio";
                        break;
                    case Cmd.WritePioExt:
                        cmdName = "WritePioExt";
                        break;
                    default:
                        cmdName = "[Unrecognised]";
                        break;
                }
                ExceptionMethods.Throw(new FOS_System.Exception("ATA send command error! Command was: " + cmdName));

                #endregion
            }
            return timeout == 0 ? Status.Timeout : xStatus;
        }
Ejemplo n.º 56
0
 public SubstitionVisitor(Dictionary <Declaration, Expr> psub, Dictionary <string, IAppliable> pFuncSub, Cmd mCmd)
 {
     _substitution = psub;
     _funcSub      = pFuncSub;
     _matchCmd     = mCmd;
 }
Ejemplo n.º 57
0
 /// <summary>
 /// Displays the argument length error.
 /// </summary>
 /// <param name="c"></param>
 /// <remarks>Not implemented because the cmd in this class requires no args.</remarks>
 public Task DisplayArgLengthError(Cmd c)
 {
     return(null);
 }
Ejemplo n.º 58
0
        private void GenerateErrorMessage(Cmd causalStatement, List <Cmd> causals)
        {
            Contract.Requires(causalStatement != null);
            Contract.Requires(cce.NonNullElements(causals));
            AssumeCmd    uc  = causalStatement as AssumeCmd;
            AssertCmd    ac  = causalStatement as AssertCmd;
            ConsoleColor col = Console.ForegroundColor;

            // Trivial case. Must be either assume or assert false
            if (m_doomedCmds.Count == 1)
            {
                Console.WriteLine("Found a trivial error:");
                if (uc != null)
                {
                    Console.Write("Trivial false assumption: ");
                    Console.Write("({0};{1}):", uc.tok.line, uc.tok.col);
                }
                if (ac != null)
                {
                    Console.Write("Trivial false assertion: ");
                    Console.Write("({0};{1}):", ac.tok.line, ac.tok.col);
                }
                causalStatement.Emit(new TokenTextWriter("<console>", Console.Out, false), 0);
            }
            else
            {
                // Safety error
                if (ac != null)
                {
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine("Safety error:");
                    Console.ForegroundColor = col;
                    Console.Write("This assertion is violated: ");
                    Console.Write("({0};{1}):", ac.tok.line, ac.tok.col);
                    ac.Emit(new TokenTextWriter("<console>", Console.Out, false), 0);
                }
                if (uc != null)
                {
                    bool containsAssert = false;
                    foreach (Cmd c in m_doomedCmds)
                    {
                        Contract.Assert(c != null);
                        if (causals.Contains(c))
                        {
                            continue;
                        }
                        AssertCmd asrt = c as AssertCmd;
                        if (asrt != null)
                        {
                            containsAssert = true;
                            break;
                        }
                    }
                    // Plausibility error
                    if (containsAssert)
                    {
                        Console.ForegroundColor = ConsoleColor.Yellow;
                        Console.WriteLine("Plausibility error:");
                        Console.ForegroundColor = col;
                        Console.Write("There is no legal exeuction passing: ");
                        Console.Write("({0};{1})", uc.tok.line, uc.tok.col);
                        uc.Emit(new TokenTextWriter("<console>", Console.Out, false), 0);
                    }
                    else // Reachability error
                    {
                        Console.ForegroundColor = ConsoleColor.DarkRed;
                        Console.WriteLine("Reachability error:");
                        Console.ForegroundColor = col;
                        Console.Write("No execution can reach: ");
                        Console.Write("({0};{1})", uc.tok.line, uc.tok.col);
                        uc.Emit(new TokenTextWriter("<console>", Console.Out, false), 0);
                    }
                }

                Console.ForegroundColor = ConsoleColor.White;
                Console.WriteLine("...on any execution passing through:");
                foreach (Cmd c in m_doomedCmds)
                {
                    Contract.Assert(c != null);
                    if (causals.Contains(c))
                    {
                        continue;
                    }
                    Console.ForegroundColor = col;
                    Console.Write("In ({0};{1}): ", c.tok.line, c.tok.col);
                    Console.ForegroundColor = ConsoleColor.DarkYellow;
                    c.Emit(new TokenTextWriter("<console>", Console.Out, false), 0);
                }
                Console.ForegroundColor = col;
                Console.WriteLine("--");
            }
        }
Ejemplo n.º 59
0
		void SendSimpleCommand (Cmd cmd)
		{
			int b = (int) cmd;
			writer.Write (b);
		}
 public Builder Cmd(Cmd cmd)
 {
     packet.Cmd = cmd;
     return(this);
 }