本文整理汇总了C#中System.UriBuilder.AppendUsageCommonFields方法的典型用法代码示例。如果您正苦于以下问题:C# UriBuilder.AppendUsageCommonFields方法的具体用法?C# UriBuilder.AppendUsageCommonFields怎么用?C# UriBuilder.AppendUsageCommonFields使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.UriBuilder
的用法示例。
在下文中一共展示了UriBuilder.AppendUsageCommonFields方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateGetRecommendedChannelsUri
/// <summary>
/// Creates the get recommended channels URI.
/// </summary>
/// <param name="connection">The server connection.</param>
/// <returns></returns>
public static Uri CreateGetRecommendedChannelsUri(this IServerConnection connection)
{
var uriBuilder = new UriBuilder("https://api.douban.com/v2/fm/app_channels");
uriBuilder.AppendUsageCommonFields(connection);
// ReSharper disable once StringLiteralTypo
uriBuilder.AppendQuery(StringTable.IconCategory, "xlarge");
return uriBuilder.Uri;
}
示例2: CreateGetPlayListUri
/// <summary>
/// Creates the get play list URI.
/// </summary>
/// <param name="connection">The server connection.</param>
/// <param name="channelId">The channel ID.</param>
/// <param name="type">The report type.</param>
/// <param name="sid">The SID of current song.</param>
/// <param name="start">The start song code.</param>
/// <param name="formats">The format of music file.</param>
/// <param name="kbps">The bit rate of music file.</param>
/// <param name="playedTime">The played time of current song.</param>
/// <param name="mode">The mode.</param>
/// <param name="excludedSids">The excluded SIDs.</param>
/// <param name="max">The maximum size of returned play list.</param>
/// <returns></returns>
public static Uri CreateGetPlayListUri(this IServerConnection connection, int channelId, ReportType type, string sid, string start, string formats, int? kbps, double? playedTime, string mode, IEnumerable<string> excludedSids, int? max)
{
var uriBuilder = new UriBuilder("https://api.douban.com/v2/fm/playlist");
uriBuilder.AppendUsageCommonFields(connection);
uriBuilder.AppendQuery(StringTable.Channel, channelId.ToString(CultureInfo.InvariantCulture));
uriBuilder.AppendQuery(StringTable.Type, ReportTypeString.GetString(type));
uriBuilder.AppendQuery(StringTable.Sid, sid);
uriBuilder.AppendQuery(StringTable.Start, start); // If start song code is not empty, then the first song returned will always be the same one.
uriBuilder.AppendQuery(StringTable.Formats, formats);
uriBuilder.AppendQuery(StringTable.Kbps, kbps?.ToString(CultureInfo.InvariantCulture));
uriBuilder.AppendQuery(StringTable.PlayedTime, playedTime?.ToString("F1", CultureInfo.InvariantCulture));
uriBuilder.AppendQuery(StringTable.Mode, mode);
uriBuilder.AppendQuery(StringTable.Exclude, excludedSids == null ? null : String.Join(",", excludedSids));
uriBuilder.AppendQuery(StringTable.Max, max?.ToString(CultureInfo.InvariantCulture));
return uriBuilder.Uri;
}
示例3: CreateGetChannelInfoUri
/// <summary>
/// Creates the get channel info URI.
/// </summary>
/// <param name="connection">The server connection.</param>
/// <param name="channelId">The channel ID.</param>
/// <returns></returns>
public static Uri CreateGetChannelInfoUri(this IServerConnection connection, int channelId)
{
var uriBuilder = new UriBuilder("https://api.douban.com/v2/fm/channel_info");
uriBuilder.AppendUsageCommonFields(connection);
uriBuilder.AppendQuery(StringTable.Id, channelId.ToString(CultureInfo.InvariantCulture));
return uriBuilder.Uri;
}
示例4: CreateGetSongUrlUri
/// <summary>
/// Creates the get song URL URI.
/// </summary>
/// <param name="connection">The server connection.</param>
/// <param name="sid">The SID of the song.</param>
/// <param name="ssid">The SSID of the song.</param>
/// <returns></returns>
public static Uri CreateGetSongUrlUri(this IServerConnection connection, string sid, string ssid)
{
var uriBuilder = new UriBuilder("https://api.douban.com/v2/fm/song_url");
uriBuilder.AppendUsageCommonFields(connection);
uriBuilder.AppendQuery(StringTable.Sid, sid);
uriBuilder.AppendQuery(StringTable.Ssid, ssid);
return uriBuilder.Uri;
}
示例5: CreateSearchChannelUri
/// <summary>
/// Creates the search channel URI.
/// </summary>
/// <param name="connection">The server connection.</param>
/// <param name="query">The query.</param>
/// <param name="start">The preferred index of the first channel in the returned channel array.</param>
/// <param name="size">The max size of returned channel array.</param>
/// <returns></returns>
public static Uri CreateSearchChannelUri(this IServerConnection connection, string query, int start, int size)
{
var uriBuilder = new UriBuilder("https://api.douban.com/v2/fm/search/channel");
uriBuilder.AppendUsageCommonFields(connection);
uriBuilder.AppendQuery(StringTable.Query, query);
uriBuilder.AppendQuery(StringTable.Start, start.ToString(CultureInfo.InvariantCulture));
uriBuilder.AppendQuery(StringTable.Limit, size.ToString(CultureInfo.InvariantCulture));
return uriBuilder.Uri;
}