예제 #1
0
        public async Task DeleteFile(string FileName = "", string FileID = "")
        {
            GoogleServiceController GSC = new GoogleServiceController();
            DriveService            DS  = GSC.GetDriveService();
            DriveController         dc  = new DriveController(DS);

            string OnlyFileName = AuxFileCommCenter.GetFileNameOnlyWithFormat(FileName)[0];

            if (string.IsNullOrEmpty(FileID) && string.IsNullOrEmpty(FileName))
            {
                //Find the file
                Dictionary <string, string> FilesInDrive = dc.FindFiles(false);
                FileID = FilesInDrive.Where(x => x.Value == OnlyFileName).First().Key;
            }
            else if (string.IsNullOrEmpty(FileID))
            {
                dc.DeleteFile(DS, FileID);
            }
            else
            {
                Console.WriteLine("Nomes em branco, abortando operação");
            }
        }