本文整理汇总了C#中System.UriBuilder.GetComponents方法的典型用法代码示例。如果您正苦于以下问题:C# UriBuilder.GetComponents方法的具体用法?C# UriBuilder.GetComponents怎么用?C# UriBuilder.GetComponents使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.UriBuilder
的用法示例。
在下文中一共展示了UriBuilder.GetComponents方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HandlePoolEditCommand
private bool HandlePoolEditCommand(string[] input)
{
var symbol = input[2];
var url = input[3];
var user = input[4];
var coinConfig = app.EngineConfiguration.CoinConfigurations.SingleOrDefault(
c => c.PoolGroup.Id.Equals(symbol, StringComparison.OrdinalIgnoreCase)
|| c.PoolGroup.Id.ShortCoinSymbol().Equals(symbol, StringComparison.OrdinalIgnoreCase));
MiningPool poolConfig = null;
if (coinConfig == null)
{
var index = -1;
if (int.TryParse(symbol, out index))
{
index--;
var fullPoolList = GetPoolList();
if ((index >= 0) && (index < fullPoolList.Count))
{
coinConfig = fullPoolList[index].Configuration;
poolConfig = fullPoolList[index].Pool;
}
}
}
else
poolConfig = app.FindPoolConfiguration(coinConfig, url, String.Empty);
if (poolConfig != null)
{
var pass = input[5];
Uri uri = new UriBuilder(url).Uri;
poolConfig.Host = uri.GetComponents(UriComponents.AbsoluteUri & ~UriComponents.Port, UriFormat.UriEscaped);
poolConfig.Port = uri.Port;
poolConfig.Password = pass;
poolConfig.Username = user;
app.EngineConfiguration.SaveCoinConfigurations();
notificationHandler(String.Format("Pool {0} updated", url));
return true;
}
return false;
}