/// <summary> /// Run one route script with an IFR model aircraft /// </summary> /// <param name="route">A complete route script to run</param> /// <returns>True if OK</returns> private bool RunSimFromScript(CmdList route) { string routeName = route.Descriptor.Start_IcaoID + "_" + route.Descriptor.End_IcaoID; var virtAcft = new IFRvAcft(route); // use the Jet model var kmlFile = new KmlFile( ); var kmlLine = new line { Name = routeName, LineColor = LineStyle.LT_Blue }; do { virtAcft.StepModel(m_stepLen_sec); // step the model at 2 sec until finished kmlLine.Add(new point { Position = new LatLon(virtAcft.LatLon), Altitude_ft = virtAcft.Alt_ft, Heading = (int)virtAcft.TRK }); } while (!virtAcft.Out); // setup Comm kmlFile.Lines.Add(kmlLine); kmlFile.WriteKML(routeName + ".kml"); return(Valid); }
protected override void InitCmd(CmdList cmdList) { cmdList.Clear(); if (plant == null) { return; } base.InitCmd(cmdList); if (!plant.mDead) { if (!plant.IsRipe) { cmdList.Remove("Get"); if (plant.NeedWater) { cmdList.Add("Water", OnWaterBtn); } if (plant.NeedClean) { cmdList.Add("Clean", OnCleanBtn); } } } else { cmdList.Remove("Get"); } cmdList.Add("Remove", OnClearBtn); }
internal static OplogRequest CreateOpSetCheckRequestEntity(int cmdid, int key, int value) { KeyValPair.Builder rb = new KeyValPair.Builder(); rb.SetKey(key); rb.SetVal(value); byte[] byteUp = rb.Build().ToByteArray(); SKBuiltinBuffer_t.Builder skbb = new SKBuiltinBuffer_t.Builder(); skbb.SetBuffer(ByteString.CopyFrom(byteUp)); skbb.SetILen(byteUp.Length); SKBuiltinBuffer_t skbObj = skbb.Build(); CmdItem.Builder cib = new CmdItem.Builder(); cib.SetCmdBuf(skbObj); cib.SetCmdId(cmdid); CmdItem ciObj = cib.Build(); CmdList.Builder clb = new CmdList.Builder(); clb.SetCount(1); clb.AddList(ciObj); CmdList clObj = clb.Build(); OplogRequest.Builder nsrb = new OplogRequest.Builder(); nsrb.SetOplog(clObj); return(nsrb.Build()); }
public void PushGang(string uid, int card1, int card2, int card3) { CmdList.Add(new CmdEntity() { Uid = uid, AType = ActionType.Gang, Card = card1, Card1 = card2, Card2 = card3 }); CmdList.Add(new CmdEntity() { Uid = uid, AType = ActionType.GangDa, Card = card2 }); CmdList.Add(new CmdEntity() { Uid = uid, AType = ActionType.GangDa, Card = card3 }); }
/// <summary> /// Creates a new <see cref="Controller"/> instance. /// </summary> /// <param name="tagController">The tag controller used by the created controller.</param> /// <param name="controllerTag">The tag, the new controller is dependend on.</param> /// <param name="userDefinedInterfaces">User defined interfaces</param> /// <param name="tagListener">A tag listener instance</param> /// <returns>A new <see cref="Controller"/> instance.</returns> public Controller Create( ITagController tagController, IControllerTag controllerTag, IList <string> userDefinedInterfaces, ITagListener tagListener) { var controller = Create(tagController, controllerTag, tagListener); if (userDefinedInterfaces != null) { tagListener.AddUdtHandler <Command>(CmdList.PlcArrayDataType()); foreach (var userDefinedInterface in userDefinedInterfaces.Where(value => !string.IsNullOrWhiteSpace(value))) { var path = TagName.SpecificInterface(parent: null).AppendTagName(userDefinedInterface); var userDefinedInterfaceTags = ChildTagsFromPath(controllerTag, path); controller.AddUserDefinedInterface(path, userDefinedInterfaceTags); // create the commands foreach (var userDefinedInterfaceTag in userDefinedInterfaceTags) { var commands = CreateCommands(controllerTag, controller, userDefinedInterfaceTag, tagListener); controller.UpdateUserDefinedCommands(userDefinedInterfaceTag.NestedName, commands.ToList()); } } } return(controller); }
protected void Page_Load(object sender, EventArgs e) { // 在此处放置用户代码以初始化页面 string ST_cmd_sql = "select top 10 * from ST_news where ST_n_iscmd=1 order by ST_n_date desc"; string ST_top_sql = "select top 10 * from ST_news order by ST_n_hit desc"; string personindex = "select top 10* from ST_news order by ST_n_id desc"; string TitleClass = "select ST_c_id, ST_c_name from ST_class order by ST_date desc"; DataSet ST_classds = myobj.GetDataSet(TitleClass, "ST_class"); DataSet ST_cmdds = myobj.GetDataSet(ST_cmd_sql, "ST_news"); DataSet ST_topds = myobj.GetDataSet(ST_top_sql, "ST_news"); DataSet mypersonds = myobj.GetDataSet(personindex, "ST_class"); //绑定博客文章类型列表 ClassList.DataSource = new DataView(ST_classds.Tables[0]); ClassList.DataBind(); //绑定推荐文章列表 CmdList.DataSource = new DataView(ST_cmdds.Tables[0]); CmdList.DataBind(); //绑定热点文章列表 TopList.DataSource = new DataView(ST_topds.Tables[0]); TopList.DataBind(); //绑定最新个人最新发表的博客文章 ClassList0.DataSource = new DataView(mypersonds.Tables[0]); ClassList0.DataBind(); if (Request.QueryString["c_id"] == null) { person_BindData(); } else { NewsBlogList_Bind(); } if (Request.Cookies["colors"] != null) { string ST_test = Request.Cookies["colors"].Value; String[] ST_colorList = ST_test.Split(new[] { ',' }); ST_bgcolor = ST_colorList[0]; ST_tcolor = ST_colorList[1]; } else { ST_bgcolor = "#FFFFFF"; ST_tcolor = "#cccccc"; } Page.DataBind(); string rd = DateTime.Now.Ticks.ToString(); str = "imgFile/1.jpg?rd=" + rd + "|imgFile/2.jpg?rd=" + rd + "|imgFile/3.jpg?rd=" + rd + "|imgFile/4.jpg?rd=" + rd + ""; string path = Server.MapPath("./") + "imgFile/LoopId.txt"; loopId = File.ReadAllText(path); loopId = loopId.Replace(',', '|'); }
internal static OplogRequest CreateExitChatroomRequestEntity(int cmdid, string chatroom, string self) { ExitChatroomObject.Builder rb = new ExitChatroomObject.Builder(); rb.SetChatroom(new SKBuiltinString_t.Builder().SetString(chatroom)); rb.SetUserName(new SKBuiltinString_t.Builder().SetString(self)); byte[] byteUp = rb.Build().ToByteArray(); SKBuiltinBuffer_t.Builder skbb = new SKBuiltinBuffer_t.Builder(); skbb.SetBuffer(ByteString.CopyFrom(byteUp)); skbb.SetILen(byteUp.Length); SKBuiltinBuffer_t skbObj = skbb.Build(); CmdItem.Builder cib = new CmdItem.Builder(); cib.SetCmdBuf(skbObj); cib.SetCmdId(cmdid); CmdItem ciObj = cib.Build(); CmdList.Builder clb = new CmdList.Builder(); clb.SetCount(1); clb.AddList(ciObj); CmdList clObj = clb.Build(); OplogRequest.Builder nsrb = new OplogRequest.Builder(); nsrb.SetOplog(clObj); return(nsrb.Build()); }
internal static OplogRequest CreateExitChatroomRequestEntity(int cmdid, string chatroom, string self) { ExitChatroomObject.Builder builder = new ExitChatroomObject.Builder(); builder.SetChatroom(new SKBuiltinString_t.Builder().SetString(chatroom)); builder.SetUserName(new SKBuiltinString_t.Builder().SetString(self)); byte[] array = builder.Build().ToByteArray(); SKBuiltinBuffer_t.Builder builder2 = new SKBuiltinBuffer_t.Builder(); builder2.SetBuffer(ByteString.CopyFrom(array)); builder2.SetILen(array.Length); SKBuiltinBuffer_t cmdBuf = builder2.Build(); CmdItem.Builder builder3 = new CmdItem.Builder(); builder3.SetCmdBuf(cmdBuf); builder3.SetCmdId(cmdid); CmdItem value = builder3.Build(); CmdList.Builder builder4 = new CmdList.Builder(); builder4.SetCount(1); builder4.AddList(value); CmdList oplog = builder4.Build(); OplogRequest.Builder builder5 = new OplogRequest.Builder(); builder5.SetOplog(oplog); return(builder5.Build()); }
public void Insert(int index, Command cmd) { if (index < 0) { string errMsg = string.Format(Properties.Resources.ErrInsertCmdUnderMin, index, 0); Log.Error(errMsg); return; } if (index > CmdList.Count) { string errMsg = string.Format(Properties.Resources.ErrInsertCmdOverMax, index, CmdList.Count); Log.Error(errMsg); return; } if (null == cmd) { Log.Error(Properties.Resources.ErrInsertCmdNullCmd); return; } CmdList.Insert(index, cmd); cmd.Owner = this; insert(index, cmd.Model); }
internal static OplogRequest CreateOpSetCheckRequestEntity(int cmdid, int key, int value) { KeyValPair.Builder builder = new KeyValPair.Builder(); builder.SetKey(key); builder.SetVal(value); byte[] array = builder.Build().ToByteArray(); SKBuiltinBuffer_t.Builder builder2 = new SKBuiltinBuffer_t.Builder(); builder2.SetBuffer(ByteString.CopyFrom(array)); builder2.SetILen(array.Length); SKBuiltinBuffer_t cmdBuf = builder2.Build(); CmdItem.Builder builder3 = new CmdItem.Builder(); builder3.SetCmdBuf(cmdBuf); builder3.SetCmdId(cmdid); CmdItem value2 = builder3.Build(); CmdList.Builder builder4 = new CmdList.Builder(); builder4.SetCount(1); builder4.AddList(value2); CmdList oplog = builder4.Build(); OplogRequest.Builder builder5 = new OplogRequest.Builder(); builder5.SetOplog(oplog); return(builder5.Build()); }
protected override void CheckOperate() { base.CheckOperate(); //if(!GameConfig.IsMultiMode) //{ if (PeInput.Get(PeInput.LogicFunction.InteractWithItem) && CanCmd()) { /* * if (Operatable() && CheckSleepEnable()) * { * DoSleep(12f); * } * */ CmdList list = simpleObjPart.GetCmdList(); if (list.count <= 0) { return; } CmdList.Cmd cmd = list.Get(0); if (cmd == null) { return; } cmd.exe(); } //} }
private void prgmInit() { updateUI += new CommCallback(updateCommUI); commandsInit(); CmdList = CmdList.OrderBy(a => a.Text).ToList(); // fill tableLayoutPanel foreach (CmdButton cmd in CmdList) { cmd.Anchor = AnchorStyles.Top; cmd.Width = 180; cmd.Height = 30; toolTip.SetToolTip(cmd, cmd.toolTip); flowCmdList.Controls.Add(cmd); } flowCmdListCheckForScrolling(); clearDetails(); // initialize the Comm panel for (int i = 0; i < arrowArray.Length; i++) { arrowArray[i] = new PictureBox(); arrowArray[i].Height = 64; arrowArray[i].SizeMode = PictureBoxSizeMode.Zoom; arrowArray[i].Dock = DockStyle.Top; flowCommStatus.Controls.Add(arrowArray[i]); } }
/// <summary> /// Sort all buttons from a to z or reversed. /// </summary> private void btnSort_Click(object sender, EventArgs e) { sortAlphabetic = !sortAlphabetic; Image newImage; if (sortAlphabetic == true) { CmdList = CmdList.OrderBy(a => a.Text).ToList(); newImage = Properties.Resources.sort_az; } else { CmdList = CmdList.OrderByDescending(a => a.Text).ToList(); newImage = Properties.Resources.sort_za; } flowCmdList.Controls.Clear(); // refill flowLayoutPanel foreach (CmdButton c in CmdList) { flowCmdList.Controls.Add(c); } Button b = sender as Button; b.BackgroundImage = newImage; }
public CmdCase(Sugarism.CmdCase model) : base(model) { _model = model; _cmdList = new ObservableCollection <Command>(); foreach (Sugarism.Command cmdModel in _model.CmdList) { Command cmdViewModel = Command.Create(cmdModel); if (null != cmdViewModel) { CmdList.Add(cmdViewModel); cmdViewModel.Owner = this; } else { Log.Error(Properties.Resources.ErrInvalidCmdType); } } _parent = null; InputBindings.Clear(); InputBindings.Add(new KeyBinding(CmdExpand, System.Windows.Input.Key.Enter, ModifierKeys.None)); InputBindings.Add(new KeyBinding(CmdAddChild, System.Windows.Input.Key.A, ModifierKeys.Control)); if (_model.CmdList.Count <= 0) { addSampleCmd(); } }
/// <summary> /// Create a random IFR flight /// </summary> /// <param name="awyTableRef">The airway table to chose from</param> /// <param name="acftNo">The aircraft regNo</param> /// <param name="acftType">The aircraft type</param> /// <param name="airline">The airline operator ICAO code</param> /// <returns></returns> public static CmdList GetRandomFlight(awyTable awyTableRef, int acftNo, string acftType, string airline) { var route = new CmdList( ); var visited = new List <string>( ); // visited Navs and Fixes, we don't want to run circles var awy = GetRandomAwy(awyTableRef); if (awy == null) { return(route); // no airways available ?? } // add Aircraft Descriptor first route.Enqueue(new CmdA(acftType, CmdA.FlightT.Airway, airline)); // some random altitude and complete start of the route var altMsl = m_random.Next(MinLevel(awy.baseFt), MaxLevel(awy.topFt)); altMsl = (int)Math.Round(altMsl / 100.0) * 100; // get 100 ft increments route.Descriptor.InitFromAirway(acftNo, awy, altMsl, GetSpeed(awy.layer)); // set start conditions (assumes MslBase=0) // add segment length command route.Enqueue(new CmdD(awy.Distance_nm)); visited.Add(awy.startID); // we add all startIDs // do we have an airway to go from here? var newleg = awyTableRef.GetNextSegment(awy); while (newleg != null) { if (visited.Contains(newleg.startID)) { break; // this would create a circle (endless loop) } awy = newleg; // random speed change if (m_random.Next(10) == 0) // one out of 10 // add S command { route.Enqueue(new CmdS(GetSpeed(awy.layer))); } // random alt change if (m_random.Next(20) == 0) // one out of 20 // add V command { altMsl = GetNewAlt(altMsl, awy.baseFt, awy.topFt); route.Enqueue(new CmdV(1200, altMsl)); } // add Goto command route.Enqueue(new CmdG(awy.end_latlon)); visited.Add(awy.startID); // we add all startIDs to avoid loops above // try next one newleg = awyTableRef.GetNextSegment(awy); } route.Descriptor.FinishFromAirway(awy); // set end location ID from last segment // add mandatory end segment route.Enqueue(new CmdE( )); return(route); }
protected override void InitCmd(CmdList cmdList) { base.InitCmd(cmdList); if (null != itemObj && null != itemObj.protoData && itemObj.protoData.unchargeable) { cmdList.Add("Refill", OnRefill); } }
protected override void InitCmd(CmdList cmdList) { cmdList.Add("Turn", Turn90Degree); cmdList.Add("Get", OnGetBtn); if (Operatable()) { AddOperateCmd(cmdList); } }
public void PushZhuoPao(string uid, int card, int huType) { CmdList.Add(new CmdEntity() { Uid = uid, AType = ActionType.ZhuoPao, Card = card }); }
public void PushHu(string uid, int huType) { CmdList.Add(new CmdEntity() { Uid = uid, AType = ActionType.Hu, HuType = huType }); }
public static NewSyncRequest ModifyProfile(string nickName, byte[] keyBuffer) { UserProfile.Builder upb = new UserProfile.Builder(); upb.SetBitFlag(2); upb.SetUserName(new SKBuiltinString_t.Builder().SetString("")); upb.SetNickName(new SKBuiltinString_t.Builder().SetString(nickName)); upb.SetBindUin(0); upb.SetBindEmail(new SKBuiltinString_t.Builder().SetString("")); upb.SetBindMobile(new SKBuiltinString_t.Builder().SetString("")); upb.SetStatus(0); upb.SetImgLen(0); upb.SetImgBuf(Google.ProtocolBuffers.ByteString.CopyFrom("", Encoding.Default)); upb.SetSex(0); upb.SetProvince(""); upb.SetCity(""); upb.SetSignature(""); upb.SetPersonalCard(1); upb.SetPluginFlag(0); upb.SetPluginSwitch(0); upb.SetAlias(""); upb.SetWeiboNickname(""); upb.SetWeiboFlag(0); upb.SetCountry("CN"); UserProfile upObj = upb.Build(); byte[] byteUp = upObj.ToByteArray(); SKBuiltinBuffer_t.Builder skbb = new SKBuiltinBuffer_t.Builder(); skbb.SetBuffer(ByteString.CopyFrom(byteUp)); skbb.SetILen(byteUp.Length); SKBuiltinBuffer_t skbObj = skbb.Build(); CmdItem.Builder cib = new CmdItem.Builder(); cib.SetCmdBuf(skbObj); cib.SetCmdId(1); CmdItem ciObj = cib.Build(); CmdList.Builder clb = new CmdList.Builder(); clb.SetCount(1); clb.AddList(ciObj); CmdList clObj = clb.Build(); NewSyncRequest.Builder nsrb = new NewSyncRequest.Builder(); nsrb.SetOplog(clObj); nsrb.SetSelector(7); nsrb.SetScene(7); SKBuiltinBuffer_t.Builder skb = new SKBuiltinBuffer_t.Builder(); skb.SetBuffer(ByteString.CopyFrom(keyBuffer)); skb.SetILen(keyBuffer.Length); nsrb.SetKeyBuf(skb.Build()); return(nsrb.Build()); }
public void CmdList_TrueWithMultipleArgs() { CmdList _list = new CmdList(); string[] args = { "string1", "string2" }; var result = _list.Validate(args); Assert.True(result, "List should return true with multiple arguments"); }
public void PushMo(string uid, int card) { CmdList.Add(new CmdEntity() { AType = ActionType.Mo, Card = card, Uid = uid, }); }
public void CmdList_TrueWithNoArgs() { CmdList _list = new CmdList(); string[] args = {}; var result = _list.Validate(args); Assert.True(result, "List should return true with no arguments"); }
//////////////////////////////////////////////////////////////////////////////////////////////// /*--------------------------------------------------------------------------------------------*/ public RequestCmd AddQuery(string pScript, IDictionary <string, IWeaverQueryVal> pParams) { string[] args = WeaverUtil.GetScriptAndParamJson(pScript, pParams); RequestCmd rc = new RequestCmd(RexConn.Command.Query.ToString().ToLower(), args); CmdList.Add(rc); return(rc); }
public void PushDa(string uid, int card) { CmdList.Add(new CmdEntity() { Uid = uid, AType = ActionType.Da, Card = card }); }
public void PushBuZhang(string uid, int card, int mCard) { CmdList.Add(new CmdEntity() { Uid = uid, AType = ActionType.BuZhang, Card = card, Card1 = mCard }); }
protected override void InitCmd(CmdList cmdList) { base.InitCmd(cmdList); if (CanRefill()) { cmdList.Add("Refill", RefillByUI); } gOperationTower = this; }
/// <summary> /// change margins when the scrollbar is visible and when the view is expanded. /// </summary> private void flowCmdListCheckForScrolling() { if (CmdExpanded == false) { if (flowCmdList.Controls.Count > 11) { flowCmdList.HorizontalScroll.Maximum = 0; flowCmdList.AutoScroll = false; flowCmdList.VerticalScroll.Visible = false; flowCmdList.AutoScroll = true; foreach (CmdButton cmd in CmdList) { cmd.Margin = new Padding(0, 3, 6, 3); } } else if (flowCmdList.Controls.Count == 11) { foreach (CmdButton cmd in CmdList) { if (CmdList.IndexOf(cmd, 0, 1) != 0) { cmd.Margin = new Padding(3, 2, 3, 3); } else { cmd.Margin = new Padding(3, 3, 3, 3); } } } else { foreach (CmdButton cmd in CmdList) { cmd.Margin = new Padding(3, 3, 3, 3); } } } else { if (flowCmdList.Controls.Count > 30) { foreach (CmdButton cmd in CmdList) { cmd.Margin = new Padding(0, 3, 6, 3); } } else { foreach (CmdButton cmd in CmdList) { cmd.Margin = new Padding(3, 3, 3, 3); } } } }
public void Delete(Command cmd) { if (null != cmd) { cmd.Owner = null; } CmdList.Remove(cmd); // List의 모든 element가 같은 object를 참조하는 경우는 없다고 가정. delete(cmd.Model); }
protected override void InitCmd(CmdList cmdList) { cmdList.Add("Get On", GetOnCarrier); //if (GameConfig.IsMultiMode) // { //cmdList.Add("Repair", OnRepair); //cmdList.Add("Charge", OnCharge); // } cmdList.Add("Get", OnGetBtn); }