Exemple #1
0
        private string GetImage(ImageSize size, string color, int view)
        {
            string tmp    = "";
            bool   isicon = (size.ToString().ToLower() == "icon");

            if (color == "" && view == 0)
            {
                tmp = AppLogic.LookupImage("product", _ProductID, size.ToString().ToLower(), _SkinID, _Locale);
            }
            else
            {
                tmp = AppLogic.LookupProductImageByNumberAndColor(_ProductID, _SkinID, _ImageFileNameOverride, _SKU, _Locale, view, color, size.ToString().ToLower());
            }
            return(tmp);
        }
Exemple #2
0
        /// <summary>
        /// Returns the list view item for the module list.
        /// </summary>
        /// <returns>ListViewItem</returns>
        public ListViewItem GetListViewItem()
        {
            var listViewItem = new ListViewItem(ModuleName);

            listViewItem.SubItems.Add(ImageBase.ToString("X8"));
            listViewItem.SubItems.Add(ImageSize.ToString("X8"));
            listViewItem.SubItems.Add(ModulePath);
            listViewItem.Tag = this;

            return(listViewItem);
        }
Exemple #3
0
        /// <summary>
        /// Returns the list view item for the driver list.
        /// </summary>
        /// <returns>ListViewItem</returns>
        public ListViewItem GetListViewItem()
        {
            var listViewItem = new ListViewItem(FullPathName.Substring(OffsetToFileName));

            listViewItem.SubItems.Add(ImageBase.ToString("X8"));
            listViewItem.SubItems.Add(ImageSize.ToString("X8"));
            listViewItem.SubItems.Add(FullPathName);
            listViewItem.Tag = this;

            return(listViewItem);
        }
Exemple #4
0
        /// <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);
        }
        private async Task <bool> ProcessPhoto(Image image, string name, string originalName, ImageSize imageSize)
        {
            using (var memoryStream = new MemoryStream())
            {
                var processedImage = await _photoService.ProcessPhotoAsync(memoryStream, image, imageSize);

                var blobPath = $"{name}/{imageSize.ToString().ToLowerInvariant()}.png";

                await _blobService.UploadPhotoStreamAsync(memoryStream, blobPath);

                var blobProperties = await _blobService.GetBlobPropertiesAsync($"{name}/{originalName}");

                blobProperties.Metadata.TryGetValue("UserId", out var userId);

                var result = await _blobService.SetBlobPropertiesAsync(blobProperties, blobPath, userId);

                if (result != null)
                {
                    return(true);
                }
            }
            return(false);
        }
        /// <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("?&", "?");
        }
Exemple #7
0
        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);
            }
        }
 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;
     }
 }
Exemple #9
0
        public IList <IImageResult> Search2(string query, ImageSize imageSize)
        {
            IList <IImageResult> Results = gimC.Search(query, GImSearchSettings.Count, imageSize.ToString().ToLower(), GImSearchSettings.Coloriztion.ToString().ToLower(), GImSearchSettings.Imtype.ToString().ToLower(), GImSearchSettings.FileTypeStr);


            return(Results);
        }
Exemple #10
0
        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;
        }
Exemple #11
0
 public static string ToSuffix(this ImageSize imageSize)
 {
     return($"!{imageSize.ToString().ToLower()}");
 }
