private bool DeleteFilesInFolder(Google.Apis.Drive.v2.Data.File Folder) { bool Succes = false; try { FilesResource.ListRequest myList = m_Drive.Files.List(); myList.Q = string.Format("trashed = false and '{0}' in parents", Folder.Id); Google.Apis.Drive.v2.Data.FileList myFiles = myList.Fetch(); foreach (Google.Apis.Drive.v2.Data.File myFile in myFiles.Items) { FilesResource.DeleteRequest myDelRequest = m_Drive.Files.Delete(myFile.Id); myDelRequest.Fetch(); } Succes = true; } catch (Exception ex) { ErrorDump.AddError(System.IntPtr.Zero, "DriveSync.cs", "DeleteFilesInFolder", ex); if (FinishedEvent != null) { FinishedEvent(new DriveFinishedEventArgs(false, "Fout bij verwijderen oude database", ex)); } } return(Succes); }
private bool GetPlacesFolder() { bool Succes = false; try { FilesResource.ListRequest myList = m_Drive.Files.List(); myList.Q = "title = 'BookSync' and mimeType = 'application/vnd.google-apps.folder' and trashed = false"; Google.Apis.Drive.v2.Data.FileList myFiles = myList.Fetch(); if (myFiles.Items.Count > 0) { m_PlacesFolder = myFiles.Items[0]; Succes = true; } } catch (Exception ex) { ErrorDump.AddError(System.IntPtr.Zero, "DriveSync.cs", "GetPlacesFolder", ex); } return(Succes); }
private bool GetPlacesBestand() { bool Succes = false; try { FilesResource.ListRequest myList = m_Drive.Files.List(); myList.Q = string.Format("title = 'places.sqlite' and mimeType = 'application/octet-stream' and trashed = false and '{0}' in parents", m_PlacesFolder.Id); Google.Apis.Drive.v2.Data.FileList myFiles = myList.Fetch(); if (myFiles.Items.Count > 0) { m_PlacesBestand = myFiles.Items[0]; Succes = true; } } catch (Exception ex) { ErrorDump.AddError(System.IntPtr.Zero, "DriveSync.cs", "GetPlacesBestand", ex); } return(Succes); }