/// <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); }
/// <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)); }
/// <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)); }
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"); }
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"); ; }
/// <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); }
/// <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); }
/// <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 (); }
/// <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)); }
/// <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); }
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"); }
/// <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)); }
/// <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); }
/// <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)); }
/// <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); }
/// <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); }
/// <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); }
/// <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); }
/// <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)); }
/// <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); }
/// <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)); }
/// <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)); }
/// <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)); }
/// <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); }
/// <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)); }