示例#1
0
        /// <summary>
        /// Get current work img url.
        /// </summary>
        /// <param name="type">Size type of img</param>
        /// <param name="proxy">Proxy to fetch img resource</param>
        /// <param name="square">if crop to square or not</param>
        /// <returns></returns>
        /// <exception cref="ArgumentOutOfRangeException"></exception>
        public string GetUrl(SizeType type = SizeType.Small, bool square = false, string proxy = "i.pixiv.cat")
        {
            var datePath       = UploadDate.ToString("yyyy/MM/dd/HH/mm/ss");
            var resizeDsc      = square ? "square" : "master";
            var extension      = type == SizeType.Original ? Ext : "jpg";
            var sizeDsc        = "";
            var imgSizeTypeDsc = type == SizeType.Original ? "img-original" : "img-master";

            switch (type)
            {
            case SizeType.Original:
            case SizeType.Regular:
                sizeDsc = imgSizeTypeDsc;
                break;

            case SizeType.Small:
                sizeDsc = $"c/540x540_70/{imgSizeTypeDsc}";
                break;

            case SizeType.Thumb:
                sizeDsc = $"c/250x250_80_a2/{imgSizeTypeDsc}";
                break;

            case SizeType.Mini:
                sizeDsc = $"c/48x48/{imgSizeTypeDsc}";
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(type), type, null);
            }
            var suffixAppend = resizeDsc.IsNullOrEmpty() ? "" : $"_{resizeDsc}1200";

            return
                ($"https://{proxy}/{sizeDsc}/img/{datePath}/{Pid}_p{P}{suffixAppend}.{extension}");
        }
示例#2
0
 public override int GetHashCode()
 {
     return(Id.GetHashCode() +
            Name.GetHashCode() +
            Description.GetHashCode() +
            Source.GetHashCode() +
            Target.GetHashCode() +
            ConfidenceViolation.GetHashCode() +
            IntegrityViolation.GetHashCode() +
            AccessViolation.GetHashCode() +
            UploadDate.GetHashCode() +
            LastModificationDate.GetHashCode());
 }
示例#3
0
 public bool Equals(Threat other)
 {
     return(LastModificationDate.Equals(other.LastModificationDate) &&
            Id == other.Id &&
            Name.Equals(other.Name) &&
            Description.Equals(other.Description) &&
            Source.Equals(other.Source) &&
            Target.Equals(other.Target) &&
            ConfidenceViolation == other.ConfidenceViolation &&
            IntegrityViolation == other.IntegrityViolation &&
            AccessViolation == other.AccessViolation &&
            UploadDate.Equals(other.UploadDate));
 }
示例#4
0
 /// <summary>
 ///Return Image Name and Creation Date String.
 /// </summary>
 public override string ToString()
 {
     return(string.Format("{0} {1}", Name, UploadDate.ToString()));
 }