Exemplo n.º 1
0
        public override object Clone()
        {
            PackageStates list = new PackageStates();

            foreach (PackageState item in this)
            {
                list.Add(item);
            }

            return(list);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Returns a matching Item for the passed State-uid
        /// </summary>
        /// <param name="uid">the unique ID of the state</param>
        /// <param name="create">true if you want to create a new state (and add it) if it did not exist</param>
        /// <returns></returns>
        public PackageState FindState(uint uid, bool create)
        {
            foreach (PackageState ps in states)
            {
                if (ps.Uid == uid)
                {
                    return(ps);
                }
            }

            if (create)
            {
                PackageState ps = new PackageState();
                ps.Uid = uid;

                states.Add(ps);
                return(ps);
            }

            return(null);
        }