Beispiel #1
0
        /// <summary>
        /// Obtains a list of slots in the system
        /// </summary>
        /// <param name="slotsType">Type of slots to be obtained</param>
        /// <returns>List of available slots</returns>
        public List <Slot> GetSlotList(SlotsType slotsType)
        {
            if (this._disposed)
            {
                throw new ObjectDisposedException(this.GetType().FullName);
            }

            if (Platform.UnmanagedLongSize == 4)
            {
                List <Slot> slotList = new List <Slot>();

                if (Platform.StructPackingSize == 0)
                {
                    List <HighLevelAPI40.Slot> hlaSlotList = _p11_40.GetSlotList(slotsType);
                    foreach (HighLevelAPI40.Slot hlaSlot in hlaSlotList)
                    {
                        slotList.Add(new Slot(hlaSlot));
                    }
                }
                else
                {
                    List <HighLevelAPI41.Slot> hlaSlotList = _p11_41.GetSlotList(slotsType);
                    foreach (HighLevelAPI41.Slot hlaSlot in hlaSlotList)
                    {
                        slotList.Add(new Slot(hlaSlot));
                    }
                }

                return(slotList);
            }
            else
            {
                List <Slot> slotList = new List <Slot>();

                if (Platform.StructPackingSize == 0)
                {
                    List <HighLevelAPI80.Slot> hlaSlotList = _p11_80.GetSlotList(slotsType);
                    foreach (HighLevelAPI80.Slot hlaSlot in hlaSlotList)
                    {
                        slotList.Add(new Slot(hlaSlot));
                    }
                }
                else
                {
                    List <HighLevelAPI81.Slot> hlaSlotList = _p11_81.GetSlotList(slotsType);
                    foreach (HighLevelAPI81.Slot hlaSlot in hlaSlotList)
                    {
                        slotList.Add(new Slot(hlaSlot));
                    }
                }

                return(slotList);
            }
        }