Exemple #1
0
 private async Task DeleteFileAsync(string file, string rootPath = null)
 {
     try
     {
         if (string.IsNullOrEmpty(rootPath))
         {
             rootPath = _path;
         }
         await _client.DeleteTask(rootPath + "/" + file);
     }
     catch (DropboxException)
     {
         throw new CloudException("Couldn't delete file on cloud.");
     }
 }
Exemple #2
0
        public async Task <bool> UploadSynchronizationAsync(List <FileInformation> fileInfo, object DriveServiceClient)
        {
            try
            {
                FileInformation[] fileArr = fileInfo.ToArray();
                DropNetClient     client  = DriveServiceClient as DropNetClient;


                foreach (var item in fileArr)
                {
                    if (!item.isFile) //File/true....Folder/false
                    {
                        switch (item.Mode)
                        {
                        case "cr":
                            this.UploadFolderCreate(item.FileName, item.CloudPath, client);      //create folder
                            break;

                        case "ch":
                            break;

                        case "re":
                            break;

                        case "de":
                            break;
                        }
                    }
                }

                foreach (var item in fileArr)
                {
                    switch (item.Mode)
                    {
                    case "ch":     //database entries
                        if (item.isFile)
                        {
                            //DIE FRAGE IST WAS STEHT IN CLOUDPATH????? WENN ROOTPATH DAS FILE IST STEHT "/" DARIN ODER NULL? WENN NULL MÜSSTE SONST IF OB NULL USW....CARL FRAGEN!!
                            await this.FileUploadDB(item.CloudPath, item.FileName, item.Path, null, client);
                        }


                        break;

                    case "cr":     //database entries
                        if (item.isFile)
                        {
                            await this.FileUploadDB(item.CloudPath, item.FileName, item.Path, null, client);
                        }

                        break;

                    case "de":     //database entries
                        await client.DeleteTask(item.Path);

                        break;

                    case "re":     //database entries
                        if (item.isFile)
                        {
                            await this.FileUploadDB(item.CloudPath, item.FileName, item.Path, null, client);
                        }

                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

            return(false);
        }