示例#1
0
		/// <summary>
		/// 
		/// </summary>
		/// <param name="op"></param>
		/// <param name="pair"></param>
		/// <returns></returns>
		private async Task<CallRet> op2 (FileHandle op, EntryPathPair pair)
		{
			string url = string.Format ("{0}/{1}/{2}/{3}",
			                            Config.RS_HOST,
			                            OPS [(int)op],
			                            Base64URLSafe.Encode (pair.URISrc),
			                            Base64URLSafe.Encode (pair.URIDest));
			return await Call(url);
		}
示例#2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="op"></param>
        /// <param name="pair"></param>
        /// <returns></returns>
        private CallRet op2(FileHandle op, EntryPathPair pair)
        {
            string url = string.Format("{0}/{1}/{2}/{3}",
                                       Config.RS_HOST,
                                       OPS [(int)op],
                                       Base64URLSafe.Encode(pair.URISrc),
                                       Base64URLSafe.Encode(pair.URIDest));

            return(Call(url));
        }
示例#3
0
        /// <summary>
        /// </summary>
        /// <param name="op"></param>
        /// <param name="pair"></param>
        /// <param name="force"></param>
        /// <returns></returns>
        private async Task <CallRet> op2Async(FileHandle op, EntryPathPair pair, bool force)
        {
            string url = string.Format("{0}/{1}/{2}/{3}/force/{4}",
                                       Config.RS_HOST,
                                       OPS[(int)op],
                                       Base64URLSafe.Encode(pair.URISrc),
                                       Base64URLSafe.Encode(pair.URIDest), force);

            return(await CallAsync(url));
        }
示例#4
0
文件: QiniuSDK.cs 项目: doscanner/GF
 public static void BatchMove(string bucket, string[] keys)
 {
     List<EntryPathPair> pairs = new List<EntryPathPair>();
     foreach (string key in keys)
     {
         EntryPathPair entry = new EntryPathPair(bucket, key, Guid.NewGuid().ToString());
         pairs.Add(entry);
     }
     RSClient client = new RSClient();
     client.BatchMove(pairs.ToArray());
 }
		public void MoveTest()
		{

			RSClient target = new RSClient(); // TODO: 初始化为适当的值
			string key = NewKey;
			EntryPathPair pathPair = new EntryPathPair(Bucket, tmpKeys[0], key); ; // TODO: 初始化为适当的值
			CallRet actual;
			//YES
			actual = target.Move(pathPair);
			if (actual.OK) {
				tmpKeys [0] = key;
			}
			Assert.IsTrue(actual.OK, "MoveTest Failure");          
		}
示例#6
0
        public void BatchCopyTest()
        {
            RSClient target = new RSClient(); // TODO: 初始化为适当的值

            EntryPathPair[] entryPathPairs = new EntryPathPair[2]; // TODO: 初始化为适当的值
            string tmpKey = NewKey;
            string tmpKey2 = NewKey;
            entryPathPairs[0] = new EntryPathPair(Bucket, tmpKeys[0], tmpKey);
            entryPathPairs[1] = new EntryPathPair(Bucket, tmpKeys[1], tmpKey2);
            CallRet actual;
            actual = target.BatchCopy(entryPathPairs);
            if (actual.OK) {
                RSHelper.RSDel (Bucket, tmpKey);
                RSHelper.RSDel (Bucket, tmpKey2);
            }
            Assert.IsTrue(actual.OK, "BatchStatTest Failure"); ;
        }
示例#7
0
文件: RSClient.cs 项目: sigcms/Seeger
 /// <summary>
 /// 
 /// </summary>
 /// <param name="bucket"></param>
 /// <param name="entryPathPari"></param>
 public CallRet BatchCopy(EntryPathPair[] entryPathPari)
 {
     string requestBody = getBatchOp_2 (FileHandle.COPY, entryPathPari);
     return batch (requestBody);
 }
示例#8
0
文件: RSClient.cs 项目: sigcms/Seeger
 /// <summary>
 /// 移动文件
 /// </summary>
 /// <param name="bucketSrc">文件所属的源空间名称</param>
 /// <param name="keySrc">源key</param>
 /// <param name="bucketDest">目标空间名称</param>
 /// <param name="keyDest">目标key</param>
 /// <returns>见<see cref="CallRet">CallRet</see></returns>
 public CallRet Move(EntryPathPair pathPair)
 {
     return op2 (FileHandle.MOVE, pathPair);
 }
