• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# RequestSettings类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中RequestSettings的典型用法代码示例。如果您正苦于以下问题:C# RequestSettings类的具体用法?C# RequestSettings怎么用?C# RequestSettings使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



RequestSettings类属于命名空间,在下文中一共展示了RequestSettings类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Extract

        public bool Extract(NetworkCredential credential, out MailContactList list)
        {
            bool result = false;
            list = new MailContactList();

            try
            {
                var rs = new RequestSettings("eStream-AspNetDating", credential.UserName, credential.Password)
                             {AutoPaging = true};

                var cr = new ContactsRequest(rs);

                Feed<Contact> f = cr.GetContacts();
                foreach (Contact e in f.Entries)
                {
                    foreach (var email in e.Emails)
                    {
                        var mailContact = new MailContact {Email = email.Address, Name = e.Title};
                        list.Add(mailContact);
                    }
                }
                result = true;
            }
            catch (Exception ex)
            {
                Global.Logger.LogError(ex);
            }

            return result;
        }
开发者ID:haimon74,项目名称:Easy-Fixup,代码行数:30,代码来源:GmailExtract.cs


示例2: Exec

        public static void Exec(string[] args)
        {
            Console.WriteLine("*** GetDocList ***");
            Console.WriteLine("--- START ---");

            string username = args[1];
            string password = args[2];

            GDataCredentials credentials = new GDataCredentials(username, password);
            RequestSettings settings = new RequestSettings("GDocBackup", credentials);
            settings.AutoPaging = true;
            settings.PageSize = 100;
            DocumentsRequest request = new DocumentsRequest(settings);

            Feed<Document> feed = request.GetEverything();
            List<Document> docs = new List<Document>();
            foreach (Document entry in feed.Entries)
                docs.Add(entry);

            StreamWriter outFile = new StreamWriter("doclist.txt", false);
            StreamWriter outFile2 = new StreamWriter("doclistdetails.txt", false);
            foreach (Document doc in docs)
            {
                string s = doc.Title + "\t" + doc.ResourceId;
                Console.WriteLine(s);
                outFile.WriteLine(s);
                outFile2.WriteLine(s);
                foreach (string pf in doc.ParentFolders)
                    outFile2.WriteLine("\t\t\t" + pf);
            }
            outFile.Close();
            outFile2.Close();

            Console.WriteLine("--- END ---");
        }
开发者ID:superhafnium,项目名称:gdocbackup,代码行数:35,代码来源:GetDocList.cs


示例3: Stream

        public override Response Stream(Uri url, HttpMethod method, Func<HttpWebResponse, bool, Response> responseBuilderCallback, Stream contents, int bufferSize, long maxReadLength, Dictionary<string, string> headers, Dictionary<string, string> queryStringParameters, RequestSettings settings, Action<long> progressUpdated)
        {
            if (settings == null)
                settings = new JsonRequestSettings();

            return base.Stream(url, method, responseBuilderCallback, contents, bufferSize, maxReadLength, headers, queryStringParameters, settings, progressUpdated);
        }
开发者ID:bretmcg,项目名称:SimpleRestServices,代码行数:7,代码来源:JsonRestService.cs


示例4: GetWebhook

        public Model.Webhook GetWebhook(string resourceGroupName, string automationAccountName, string name)
        {
            Requires.Argument("ResourceGroupName", resourceGroupName).NotNull();
            Requires.Argument("AutomationAccountName", automationAccountName).NotNull();
            using (var request = new RequestSettings(this.automationManagementClient))
            {
                try
                {
                    var webhook =
                        this.automationManagementClient.Webhooks.Get(resourceGroupName, automationAccountName, name)
                            .Webhook;
                    if (webhook == null)
                    {
                        throw new ResourceNotFoundException(
                            typeof(Webhook),
                            string.Format(CultureInfo.CurrentCulture, Resources.WebhookNotFound, name));
                    }

                    return new Model.Webhook(resourceGroupName, automationAccountName, webhook);
                }
                catch (CloudException cloudException)
                {
                    if (cloudException.Response.StatusCode == HttpStatusCode.NotFound)
                    {
                        throw new ResourceNotFoundException(
                            typeof(Webhook),
                            string.Format(CultureInfo.CurrentCulture, Resources.WebhookNotFound, name));
                    }

                    throw;
                }
            }
        }
