TraktPlugin.GUI.GUIImageHandler.GetTextureIdentFromFile C# (CSharp) Méthode

GetTextureIdentFromFile() public static méthode

Gets a MediaPortal texture identifier from filename
public static GetTextureIdentFromFile ( string filename ) : string
filename string Filename to generate texture
Résultat string
        public static string GetTextureIdentFromFile(string filename)
        {
            return GetTextureIdentFromFile(filename, string.Empty);
        }

Same methods

GUIImageHandler::GetTextureIdentFromFile ( string filename, string suffix ) : string

Usage Example

        /// <summary>
        /// Loads an Image from memory into a facade item
        /// </summary>
        /// <param name="imageFilePath">Filename of image</param>
        protected void SetImageToGui(string imageFilePath)
        {
            if (string.IsNullOrEmpty(imageFilePath))
            {
                return;
            }

            // determine the overlays to add to poster
            var mainOverlay = MainOverlayImage.None;

            if (Season.IsWatchlisted(Show))
            {
                mainOverlay = MainOverlayImage.Watchlist;
            }
            else if (Season.IsWatched(Show))
            {
                mainOverlay = MainOverlayImage.Seenit;
            }

            // add additional overlay if applicable
            if (Season.IsCollected(Show))
            {
                mainOverlay |= MainOverlayImage.Library;
            }

            RatingOverlayImage ratingOverlay = GUIImageHandler.GetRatingOverlay(Season.UserRating(Show));

            // get a reference to a MediaPortal Texture Identifier
            string suffix  = Enum.GetName(typeof(MainOverlayImage), mainOverlay) + Enum.GetName(typeof(RatingOverlayImage), ratingOverlay);
            string texture = GUIImageHandler.GetTextureIdentFromFile(imageFilePath, suffix);

            // build memory image
            Image memoryImage = null;

            if (mainOverlay != MainOverlayImage.None || ratingOverlay != RatingOverlayImage.None)
            {
                memoryImage = GUIImageHandler.DrawOverlayOnPoster(imageFilePath, mainOverlay, ratingOverlay);
                if (memoryImage == null)
                {
                    return;
                }

                // load texture into facade item
                if (GUITextureManager.LoadFromMemory(memoryImage, texture, 0, 0, 0) > 0)
                {
                    ThumbnailImage = texture;
                    IconImage      = texture;
                    IconImageBig   = texture;
                }
            }
            else
            {
                ThumbnailImage = imageFilePath;
                IconImage      = imageFilePath;
                IconImageBig   = imageFilePath;
            }

            // if selected and is current window force an update of thumbnail
            this.UpdateItemIfSelected(WindowID, ItemId);
        }
All Usage Examples Of TraktPlugin.GUI.GUIImageHandler::GetTextureIdentFromFile