Exemplo n.º 1
0
        public int WriteFile(string filename, byte[] buffer, ref uint writtenBytes, long offset, DokanFileInfo info)
        {
            WriteTrace("writefile", filename, offset);

            StartCommunication();

            FileUploader fileUploader = info.Context as FileUploader;

            if (fileUploader == null)
            {
                WriteTrace("writefile", filename, "no uploader found");
                return(-DokanNet.ERROR_ACCESS_DENIED);
            }

            DokanNet.DokanResetTimeout(1000 * 30, info);

            fileUploader.WriteAsync(buffer).Wait();

            writtenBytes = (uint)buffer.Length;

            if (fileUploader.IsFinished())
            {
                OnUploadComplete(fileUploader, filename);
            }

            WriteTrace("writefile", filename, writtenBytes, fileUploader.Id, fileUploader.IsFinished());

            return(DokanNet.DOKAN_SUCCESS);
        }
Exemplo n.º 2
0
        public int CloseFile(string filename, DokanFileInfo info)
        {
            WriteTrace("closefile", filename);

            FileUploader fileUploader = info.Context as FileUploader;

            if (fileUploader != null && fileUploader.IsFinished())
            {
                OnUploadComplete(fileUploader, filename);
            }

            return(DokanNet.DOKAN_SUCCESS);
        }