开发者ID:docschmidt,项目名称:azure-powershell,代码行数:33,代码来源:AutomationClientWebhook.cs


示例5: Execute

        public override Response Execute(Uri url, HttpMethod method, Func<HttpWebResponse, bool, Response> responseBuilderCallback, string body, Dictionary<string, string> headers, Dictionary<string, string> queryStringParameters, RequestSettings settings)
        {
            if (settings == null)
                settings = new JsonRequestSettings();

            return base.Execute(url, method, responseBuilderCallback, body, headers, queryStringParameters, settings);
        }
开发者ID:bretmcg,项目名称:SimpleRestServices,代码行数:7,代码来源:JsonRestService.cs


示例6: Test

        public void Test()
        {
            RequestSettings settings = new RequestSettings("yourApp");
            settings.PageSize = 50000;
            settings.AutoPaging = true;
            
            PicasaRequest pr = new PicasaRequest(settings);
            pr.Service = GetPicasaService();
            Feed<Photo> feed = pr.GetPhotos();
            
            int cnt = 0;

            Photo x = null;

            foreach (Photo p in feed.Entries)
            {
                if (p.Title.ToLower() == "2005-12-16Kovalev_Zachet.avi".ToLower())
                {
                    x = p;
                    break;
                }
                cnt++;
            }
            var longTime = (DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1))).TotalMilliseconds;

            x.Timestamp = Convert.ToUInt64(longTime);


            pr.Update(x);
            

            Console.WriteLine(cnt);
        }
开发者ID:drasockalypse,项目名称:GooglePhotoOrganizer,代码行数:33,代码来源:PicasaClient.cs


示例7: GoogleContactsRepository

 public GoogleContactsRepository(AbstractContactsConfiguration credentials)
 {
     _settings = new RequestSettings(credentials.ApplicationName, credentials.Username, credentials.Password)
                     {
                         AutoPaging = true
                     };
 }
开发者ID:tombuildsstuff,项目名称:Mailer,代码行数:7,代码来源:GoogleContactsRepository.cs


示例8: ExportDocList

        public static void ExportDocList(string outFolder, string username, string password)
        {
            GDataCredentials credentials = new GDataCredentials(username, password);
            RequestSettings settings = new RequestSettings("GDocBackup", credentials);
            settings.AutoPaging = true;
            settings.PageSize = 100;
            DocumentsRequest request = new DocumentsRequest(settings);

            Feed<Document> feed = request.GetEverything();
            List<Document> docs = new List<Document>();
            foreach (Document entry in feed.Entries)
                docs.Add(entry);

            using (StreamWriter outFile = new StreamWriter(Path.Combine(outFolder, "doclist.txt"), false),
                outFile2 = new StreamWriter(Path.Combine(outFolder, "doclistdetails.txt"), false))
            {
                foreach (Document doc in docs)
                {
                    string s = doc.Title + "\t" + doc.ResourceId;
                    outFile.WriteLine(s);
                    outFile2.WriteLine(s);
                    foreach (string pf in doc.ParentFolders)
                        outFile2.WriteLine("\t\t\t" + pf);
                }
                outFile.Close();
                outFile2.Close();
            }
        }
开发者ID:superhafnium,项目名称:gdocbackup,代码行数:28,代码来源:TechSupport.cs


示例9: GetGoogleRequest

		private ContactsRequest GetGoogleRequest() {
			if (_googleContactRequest == null) {
				RequestSettings rs = new RequestSettings("Avega.ContactSynchronizer", GoogleAuthentication.Username, GoogleAuthentication.Password);
				rs.AutoPaging = true;
				_googleContactRequest = new ContactsRequest(rs);
			}
			return _googleContactRequest;
		}
开发者ID:yodiz,项目名称:Avega.ContactSynchronizer,代码行数:8,代码来源:GoogleContactService.cs


示例10: GContact

 public GContact(RequestSettings rs, IContact other)
 {
     //System.Windows.Forms.MessageBox.Show("Creating a new Google contact for " + other.ToString() + " in memory");
     _rs = rs;
     _item = new Google.Contacts.Contact();
     _item.AtomEntry = new Google.GData.Contacts.ContactEntry();
     MergeFrom(other);
 }
