本文整理汇总了C#中SirenOfShame.Lib.Settings.SirenOfShameSettings.GetSosOnlineProxy方法的典型用法代码示例。如果您正苦于以下问题:C# SirenOfShameSettings.GetSosOnlineProxy方法的具体用法?C# SirenOfShameSettings.GetSosOnlineProxy怎么用?C# SirenOfShameSettings.GetSosOnlineProxy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SirenOfShame.Lib.Settings.SirenOfShameSettings
的用法示例。
在下文中一共展示了SirenOfShameSettings.GetSosOnlineProxy方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: VerifyCredentialsAsync
public virtual void VerifyCredentialsAsync(SirenOfShameSettings settings, Action onSuccess, Action<string, Exception> onFail)
{
WebClientXml webClientXml = new WebClientXml();
AddSosOnlineCredentials(settings, webClientXml);
webClientXml.UploadValuesAndReturnXmlAsync(SOS_URL + "/ApiV1/VerifyCredentials", doc =>
{
string success = doc.Descendants("Success").First().Value;
if (success == "true")
{
onSuccess();
}
else
{
string errorMessage = doc.Descendants("ErrorMessage").First().Value;
onFail(errorMessage, null);
}
}, OnConnectionFail(onFail), settings.GetSosOnlineProxy());
}
示例2: BuildStatusChanged
public virtual void BuildStatusChanged(SirenOfShameSettings settings, IList<BuildStatus> changedBuildStatuses)
{
WebClientXml webClientXml = new WebClientXml();
AddSosOnlineCredentials(settings, webClientXml);
string json = JsonConvert.SerializeObject(changedBuildStatuses);
webClientXml.Add("ChangedBuildStatuses", json);
if (settings.SoftwareInstanceId.HasValue)
webClientXml.Add("SoftwareInstanceId", settings.SoftwareInstanceId.Value.ToString(CultureInfo.InvariantCulture));
const string url = SOS_URL + "/ApiV1/BuildStatusChangedV1";
webClientXml.UploadValuesAndReturnXmlAsync(url,
doc =>
{
string success = doc.Descendants("Success").First().Value;
if (success != "true")
{
string errorMessage = doc.Descendants("ErrorMessage").First().Value;
_log.Error("Error publishing to: " + url + " error: " + errorMessage);
}
}, ex => _log.Error("Error publishing to: " + url, ex), settings.GetSosOnlineProxy());
}
示例3: BuildStatusChanged
public virtual void BuildStatusChanged(SirenOfShameSettings settings, IList<BuildStatus> changedBuildStatuses, List<InstanceUserDto> changedUsers)
{
WebClientXml webClientXml = new WebClientXml();
AddSosOnlineCredentials(settings, webClientXml);
webClientXml.Add("ChangedBuildStatuses", JsonConvert.SerializeObject(changedBuildStatuses));
webClientXml.Add("ChangedUsers", JsonConvert.SerializeObject(changedUsers));
if (settings.SoftwareInstanceId.HasValue)
webClientXml.Add("SoftwareInstanceId", settings.SoftwareInstanceId.Value.ToString(CultureInfo.InvariantCulture));
string url = SOS_URL + "/ApiV1/BuildStatusChangedV1";
webClientXml.UploadValuesAndReturnStringAsync(url, ReadResult, ex => _log.Error("Error publishing to: " + url, ex), settings.GetSosOnlineProxy());
}
示例4: SendMessage
public virtual void SendMessage(SirenOfShameSettings settings, string message)
{
WebClientXml webClientXml = new WebClientXml();
AddSosOnlineCredentials(settings, webClientXml);
webClientXml.Add("Message", message);
webClientXml.UploadValuesAndReturnXmlAsync(SOS_URL + "/ApiV1/AddMessage", doc =>
{
string success = doc.Descendants("Success").First().Value;
if (success == "true")
{
_log.Debug("Message successfully added");
}
else
{
string errorMessage = doc.Descendants("ErrorMessage").First().Value;
_log.Error("Failed to add message: " + errorMessage);
}
}, OnConnectionFail, settings.GetSosOnlineProxy());
}
示例5: Synchronize
public virtual void Synchronize(SirenOfShameSettings settings, string exportedBuilds, string exportedAchievements, Action<DateTime> onSuccess, Action<string, Exception> onFail)
{
WebClientXml webClientXml = new WebClientXml();
AddSosOnlineCredentials(settings, webClientXml);
webClientXml.Add("Builds", exportedBuilds);
webClientXml.Add("Achievements", exportedAchievements);
if (settings.SoftwareInstanceId.HasValue)
webClientXml.Add("SoftwareInstanceId", settings.SoftwareInstanceId.Value.ToString(CultureInfo.InvariantCulture));
webClientXml.UploadValuesAndReturnXmlAsync(SOS_URL + "/ApiV1/Synchronize", doc =>
{
string success = doc.Descendants("Success").First().Value;
if (success == "true")
{
string newHighWaterMarkStr = doc.Descendants("NewHighWaterMark").First().Value;
DateTime newHighWaterMark = new DateTime(long.Parse(newHighWaterMarkStr));
onSuccess(newHighWaterMark);
}
else
{
string errorMessage = doc.Descendants("ErrorMessage").First().Value;
onFail(errorMessage, null);
}
}, ex => onFail("Failed to connect to SoS Online", ex), settings.GetSosOnlineProxy());
}
示例6: BuildStatusChanged
public virtual void BuildStatusChanged(SirenOfShameSettings settings, IList<BuildStatus> changedBuildStatuses)
{
WebClientXml webClientXml = new WebClientXml();
AddSosOnlineCredentials(settings, webClientXml);
string json = JsonConvert.SerializeObject(changedBuildStatuses);
webClientXml.Add("ChangedBuildStatuses", json);
if (settings.SoftwareInstanceId.HasValue)
webClientXml.Add("SoftwareInstanceId", settings.SoftwareInstanceId.Value.ToString(CultureInfo.InvariantCulture));
const string url = SOS_URL + "/ApiV1/BuildStatusChangedV1";
webClientXml.UploadValuesAndReturnStringAsync(url,
resultsStr =>
{
var result = JsonConvert.DeserializeObject<ApiResultBase>(resultsStr);
if (!result.Success)
{
string errorMessage = result.Message;
_log.Error("Error publishing to: " + url + " error: " + errorMessage);
}
}, ex => _log.Error("Error publishing to: " + url, ex), settings.GetSosOnlineProxy());
}
示例7: SendNewCustomImages
private void SendNewCustomImages(SirenOfShameSettings settings, List<InstanceUserDto> changedUsers)
{
var changedPeople = changedUsers
.Select(changedUser => settings.FindPersonByRawName(changedUser.RawName))
.Where(person => person != null);
var changedPeopleWithUnUploadedCustomImages = changedPeople
.Where(i => !string.IsNullOrEmpty(i.AvatarImageName) && !i.AvatarImageUploaded);
foreach (var person in changedPeopleWithUnUploadedCustomImages)
{
var webClientXml = new WebClientXml();
AddSosOnlineCredentials(settings, webClientXml);
webClientXml.Add("AvatarImageName", person.AvatarImageName);
var avatarImagePath = SirenOfShameSettings.GetAvatarImagePath(person.AvatarImageName);
var imageAsBytes = File.ReadAllBytes(avatarImagePath);
var imageAsString = Convert.ToBase64String(imageAsBytes);
webClientXml.Add("AvatarImage", imageAsString);
string url = SOS_URL + "/ApiV1/AddImage";
var person1 = person;
webClientXml.UploadValuesAndReturnStringAsync(url, s => _log.Debug("Uploaded " + person1.AvatarImageName), ex => _log.Error("Error uploading image for " + person1.AvatarImageName), settings.GetSosOnlineProxy());
person.AvatarImageUploaded = true;
settings.Save();
}
}