Beispiel #1
0
 /// <summary>Creates an empty Group with the given ID</summary>
 /// <param name="groupID">Group ID value</param>
 /// <remarks><see cref="Subs"/> is initialized as empty</remarks>
 public Group(short groupID)
 {
     _header = new byte[_headerLength];
     _id = groupID;
     ArrayFunctions.WriteToArray(_id, _header, 0);
     _subs = new SubCollection(_id);
 }
Beispiel #2
0
 /// <summary>Creates a new Group and populate with the given SubCollection</summary>
 /// <param name="subs">Subs to be included in the Group</param>
 public Group(SubCollection subs)
 {
     _header = new byte[_headerLength];
     _id = subs.GroupID;
     ArrayFunctions.WriteToArray(_id, _header, 0);
     _subs = subs;
 }
Beispiel #3
0
 /// <summary>Creates a new Group according to the supplied header information</summary>
 /// <param name="header">GroupHeader raw data, must have a length of 24</param>
 /// <exception cref="System.ArgumentException"><i>header</i> is not the required length</exception>
 public Group(byte[] header)
 {
     if (header.Length != _headerLength) throw new ArgumentException("header must have a length of " + _headerLength, "header");
     _header = header;
     _id = BitConverter.ToInt16(_header, 0);
     _subs = new SubCollection(BitConverter.ToInt16(_header, 2), _id);
 }
        public void Count_GetWithList_ReturnsExpected()
        {
            var collection = new SubCollection(new ArrayList {
                1, 2, 3
            });

            Assert.Equal(3, collection.Count);
        }
        public void GetEnumerator_InvokeWithList_Success()
        {
            var collection = new SubCollection(new ArrayList {
                1, 2, 3
            });
            IEnumerator enumerator = collection.GetEnumerator();

            Assert.True(enumerator.MoveNext());
            Assert.Equal(1, enumerator.Current);
        }
        public void CopyTo_InvokeWithList_Success()
        {
            var collection = new SubCollection(new ArrayList {
                1, 2, 3
            });
            var array = new object[] { 0, 0, 0, 0, 4 };

            collection.CopyTo(array, 1);
            Assert.Equal(new object[] { 0, 1, 2, 3, 4 }, array);
        }
    private SubCollection FindSubCollectionByLetter(string letter)
    {
        SubCollection sub = null;

        foreach (SubCollection subCollection in subCollections)
        {
            if (subCollection.letter == letter)
            {
                sub = subCollection;
                break;
            }
        }

        return(sub);
    }
    public Word[] GetAllWordsWithLetter(string letter)
    {
        SubCollection subCollection = FindSubCollectionByLetter(letter);

        return(subCollection?.words.ToArray());
    }
 /// <summary>
 /// Creates a new enumerator.
 /// </summary>
 /// <param name="collection">the collection to enumerate</param>
 public Enumerator(SubCollection <T> collection)
 {
     _enumerator = collection.Dictionary.GetEnumerator();
     _collection = collection;
 }
Beispiel #10
0
 /// <summary>Creates a new Group and populates it with the given images</summary>
 /// <param name="groupID">Group ID value</param>
 /// <param name="images">Images from which to create the Subs</param>
 /// <exception cref="System.ArgumentException">Not all <i>images</i> are 8bppIndexed</exception>
 /// <exception cref="Idmr.Common.BoundaryException">Not all <i>images</i> meet allowable dimensions</exception>
 /// <remarks><see cref="Sub.SubID"/> starts at <b>0</b> and increments by 1. All <i>images</i> must be 8bppIndexed and are initialized as <b>ImageType.Transparent</b><br/>
 /// To use Blended images, <see cref="Subs"/> must individually have their <see cref="Sub.Type"/> changed and use <see cref="Sub.SetTransparencyMask"/></remarks>
 public Group(short groupID, Bitmap[] images)
 {
     for (int i = 0; i < images.Length; i++)
     {
         if (images[i].PixelFormat != PixelFormat.Format8bppIndexed)
             throw new ArgumentException("All images must be 8bppIndexed", "images[" + i + "]");
         if (images[i].Width > Sub.MaximumWidth || images[i].Height > Sub.MaximumHeight)
             throw new BoundaryException("images[" + i + "]", Sub.MaximumWidth + "x" + Sub.MaximumHeight);
     }
     _header = new byte[_headerLength];
     _id = groupID;
     ArrayFunctions.WriteToArray(_id, _header, 0);
     _subs = new SubCollection(_id, images);
 }