示例#9
0
文件: RSClient.cs 项目: sigcms/Seeger
 /// <summary>
 /// 
 /// </summary>
 /// <param name="opName"></param>
 /// <param name="keys"></param>
 /// <returns></returns>
 private string getBatchOp_2(FileHandle op, EntryPathPair[] keys)
 {
     if (keys.Length < 1)
         return string.Empty;
     StringBuilder sb = new StringBuilder ();
     for (int i = 0; i < keys.Length - 1; i++) {
         string item = string.Format ("op=/{0}/{1}/{2}&",
                                      OPS [(int)op],
                                      Base64URLSafe.Encode (keys [i].URISrc),
                                      Base64URLSafe.Encode (keys [i].URIDest));
         sb.Append (item);
     }
     string litem = string.Format ("op=/{0}/{1}/{2}", OPS [(int)op],
                                   Base64URLSafe.Encode (keys [keys.Length - 1].URISrc),
                                   Base64URLSafe.Encode (keys [keys.Length - 1].URIDest));
     return sb.Append (litem).ToString ();
 }
示例#10
0
 /// <summary>
 /// 复制
 /// </summary>
 /// <param name="bucketSrc">文件所属的空间名称</param>
 /// <param name="keySrc">需要复制的文件key</param>
 /// <param name="bucketDest">复制至目标空间</param>
 /// <param name="keyDest">复制的副本文件key</param>
 /// <returns>见<see cref="CallRet">CallRet</see></returns>
 public async Task <CallRet> Copy(EntryPathPair pathPair)
 {
     return(await op2(FileHandle.COPY, pathPair));
 }
示例#11
0
文件: RSClient.cs 项目: sigcms/Seeger
 /// <summary>
 /// 复制
 /// </summary>
 /// <param name="bucketSrc">文件所属的空间名称</param>
 /// <param name="keySrc">需要复制的文件key</param>
 /// <param name="bucketDest">复制至目标空间</param>
 /// <param name="keyDest">复制的副本文件key</param>
 /// <returns>见<see cref="CallRet">CallRet</see></returns>
 public CallRet Copy(EntryPathPair pathPair)
 {
     return op2 (FileHandle.COPY, pathPair);
 }
示例#12
0
 public void CopyTest()
 {
     RSClient target = new RSClient(); // TODO: 初始化为适当的值
     string key = NewKey;
     EntryPathPair pathPair = new EntryPathPair(Bucket, tmpKeys[0], key); // TODO: 初始化为适当的值
     CallRet actual;
     actual = target.Copy(pathPair);
     if (actual.OK) {
         RSHelper.RSDel (Bucket, key);
     }
     Assert.IsTrue(actual.OK, "CopyTest Failure");
 }
示例#13
0
 /// <summary>
 /// 移动文件
 /// </summary>
 /// <param name="bucketSrc">文件所属的源空间名称</param>
 /// <param name="keySrc">源key</param>
 /// <param name="bucketDest">目标空间名称</param>
 /// <param name="keyDest">目标key</param>
 /// <param name="force">强制覆盖</param>
 /// <returns>见<see cref="CallRet">CallRet</see></returns>
 public async Task <CallRet> MoveAsync(EntryPathPair pathPair, bool force)
 {
     return(await op2Async(FileHandle.MOVE, pathPair, force));
 }
示例#14
0
		/// <summary>
		/// 复制
		/// </summary>
		/// <param name="bucketSrc">文件所属的空间名称</param>
		/// <param name="keySrc">需要复制的文件key</param>
		/// <param name="bucketDest">复制至目标空间</param>
		/// <param name="keyDest">复制的副本文件key</param>
		/// <returns>见<see cref="CallRet">CallRet</see></returns>
		public async System.Threading.Tasks.Task<CallRet> Copy(EntryPathPair pathPair)
		{
			return await op2(FileHandle.COPY, pathPair);
		}
示例#15
0
 /// <summary>
 /// 移动文件
 /// </summary>
 /// <param name="bucketSrc">文件所属的源空间名称</param>
 /// <param name="keySrc">源key</param>
 /// <param name="bucketDest">目标空间名称</param>
 /// <param name="keyDest">目标key</param>
 /// <returns>见<see cref="CallRet">CallRet</see></returns>
 public CallRet Move(EntryPathPair pathPair)
 {
     return(op2(FileHandle.MOVE, pathPair));
 }
示例#16
0
		/// <summary>
		/// 批操作:文件移动
		/// </summary>
		/// <param name="entryPathPair"><see cref="">EntryPathPair</see></param>
		public async Task<CallRet> BatchMove (EntryPathPair[] entryPathPairs)
		{
			string requestBody = getBatchOp_2 (FileHandle.MOVE, entryPathPairs);
			return await batch (requestBody);
		}
示例#17
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="bucket"></param>
        /// <param name="entryPathPari"></param>
        public async Task<CallRet> BatchCopy (EntryPathPair[] entryPathPari)
		{
			string requestBody = getBatchOp_2 (FileHandle.COPY, entryPathPari);
			return await batch (requestBody);
		}
