private static async Task updateSourceAsync(WebFileStream stream) { var gProfile = stream.Profile as GoogleDriveProfile; var gModel = stream.EntryModel as GoogleDriveItemModel; CancellationTokenSource cts = new CancellationTokenSource(); //Create New.. if (String.IsNullOrEmpty(gModel.UniqueId)) { var newFile = new Google.Apis.Drive.v2.Data.File() { Title = gModel.Name, Description = gModel.Name, MimeType = "" }; newFile.Parents = new List <ParentReference>(); newFile.Parents.Add(new ParentReference() { Id = (gModel.Parent as GoogleDriveItemModel).Metadata.Id }); stream.Seek(0, SeekOrigin.Begin); var request = gProfile.DriveService.Files.Insert(newFile, stream, ""); await request.UploadAsync(cts.Token); } else { gProfile.DriveService.Files.Update(gModel.Metadata, gModel.UniqueId, stream, ""); } stream.Seek(0, SeekOrigin.Begin); }
private static async Task updateSourceAsync(WebFileStream stream) { var profile = stream.Profile as DropBoxProfile; var fileModel = stream.EntryModel as DropBoxItemModel; string fileName = fileModel.Name; string filePath = profile.Path.GetDirectoryName(fileModel.RemotePath); stream.Seek(0, SeekOrigin.Begin); CancellationTokenSource cts = new CancellationTokenSource(); var client = profile.GetClient(); await client.UploadFileTask(filePath, fileName, stream.ToByteArray()); }
private static async Task updateSourceAsync(WebFileStream stream) { //throw new Exception(); var szsProfile = stream.Profile as SzsProfile; var szsModel = stream.EntryModel as ISzsItemModel; //var rootReferencedFile = szsModel.Root.ReferencedFile; string type = szsModel.Root.GetExtension(); using (var releaser = await szsProfile.WorkingLock.LockAsync()) using (Stream archiveStream = await(szsModel.Root.Profile as IDiskProfile).DiskIO.OpenStreamAsync(szsModel.Root, Defines.FileAccess.ReadWrite, CancellationToken.None)) { szsProfile.Wrapper.CompressOne(type, archiveStream, szsModel.RelativePath, stream); } }
private static async Task updateSourceAsync(WebFileStream stream) { var skyProfile = stream.Profile as SkyDriveProfile; var skyModel = stream.EntryModel as SkyDriveItemModel; await skyProfile.checkLoginAsync(); CancellationTokenSource cts = new CancellationTokenSource(); var progressHandler = new Progress <LiveOperationProgress>( (progress) => { }); LiveConnectClient liveClient = new LiveConnectClient(skyProfile.Session); LiveOperationResult result; stream.Seek(0, SeekOrigin.Begin); var uid = (skyModel.Parent as SkyDriveItemModel).UniqueId; result = await liveClient.UploadAsync(uid, skyModel.Name, stream, OverwriteOption.Overwrite, cts.Token, progressHandler); skyModel.init(skyProfile, skyModel.FullPath, result.Result); }