예제 #1
0
파일: Hubic.cs 프로젝트: sp1r00000/ShareX
        public List <HubicFolderInfo> GetFiles(HubicFolderInfo fileInfo)
        {
            if (!CheckAuthorization())
            {
                return(null);
            }

            string response = SendRequest(HttpMethod.GET, HubicOpenstackAuthInfo.endpoint + "/default" + "/?path=" + fileInfo.name + "&format=json", headers: GetAuthHeaders("X-Auth-Token"));

            if (!string.IsNullOrEmpty(response))
            {
                return(JsonConvert.DeserializeObject <List <HubicFolderInfo> >(response));
            }

            return(null);
        }
예제 #2
0
 private void HubicAddFolder(HubicFolderInfo folder)
 {
     ListViewItem lvi = new ListViewItem(folder.name);
     lvi.Tag = folder;
     lvHubicFolders.Items.Add(lvi);
 }
예제 #3
0
        public void HubicListFolders(HubicFolderInfo fileInfo)
        {
            lvHubicFolders.Items.Clear();

            if (!OAuth2Info.CheckOAuth(Config.HubicOAuth2Info))
            {
                MessageBox.Show(Resources.UploadersConfigForm_ListFolders_Authentication_required_, Resources.UploadersConfigForm_HubicListFolders_Hubic_refresh_folders_list_failed,
                    MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else
            {
                Hubic hubic = new Hubic(Config.HubicOAuth2Info, Config.HubicOpenstackAuthInfo);
                List<HubicFolderInfo> folders = hubic.GetFiles(fileInfo);
                if (folders != null && folders.Count != 0)
                {
                    foreach (HubicFolderInfo folder in folders.Where(x => x.content_type == "application/directory" && x.name[0] != '.'))
                    {
                        HubicAddFolder(folder);
                    }
                }
            }
        }
예제 #4
0
파일: Hubic.cs 프로젝트: raymondle/ShareX
        public List<HubicFolderInfo> GetFiles(HubicFolderInfo fileInfo)
        {
            if (!CheckAuthorization())
            {
                return null;
            }

            string response = SendRequest(HttpMethod.GET, HubicOpenstackAuthInfo.endpoint + "/default" + "/?path=" + fileInfo.name + "&format=json", headers: GetAuthHeaders("X-Auth-Token"));

            if (!string.IsNullOrEmpty(response))
            {
                return JsonConvert.DeserializeObject<List<HubicFolderInfo>>(response);
            }

            return null;
        }