示例#18
0
        /// <summary>
        /// 复制
        /// </summary>
        /// <param name="bucketSrc">文件所属的空间名称</param>
        /// <param name="keySrc">需要复制的文件key</param>
        /// <param name="bucketDest">复制至目标空间</param>
        /// <param name="keyDest">复制的副本文件key</param>
        /// <returns>见<see cref="CallRet">CallRet</see></returns>
        public async Task<CallRet> Copy (EntryPathPair pathPair)
		{
			return await op2 (FileHandle.COPY, pathPair);
		}
示例#19
0
		/// <summary>
		/// 移动文件
		/// </summary>
		/// <param name="bucketSrc">文件所属的源空间名称</param>
		/// <param name="keySrc">源key</param>
		/// <param name="bucketDest">目标空间名称</param>
		/// <param name="keyDest">目标key</param>
		/// <returns>见<see cref="CallRet">CallRet</see></returns>
		public async Task<CallRet> Move (EntryPathPair pathPair)
		{
			return await op2 (FileHandle.MOVE, pathPair);
		}
示例#20
0
 /// <summary>
 /// 复制
 /// </summary>
 /// <param name="bucketSrc">文件所属的空间名称</param>
 /// <param name="keySrc">需要复制的文件key</param>
 /// <param name="bucketDest">复制至目标空间</param>
 /// <param name="keyDest">复制的副本文件key</param>
 /// <param name="force">复制是否强制覆盖目标文件</param>
 /// <returns>见<see cref="CallRet">CallRet</see></returns>
 public async Task <CallRet> CopyAsync(EntryPathPair pathPair, bool force)
 {
     return(await op2Async(FileHandle.COPY, pathPair, force));
 }
示例#21
0
文件: RSClient.cs 项目: sigcms/Seeger
 /// <summary>
 /// 批操作:文件移动
 /// </summary>
 /// <param name="entryPathPair"><see cref="">EntryPathPair</see></param>
 public CallRet BatchMove(EntryPathPair[] entryPathPairs)
 {
     string requestBody = getBatchOp_2 (FileHandle.MOVE, entryPathPairs);
     return batch (requestBody);
 }
示例#22
0
 /// <summary>
 /// 复制
 /// </summary>
 /// <param name="bucketSrc">文件所属的空间名称</param>
 /// <param name="keySrc">需要复制的文件key</param>
 /// <param name="bucketDest">复制至目标空间</param>
 /// <param name="keyDest">复制的副本文件key</param>
 /// <returns>见<see cref="CallRet">CallRet</see></returns>
 public CallRet Copy(EntryPathPair pathPair)
 {
     return(op2(FileHandle.COPY, pathPair));
 }
示例#23
0
 /// <summary>
 /// 移动文件
 /// </summary>
 /// <param name="bucketSrc">文件所属的源空间名称</param>
 /// <param name="keySrc">源key</param>
 /// <param name="bucketDest">目标空间名称</param>
 /// <param name="keyDest">目标key</param>
 /// <returns>见<see cref="CallRet">CallRet</see></returns>
 public async Task <CallRet> Move(EntryPathPair pathPair)
 {
     return(await op2(FileHandle.MOVE, pathPair));
 }
示例#24
0
 /// <summary>
 /// 移动文件
 /// </summary>
 /// <param name="bucketSrc">文件所属的源空间名称</param>
 /// <param name="keySrc">源key</param>
 /// <param name="bucketDest">目标空间名称</param>
 /// <param name="keyDest">目标key</param>
 /// <param name="force">强制覆盖</param>
 /// <returns>见<see cref="CallRet">CallRet</see></returns>
 public CallRet Move(EntryPathPair pathPair, bool force)
 {
     return(op2(FileHandle.MOVE, pathPair, force));
 }
示例#25
0
		/// <summary>
		/// 移动文件
		/// </summary>
		/// <param name="bucketSrc">文件所属的源空间名称</param>
		/// <param name="keySrc">源key</param>
		/// <param name="bucketDest">目标空间名称</param>
		/// <param name="keyDest">目标key</param>
		/// <returns>见<see cref="CallRet">CallRet</see></returns>
		public async System.Threading.Tasks.Task<CallRet> Move(EntryPathPair pathPair)
		{
			return await op2(FileHandle.MOVE, pathPair);
		}
示例#26
0
 /// <summary>
 /// 复制
 /// </summary>
 /// <param name="bucketSrc">文件所属的空间名称</param>
 /// <param name="keySrc">需要复制的文件key</param>
 /// <param name="bucketDest">复制至目标空间</param>
 /// <param name="keyDest">复制的副本文件key</param>
 /// <param name="force">复制是否强制覆盖目标文件</param>
 /// <returns>见<see cref="CallRet">CallRet</see></returns>
 public CallRet Copy(EntryPathPair pathPair, bool force)
 {
     return(op2(FileHandle.COPY, pathPair, force));
 }