示例#1
0
 public void Copy(C8oFileTransferSettings settings)
 {
     projectName = settings.projectName;
     taskDb      = settings.taskDb;
     filePrefix  = settings.filePrefix;
     maxRunning  = settings.maxRunning;
     maxDurationForTransferAttempt = settings.maxDurationForTransferAttempt;
     maxDurationForChunk           = settings.maxDurationForChunk;
     useCouchBaseReplication       = settings.useCouchBaseReplication;
 }
示例#2
0
 /// <summary>
 /// Initialize a File transfer. This will prepare everything needed to transfer a file. The name of the backend project and
 /// the name of the FullSync status database will be set by default to <b>lib_FileTransfer</b> and to <b>c8ofiletransfer_tasks</b> but
 /// you can override them passing custom values the <b>projectname</b> and the <b>taskDb</b> parameters.
 /// </summary>
 /// <param name="c8o">An initilized C8o endpoint object</param>
 /// <param name="projectName">the overrided project name</param>
 /// <param name="taskDb">the overrided status database name</param>
 /// <sample>
 ///     Typical usage :
 ///     <code>
 ///         // Construct the endpoint to Convertigo Server
 ///         c8o = new C8o("http://[server:port]/convertigo/projects/[my__backend_project]");
 ///
 ///         // Buid a C8oFileTransfer object
 ///         fileTransfer = new C8oFileTransfer(c8o);
 ///
 ///         // Attach a TransferStatus monitor
 ///         fileTransfer.RaiseTransferStatus += (sender, transferStatus) => {
 ///             // Do Whatever has to be done to monitor the transfer
 ///         };
 ///
 ///         // Start Transfer engine
 ///         fileTransfer.Start();
 ///
 ///         // DO Some Stuff
 ///         ....
 ///         // Call a custom Sequence in the server responsible for getting the document to be transffered from any
 ///         // Repository and pushing it to FullSync using the lib_FileTransfer.var library.
 ///         JObject data = await c8o.CallJSON(".AddFileXfer").Async();
 ///
 ///         // This sequence should return an uuid identifying the transfer.
 ///         String uuid = ["document"]["uuid"].Value();
 ///
 ///         // Use this uuid to start the transfer and give the target filename and path on your device file system.
 ///         fileTransfer.DownloadFile(uuid, "c:\\temp\\MyTransferredFile.data");
 ///     </code>
 /// </sample>
 public C8oFileTransfer(C8o c8o, C8oFileTransferSettings c8oFileTransferSettings = null)
 {
     if (c8oFileTransferSettings != null)
     {
         Copy(c8oFileTransferSettings);
     }
     _maxRunning    = new int[] { maxRunning };
     c8oTask        = new C8o(c8o.EndpointConvertigo + "/projects/" + projectName, new C8oSettings(c8o).SetDefaultDatabaseName(taskDb));
     streamToUpload = new Dictionary <string, Stream>();
 }
示例#3
0
 public C8oFileTransferSettings(C8oFileTransferSettings c8oFileTransferSettings)
 {
     Copy(c8oFileTransferSettings);
 }