示例#1
0
        private async void AllSerach()
        {
            foreach (var item in Setting.driveinfo)
            {
                CloudFiles files = null;
                if (item.token.Drive == "Google")
                {
                    string query     = "title = " + "'" + serchname + "'";
                    var    parameter = new Dictionary <string, string>
                    {
                        { "q", query }
                    };

                    var result = await HttpHelper.RequstHttp("GET", "https://www.googleapis.com/drive/v2/files", parameter, item.token.access_token);

                    Dictionary <string, object> fileinfo = HttpHelper.DerealizeJson(result.GetResponseStream());
                    object[] items = (object[])fileinfo["items"];
                    googlecloud1.Folder.GoogleFolder folder = new Folder.GoogleFolder(item);
                    foreach (var fi in items)
                    {
                        files = folder.AddFiles((Dictionary <string, object>)fi);
                        file.Add(files);
                    }
                }
                else if (item.token.Drive == "OneDrive")
                {
                    var parameter = new Dictionary <string, string>
                    {
                        { "q", serchname }
                    };
                    var result = await HttpHelper.RequstHttp("GET", "https://api.onedrive.com/v1.0/drive/root/view.search", parameter, item.token.access_token);

                    Dictionary <string, object> fileinfo = HttpHelper.DerealizeJson(result.GetResponseStream());
                    object[] items = (object[])fileinfo["value"];
                    googlecloud1.Folder.OneDriveFolder folder = new Folder.OneDriveFolder(item);
                    foreach (var fi in items)
                    {
                        files = folder.AddFiles((Dictionary <string, object>)fi);
                        file.Add(files);
                    }
                }
                else if (item.token.Drive == "DropBox")
                {
                    var parameter = new HttpParameterCollection()
                    {
                        { "query", serchname },
                        { "access_token", item.token.access_token }
                    };
                    var result = OAuthUtility.Get("https://api.dropboxapi.com/1/search/auto//", parameter);
                    googlecloud1.Folder.DropBoxFolder folder = new Folder.DropBoxFolder(item);
                    foreach (RequestResult re in result)
                    {
                        files = folder.AddFiles(re.ToDictionary());
                        file.Add(files);
                    }
                }
            }
        }
示例#2
0
 private async Task LoadOneDriveFile(string p, ODConnection item)
 {
     OneDriveFolder Ones = new OneDriveFolder(item);
     await Ones.AddFiles(p);
     Ones.ToString();
     folder.Add(Ones);
 }
示例#3
0
 private async void NavigateToItem(CloudFiles item)
 {
     flowLayoutPanel_filecontent.Controls.Clear();
     if((item as GoogleFile) != null)
     {
         GoogleFile file = (GoogleFile)item;
         AllFolder newfolder = new GoogleFolder(file.Service);
         await newfolder.AddFiles(file.GetId());
         LoadTile(newfolder);
     }
     else if((item as OneDriveFile) != null)
     {
         OneDriveFile file = (OneDriveFile)item;
         AllFolder newfolder = new OneDriveFolder(file.Connect);
         await newfolder.AddFiles(file.GetId());
         LoadTile(newfolder);
     }
     else
     {
         MessageBox.Show("파일 열기 실패");
     }
 }