protected void btnAdd_Click(object sender, EventArgs e) { if (Session["zero"] != "zero" && Session["null"] != "notnull") { if (Session["nochangeReq"] != "0") {//if (Session["nochangeReq"] != "0" || Session["nochange"] == null) MyItem item = new MyItem(); //item.ReqItemID = int.Parse(ddlSearch.SelectedValue); //item.ItemDescription = ddlSearch.SelectedItem.Text; if (txtAutoComplete.Text != "") { int itmid = requisition.getItemIDByItemDescription(txtAutoComplete.Text); if (itmid != 0) { item.ReqItemID = itmid; item.ItemDescription = txtAutoComplete.Text; int qty = 1; qty = (qty <= 0) ? 1 : qty; item.ReqQuantityReq = qty; items.AddItem(item, qty); Session["cart"] = items; gvRequisition.DataSource = items; gvRequisition.DataBind(); if (items.Count > 0) { btnComfirm.Visible = true; } else { btnComfirm.Visible = false; } } else { var script = "alert('Please choose item');"; ClientScript.RegisterStartupScript(this.GetType(), "sample", script.ToString(), true); } txtAutoComplete.Text = ""; } } else { binding(); Session["nochangeReq"] = null; } Session["zero"] = null; Session["null"] = null; lblMsg.Text = ""; } else { lblMsg.Text = "Not allow null and quantity zero!"; var script = "alert('Not allow null and zero quantity');"; ClientScript.RegisterStartupScript(this.GetType(), "sample", script.ToString(), true); } }
public 确认已送水(NetworkStream ns, string uAccount) { this.ns = ns; this.uAccount = uAccount; InitializeComponent(); List<MyItem> vtData = new List<MyItem>(); int count = OrderNumber(ns, uAccount).Tables["Orders"].Rows.Count; for (int i = 0; i < count; i++) { MyItem rItem = new MyItem(); rItem.Did = OrderNumber(ns, uAccount).Tables["Orders"].Rows[i][0].ToString().TrimEnd(); vtData.Add(rItem); } comboBox1.DataSource = vtData; comboBox1.ValueMember = "did"; }
public ActionResult ListItems() { List<MyItem> data = new List<MyItem>(); using ( var db = new TestDBEntities()) { var temp = db.Items.ToList(); foreach(Item itm in temp) { MyItem newitem = new MyItem(); newitem.ID = itm.ID; newitem.Value = itm.Value; data.Add(newitem); } } return View(data); }
/// <summary> /// Initializes a new instance of the <see cref="TagTreeNode"/> class. /// </summary> /// <param name="row">The description row <see cref="OPCCliConfiguration.ItemsRow"/>.</param> /// <param name="parentNode">The parent node.</param> internal TagTreeNode(OPCCliConfiguration.ItemsRow row, SubscriptionTreeNodeSession parentNode) : base(row.Name, null, parentNode) { Tag = new MyItem(row, this); InitializeObject(); }
public MyItemWrapper(MyItem item) { Info = item; IsVisible = true; }
public PartialViewResult Me(MyItem item) { return(PartialView("Me", item)); }
protected void btnRemove_Click(object sender, CommandEventArgs e) { int id = Convert.ToInt32(e.CommandArgument.ToString()); MyItem item = new MyItem(); items.RemoveItem(id); items.Remove(item); gvRequisition.DataSource = items; gvRequisition.DataBind(); if (items.Count > 0) { btnComfirm.Visible = true; } else { btnComfirm.Visible = false; lblMsg.Text = ""; } }
internal void LinkData(MyItem item) { Item = item; }
public void HandleItemReceived(MyItem item) { // ... }
public ViewResult Edit(int productId) { MyItem product = repository.Myitems.FirstOrDefault(p => p.NumberID == productId); return(View(product)); }
public override void SetUp() { base.SetUp(); root = CreateOneItem <MyItem>(1, "root", null); }
private void btnDelete_Click(object sender, RoutedEventArgs e) { MyItem item = (MyItem)mailList.SelectedItem; if (item != null) { for (int i = 0; i < allMails.Count; i++) { if (item.id == allMails[i].id) { if (allMails.ElementAt(i).type == "trash") { MessageBoxResult messageBoxResult = System.Windows.MessageBox.Show("Are you sure you want to delete this message?", "Delete Confirmation", System.Windows.MessageBoxButton.YesNo); if (messageBoxResult == MessageBoxResult.Yes) { allMails.RemoveAt(i); txtMail.Text = ""; } //update mailList mailList.Items.Clear(); for (int j = 0; j < allMails.Count; j++) { if (allMails.ElementAt(j).type == "trash") { mailList.Items.Add(new MyItem { Sender = allMails[j].senderAddress, Title = allMails[j].title, id = allMails[j].id }); } } } else if (allMails.ElementAt(i).type == "inbox") { allMails.ElementAt(i).type = "trash"; txtMail.Text = ""; //update mailList mailList.Items.Clear(); for (int j = 0; j < allMails.Count; j++) { if (allMails.ElementAt(j).type == "inbox") { mailList.Items.Add(new MyItem { Sender = allMails[j].senderAddress, Title = allMails[j].title, id = allMails[j].id }); } } } else if (allMails.ElementAt(i).type == "sent") { allMails.ElementAt(i).type = "trash"; txtMail.Text = ""; mailList.Items.Clear(); for (int j = 0; j < allMails.Count; j++) { if (allMails.ElementAt(j).type == "sent") { mailList.Items.Add(new MyItem { Sender = allMails[j].recipients[0].address, Title = allMails[j].title, id = allMails[j].id }); } } } else if (allMails.ElementAt(i).type == "draft") { allMails.ElementAt(i).type = "trash"; txtMail.Text = ""; mailList.Items.Clear(); for (int j = 0; j < allMails.Count; j++) { if (allMails.ElementAt(j).type == "draft") { mailList.Items.Add(new MyItem { Sender = allMails[j].recipients[0].address, Title = allMails[j].title, id = allMails[j].id }); } } } } } } }
private void Update() { if (MouseIn && Input.GetMouseButtonUp(0) && DS.CurrentItemGrid != null) { if (DS.CurrentItemGrid.GetType() == typeof(QuickSlotItem)) { // 快捷栏内转移物品 if (DS.CurrentItemGrid != MyItem) { Item tempitem = MyItem; int tempcount = ItemCount; initItemGird(DS.CurrentItemGrid.MyItem, DS.CurrentItemGrid.ItemCount); DS.CurrentItemGrid.initItemGird(tempitem, tempcount); } else { } DS.CurrentItemGrid = null; } else if (DS.CurrentItemGrid.GetType() == typeof(EquipmentGrid)) { // 装备栏->快捷栏 if (MyItem != null) { Bag.addItem(MyItem, ItemCount, true); } initItemGird(DS.CurrentItemGrid.MyItem, DS.CurrentItemGrid.ItemCount); DS.CurrentItemGrid.release(); Bag.removeItem(Bag.findItemGrid(MyItem), 1, true); DS.CurrentItemGrid = null; Bag.Owner.ItemList.Add(MyItem); } else { // 物品栏->快捷栏 if (MyItem != null) { Bag.addItem(MyItem, ItemCount, true); } initItemGird(DS.CurrentItemGrid.MyItem, DS.CurrentItemGrid.ItemCount); Bag.removeItem(DS.CurrentItemGrid, DS.CurrentItemGrid.ItemCount, true); DS.CurrentItemGrid = null; Bag.Owner.ItemList.Add(MyItem); } } if (MouseIn && Input.GetMouseButtonDown(1) && MyItem != null) { MyItem.QSID = ""; Bag.addItem(MyItem, ItemCount, true); MyIcon.sprite = DefaultIcon; CountComponent.SetActive(false); CDComponent.SetActive(false); MyItem = null; } #region initItemGird if (MyItem == null) { MyIcon.sprite = DefaultIcon; CountComponent.SetActive(false); CDComponent.SetActive(false); } else { MyItem.onHold(); MyIcon.enabled = true; CountComponent.SetActive(true); //MyIcon.sprite = MyItemGrid.MyIcon.sprite; CountText.text = ItemCount.ToString(); if (Input.GetKeyDown(HotKey)) { Bag.useItem(this, 1); } #region CDCheck try { if (MyItem.CoolDown != 0) { if (MyItem.CurrentCoolDown == MyItem.CoolDown) { CDComponent.SetActive(false); CDText.text = "0%"; } else { CDComponent.SetActive(true); int percent = int.Parse(string.Format("{0:0}", MyItem.CurrentCoolDown / MyItem.CoolDown * 100f)); CDMask.transform.localScale = new Vector2(OriginalSize.x, OriginalSize.y * (1 - percent * 0.01f)); if (percent < 80 && percent % 5 == 0) { CDText.text = string.Format("{0:0%}", MyItem.CurrentCoolDown / MyItem.CoolDown); } else if (percent >= 80) { CDText.text = string.Format("{0:0%}", MyItem.CurrentCoolDown / MyItem.CoolDown); } } } else { CDComponent.SetActive(false); } } catch (Exception e) { print(e.StackTrace); } #endregion } #endregion }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); var _Item = new MyItem() { options = new string [] { "aaa", "bbb", "ccc" }, id = 0 }; var _MultiAnswer = new MyMultiAnswer() { _QuestionId = 0 }; ScrollView _Scroll = new ScrollView(this); _Scroll.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent); LinearLayout _LScroll = new LinearLayout(this); _LScroll.LayoutParameters = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent); _LScroll.Orientation = Orientation.Vertical; _LScroll.SetGravity(GravityFlags.CenterHorizontal); TextView txView = new TextView(this); //_Scroll.AddView(_LScroll); Button _Send = new Button(this); _Send.Text = "test"; _Send.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent); for (int i = 0; i < _Item.options.Length; i++) { CheckBox _Options = new CheckBox(this); _chkList.Add(_Options); _Options.Text = _Item.options[i]; _Options.Id = i; _Options.LayoutParameters = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent); _LScroll.AddView(_Options); } _Send.Click += delegate { _MultiAnswer._QuestionId = _Item.id; string strChkIds = ""; foreach (var chk in _chkList.Where(c => c.Checked)) { //_MultiAnswer._AnwserOptionIds.SetValue(_Options.Id + 1, _Options.Id); //do something strChkIds += " - " + chk.Id; } // or for (int i = 0; i < _Item.options.Length; i++) { if (_chkList[i].Checked == true) { //_MultiAnswer._AnwserOptionIds.SetValue(i + 1, i); //do something } } //output = JsonConvert.SerializeObject(_MultiAnswer); //SendJson(_Url, DataCache._Login, output); //SetLayout(layout, btn); txView.Text = "selected ids " + strChkIds; }; _Scroll.AddView(_LScroll); _LScroll.AddView(_Send); _LScroll.AddView(txView); // Set our view from the "main" layout resource SetContentView(_Scroll); }
public void AddItem(MyItem item) { }
/// <summary> /// Override to create the required scene /// </summary> protected override void OnCreate() { base.OnCreate(); int ItemCount = 400; // Get the window instance and change background color Window window = Window.Instance; window.BackgroundColor = Color.White; View Box = new View() { WidthSpecification = LayoutParamPolicies.MatchParent, HeightSpecification = LayoutParamPolicies.MatchParent }; Box.Layout = new LinearLayout() { LinearOrientation = LinearLayout.Orientation.Vertical }; window.Add(Box); View ButtonBox = new View() { WidthSpecification = LayoutParamPolicies.MatchParent, HeightSpecification = 0, Weight = 0.1F }; ButtonBox.Layout = new LinearLayout() { LinearOrientation = LinearLayout.Orientation.Horizontal }; Box.Add(ButtonBox); Button NearestButton = new Button() { WidthSpecification = 0, HeightSpecification = LayoutParamPolicies.MatchParent, Weight = 1, Text = "Nearest" }; NearestButton.Clicked += NearestClickedEvt; ButtonBox.Add(NearestButton); Button StartButton = new Button() { WidthSpecification = 0, HeightSpecification = LayoutParamPolicies.MatchParent, Weight = 1, Text = "Start" }; StartButton.Clicked += StartClickedEvt; ButtonBox.Add(StartButton); Button CenterButton = new Button() { WidthSpecification = 0, HeightSpecification = LayoutParamPolicies.MatchParent, Weight = 1, Text = "Center" }; CenterButton.Clicked += CenterClickedEvt; ButtonBox.Add(CenterButton); Button EndButton = new Button() { WidthSpecification = 0, HeightSpecification = LayoutParamPolicies.MatchParent, Weight = 1, Text = "End" }; EndButton.Clicked += EndClickedEvt; ButtonBox.Add(EndButton); var Data = Example.DummyData.CreateDummyMenu(ItemCount); targetItem = Data[50]; var titleStyle = new ViewItemStyle() { Name = "titleStyle", BackgroundColor = new Selector <Color>() { Normal = new Color(0.972F, 0.952F, 0.749F, 1), Pressed = new Color(0.1F, 0.85F, 0.85F, 1), Disabled = new Color(0.70F, 0.70F, 0.70F, 1), Selected = new Color(0.701F, 0.898F, 0.937F, 1) } }; ItemsLayouter viewLayouter = new LinearLayouter(); // GridLayouter(); RadioButtonGroup group = new RadioButtonGroup(); selectionMode = ItemSelectionMode.SingleSelection; if (viewLayouter is LinearLayouter) { colView = new CollectionView() { SizingStrategy = ItemSizingStrategy.MeasureFirst, ItemsSource = Data, ItemTemplate = new DataTemplate(() => { MyItem item = new MyItem(); item.Label.SetBinding(TextLabel.TextProperty, "IndexName"); item.Label.HorizontalAlignment = HorizontalAlignment.Begin; item.LabelPadding = new Extents(10, 10, 10, 10); item.Icon.SetBinding(ImageView.ResourceUrlProperty, "SubNameUrl"); item.Icon.WidthSpecification = 50; item.Icon.HeightSpecification = 50; item.IconPadding = new Extents(10, 10, 10, 10); var radio = new RadioButton(); item.Extra = radio; radio.SetBinding(RadioButton.IsSelectedProperty, "Selected"); item.Extra.WidthSpecification = 50; item.Extra.HeightSpecification = 50; item.ExtraPadding = new Extents(10, 10, 10, 10); return(item); }), ItemsLayouter = viewLayouter, Header = new OneLineLinearItem(titleStyle) { WidthSpecification = LayoutParamPolicies.MatchParent, HeightSpecification = 50, Text = "Header!" }, Footer = new OneLineLinearItem() { WidthSpecification = LayoutParamPolicies.MatchParent, HeightSpecification = 50, Text = "Count:[" + Data.Count + "]" }, ScrollingDirection = ScrollableBase.Direction.Vertical, WidthSpecification = LayoutParamPolicies.MatchParent, HeightSpecification = 0, Weight = 0.5F, SelectionMode = selectionMode, BackgroundColor = Color.Cyan }; } else if (viewLayouter is GridLayouter) { colView = new CollectionView() { SizingStrategy = ItemSizingStrategy.MeasureFirst, ItemTemplate = new DataTemplate(() => { MyItem2 item = new MyItem2(); item.Label.SetBinding(TextLabel.TextProperty, "IndexName"); item.Label.HorizontalAlignment = HorizontalAlignment.Begin; item.Label.PointSize = 10; item.LabelPadding = new Extents(5, 5, 5, 5); item.Image.SetBinding(ImageView.ResourceUrlProperty, "SubNameUrl"); item.Image.WidthSpecification = 110; item.Image.HeightSpecification = 110; item.ImagePadding = new Extents(5, 5, 5, 5); item.Badge = new CheckBox(); item.Badge.WidthSpecification = 20; item.Badge.HeightSpecification = 20; item.BadgePadding = new Extents(2, 2, 2, 2); return(item); }), ItemsSource = Data, ItemsLayouter = viewLayouter, Header = new OneLineLinearItem(titleStyle) { WidthSpecification = LayoutParamPolicies.MatchParent, HeightSpecification = 80, //WidthSpecification = 100, //HeightSpecification = LayoutParamPolicies.MatchParent, Text = "Header!" }, Footer = new OneLineLinearItem() { WidthSpecification = LayoutParamPolicies.MatchParent, HeightSpecification = 80, //WidthSpecification = 200, //HeightSpecification = LayoutParamPolicies.MatchParent, Text = "Count:[" + Data.Count + "]" }, ScrollingDirection = ScrollableBase.Direction.Vertical, WidthSpecification = LayoutParamPolicies.MatchParent, HeightSpecification = 0, Weight = 0.4F, SelectionMode = selectionMode, BackgroundColor = Color.Blue }; } colView.SelectionChanged += SelectionEvt; Box.Add(colView); window.KeyEvent += OnKeyEvent; }
public MyItemDrop(MyItem item) { _item = item; }
public bool Equals(MyItem other) { return(other != null && Id == other.Id); }
public ViewResult OneItem(int numberID) // selecting one item { MyItem item = repository.Myitems.Single(p => p.NumberID == numberID); return(View("OneItem", item)); }
public MyItemWrapper(MyItem myItem) { _model = myItem; }
private void ClickMe(MyItem item) { Debug.WriteLine(string.Format("This book was clicked: {0}", item.BookName)); }
public void LoadSelectedPage(MyItem item) { //load this page }
/// <summary> /// * Checks if 2 items are on the same line. /// </summary> /// <param name="i1">first item</param> /// <param name="i2">second item</param> /// <returns>true if items are on the same line, otherwise false</returns> static bool AreOnSameLine(MyItem i1, MyItem i2) { return Math.Abs(i1.GetLL().y - i2.GetLL().y) <= MyItem.ItemPositionTolerance; }
public void TestArrayOfObjects() { var service = this.GetService(); var item = new MyItem { MyGuid = new Guid("11ba7957-5afb-4b59-9d9b-c06a18cda5c2"), MyInt = 1, MyDouble = 1.5, MyString = "my value 1", MyBool = true, MyEnumValue = MyEnum.Other, MyDate = new DateTime(1990, 12, 12), MyObj = new MyInnerItem { MyInnerString = "my inner value 1" }, MyList = new List <string> { "a1", "b1" }, MyArray = new string[] { "y1", "z1" } }; var item2 = new MyItem { MyGuid = new Guid("11ba7957-5afb-4b59-9d9b-c06a18cda5c3"), MyInt = 2, MyDouble = 2.5, MyString = "my value 2", MyBool = false, MyEnumValue = MyEnum.Default, MyDate = new DateTime(1990, 10, 12), MyObj = new MyInnerItem { MyInnerString = "my inner value 2" }, MyList = new List <string> { "a2", "b2" }, MyArray = new string[] { "y2", "z2" } }; var xmlArray = new XmlArray("MyItems") .Add(new XmlObject("MyItem") .AddString("MyGuid", item.MyGuid.ToString()) .AddNumber("MyInt", item.MyInt) .AddNumber("MyDouble", item.MyDouble) .AddBool("MyBool", item.MyBool) .AddString("MyString", item.MyString) .AddString("MyEnumValue", item.MyEnumValue.ToString()) .AddString("MyDate", item.MyDate.ToString()) .AddObject("MyObj", XmlValue.CreateObject("MyObj").AddString("MyInnerString", "my inner value 1")) .AddArray("MyList", XmlValue.CreateArray("MyList").Add(new XmlString("String", item.MyList[0])).Add(new XmlString("String", item.MyList[1]))) .AddArray("MyArray", XmlValue.CreateArray("MyArray").Add(new XmlString("String", item.MyArray[0])).Add(new XmlString("String", item.MyArray[1])))) .Add(new XmlObject("MyItem") .AddString("MyGuid", item2.MyGuid.ToString()) .AddNumber("MyInt", item2.MyInt) .AddNumber("MyDouble", item2.MyDouble) .AddString("MyString", item2.MyString) .AddString("MyEnumValue", item2.MyEnumValue.ToString()) .AddString("MyDate", item2.MyDate.ToString()) .AddObject("MyObj", XmlValue.CreateObject("MyObj").AddString("MyInnerString", "my inner value 2")) .AddArray("MyList", XmlValue.CreateArray("MyList").Add(new XmlString("String", item2.MyList[0])).Add(new XmlString("String", item2.MyList[1]))) .AddArray("MyArray", XmlValue.CreateArray("MyArray").Add(new XmlString("String", item2.MyArray[0])).Add(new XmlString("String", item2.MyArray[1])))); var results = service.Resolve <List <MyItem> >(xmlArray); var result = results[0]; Assert.IsNotNull(result); Assert.AreEqual(new Guid("11ba7957-5afb-4b59-9d9b-c06a18cda5c2"), result.MyGuid); Assert.AreEqual(1, result.MyInt); Assert.AreEqual(1.5, result.MyDouble); Assert.AreEqual("my value 1", result.MyString); Assert.AreEqual(true, result.MyBool); Assert.AreEqual(MyEnum.Other, result.MyEnumValue); Assert.AreEqual(new DateTime(1990, 12, 12), result.MyDate); Assert.AreEqual("my inner value 1", result.MyObj.MyInnerString); Assert.AreEqual(2, result.MyList.Count); Assert.AreEqual("a1", result.MyList[0]); Assert.AreEqual("b1", result.MyList[1]); Assert.AreEqual(2, result.MyArray.Length); Assert.AreEqual("y1", result.MyArray[0]); Assert.AreEqual("z1", result.MyArray[1]); var result2 = results[1]; Assert.IsNotNull(result2); Assert.AreEqual(new Guid("11ba7957-5afb-4b59-9d9b-c06a18cda5c3"), result2.MyGuid); Assert.AreEqual(2, result2.MyInt); Assert.AreEqual(2.5, result2.MyDouble); Assert.AreEqual("my value 2", result2.MyString); Assert.AreEqual(false, result2.MyBool); Assert.AreEqual(MyEnum.Default, result2.MyEnumValue); Assert.AreEqual(new DateTime(1990, 10, 12), result2.MyDate); Assert.AreEqual("my inner value 2", result2.MyObj.MyInnerString); Assert.AreEqual(2, result2.MyList.Count); Assert.AreEqual("a2", result2.MyList[0]); Assert.AreEqual("b2", result2.MyList[1]); Assert.AreEqual(2, result2.MyArray.Length); Assert.AreEqual("y2", result2.MyArray[0]); Assert.AreEqual("z2", result2.MyArray[1]); }
public Task <MyItem> Post([FromBody] MyItem item) { return(repository.AddOrUpdate(item)); }
/// <summary> /// The spawn bot. /// </summary> public void SpawnBot() { string name = Environment.UserName + " Bot" + this.botCounter++; var item = new MyItem(Guid.NewGuid().ToString(), (byte)ItemType.Bot, this.Game, name); this.Game.AddItem(item); item.Spawn(this.GetRandomPosition(), null, this.Game.Avatar.Color, false); this.ownedItems.Add(item); ////this.LogInfo(this.Game, (this.ownedItems.Count - 1) + " Bots running"); }
protected MyItem AssignItem(string itemId) { int healthEffect = 0; int defenseEffect = 0; int attackEffect = 0; switch (itemId) { case "axe": healthEffect = 0; defenseEffect = 0; attackEffect = 75; break; case "shield": healthEffect = 0; defenseEffect = 50; attackEffect = 0; break; default: break; } MyItem currentItem = new MyItem(itemId, healthEffect, defenseEffect, attackEffect); return currentItem; }
/// <summary> /// The auto move start. /// </summary> /// <param name="item"> /// The mmo item. /// </param> private void AutoMoveStart(MyItem item) { if (item.IsMoving) { return; } if (item.IsDestroyed) { return; } item.IsMoving = true; Stopwatch t = Stopwatch.StartNew(); int horizontal; int vertical; do { horizontal = this.random.Next(-1, 2); vertical = this.random.Next(-1, 2); } while (horizontal == 0 & vertical == 0); var settings = (Settings)this.Game.Settings; horizontal *= settings.AutoMoveVelocity; vertical *= settings.AutoMoveVelocity; this.AutoMove(settings, horizontal, vertical, t, item); }
public static void ProcessMemoryDump(Session MySession) { //Let's get remaining character data before preparing it for transport //Hotkeys SQLOperations.GetPlayerHotkeys(MySession); //Quests, skip for now //Weaponhotbars SQLOperations.GetPlayerWeaponHotbar(MySession); //Auctions go here, skip for now //Spells SQLOperations.GetPlayerSpells(MySession); MySession.MyDumpData.AddRange(MySession.MyCharacter.PullCharacter()); MySession.MyDumpData.Add((byte)(MySession.MyCharacter.MyHotkeys.Count() * 2)); //cycle over all our hotkeys and append them foreach (Hotkey MyHotkey in MySession.MyCharacter.MyHotkeys) { MySession.MyDumpData.AddRange(MyHotkey.PullHotkey()); } //Unknown at this time 4 byte null MySession.MyDumpData.AddRange(BitConverter.GetBytes(0)); //Unknown at this time 4 byte null MySession.MyDumpData.AddRange(BitConverter.GetBytes(0)); //Quest Count MySession.MyDumpData.AddRange(BitConverter.GetBytes(MySession.MyCharacter.MyQuests.Count())); //Iterate over quest data and append (Should be 0 for now...) foreach (Quest MyQuest in MySession.MyCharacter.MyQuests) { MySession.MyDumpData.AddRange(MyQuest.PullQuest()); } //Get Inventory Item count MySession.MyDumpData.Add((byte)(MySession.MyCharacter.InventoryItems.Count() * 2)); MySession.MyDumpData.AddRange(BitConverter.GetBytes(MySession.MyCharacter.InventoryItems.Count())); foreach (Item MyItem in MySession.MyCharacter.InventoryItems) { MySession.MyDumpData.AddRange(MyItem.PullItem()); } foreach (WeaponHotbar MyWeaponHotbar in MySession.MyCharacter.WeaponHotbars) { MySession.MyDumpData.AddRange(MyWeaponHotbar.PullWeaponHotbar()); } //Get Bank Item count MySession.MyDumpData.Add((byte)(MySession.MyCharacter.BankItems.Count() * 2)); MySession.MyDumpData.AddRange(BitConverter.GetBytes(MySession.MyCharacter.BankItems.Count())); foreach (Item MyItem in MySession.MyCharacter.BankItems) { MySession.MyDumpData.AddRange(MyItem.PullItem()); } // end of bank? or could be something else for memory dump MySession.MyDumpData.Add((byte)0); //Buying auctions MySession.MyDumpData.Add((byte)(MySession.MyCharacter.MyBuyingAuctions.Count())); foreach (Auction MyAuction in MySession.MyCharacter.MyBuyingAuctions) { MySession.MyDumpData.AddRange(MyAuction.PullAuction()); } //Selling auctions MySession.MyDumpData.Add((byte)(MySession.MyCharacter.MySellingAuctions.Count())); foreach (Auction MyAuction in MySession.MyCharacter.MySellingAuctions) { MySession.MyDumpData.AddRange(MyAuction.PullAuction()); } //Spell count and Spells MySession.MyDumpData.AddRange(Utility_Funcs.Technique(MySession.MyCharacter.MySpells.Count())); foreach (Spell MySpell in MySession.MyCharacter.MySpells) { MySession.MyDumpData.AddRange(MySpell.PullSpell()); //Indicates end of spell? MySession.MyDumpData.Add((byte)0); } MySession.MyDumpData.AddRange(new byte[] { 0x55, 0x55, 0x0d, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0, 0x0f, 0xae, 0x98, 0x4c, 0x00, 0x55, 0x55, 0x0d, 0x41, 0xe6, 0x01, 0x96, 0x01, 0x78, 0x96, 0x01, 0x00, 0x00, 0x00, 0xde, 0x02, 0xde, 0x02, 0x00, 0xfa, 0x01, 0x00, 0x00, 0x00, 0xe8, 0x07, 0x00, 0x5a, 0x00, 0x00, 0x04, 0x00, 0x0c, 0x4f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xde, 0x02, 0xde, 0x02, 0x00, 0xfa, 0x01, 0x00, 0x00, 0x00 }); MySession.Dumpstarted = true; //Get our timestamp opcode in queue RdpCommOut.PackMessage(MySession, DNP3Creation.CreateDNP3TimeStamp(), MessageOpcodeTypes.ShortReliableMessage, GameOpcode.Time); List <byte> ThisChunk; //Gather our dump data if (MySession.MyDumpData.Count() > 500) { ThisChunk = MySession.MyDumpData.GetRange(0, 500); MySession.MyDumpData.RemoveRange(0, 500); //Set this to true to send packet to client MySession.ClientFirstConnect = true; ///Handles packing message into outgoing packet RdpCommOut.PackMessage(MySession, ThisChunk, MessageOpcodeTypes.MultiShortReliableMessage, GameOpcode.MemoryDump); } //Dump data is smaller then 500 bytes else { ThisChunk = MySession.MyDumpData.GetRange(0, MySession.MyDumpData.Count()); MySession.MyDumpData.Clear(); //Set this to true to send packet to client MySession.ClientFirstConnect = true; //Appears dump is short, end it here MySession.Dumpstarted = false; ///Handles packing message into outgoing packet RdpCommOut.PackMessage(MySession, ThisChunk, MessageOpcodeTypes.ShortReliableMessage, GameOpcode.MemoryDump); } }
/// <summary> /// Initializes a new instance of the <see cref="TagTreeNode"/> class. /// </summary> /// <param name="item">The item.</param> /// <param name="parentNode">The parent node.</param> internal TagTreeNode(OpcDa.ItemResult item, SubscriptionTreeNodeSession parentNode) : base(item.ItemName, null, parentNode) { Tag = new MyItem(item, this); InitializeObject(); }
/// <summary> /// The auto move. /// </summary> /// <param name="settings"> /// The settings. /// </param> /// <param name="horizontal"> /// The horizontal. /// </param> /// <param name="vertical"> /// The vertical. /// </param> /// <param name="t"> /// The stop watch. /// </param> /// <param name="item"> /// The mmo item. /// </param> private void AutoMove(Settings settings, int horizontal, int vertical, Stopwatch t, MyItem item) { try { if (item.IsDestroyed) { item.IsMoving = false; return; } if (settings.AutoMove && this.Game.State == GameState.WorldEntered) { if (t.ElapsedMilliseconds < settings.AutoMoveInterval) { if (false == item.MoveRelative(new float[] { horizontal, vertical }, null)) { float[] newPos = this.GetRandomPosition(); item.MoveAbsolute(newPos, null); } this.fiber.Schedule(() => this.AutoMove(settings, horizontal, vertical, t, item), settings.SendInterval); } else { item.IsMoving = false; this.fiber.Schedule(() => this.AutoMoveStart(item), settings.SendInterval); } } else { item.IsMoving = false; } } catch (Exception e) { log.Error(e); } }
private void AutoMove(Settings settings, int horizontal, int vertical, Stopwatch t, MyItem item) { try { if (item.IsDestroyed) { item.IsMoving = false; return; } if (settings.AutoMove && this.Game.WorldEntered) { if (t.ElapsedMilliseconds < settings.AutoMoveInterval) { if (false == item.MoveRelative(new Vector { X = horizontal, Y = vertical }, Vector.Zero)) { Vector newPos = this.GetRandomPosition(); item.MoveAbsolute(newPos, Vector.Zero); } this.fiber.Schedule(() => this.AutoMove(settings, horizontal, vertical, t, item), settings.SendInterval); } else { item.IsMoving = false; this.fiber.Schedule(() => this.AutoMoveStart(item), settings.SendInterval); } } else { item.IsMoving = false; } } catch (Exception e) { log.Error(e); } }
public override void SetUp() { base.SetUp(); root = CreateOneItem<MyItem>(1, "root", null); }
/// <summary> /// * Checks if 2 items are on the same line. /// </summary> /// <param name="i1">first item</param> /// <param name="i2">second item</param> /// <returns>true if items are on the same line, otherwise false</returns> static bool AreOnSameLine(MyItem i1, MyItem i2) { return(Math.Abs(i1.GetLL().y - i2.GetLL().y) <= MyItem.ItemPositionTolerance); }