示例#1
0
        public string[] ReadDriveFolderForFiles(string folder = "In")
        {
            DriveService service = Authentication.AuthenticateOauth(GoogleClientId, GoogleClientSecret, GoogleUserName);
            string       q       = "title = '" + folder + "' and mimeType = 'application/vnd.google-apps.folder'";
            var          dir     = GoogleDriveHelper.GetFiles(service, q);

            if (dir == null || dir.Count == 0)
            {
                return(null);
            }

            q = "'" + dir[0].Id + "' in parents";
            var _filesInsideDir = GoogleDriveHelper.GetFiles(service, q);
            var retList         = new List <string>();

            foreach (var f in _filesInsideDir)
            {
                string downloadedFile = Path.Combine(DownloadLocation, f.OriginalFilename);
                GoogleDriveHelper.downloadFile(service, f.DownloadUrl, downloadedFile);

                if (System.IO.File.Exists(downloadedFile))
                {
                    retList.Add(downloadedFile);
                    GoogleDriveHelper.removeFileFromFolder(service, dir[0].Id, f.Id);
                }
            }

            return(retList.ToArray());
        }
示例#2
0
 /// <summary>
 /// 드라이브 정보를 받아옴
 /// </summary>
 /// <returns></returns>
 public async Task Signin()
 {
     service = Authentication.AuthenticateOauth("892886432316-smcv78utjgpp1iec18v67amr2gigv24m.apps.googleusercontent.com", "eyOFpG-LFIfp8ad3usTL81LG", "bit12");
     if (service != null)
     {
         item = new GoogleFile(service);
         await LoadFolderFromId("root");
     }
 }
示例#3
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (textBox1.Text != null)
     {
         DriveService service = Authentication.AuthenticateOauth("892886432316-smcv78utjgpp1iec18v67amr2gigv24m.apps.googleusercontent.com", "eyOFpG-LFIfp8ad3usTL81LG", textBox1.Text);
         if (service != null)
         {
             googlelist.Add(service);
             listBox1.Items.Add(service.Name);
         }
     }
 }
示例#4
0
 public static void SignInToMicrosoftAccount(System.Windows.Forms.IWin32Window parentWindow)
 {
     Authentication.AuthenticateOauth(client_id, client_secret, "baba");
 }