本文整理汇总了C#中System.Net.Http.HttpClient.Split方法的典型用法代码示例。如果您正苦于以下问题:C# HttpClient.Split方法的具体用法?C# HttpClient.Split怎么用?C# HttpClient.Split使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Net.Http.HttpClient
的用法示例。
在下文中一共展示了HttpClient.Split方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestSendingEmailAndPhoneCall
internal void TestSendingEmailAndPhoneCall()
{
Console.WriteLine("TestSendingEmail started.");
Utils.Logger.Info("TestSendingEmail() START");
DailyMorningTimer_Elapsed(null);
//string biduDelayedPriceCSV = new WebClient().DownloadString("http://download.finance.yahoo.com/d/quotes.csv?s=BIDU&f=sl1d1t1c1ohgv&e=.csv");
//string biduDelayedPriceCSV = new WebClient().DownloadString("http://finance.yahoo.com/d/quotes.csv?s=BIDU&f=sl1d1t1c1ohgv&e=.csv");
var biduDelayedPriceCSV = new HttpClient().GetStringAsync("http://finance.yahoo.com/d/quotes.csv?s=BIDU&f=sl1d1t1c1ohgv&e=.csv").Result;
string[] biduDelayedPriceSplit = biduDelayedPriceCSV.Split(new char[] { ',', ' ' });
double realTimePrice = Double.Parse(biduDelayedPriceSplit[1]);
double dailyChange = Double.Parse(biduDelayedPriceSplit[4]);
double yesterdayClose = realTimePrice - dailyChange;
double todayPercentChange = realTimePrice / yesterdayClose - 1;
Console.WriteLine("BIDU %change: " + (todayPercentChange * 100).ToString("0.00") + @"%");
Utils.Logger.Info("BIDU %change: " + (todayPercentChange * 100).ToString("0.00") + @"%");
//if (Math.Abs(todayPercentChange) >= 0.04)
if (Math.Abs(todayPercentChange) >= 0.00)
{
new Email { ToAddresses = Utils.Configuration["EmailGyantal"], Subject = "OvermindServer: BIDU price % move", Body = "BIDU price % move. In percentage: " + (todayPercentChange * 100).ToString("0.00") + @"%", IsBodyHtml = false }.Send();
Console.WriteLine("Email was sent.");
Utils.Logger.Info("Email was sent.");
var call = new PhoneCall
{
FromNumber = Caller.Gyantal,
ToNumber = PhoneCall.PhoneNumbers[Caller.Gyantal],
Message = "This is a warning notification from SnifferQuant. There's a large up or down movement in the ticker B I D U. ... I repeat the ticker: B I D U.",
NRepeatAll = 2
};
// skipped temporarily
bool phoneCallSuccess = call.MakeTheCall();
Console.WriteLine("Phonecall success: " + phoneCallSuccess);
Utils.Logger.Info("Phonecall success: " + phoneCallSuccess);
}
Console.WriteLine("TestSendingEmail Finished.");
Utils.Logger.Info("TestSendingEmail() END");
}
示例2: GetTodayPctChange
private static double GetTodayPctChange(string p_ticker)
{
Utils.Logger.Trace("GetTodayPctChange(): " + p_ticker);
var biduDelayedPriceCSV = new HttpClient().GetStringAsync("http://download.finance.yahoo.com/d/quotes.csv?s=" + p_ticker + "&f=sl1d1t1c1ohgv&e=.csv").Result;
Utils.Logger.Trace("HttpClient().GetStringAsync returned: " + biduDelayedPriceCSV);
string[] biduDelayedPriceSplit = biduDelayedPriceCSV.Split(new char[] { ',', ' ' });
double realTimePrice = Double.Parse(biduDelayedPriceSplit[1]);
double dailyChange = Double.Parse(biduDelayedPriceSplit[4]);
double yesterdayClose = realTimePrice - dailyChange;
double todayPercentChange = realTimePrice / yesterdayClose - 1;
return todayPercentChange;
}