Swapper.NET Logo

Source Code Interfaces ~ IDownloadables.cs


using System;
using System.IO;
using RevolutionaryStuff.JBT;

namespace RevolutionaryStuff.P2P.Basics
{
	public interface IDownloadableBase
	{
		bool IsComplete { get; }	
		long Size { get; }
		string Name { get; }
		long BytesDownloaded { get; }
	}

	public interface IDownloadableItem : IDownloadableBase, IWebItem
	{
		IDownloadablePackage Package { get; }
		Region1D[] GetCompletedRegions();
	}

	public interface IDownloadablePackage : IDownloadableBase
	{
		void Abort();
		IDownloadableItem[] Items { get; }
		IDownloadableSource[] Sources { get; }
		event System.EventHandler DownloadComplete;
		DownloadableAttributes Attributes { get; set; }
		string SimpleTag { get; }
	}

	public interface IDownloadableSource
	{
		System.Net.EndPoint EndPoint { get; }
		long BytesDownloaded { get; }
		bool Active { get; }
		bool Error { get; }
		IUserAgent UserAgent { get; }
	}

	public interface IDownloadableConnection : IConnection
	{
		IDownloadableItem Item { get; }
	}

	public interface IDownloadablePackageGetter
	{
		IDownloadablePackage[] GetDownloadablePackages();
	}

	[Flags]
	public enum DownloadableAttributes
	{
		/// 
		/// This is a normal item
		/// 
		Normal = 0,
		/// 
		/// When State==Pending, when true, don't begin a download
		/// 
		Suspended=0x1,
		/// 
		/// When true, This content should NOT be shown to a user
		/// 
		Invisible=0x2,
		/// 
		/// When true, and end user should NOT be able to delete this
		/// 
		Protected=0x4,
		/// 
		/// Don't look for additional sources
		/// 
		DontFindAdditionalSources=0x8,
		/// 
		/// The download must finish in this session
		/// 
		MustCompleteInThisSession=0x10
	}
}