public ImageDescription(ImageId id, int width, int height, ImageTags tags) { Id = id; Width = width; Height = height; Tags = tags; }
public void ShouldReturnAnInstanceOfImageTags() { setRequireVariables(); ImageTags imageTags = client.ImageTags(url: imageUrl); Assert.IsInstanceOfType(imageTags, typeof(ImageTags)); }
/// <summary> /// 获取热门标签 /// </summary> /// <returns></returns> public ImageTags getImageHotTags() { string curl = @"http://static.apc.360.cn/cms/wallpaper/hot_tag.html"; //创建一个HttpWebRequest对象 req = (HttpWebRequest)HttpWebRequest.Create(curl); //设置它提交数据的方式GET req.Method = "GET"; StreamReader sr = new StreamReader(req.GetResponse().GetResponseStream()); //获取返回的数据 string Reader = Unicode2String(sr.ReadToEnd()); Reader = Reader.Replace("16", "jbtyImg").Replace("22", "jstdImg").Replace("11", "mxfsImg").Replace("10", "kxssImg").Replace("30", "aqmtImg").Replace("26", "dmktImg").Replace("15", "xqxImg").Replace("12", "qctxImg").Replace("14", "mcdwImg").Replace("5", "gameImg").Replace("9", "fjdpImg").Replace("7", "ysjzImg").Replace("6", "mnmtImg"); JavaScriptSerializer jss = new JavaScriptSerializer(); ImageTags it = jss.Deserialize <ImageTags>(Reader); return(it); }
public Result <string, ImageTags> GetTags(string imageName) { try { var imageTags = _registryClient.GetTags(imageName); var tags = new ImageTags() { ImageName = imageTags.Name, TagList = imageTags.Tags }; return(Result <string, ImageTags> .ForRight(tags)); } catch (Exception ex) { _logger.LogError("can't get tags for image: {0} - : ", imageName, ex); return(Result <string, ImageTags> .ForLeft("can't get tags for image: " + imageName)); } }
public ImageDescription WithoutTags(ImageTags tags) => new ImageDescription(Id, Width, Height, Tags & ~tags);
public ImageDescription WithAdditionalTags(ImageTags tags) => new ImageDescription(Id, Width, Height, Tags | tags);
public ImageDescription(ImageId id, int size, ImageTags tags) : this(id, size, size, tags) { }
public ImageDescription(ImageId id, ImageTags tags) : this(id, 0, 0, tags) { }
public static object GetImage( this IImageService imageService, ImageId id, int size, ImageTags tags = ImageTags.None) => imageService.GetImage(new ImageDescription(id, size, tags));
public string GetTagString() { var combined = string.Join(",", ImageTags.Select(el => el.Name)); return(combined); }
public static object GetImage(this IImageService imageService, OverviewMarginImageId imageId, ImageTags imageTags = default) => imageService.GetImage(new ImageDescription(new ImageId(CatalogId, (int)imageId), 16, imageTags));