static void Main(string[] args)
 {
     list.Add(1);
     list.Add(2);
     list.Add(3);
     list.Add(4);
     Console.WriteLine("Count:{0}", GetList().Count);
     foreach (var x in GetList())
     {
         Console.WriteLine(x);
     }
 }
Example #2
0
        private void InitSampleList()
        {
            foreach (WorldObject worldObject in Globals.Core.WorldFilter.GetByContainer(Globals.Core.CharacterFilter.Id))
            {
                ListRow row = SampleList.Add();

                row[0][1] = worldObject.Icon + 0x6000000;                 // Notice we're using an index of 1 for the second parameter. That's because this is a DecalControls.IconColumn column.
                row[1][0] = worldObject.Name;

                // Also note that you can create an empty column. In our mainView.xml we have:
                // <column progid="DecalControls.TextColumn" name="colF" />
                // It is column index 5 and has no size associated with it. You can use this column to store an id of an item, or other misc data that you can use
                // later to grab info about the row, or maybe its sort order, etc..

                // To clear the list you can do:
                // SampleList.Clear();


                // If we want to check if this item is equipped, we could do the following
                if (worldObject.Values(LongValueKey.EquippedSlots) > 0)
                {
                }

                // This check will pass if the object is wielded
                // Take note that someone else might be wielding this object. If you want to know if its wielded by YOU, you need to add another check.
                if (worldObject.Values(LongValueKey.Slot, -1) == -1)
                {
                }

                // You can get an items current mana, but only if the item has been id'd, otherwise it will just return 0.
                if (worldObject.HasIdData)
                {
                    int currentMana = worldObject.Values(LongValueKey.CurrentMana);
                }

                // But also note that we don't know how long ago this item has been id'd. Maybe it was id'd an hour ago? The mana data would be erroneous.
                // So, we could get fresh id data for the object with the following:
                // Globals.Host.Actions.RequestId(worldObject.Id);

                // But now note that it may take a second or so to get that id data. So if we did the following:
                // Globals.Host.Actions.RequestId(worldObject.Id);
                // worldObject.Values(LongValueKey.CurrentMana) <-- This would still be the OLD information and not the new because the above statement hasn't finished.
            }
        }
        public void Not_implemented_members___throws_NotSupported()
        {
            var list = new List <int> {
                0, 1, 2
            };
            var sut = new ListWrapper <int>(list);

            Assert.Throws <NotSupportedException>(() => Assert.IsFalse(sut.IsReadOnly));
            Assert.Throws <NotSupportedException>(() => sut.Add(42));
            Assert.Throws <NotSupportedException>(() => sut.Clear());
            Assert.Throws <NotSupportedException>(() => sut.Contains(1));
            Assert.Throws <NotSupportedException>(() => sut.CopyTo(new int[3], 0));
            Assert.Throws <NotSupportedException>(() => sut.GetEnumerator());
            Assert.Throws <NotSupportedException>(() => sut.IndexOf(1));
            Assert.Throws <NotSupportedException>(() => sut.Insert(0, 0));
            Assert.Throws <NotSupportedException>(() => sut.Remove(1));
            Assert.Throws <NotSupportedException>(() => sut.RemoveAt(0));
            Assert.Throws <NotSupportedException>(() => (sut as IEnumerable)?.GetEnumerator());
        }
Example #4
0
		private void InitMouseList(ListWrapper lst, string controlName, MouseButtons buttons)
		{
			ListRow r = lst.Add();
			r[MouseList.Name][0] = controlName;
			r[MouseList.Left][0] = (buttons & MouseButtons.Left) != 0;
			r[MouseList.Middle][0] = (buttons & MouseButtons.Middle) != 0;
			r[MouseList.Right][0] = (buttons & MouseButtons.Right) != 0;
			r[MouseList.X1][0] = (buttons & MouseButtons.XButton1) != 0;
			r[MouseList.X2][0] = (buttons & MouseButtons.XButton2) != 0;
		}
Example #5
0
		private void FillLocationList(ListWrapper lst, List<Location> locations, bool relativeCoords)
		{
			lst.Clear();
			foreach (Location loc in locations)
			{
				ListRow row = lst.Add();
				row[LocationList.Icon][1] = loc.Icon;
				row[LocationList.Name][0] = loc.Name;
				row[LocationList.GoIcon][1] = GoIcon;
				row[LocationList.ID][0] = loc.Id.ToString();
			}
			UpdateListCoords(lst, relativeCoords);
		}