public StorageClientTests()
		{
			var configuration = Zongsoft.Options.Configuration.OptionConfiguration.Load(@"\Zongsoft\Zongsoft.Externals.Aliyun\src\Zongsoft.Externals.Aliyun.option");
			var option = configuration.GetOptionObject("Externals/Aliyun/General") as Zongsoft.Externals.Aliyun.Options.Configuration.GeneralConfiguration;

			_client = StorageServiceCenter.GetInstance(option.Name, option.IsInternal).Client;
			_client.Certification = option.Certification;
		}
		public StorageUploader(StorageClient client, string path, IDictionary<string, string> extendedProperties, int bufferSize = DEFAULT_BUFFER_SIZE)
		{
			if(client == null)
				throw new ArgumentNullException("client");

			if(string.IsNullOrWhiteSpace(path))
				throw new ArgumentNullException("path");

			if(bufferSize > MAXIMUM_BUFFER_SIZE)
				throw new ArgumentOutOfRangeException("bufferSize");

			_client = client;
			_path = path.Trim().TrimEnd('/', '\\');

			_length = 0;
			_offset = 0;
			_buffer = new byte[Math.Max(bufferSize, MINIMUM_BUFFER_SIZE)];
			_multiparts = new List<StorageMultipart>();
			_extendedProperties = extendedProperties;
		}
		public StorageUploader(StorageClient client, string path, int bufferSize) : this(client, path, null, bufferSize)
		{
		}
		public StorageUploader(StorageClient client, string path) : this(client, path, null, DEFAULT_BUFFER_SIZE)
		{
		}
		protected virtual void Dispose(bool disposing)
		{
			const int DISPOSED_FLAG = -1;

			//设置释放标志
			int isDisposed = Interlocked.Exchange(ref _isDisposed, DISPOSED_FLAG);

			//如果已经释放了则退出
			if(isDisposed == DISPOSED_FLAG)
				return;

			try
			{
				//确认提交整个上传操作
				this.Complete();
			}
			finally
			{
				_id = null;
				_length = 0;
				_offset = 0;
				_buffer = null;
				_multiparts = null;
				_extendedProperties = null;
				_client = null;

				var http = _http;

				if(http != null)
					http.Dispose();
			}
		}
Ejemplo n.º 6
0
 public StorageUploader(StorageClient client, string path, int bufferSize) : this(client, path, null, bufferSize)
 {
 }
Ejemplo n.º 7
0
 public StorageUploader(StorageClient client, string path) : this(client, path, null, DEFAULT_BUFFER_SIZE)
 {
 }