public virtual void AddRange(DestinationInfoCollection items)
 {
     foreach (DestinationInfo item in items)
     {
         this.List.Add(item);
     }
 }
        /// <summary>
        /// Returns a collection of destinations specified within the system.
        /// </summary>
        /// <returns>A DestinationInfo collection with details of all the destinations in the system.</returns>
        public DestinationInfoCollection EnumDestinations()
        {
            DestinationInfo destInfo  = new DestinationInfo();
            IntPtr          hDestInfo = IntPtr.Zero;

            DestinationInfoCollection dests = new DestinationInfoCollection();

            bool loop = true;

            int i   = 0;
            int ret = 0;

            lock (syncRoot)
            {
                do
                {
                    hDestInfo = MarshalEx.AllocHLocal((uint)DestinationInfo.NativeSize);

                    ret = ConnMgrEnumDestinations(i++, hDestInfo);
                    if (ret == -2147467259)
                    {
                        loop = false;
                        break;
                    }
                    DestinationInfo cm = new DestinationInfo(hDestInfo);
                    dests.Add(cm);

                    MarshalEx.FreeHLocal(hDestInfo);
                }while(loop);
            }

            return(dests);
        }
		public virtual void AddRange(DestinationInfoCollection items)
		{
			foreach (DestinationInfo item in items)
			{
				this.List.Add(item);
			}
		}
Beispiel #4
0
        /// <summary>
        /// Returns a collection of destinations specified within the system.
        /// </summary>
        /// <returns>A DestinationInfo collection with details of all the destinations in the system.</returns>
        public DestinationInfoCollection EnumDestinations()
        {
            DestinationInfoCollection dests = new DestinationInfoCollection();

            int i = 0;

            lock (syncRoot)
            {
                do
                {
                    IntPtr hDestInfo = Marshal.AllocHGlobal(DestinationInfo.NativeSize);

                    long ret = SafeNativeMethods.ConnMgrEnumDestinations(i++, hDestInfo);
                    if (ret != 0)
                    {
                        break;
                    }
                    DestinationInfo cm = new DestinationInfo(hDestInfo);
                    dests.Add(cm);

                    Marshal.FreeHGlobal(hDestInfo);
                }while (true);
            }

            return(dests);
        }
 public Enumerator(DestinationInfoCollection collection)
 {
     this.wrapped = ((System.Collections.CollectionBase)collection).GetEnumerator();
 }
 public DestinationInfoCollection(DestinationInfoCollection items)
 {
     this.AddRange(items);
 }
			public Enumerator(DestinationInfoCollection collection)
			{
				this.wrapped = ((System.Collections.CollectionBase)collection).GetEnumerator();
			}
		public DestinationInfoCollection(DestinationInfoCollection items)
		{
			this.AddRange(items);
		}
		/// <summary>
		/// Returns a collection of destinations specified within the system.
		/// </summary>
		/// <returns>A DestinationInfo collection with details of all the destinations in the system.</returns>
		public DestinationInfoCollection EnumDestinations()
		{
			DestinationInfo destInfo = new DestinationInfo();
			IntPtr hDestInfo = IntPtr.Zero;

			DestinationInfoCollection dests = new DestinationInfoCollection();

			bool loop = true;

			int i = 0;
			int ret = 0;

			lock(syncRoot)
			{
				do  
				{
					hDestInfo = MarshalEx.AllocHLocal((uint)DestinationInfo.NativeSize);

					ret = ConnMgrEnumDestinations(i++, hDestInfo);
					if(ret == -2147467259)
					{
						loop = false;
						break;
					}
					DestinationInfo cm = new DestinationInfo(hDestInfo);
					dests.Add(cm);

					MarshalEx.FreeHLocal(hDestInfo);
				}
				while(loop);
			}

			return dests;
		}