开发者ID:KrishPS,项目名称:GContactSync,代码行数:8,代码来源:GContact.cs


示例11: GridBindingSettings

 public GridBindingSettings(IGrid grid)
 {
     this.grid = grid;
     Custom = new RequestSettings();
     Edit = new RequestSettings();
     Show = new RequestSettings();
     Delete = new RequestSettings();
 }
开发者ID:VlaTo,项目名称:EmpRe.NET,代码行数:8,代码来源:GridBindingSettings.cs


示例12: Get

        public string Get()
        {
            RequestSettings settings = new RequestSettings("YOUR_APPLICATION_NAME");
            // Add authorization token.
            // ...
            ContactsRequest cr = new ContactsRequest(settings);

            return "ok";
        }
开发者ID:akkgr,项目名称:yolo,代码行数:9,代码来源:GoogleDataController.cs


示例13: Authenticate

 private bool Authenticate(string user, string pass)
 {
     _user = user;
     _pass = pass;
     _rs = new RequestSettings("GContactSync", _user, _pass);
     // AutoPaging results in automatic paging in order to retrieve all contacts
     _rs.AutoPaging = true;
     return true;
 }
开发者ID:KrishPS,项目名称:GContactSync,代码行数:9,代码来源:GoogleContactDownloader.cs


示例14: GetConfigurationContent

        public DirectoryInfo GetConfigurationContent(string resourceGroupName, string automationAccountName, string configurationName, bool? isDraft, string outputFolder, bool overwriteExistingFile)
        {
            using (var request = new RequestSettings(this.automationManagementClient))
            {
                if (isDraft != null)
                {
                    throw new NotImplementedException(string.Format(CultureInfo.CurrentCulture, Resources.ConfigurationDraftMode));
                }

                try
                {
                    var configuration = this.automationManagementClient.Configurations.GetContent(resourceGroupName, automationAccountName, configurationName);
                    if (configuration == null)
                    {
                        throw new ResourceNotFoundException(typeof(ConfigurationContent),
                            string.Format(CultureInfo.CurrentCulture, Resources.ConfigurationContentNotFound, configurationName));
                    }

                    string outputFolderFullPath = this.GetCurrentDirectory();

                    if (!string.IsNullOrEmpty(outputFolder))
                    {
                        outputFolderFullPath = this.ValidateAndGetFullPath(outputFolder);
                    }

                    var slot = (isDraft == null) ? Constants.Published : Constants.Draft;

                    const string FileExtension = ".ps1";

                    var outputFilePath = outputFolderFullPath + "\\" + configurationName + FileExtension;

                    // file exists and overwrite Not specified
                    if (File.Exists(outputFilePath) && !overwriteExistingFile)
                    {
                        throw new ArgumentException(
                                string.Format(CultureInfo.CurrentCulture, Resources.ConfigurationAlreadyExists, outputFilePath));
                    }

                    // Write to the file
                    this.WriteFile(outputFilePath, configuration.Content);

                    return new DirectoryInfo(configurationName + FileExtension);
                }
                catch (CloudException cloudException)
                {
                    if (cloudException.Response.StatusCode == HttpStatusCode.NotFound)
                    {
                        throw new ResourceNotFoundException(typeof(ConfigurationContent),
                            string.Format(CultureInfo.CurrentCulture, Resources.ConfigurationContentNotFound, configurationName));
                    }

                    throw;
                }
            }
        }
开发者ID:dulems,项目名称:azure-powershell,代码行数:55,代码来源:AutomationClientDSC.cs


示例15: ProfilesManager

        /// <summary>
        /// constructs a new ProfilesManager and authenticate using 2-Legged OAuth
        /// </summary>
        /// <param name="consumerKey">Domain's consumer key</param>
        /// <param name="consumerSecret">Domain's consumer secret</param>
        /// <param name="adminEmail">Domain administrator's email</param>
        public ProfilesManager(String consumerKey, String consumerSecret, String adminEmail) {
            String admin = adminEmail.Substring(0, adminEmail.IndexOf('@'));
            this.domain = adminEmail.Substring(adminEmail.IndexOf('@') + 1);

            RequestSettings settings =
                new RequestSettings("GoogleInc-UnshareProfilesSample-1", consumerKey,
                                    consumerSecret, admin, this.domain);
            settings.AutoPaging = true;
            this.cr = new ContactsRequest(settings);

            this.BatchSize = 100;
        }
