本文整理汇总了C#中RequestSettings类的典型用法代码示例。如果您正苦于以下问题:C# RequestSettings类的具体用法?C# RequestSettings怎么用?C# RequestSettings使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RequestSettings类属于命名空间,在下文中一共展示了RequestSettings类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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 ---");
}
示例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);
}
示例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;
}
}
}
示例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);
}
示例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);
}
示例7: GoogleContactsRepository
public GoogleContactsRepository(AbstractContactsConfiguration credentials)
{
_settings = new RequestSettings(credentials.ApplicationName, credentials.Username, credentials.Password)
{
AutoPaging = true
};
}
示例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();
}
}
示例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;
}
示例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);
}
示例11: GridBindingSettings
public GridBindingSettings(IGrid grid)
{
this.grid = grid;
Custom = new RequestSettings();
Edit = new RequestSettings();
Show = new RequestSettings();
Delete = new RequestSettings();
}
示例12: Get
public string Get()
{
RequestSettings settings = new RequestSettings("YOUR_APPLICATION_NAME");
// Add authorization token.
// ...
ContactsRequest cr = new ContactsRequest(settings);
return "ok";
}
示例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;
}
示例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;
}
}
}
示例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;
}