Exemple #1
0
        protected virtual TextureFile EnhancedTexture_Getter(int textureID)
        {
            try
            {
                if (Globals.Instance.EnhancedAssets != null)
                {
                    byte[] data = Globals.Instance.EnhancedAssets.GetTexture(textureID);

                    if (data != null)
                    {
                        string name = String.Format("0x{0:X}", textureID);

                        if (Globals.Instance.Clilocs != null)
                        {
                            int    cliloc     = UltimaItemGenerator.GetClilocFromItemID(textureID);
                            string clilocText = Globals.Instance.Clilocs.GetString(cliloc);

                            if (!String.IsNullOrEmpty(clilocText))
                            {
                                name = String.Format("{0} - {1}", name, clilocText);
                            }
                        }

                        TextureFile texture = new TextureFile();
                        texture.ID    = textureID;
                        texture.Name  = name;
                        texture.Data  = data;
                        texture.Image = DDS.FromMemory(data).GetTextureAsBitmapSource();

                        return(texture);
                    }
                }
            }
            catch (Exception ex)
            {
                App.Window.ShowNotification(NotificationType.Error, ex);
            }

            return(GetDefaultTexture(textureID, true));
        }