开发者ID:Zelxin,项目名称:RPiKeg,代码行数:18,代码来源:unshare_profiles.cs


示例16: Index

 public ActionResult Index()
 {
     var webRequestManager = new HttpWebRequestManager();
     var url = Constants.ServerApi + "Users";
     var requestConfig = new RequestSettings
     {
         Method = HttpMethod.Get,
     };
     var headers = ServiceHelper.AddHeaders("application/json");
     var response = webRequestManager.GetResponse(url, requestConfig, headers, null, null);
     var result = JsonConvert.Deserialize<List<User>>(response);
     return View(result);
 }
开发者ID:nimishbhonsale,项目名称:cause2life,代码行数:13,代码来源:HomeController.cs


示例17: TestWebmasterToolsKeywordsRequest

        public void TestWebmasterToolsKeywordsRequest()
        {
            Tracing.TraceMsg("Entering Webmaster Tools Keywords RequestTest");

            RequestSettings settings = new RequestSettings("NETUnittests", this.userName, this.passWord);
            WebmasterToolsRequest f = new WebmasterToolsRequest(settings);

            Feed<Keywords> keywords = f.GetKeywords("http%3A%2F%2Fwww%2Eexample%2Ecom%2F");
            foreach (Keywords keyword in keywords.Entries)
            {
                Assert.IsTrue(keyword.AtomEntry != null, "There should be an atomentry");
            }
        }
开发者ID:Zelxin,项目名称:RPiKeg,代码行数:13,代码来源:WebmasterToolsRequestTests.cs


示例18: Delete

 public ActionResult Delete(string id)
 {
     var webRequestManager = new HttpWebRequestManager();
     var url = Constants.ServerApi + "Users/" + id ;
     var requestConfig = new RequestSettings
     {
         Method = HttpMethod.Delete,
     };
     var headers = ServiceHelper.AddHeaders("application/json");
     var response = webRequestManager.GetResponse(url, requestConfig, headers, null, null);
     var result = JsonConvert.Deserialize<User>(response);
     return RedirectToAction("Index");
 }
开发者ID:nimishbhonsale,项目名称:cause2life,代码行数:13,代码来源:HomeController.cs


示例19: AddSite

        public void AddSite()
        {
            RequestSettings settings = new RequestSettings("NETUnittests", this.userName, this.passWord);
            WebmasterToolsRequest f = new WebmasterToolsRequest(settings);

            Sites site = new Sites();
            site.AtomEntry = new AtomEntry();
            site.AtomEntry.Content.Src = "http://www.example-five.com/";
            site.AtomEntry.Content.Type = "text/plain";
            Sites newSite = f.AddSite(site);

            Assert.IsNotNull(newSite);
        }
开发者ID:david-mitchell,项目名称:MonoMac-Demo,代码行数:13,代码来源:WebmasterToolsInsertTests.cs


示例20: TestWebmasterToolsCrawlIssuesRequest

        public void TestWebmasterToolsCrawlIssuesRequest()
        {
            Tracing.TraceMsg("Entering Webmaster Tools Crawl Issues RequestTest");

            RequestSettings settings = new RequestSettings("NETUnittests", this.userName, this.passWord);
            WebmasterToolsRequest f = new WebmasterToolsRequest(settings);

            Feed<CrawlIssues> crawlIssues = f.GetCrawlIssues("http%3A%2F%2Fwww%2Eexample%2Ecom%2F");
            foreach (CrawlIssues crawlIssue in crawlIssues.Entries)
            {
                Assert.IsTrue(crawlIssue.AtomEntry != null, "There should be an atomentry");
            }
        }
开发者ID:Zelxin,项目名称:RPiKeg,代码行数:13,代码来源:WebmasterToolsRequestTests.cs



注:本文中的RequestSettings类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# RequestState类代码示例发布时间:2022-05-24
下一篇:
C# RequestSecurityToken类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap