public IList <DocsResp> syncVideos(IList <IFileDescriptor> videos, SessionInf user, OnProcess proc, ErrorCtx onErr = null) { ErrorCtx errHandler = onErr == null ? errCtx : onErr; DocsResp resp = null; try { AnsonHeader header = client.Header().act(new string[] { "album.c#", "synch", "c/photo", "multi synch" }); IList <DocsResp> reslts = new List <DocsResp>(videos.Count); for (int px = 0; px < videos.Count; px++) { IFileDescriptor p = videos[px]; DocsReq req = new DocsReq() .blockStart(p, user); AnsonMsg q = client.UserReq(uri, new AlbumPort(AlbumPort.album), req) .Header(header); resp = (DocsResp)client.Commit(q, errHandler); // stringchainId = resp.chainId(); string pth = p.fullpath(); if (pth != resp.Fullpath()) { Utils.Warn("resp not reply with exactly the same path: %s", resp.Fullpath()); } int totalBlocks = (int)((new FileInfo(pth).Length + 1) / blocksize); if (proc != null) { proc.proc(px, totalBlocks, resp); } int seq = 0; FileStream ifs = File.Create(p.fullpath()); try { string b64 = AESHelper.Encode64(ifs, blocksize); while (b64 != null) { req = new DocsReq().blockUp(seq, resp, b64, user); seq++; q = client.UserReq(uri, new AlbumPort(AlbumPort.album), req) .Header(header); resp = (DocsResp)client.Commit(q, errHandler); if (proc != null) { proc.proc(px, totalBlocks, resp); } b64 = AESHelper.Encode64(ifs, blocksize); } req = new DocsReq().blockEnd(resp, user); q = client.UserReq(uri, new AlbumPort(AlbumPort.album), req) .Header(header); resp = (DocsResp)client.Commit(q, errHandler); if (proc != null) { proc.proc(px, totalBlocks, resp); } } catch (Exception ex) { Utils.Warn(ex.Message); req = new DocsReq().blockAbort(resp, user); req.A(DocsReq.A.blockAbort); q = client.UserReq(uri, new AlbumPort(AlbumPort.album), req) .Header(header); resp = (DocsResp)client.Commit(q, errHandler); if (proc != null) { proc.proc(px, totalBlocks, resp); } throw ex; } finally { ifs.Close(); } reslts.Add(resp); } return(reslts); } catch (Exception e) { errHandler.onError(new MsgCode(MsgCode.exIo), e.GetType().Name + " " + e.Message); } return(null); }