Exemple #12
0
        public Dictionary <string, Tuple <string, string> > Diff(AudioTag other)
        {
            var output = new Dictionary <string, Tuple <string, string> >();

            if (!IsValid || !other.IsValid)
            {
                return(output);
            }

            if (Title != other.Title)
            {
                output.Add("Title", Tuple.Create(Title, other.Title));
            }

            if ((Performers != null && Performers.Any()) ^
                (other.Performers != null && other.Performers.Any()) || (
                    other.Performers != null && other.Performers.Any() &&
                    Performers != null && Performers.Any() &&
                    !Performers.SequenceEqual(other.Performers)))
            {
                var oldValue = Performers != null && Performers.Any() ? string.Join(" / ", Performers) : null;
                var newValue = other.Performers != null && other.Performers.Any() ? string.Join(" / ", other.Performers) : null;

                output.Add("Artist", Tuple.Create(oldValue, newValue));
            }

            if (Album != other.Album && other.Album != null)
            {
                output.Add("Album", Tuple.Create(Album, other.Album));
            }

            if ((AlbumArtists != null && AlbumArtists.Any()) ^
                (other.AlbumArtists != null && other.AlbumArtists.Any()) || (
                    other.AlbumArtists != null && other.AlbumArtists.Any() &&
                    AlbumArtists != null && AlbumArtists.Any() &&
                    !AlbumArtists.SequenceEqual(other.AlbumArtists)))
            {
                var oldValue = AlbumArtists != null && AlbumArtists.Any() ? string.Join(" / ", AlbumArtists) : null;
                var newValue = other.AlbumArtists != null && other.AlbumArtists.Any() ? string.Join(" / ", other.AlbumArtists) : null;

                output.Add("Album Artist", Tuple.Create(oldValue, newValue));
            }

            if (Track != other.Track)
            {
                output.Add("Track", Tuple.Create(Track.ToString(), other.Track.ToString()));
            }

            if (TrackCount != other.TrackCount)
            {
                output.Add("Track Count", Tuple.Create(TrackCount.ToString(), other.TrackCount.ToString()));
            }

            if (Disc != other.Disc)
            {
                output.Add("Disc", Tuple.Create(Disc.ToString(), other.Disc.ToString()));
            }

            if (DiscCount != other.DiscCount)
            {
                output.Add("Disc Count", Tuple.Create(DiscCount.ToString(), other.DiscCount.ToString()));
            }

            if (Media != other.Media)
            {
                output.Add("Media Format", Tuple.Create(Media, other.Media));
            }

            if (Date != other.Date)
            {
                var oldValue = Date.HasValue ? Date.Value.ToString("yyyy-MM-dd") : null;
                var newValue = other.Date.HasValue ? other.Date.Value.ToString("yyyy-MM-dd") : null;
                output.Add("Date", Tuple.Create(oldValue, newValue));
            }

            if (OriginalReleaseDate != other.OriginalReleaseDate)
            {
                // Id3v2.3 tags can only store the year, not the full date
                if (OriginalReleaseDate.HasValue &&
                    OriginalReleaseDate.Value.Month == 1 &&
                    OriginalReleaseDate.Value.Day == 1)
                {
                    if (OriginalReleaseDate.Value.Year != other.OriginalReleaseDate.Value.Year)
                    {
                        output.Add("Original Year", Tuple.Create(OriginalReleaseDate.Value.Year.ToString(), other.OriginalReleaseDate.Value.Year.ToString()));
                    }
                }
                else
                {
                    var oldValue = OriginalReleaseDate.HasValue ? OriginalReleaseDate.Value.ToString("yyyy-MM-dd") : null;
                    var newValue = other.OriginalReleaseDate.HasValue ? other.OriginalReleaseDate.Value.ToString("yyyy-MM-dd") : null;
                    output.Add("Original Release Date", Tuple.Create(oldValue, newValue));
                }
            }

            if (Publisher != other.Publisher)
            {
                output.Add("Label", Tuple.Create(Publisher, other.Publisher));
            }

            if ((Genres != null && Genres.Any()) ^
                (other.Genres != null && other.Genres.Any()) || (
                    other.Genres != null && other.Genres.Any() &&
                    Genres != null && Genres.Any() &&
                    !Genres.SequenceEqual(other.Genres)))
            {
                var oldValue = Genres != null && Genres.Any() ? string.Join(" / ", Genres) : null;
                var newValue = other.Genres != null && other.Genres.Any() ? string.Join(" / ", other.Genres) : null;

                output.Add("Genres", Tuple.Create(oldValue, newValue));
            }

            if (ImageSize != other.ImageSize)
            {
                output.Add("Image Size", Tuple.Create(ImageSize.ToString(), other.ImageSize.ToString()));
            }

            return(output);
        }
Exemple #13
0
        private static string GetImageSizeAsFirstLetterNotation(ImageSize size)
        {
            var imageSizeName = size.ToString().ToUpper();

            return(imageSizeName[0].ToString());
        }
Exemple #14
0
 private string ImagePathMaker(string serverPath, string imageName, ImageSize imageSize)
 {
     return(serverPath + "/" + imageSize.ToString() + "/" + imageName + "." + ImageExtension.jpeg);
 }
	    // 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. 
	    }
        /// <include file='doc\ImageList.uex' path='docs/doc[@for="ImageList.ToString"]/*' />
        /// <devdoc>
        ///     Returns a string representation for this control.
        /// </devdoc>
        /// <internalonly/>
        public override string ToString()
        {
            string s = base.ToString();

            if (Images != null)
            {
                return(s + " Images.Count: " + Images.Count.ToString() + ", ImageSize: " + ImageSize.ToString());
            }
            else
            {
                return(s);
            }
        }
 public Task<byte[]> GetUserProfileImageAsync(string screenName, ImageSize size) 
 {
     return this.restTemplate.GetForObjectAsync<byte[]>(
         "users/profile_image/{screenName}?size={size}", screenName, size.ToString().ToLowerInvariant());
 }
 public RestOperationCanceler GetUserProfileImageAsync(string screenName, ImageSize size, Action<RestOperationCompletedEventArgs<byte[]>> operationCompleted)
 {
     return this.restTemplate.GetForObjectAsync<byte[]>(
         "users/profile_image/{screenName}?size={size}", operationCompleted, screenName, size.ToString().ToLowerInvariant());
 }
		/// <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);
		}