本文整理汇总了C#中ImageSize.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# ImageSize.ToString方法的具体用法?C# ImageSize.ToString怎么用?C# ImageSize.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ImageSize
的用法示例。
在下文中一共展示了ImageSize.ToString方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SearchGalleryAdvancedRequest
/// <exception cref="ArgumentNullException">
/// Thrown when a null reference is passed to a method that does not accept it as a
/// valid argument.
/// </exception>
internal string SearchGalleryAdvancedRequest(string url,
string qAll = null, string qAny = null,
string qExactly = null, string qNot = null,
ImageFileType? fileType = null, ImageSize? imageSize = null)
{
if (string.IsNullOrWhiteSpace(url))
throw new ArgumentNullException(nameof(url));
if (string.IsNullOrWhiteSpace(qAll) &&
string.IsNullOrWhiteSpace(qAny) &&
string.IsNullOrWhiteSpace(qExactly) &&
string.IsNullOrWhiteSpace(qNot))
throw new ArgumentNullException(null,
"At least one search parameter must be provided (All | Any | Exactly | Not).");
var query = new StringBuilder();
if (!string.IsNullOrWhiteSpace(qAll))
query.Append($"&q_all={WebUtility.UrlEncode(qAll)}");
if (!string.IsNullOrWhiteSpace(qAny))
query.Append($"&q_any={WebUtility.UrlEncode(qAny)}");
if (!string.IsNullOrWhiteSpace(qExactly))
query.Append($"&q_exactly={WebUtility.UrlEncode(qExactly)}");
if (!string.IsNullOrWhiteSpace(qNot))
query.Append($"&q_not={WebUtility.UrlEncode(qNot)}");
if (fileType != null)
query.Append($"&q_type={WebUtility.UrlEncode(fileType.ToString().ToLower())}");
if (imageSize != null)
query.Append($"&q_size_px={WebUtility.UrlEncode(imageSize.ToString().ToLower())}");
return $"{url}?{query}".Replace("?&", "?");
}
示例2: GetArtistArt
public static string GetArtistArt(string baseUrl, ImageSize size, string apiKey, string artist)
{
//artist = GetArtistCorrection(baseUrl, apiKey, artist);
Dictionary<string, string> parameters = new Dictionary<string, string>();
parameters["method"] = "artist.getInfo";
parameters["api_key"] = apiKey;
parameters["artist"] = artist;
XmlDocument xml = GetResponse(GetUrl(baseUrl, parameters));
if (xml != null) {
XmlNodeList xnList = xml.SelectNodes("/lfm/artist/image");
foreach (XmlNode xn in xnList) {
if (xn.Attributes["size"].Value == size.ToString())
return xn.InnerText;
}
}
return string.Empty;
}
示例3: AssertUserProfileImage
// test helpers
private void AssertUserProfileImage(ImageSize imageSize)
{
HttpHeaders responseHeaders = new HttpHeaders();
responseHeaders.ContentType = MediaType.IMAGE_PNG;
mockServer.ExpectNewRequest()
.AndExpectUri("https://api.twitter.com/1/users/profile_image/brbaia?size=" + imageSize.ToString().ToLowerInvariant())
.AndExpectMethod(HttpMethod.GET)
.AndRespondWith(new AssemblyResource("assembly://Spring.Social.Twitter.Tests/Spring.Social.Twitter.Api.Impl/Logo.png"), responseHeaders);
#if NET_4_0 || SILVERLIGHT_5
twitter.UserOperations.GetUserProfileImageAsync("brbaia", imageSize).Wait();
#else
twitter.UserOperations.GetUserProfileImage("brbaia", imageSize);
#endif
// TODO: Fix ResponseCreators to handle binary data so that we can assert the contents/size of the image bytes.
}
示例4: GetUserProfileImageAsync
public Task<byte[]> GetUserProfileImageAsync(string screenName, ImageSize size)
{
return this.restTemplate.GetForObjectAsync<byte[]>(
"users/profile_image/{screenName}?size={size}", screenName, size.ToString().ToLowerInvariant());
}
示例5: SetImageSize
/// <summary>
/// Sets the image size. Camera must be reset afterwards.
/// </summary>
public void SetImageSize (ImageSize ImageSize)
{
this.EmptyBuffers ();
if (this.uart.OutputToConsole)
Console.Out.WriteLine ("SetImageSize(" + ImageSize.ToString () + ")");
this.uart.Transmit (0x56, 0x00, 0x31, 0x05, 0x04, 0x01, 0x00, 0x19, (byte)ImageSize);
this.uart.ReceiveAndVerify (0x76, 0x00, 0x31, 0x00, 0x00);
}
示例6: ConvertToImageSizeName
private ImageSizeName ConvertToImageSizeName(ImageSize size)
{
switch (size)
{
case PostHtmlEditing.ImageSize.Small:
return ImageSizeName.Small;
case PostHtmlEditing.ImageSize.Medium:
return ImageSizeName.Medium;
case PostHtmlEditing.ImageSize.Large:
return ImageSizeName.Large;
case PostHtmlEditing.ImageSize.Original:
return ImageSizeName.Full;
case PostHtmlEditing.ImageSize.Unknown:
return ImageSizeName.Custom;
default:
Debug.Fail("Unknown image size: " + size.ToString());
return ImageSizeName.Full;
}
}