Class GDrive
Allows in/out operations and/or data validations with a GDrive instance.
Inheritance
Implements
Inherited Members
Namespace: AutoCheck.Core.Connectors
Assembly: AutoCheck.dll
Syntax
public class GDrive : Connector, IDisposable
Constructors
| Improve this Doc View SourceGDrive(String, String)
Declaration
public GDrive(string clientSecretJson, string userName)
Parameters
Type | Name | Description |
---|---|---|
System.String | clientSecretJson | |
System.String | userName |
Properties
| Improve this Doc View SourceDrive
Declaration
public DriveService Drive { get; }
Property Value
Type | Description |
---|---|
Google.Apis.Drive.v3.DriveService |
Methods
| Improve this Doc View SourceCopyFile(File, String, String)
Copy an external Google Drive file into the main account.
Declaration
public void CopyFile(File file, string remoteFilePath, string remoteFileName = null)
Parameters
Type | Name | Description |
---|---|---|
Google.Apis.Drive.v3.Data.File | file | The Google Drive API file to copy. |
System.String | remoteFilePath | Remote file path |
System.String | remoteFileName | Remote file name (extenssion and/or name will be infered from source if not provided). |
CopyFile(String, String, String)
Copy an external Google Drive file into the main account.
Declaration
public void CopyFile(string fileID, string remoteFilePath, string remoteFileName = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | fileID | The Google Drive API file's ID to copy. |
System.String | remoteFilePath | Remote file path |
System.String | remoteFileName | Remote file name (extenssion and/or name will be infered from source if not provided). |
CopyFile(Uri, String, String)
Copy an external Google Drive file into the main account.
Declaration
public void CopyFile(Uri uri, string remoteFilePath, string remoteFileName = null)
Parameters
Type | Name | Description |
---|---|---|
System.Uri | uri | The Google Drive API file URI to copy. |
System.String | remoteFilePath | Remote file path |
System.String | remoteFileName | Remote file name (extenssion and/or name will be infered from source if not provided). |
CountFiles(String, Boolean)
Returns how many folders has been found within the given path.
Declaration
public int CountFiles(string path, bool recursive = true)
Parameters
Type | Name | Description |
---|---|---|
System.String | path | Path where the folders will be searched into. |
System.Boolean | recursive | Recursive deep search. |
Returns
Type | Description |
---|---|
System.Int32 | The amount of folders. |
CountFolders(String, Boolean)
Returns how many folders has been found within the given path.
Declaration
public int CountFolders(string path, bool recursive = true)
Parameters
Type | Name | Description |
---|---|---|
System.String | path | Path where the folders will be searched into. |
System.Boolean | recursive | Recursive deep search. |
Returns
Type | Description |
---|---|
System.Int32 | The amount of folders. |
CreateFile(String, String, String)
Uploads a local file to a remote Google Drive folder.
Declaration
public void CreateFile(string localFilePath, string remoteFilePath, string remoteFileName = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | localFilePath | Local file path |
System.String | remoteFilePath | Remote file path (will be created if not exists). |
System.String | remoteFileName | Remote file name (extenssion and/or name will be infered from source if not provided). |
CreateFolder(String, String)
Creates the specified folder
Declaration
public File CreateFolder(string path, string folder)
Parameters
Type | Name | Description |
---|---|---|
System.String | path | Path where the folder will be created into. |
System.String | folder | The folder to create (all needed subfolders will be created also). |
Returns
Type | Description |
---|---|
Google.Apis.Drive.v3.Data.File |
DeleteFile(String, String)
Removes a remote file
Declaration
public void DeleteFile(string remoteFilePath, string remoteFileName)
Parameters
Type | Name | Description |
---|---|---|
System.String | remoteFilePath | Remote file path . |
System.String | remoteFileName | Remote file name (extenssion and/or name will be infered from source if not provided). |
DeleteFolder(String, String)
Removes a remote folder
Declaration
public void DeleteFolder(string path, string folder)
Parameters
Type | Name | Description |
---|---|---|
System.String | path | Path where the folder will be searched into. |
System.String | folder | The folder to search. |
Dispose()
Disposes the object releasing its unmanaged properties.
Declaration
public override void Dispose()
Overrides
Download(File, String)
Declaration
public string Download(File file, string savePath)
Parameters
Type | Name | Description |
---|---|---|
Google.Apis.Drive.v3.Data.File | file | |
System.String | savePath |
Returns
Type | Description |
---|---|
System.String |
Download(String, String)
Declaration
public string Download(string fileID, string savePath)
Parameters
Type | Name | Description |
---|---|---|
System.String | fileID | |
System.String | savePath |
Returns
Type | Description |
---|---|
System.String |
Download(Uri, String)
Declaration
public string Download(Uri uri, string savePath)
Parameters
Type | Name | Description |
---|---|---|
System.Uri | uri | |
System.String | savePath |
Returns
Type | Description |
---|---|
System.String |
GetFile(String, String, Boolean)
Returns the selected file
Declaration
public File GetFile(string path, string file, bool recursive = true)
Parameters
Type | Name | Description |
---|---|---|
System.String | path | Path where the file will be searched into. |
System.String | file | The file to search. |
System.Boolean | recursive | Recursive deep search. |
Returns
Type | Description |
---|---|
Google.Apis.Drive.v3.Data.File | The selected file. |
GetFolder(String, String, Boolean)
Returns the selected folder
Declaration
public File GetFolder(string path, string folder, bool recursive = true)
Parameters
Type | Name | Description |
---|---|---|
System.String | path | Path where the folder will be searched into. |
System.String | folder | The folder to search. |
System.Boolean | recursive | Recursive deep search. |
Returns
Type | Description |
---|---|
Google.Apis.Drive.v3.Data.File | The selected folder. |