예제 #1
0
 protected string ImageBackgroundStyle(string url)
 {
     if (ImagesUtility.IsImagePath(url))
     {
         return(string.Format("background-image:url({0})", N2.Edit.Web.UI.Controls.ResizedImage.GetResizedImageUrl(url, 100, 100, N2.Web.Drawing.ImageResizeMode.Fit)));
     }
     else
     {
         return("");
     }
 }
예제 #2
0
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);

            sizes = Engine.Resolve <EditSection>().Images.Sizes;
            fs    = Engine.Resolve <IFileSystem>();

            ImagesUtility.SplitImageAndSize(Selection.SelectedItem.Url, sizes.GetSizeNames(), out baseImagePath, out imageSize);
            originalImagePath = fs.GetExistingImagePath(baseImagePath, "original");

            size = sizes.FirstOrDefault(s => s.Name == imageSize);
        }
        protected override void Render(System.Web.UI.HtmlTextWriter writer)
        {
            if (string.IsNullOrEmpty(ImageUrl))
            {
                return;
            }
            if (!ImagesUtility.IsImagePath(ImageUrl))
            {
                return;
            }

            base.Render(writer);
        }
예제 #4
0
        public virtual void CreateSize(Url virtualPath, byte[] image, ImageSizeElement size)
        {
            if (!size.ResizeOnUpload)
            {
                return;
            }

            string resizedPath = ImagesUtility.GetResizedPath(virtualPath, size.Name);

            using (var sourceStream = new MemoryStream(image))
            {
                if (size.Width <= 0 && size.Height <= 0)
                {
                    using (var destinationStream = files.OpenFile(resizedPath))
                    {
                        int b;
                        while ((b = sourceStream.ReadByte()) != -1)
                        {
                            destinationStream.WriteByte((byte)b);
                        }
                    }
                }
                else
                {
                    // Delete the image before writing.
                    // Fixes a weird bug where overwriting the original file while it still exists
                    //  leaves the resized image the with the exact same file size as the original even
                    //  though it should be smaller.
                    if (files.FileExists(resizedPath))
                    {
                        files.DeleteFile(resizedPath);
                    }

                    try
                    {
                        using (var destinationStream = files.OpenFile(resizedPath))
                        {
                            resizer.Resize(sourceStream, new ImageResizeParameters(size.Width, size.Height, size.Mode)
                            {
                                Quality = size.Quality
                            }, destinationStream);
                        }
                    }
                    catch
                    {
                    }
                }
            }
        }
예제 #5
0
        /// <summary>Adds an image control to the container.</summary>
        /// <param name="container">The containing control.</param>
        /// <param name="item">The item containing image informatin.</param>
        /// <param name="detailName">The detail name on the item.</param>
        /// <param name="cssClass">The css class to applky to the image element.</param>
        /// <param name="altText">Alt alternative text to apply to the image element.</param>
        /// <returns>An image control.</returns>
        public static Control AddImage(Control container, ContentItem item, string detailName, string preferredSize, string cssClass, string altText)
        {
            string imageUrl = item[detailName] as string;

            if (!string.IsNullOrEmpty(imageUrl))
            {
                Image image = new Image();
                image.ImageUrl      = ImagesUtility.GetExistingImagePath(imageUrl, preferredSize);
                image.AlternateText = item.GetDetail(detailName + "_AlternateText", altText);
                image.CssClass      = item.GetDetail(detailName + "_CssClass", cssClass);
                container.Controls.Add(image);
                return(image);
            }
            return(null);
        }
예제 #6
0
        public async Task <ApiResult> Update([FromBody] AdverViewModel avm)
        {
            var res = new ApiResult();

            if (!string.IsNullOrWhiteSpace(avm.Title) && avm.TypeID > 0)
            {
                try
                {
                    Advert m = null;
                    m = db.GetId(avm.ID);
                    if (m == null)
                    {
                        m = new Advert();
                    }
                    m.Title           = avm.Title;
                    m.TypeID          = avm.TypeID;
                    m.Pic             = avm.Pic;
                    m.BackgroundColor = avm.BackgroundColor;
                    m.StartDate       = C.DateTimes(avm.StartDate);
                    m.EndDate         = C.DateTimes(avm.EndDate);
                    m.IsEnable        = avm.IsEnable;
                    m.Url             = avm.Url;
                    m.Sorting         = avm.Sorting;
                    if (res.success)
                    {
                        res.statusCode = (int)ApiEnum.Status;
                    }
                    // 如有图片上传则保存到本地
                    if (avm.Pic.Contains("base64"))
                    {
                        string path  = "UploadFiles/advert/";
                        string path2 = Utility.HostAddress + "advert\\";
                        m.Pic = ImagesUtility.Base64StringToFile(avm.Pic, path2, DateTime.Now.ToString("yyyyMMddHHmmssfff"));
                        if (m.Pic != "")
                        {
                            m.Pic = path + m.Pic;
                        }
                    }
                    res.success = db.Update(m) > 0;
                }
                catch (Exception ex)
                {
                    res.statusCode = (int)ApiEnum.Error;
                    res.msg        = ApiEnum.Error.GetEnumText() + ex.Message;
                }
            }
            return(await Task.Run(() => res));
        }
예제 #7
0
        protected string ImageBackgroundStyle(string url)
        {
            if (!ImagesUtility.IsImagePath(url))
            {
                return("");
            }

            if (UseCustomResizing && !string.IsNullOrWhiteSpace(CustomThumbResizePattern) && !string.IsNullOrWhiteSpace(CustomImagePath))
            {
                var ThumbnailImageResizeUrl = CustomImagePath + CustomThumbResizePattern;
                return(string.Format("background-image:url({0})", N2.Edit.Web.UI.Controls.ResizedImage.GetCustomResizedImageUrl(ThumbnailImageResizeUrl, url)));
            }
            else
            {
                return(string.Format("background-image:url({0})", N2.Edit.Web.UI.Controls.ResizedImage.GetResizedImageUrl(url, 100, 100, N2.Web.Drawing.ImageResizeMode.Fit)));
            }
        }
예제 #8
0
        void files_FileDeleted(object sender, FileEventArgs e)
        {
            if (!IsResizableImagePath(e.VirtualPath))
            {
                return;
            }

            foreach (ImageSizeElement size in images.Sizes.AllElements)
            {
                string resizedPath = ImagesUtility.GetResizedPath(e.VirtualPath, size.Name);

                if (files.FileExists(resizedPath))
                {
                    files.DeleteFile(resizedPath);
                }
            }
        }
예제 #9
0
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);

            Page.StyleSheet("{ManagementUrl}/Files/Css/Files.css");

            Fs = Engine.Resolve <IFileSystem>();

            if (Selection == null || Selection.SelectedItem == null)
            {
                Ancestors       = new ContentItem[0];
                btnEdit.Visible = false;
                hlCrop.Visible  = false;
            }
            else
            {
                var config = Engine.Resolve <EditSection>();

                if (SelectedFile != null)
                {
                    if (config.FileSystem.IsTextFile(SelectedFile.Url))
                    {
                        btnEdit.Visible = true;
                    }

                    if (ImagesUtility.IsImagePath(Selection.SelectedItem.Url))
                    {
                        var size = config.Images.GetImageSize(SelectedFile.Url);
                        if (size != null && size.Mode == ImageResizeMode.Fill)
                        {
                            hlCrop.NavigateUrl = "../Crop.aspx?selected=" + Selection.SelectedItem.Path;
                        }
                        else
                        {
                            hlCrop.Visible = false;
                        }
                    }
                }

                Ancestors = Find.EnumerateParents(Selection.SelectedItem, null, true).Where(a => a is AbstractNode).Reverse();
                DataBind();
                LoadSizes();
                Refresh(Selection.SelectedItem, ToolbarArea.Navigation, force: false);
            }
        }
예제 #10
0
        public static void DrawRarityBackground(JArray AssetProperties)
        {
            JToken serieToken  = AssetsUtility.GetPropertyTagImport <JToken>(AssetProperties, "Series");
            JToken rarityToken = AssetsUtility.GetPropertyTag <JToken>(AssetProperties, "Rarity");

            if (AssetsLoader.ExportType == "FortAmmoItemDefinition")
            {
                DrawBackground(ImagesUtility.ParseColorFromHex("#6D6D6D"), ImagesUtility.ParseColorFromHex("#464646"), ImagesUtility.ParseColorFromHex("#9E9E9E"));
            }
            else if (serieToken != null)
            {
                GetSerieAsset(serieToken, rarityToken);
            }
            else
            {
                DrawNormalRarity(rarityToken);
            }
        }
예제 #11
0
        public static void WriteImage(string imageUrl, System.IO.TextWriter writer, IEnumerable <string> preferredSizes = null, string cssClass = null, string alt = null)
        {
            TagBuilder tb = new TagBuilder("img");
            bool       preferredSizeExists = false;
            string     preferredSize       = null;

            if (preferredSizes != null)
            {
                foreach (var size in preferredSizes)
                {
                    var sizeUrl = ImagesUtility.GetExistingImagePath(imageUrl, size, out preferredSizeExists);
                    if (!preferredSizeExists)
                    {
                        continue;
                    }

                    preferredSize = size;
                    imageUrl      = sizeUrl;
                    break;
                }
            }

            tb.Attributes["src"] = Url.ToAbsolute(imageUrl);
            tb.Attributes["alt"] = alt;
            if (preferredSizeExists)
            {
                if (string.IsNullOrEmpty(cssClass))
                {
                    cssClass = preferredSize;
                }
                else
                {
                    cssClass += " " + preferredSize;
                }
            }

            if (!string.IsNullOrEmpty(cssClass))
            {
                tb.AddCssClass(cssClass);
            }

            writer.Write(tb.ToString(TagRenderMode.SelfClosing));
        }
예제 #12
0
        public static void DrawIconWatermark()
        {
            if (FProp.Default.FUseWatermark)
            {
                using (StreamReader image = new StreamReader(FProp.Default.FWatermarkFilePath))
                {
                    if (image != null)
                    {
                        BitmapImage bmp = new BitmapImage();
                        bmp.BeginInit();
                        bmp.CacheOption  = BitmapCacheOption.OnLoad;
                        bmp.StreamSource = image.BaseStream;
                        bmp.EndInit();
                        bmp.Freeze();

                        IconCreator.ICDrawingContext.DrawImage(ImagesUtility.CreateTransparency(bmp, FProp.Default.FWatermarkOpacity), new Rect(FProp.Default.FWatermarkXPos, FProp.Default.FWatermarkYPos, FProp.Default.FWatermarkScale, FProp.Default.FWatermarkScale));
                    }
                }
            }
        }
예제 #13
0
        void files_FileMoved(object sender, FileEventArgs e)
        {
            if (!IsResizableImagePath(e.VirtualPath))
            {
                return;
            }

            foreach (ImageSizeElement size in images.Sizes.AllElements)
            {
                string source = ImagesUtility.GetResizedPath(e.SourcePath, size.Name);
                if (files.FileExists(source))
                {
                    string destination = ImagesUtility.GetResizedPath(e.VirtualPath, size.Name);
                    if (!files.FileExists(destination))
                    {
                        files.MoveFile(source, destination);
                    }
                }
            }
        }
예제 #14
0
        private void RemoveImageSizes(List <FileData> preExistingFiles, string commaSeparatedListOfSizes)
        {
            if (string.IsNullOrEmpty(commaSeparatedListOfSizes))
            {
                return;
            }

            foreach (var s in commaSeparatedListOfSizes.Split(','))
            {
                foreach (var file in preExistingFiles)
                {
                    var resizedPath = ImagesUtility.GetResizedPath(file.VirtualPath, s);
                    if (Fs.FileExists(resizedPath))
                    {
                        Response.Write("<div class='processed-image'>Removing " + file.Name + " - " + s + "</div>");
                        Fs.DeleteFile(resizedPath);
                    }
                }
            }
        }
예제 #15
0
        protected void OnUpdateCommand(object sender, CommandEventArgs args)
        {
            if (chkPermanentRedirect.Checked && previousParent != null)
            {
                var redirect = Engine.Resolve <ContentActivator>().CreateInstance <PermanentRedirect>(previousParent);
                redirect.Title       = previousName + GetLocalResourceString("PermanentRedirect", " (permanent redirect)");
                redirect.Name        = previousName;
                redirect.RedirectUrl = Selection.SelectedItem.Url;
                redirect.RedirectTo  = Selection.SelectedItem;
                redirect.AddTo(previousParent);

                Engine.Persister.Save(redirect);
            }

            tracker.UpdateReferencesTo(Selection.SelectedItem, previousUrl, isRenamingDirectory: Selection.SelectedItem is IFileSystemDirectory);

            if (Selection.SelectedItem is IFileSystemFile)
            {
                var sizes = this.Engine.Resolve <ImageSizeCache>().ImageSizes;
                foreach (var sizedImage in Selection.SelectedItem.Children)
                {
                    var size            = ImagesUtility.GetSize(sizedImage.Url, sizes);
                    var previousSizeUrl = ImagesUtility.GetResizedPath(previousUrl, size);

                    tracker.UpdateReferencesTo(sizedImage, previousSizeUrl, isRenamingDirectory: false);
                }
            }

            if (chkChildren.Checked)
            {
                mvPhase.ActiveViewIndex = 1;
                //rptDescendants.DataSource = Content.Search.Find.Where.AncestralTrail.Like(Selection.SelectedItem.GetTrail() + "%").Select()
                //  .Where(Content.Is.Accessible());
                rptDescendants.DataSource = Content.Search.Repository.Find(N2.Persistence.Parameter.Below(Selection.SelectedItem)).Where(Content.Is.Accessible());
                rptDescendants.DataBind();
            }
            else
            {
                Refresh(Selection.SelectedItem, ToolbarArea.Both);
            }
        }
예제 #16
0
        /// <summary>Writes an image html to the given writer.</summary>
        /// <param name="item">The item containing the data.</param>
        /// <param name="detailName">The name of the property to write.</param>
        /// <param name="writer">The writer to write to.</param>
        public static void WriteImage(ContentItem item, string detailName, string preferredSize, string alt, string cssClass, System.IO.TextWriter writer)
        {
            string imageUrl = item[detailName] as string;

            if (string.IsNullOrEmpty(imageUrl))
            {
                return;
            }

            TagBuilder tb = new TagBuilder("img");

            tb.Attributes["src"] = ImagesUtility.GetExistingImagePath(imageUrl, preferredSize);
            tb.Attributes["alt"] = item.GetDetail(detailName + "_AlternateText", alt);
            cssClass             = item.GetDetail(detailName + "_CssClass", cssClass);
            if (!string.IsNullOrEmpty(cssClass))
            {
                tb.AddCssClass(cssClass);
            }

            writer.Write(tb.ToString(TagRenderMode.SelfClosing));
        }
예제 #17
0
        public virtual void Write(ContentItem item, string propertyName, TextWriter writer)
        {
            string url = item[propertyName] as string;

            if (string.IsNullOrEmpty(url))
            {
                return;
            }

            switch (ExtensionGroup ?? ImagesUtility.GetExtensionGroup(VirtualPathUtility.GetExtension(url)))
            {
            case ImagesUtility.ExtensionGroups.Flash:
                WriteFlash(url, writer);
                return;

            case ImagesUtility.ExtensionGroups.Video:
                WriteMovie(url, writer);
                return;

            case ImagesUtility.ExtensionGroups.Audio:
                WriteAudio(url, writer);
                return;

            case ImagesUtility.ExtensionGroups.ClientCode:
            case ImagesUtility.ExtensionGroups.Compressed:
            case ImagesUtility.ExtensionGroups.Excel:
            case ImagesUtility.ExtensionGroups.Pdf:
            case ImagesUtility.ExtensionGroups.ServerCode:
            case ImagesUtility.ExtensionGroups.Text:
            case ImagesUtility.ExtensionGroups.Word:
                WriteUrl(item, propertyName, CssClass, writer, url);
                return;

            case ImagesUtility.ExtensionGroups.Images:
            default:
                var sizes = DisplayableImageAttribute.GetSizes(PreferredSize);
                DisplayableImageAttribute.WriteImage(item, propertyName, sizes, (AltSource != null ? item[AltSource] as string : null) ?? alt, CssClass, writer);
                return;
            }
        }
예제 #18
0
        public virtual void Write(ContentItem item, string propertyName, TextWriter writer)
        {
            string url = item[propertyName] as string;

            if (string.IsNullOrEmpty(url))
            {
                return;
            }

            string extension = VirtualPathUtility.GetExtension(url);

            switch (ImagesUtility.GetExtensionGroup(extension))
            {
            case ImagesUtility.ExtensionGroups.Images:
                DisplayableImageAttribute.WriteImage(item, propertyName, PreferredSize, alt, CssClass, writer);
                return;

            default:
                WriteUrl(item, propertyName, cssClass, writer, url);
                return;
            }
        }
        private ImageViewModel FileToImageViewModel(FileData file)
        {
            string url       = null;
            var    extension = VirtualPathUtility.GetExtension(file.Name);
            string path      = file.VirtualPath;

            if (!String.IsNullOrEmpty(path))
            {
                if (path.Substring(0, 1) != "/")
                {
                    path = "/" + path;
                }
                path = "~" + path;
            }
            if (ImagesUtility.GetExtensionGroup(extension) == ImagesUtility.ExtensionGroups.Images)
            {
                url = DependencyResolver.Current.Get <IExternalWebLinkResolver>().GetPublicUrl(path);
            }
            return(new ImageViewModel(file.Name, path, "f")
            {
                ImageUrl = url, FileDate = file.Created, FileDateStr = file.Created.ToShortDateString()
            });
        }
예제 #20
0
        private static void DrawAbilityKit(string assetPath)
        {
            if (!string.IsNullOrEmpty(assetPath))
            {
                string jsonData = AssetsUtility.GetAssetJsonDataByPath(assetPath);
                if (jsonData != null && AssetsUtility.IsValidJson(jsonData))
                {
                    JToken AssetMainToken = AssetsUtility.ConvertJson2Token(jsonData);
                    if (AssetMainToken != null)
                    {
                        JArray abilityKitProperties = AssetMainToken["properties"].Value <JArray>();
                        if (abilityKitProperties != null)
                        {
                            JToken name_namespace     = AssetsUtility.GetPropertyTagText <JToken>(abilityKitProperties, "DisplayName", "namespace");
                            JToken name_key           = AssetsUtility.GetPropertyTagText <JToken>(abilityKitProperties, "DisplayName", "key");
                            JToken name_source_string = AssetsUtility.GetPropertyTagText <JToken>(abilityKitProperties, "DisplayName", "source_string");

                            JArray iconBrushArray = AssetsUtility.GetPropertyTagStruct <JArray>(abilityKitProperties, "IconBrush", "properties");
                            if (iconBrushArray != null)
                            {
                                JToken resourceObjectToken = AssetsUtility.GetPropertyTagOuterImport <JToken>(iconBrushArray, "ResourceObject");
                                if (resourceObjectToken != null)
                                {
                                    string texturePath = FoldersUtility.FixFortnitePath(resourceObjectToken.Value <string>());
                                    using (Stream image = AssetsUtility.GetStreamImageFromPath(texturePath))
                                    {
                                        if (image != null)
                                        {
                                            BitmapImage bmp = new BitmapImage();
                                            bmp.BeginInit();
                                            bmp.CacheOption  = BitmapCacheOption.OnLoad;
                                            bmp.StreamSource = image;
                                            bmp.EndInit();
                                            bmp.Freeze();

                                            //background
                                            IconCreator.ICDrawingContext.DrawRectangle(new SolidColorBrush(ImagesUtility.ParseColorFromHex("#6D6D6D")), null, new Rect(0, _borderY, 515, 34));

                                            if (name_namespace != null && name_key != null && name_source_string != null)
                                            {
                                                string displayName = AssetTranslations.SearchTranslation(name_namespace.Value <string>(), name_key.Value <string>(), name_source_string.Value <string>());

                                                Typeface typeface = new Typeface(TextsUtility.FBurbank, FontStyles.Normal, FontWeights.Normal, FontStretches.Normal);

                                                FormattedText formattedText =
                                                    new FormattedText(
                                                        displayName.ToUpperInvariant(),
                                                        CultureInfo.CurrentUICulture,
                                                        FlowDirection.LeftToRight,
                                                        typeface,
                                                        25,
                                                        Brushes.White,
                                                        IconCreator.PPD
                                                        );
                                                formattedText.TextAlignment = TextAlignment.Left;
                                                formattedText.MaxTextWidth  = 515;
                                                formattedText.MaxLineCount  = 1;

                                                Point textLocation = new Point(50, _textY - formattedText.Height);

                                                IconCreator.ICDrawingContext.DrawText(formattedText, textLocation);
                                            }

                                            IconCreator.ICDrawingContext.DrawImage(bmp, new Rect(9, _imageY, 32, 32));

                                            _borderY += 37;
                                            _textY   += 37;
                                            _imageY  += 37;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
예제 #21
0
        public static void LoadAsset(string assetPath)
        {
            string jsonData = AssetsUtility.GetAssetJsonDataByPath(assetPath, true);

            if (jsonData != null)
            {
                FWindow.FMain.Dispatcher.InvokeAsync(() =>
                {
                    FWindow.FMain.AssetPropertiesBox_Main.Text = jsonData;
                });

                if (AssetsUtility.IsValidJson(jsonData))
                {
                    JToken AssetMainToken = AssetsUtility.ConvertJson2Token(jsonData);
                    if (AssetMainToken != null && AssetMainToken["export_type"] != null && AssetMainToken["properties"] != null)
                    {
                        ExportType = AssetMainToken["export_type"].Value <string>();
                        DrawingVisual VisualImage = null;
                        switch (ExportType)
                        {
                        case "AthenaBackpackItemDefinition":
                        case "AthenaBattleBusItemDefinition":
                        case "AthenaCharacterItemDefinition":
                        case "AthenaConsumableEmoteItemDefinition":
                        case "AthenaSkyDiveContrailItemDefinition":
                        case "AthenaDanceItemDefinition":
                        case "AthenaEmojiItemDefinition":
                        case "AthenaGliderItemDefinition":
                        case "AthenaItemWrapDefinition":
                        case "AthenaLoadingScreenItemDefinition":
                        case "AthenaMusicPackItemDefinition":
                        case "AthenaPetCarrierItemDefinition":
                        case "AthenaPickaxeItemDefinition":
                        case "AthenaSprayItemDefinition":
                        case "AthenaToyItemDefinition":
                        case "AthenaVictoryPoseItemDefinition":
                        case "FortBannerTokenType":
                        case "AthenaGadgetItemDefinition":
                        case "FortWeaponRangedItemDefinition":
                        case "FortWeaponMeleeItemDefinition":
                        case "FortWeaponMeleeDualWieldItemDefinition":
                        case "FortIngredientItemDefinition":
                        case "FortVariantTokenType":
                        case "FortAmmoItemDefinition":
                        case "FortHeroType":
                        case "FortDefenderItemDefinition":
                        case "FortContextTrapItemDefinition":
                        case "FortTrapItemDefinition":
                        case "FortCardPackItemDefinition":
                        case "FortPlaysetGrenadeItemDefinition":
                        case "FortConsumableAccountItemDefinition":
                        case "FortBadgeItemDefinition":
                        case "FortCurrencyItemDefinition":
                        case "FortConversionControlItemDefinition":
                        case "FortHomebaseNodeItemDefinition":
                        case "FortPersonalVehicleItemDefinition":
                        case "FortCampaignHeroLoadoutItemDefinition":
                        case "FortNeverPersistItemDefinition":
                        case "FortPersistentResourceItemDefinition":
                        case "FortResourceItemDefinition":
                        case "FortGadgetItemDefinition":
                        case "FortStatItemDefinition":
                        case "FortTokenType":
                        case "FortDailyRewardScheduleTokenDefinition":
                        case "FortWorkerType":
                        case "FortConditionalResourceItemDefinition":
                        case "FortAwardItemDefinition":
                        case "FortChallengeBundleScheduleDefinition":
                        case "FortAbilityKit":
                        case "FortSchematicItemDefinition":
                        case "FortAccoladeItemDefinition":
                        case "FortSpyTechItemDefinition":
                        case "FortPlayerPerksItemDefinition":
                        case "FortHardcoreModifierItemDefinition":
                        case "FortQuestItemDefinition":
                        case "FortFeatItemDefinition":
                        case "AthenaDailyQuestDefinition":
                            VisualImage = IconCreator.IconCreator.DrawNormalIconKThx(AssetMainToken["properties"].Value <JArray>());
                            break;

                        case "FortChallengeBundleItemDefinition":
                            VisualImage = IconCreator.IconCreator.DrawChallengeKThx(AssetMainToken["properties"].Value <JArray>(), assetPath);
                            break;
                        }
                        if (VisualImage != null)
                        {
                            ImagesUtility.LoadImageAfterExtraction(VisualImage);
                        }
                    }
                }
            }
        }
예제 #22
0
        private void UpdateChallengeCustomTheme()
        {
            bool   watermarkEnabled = (bool)bCustomChallenge.IsChecked;
            string watermark        = WatermarkChallenge_TextBox.Text;
            string path             = FProp.Default.FBannerFilePath;
            int    opacity          = Convert.ToInt32(OpacityBanner_Slider.Value);

            string[]        primaryParts   = FProp.Default.FPrimaryColor.Split(':');
            string[]        secondaryParts = FProp.Default.FSecondaryColor.Split(':');
            SolidColorBrush PrimaryColor   = new SolidColorBrush(Color.FromRgb(Convert.ToByte(primaryParts[0]), Convert.ToByte(primaryParts[1]), Convert.ToByte(primaryParts[2])));
            SolidColorBrush SecondaryColor = new SolidColorBrush(Color.FromRgb(Convert.ToByte(secondaryParts[0]), Convert.ToByte(secondaryParts[1]), Convert.ToByte(secondaryParts[2])));

            if (watermarkEnabled)
            {
                DrawingVisual drawingVisual = new DrawingVisual();
                double        PPD           = VisualTreeHelper.GetDpi(drawingVisual).PixelsPerDip;
                using (DrawingContext drawingContext = drawingVisual.RenderOpen())
                {
                    //INITIALIZATION
                    drawingContext.DrawRectangle(Brushes.Transparent, null, new Rect(new Point(0, 0), new Size(1024, 410)));

                    Point         dStart    = new Point(0, 256);
                    LineSegment[] dSegments = new[]
                    {
                        new LineSegment(new Point(1024, 256), true),
                        new LineSegment(new Point(1024, 241), true),
                        new LineSegment(new Point(537, 236), true),
                        new LineSegment(new Point(547, 249), true),
                        new LineSegment(new Point(0, 241), true)
                    };
                    PathFigure   dFigure = new PathFigure(dStart, dSegments, true);
                    PathGeometry dGeo    = new PathGeometry(new[] { dFigure });

                    Typeface      typeface      = new Typeface(TextsUtility.Burbank, FontStyles.Normal, FontWeights.Black, FontStretches.Normal);
                    FormattedText formattedText =
                        new FormattedText(
                            "{BUNDLE DISPLAY NAME HERE}",
                            CultureInfo.CurrentUICulture,
                            FlowDirection.LeftToRight,
                            typeface,
                            55,
                            Brushes.White,
                            PPD
                            );
                    formattedText.TextAlignment = TextAlignment.Left;
                    formattedText.MaxTextWidth  = 768;
                    formattedText.MaxLineCount  = 1;
                    Point textLocation = new Point(50, 165 - formattedText.Height);

                    drawingContext.DrawRectangle(PrimaryColor, null, new Rect(0, 0, 1024, 256));
                    if (!string.IsNullOrEmpty(path))
                    {
                        BitmapImage bmp = new BitmapImage(new Uri(path));
                        drawingContext.DrawImage(ImagesUtility.CreateTransparency(bmp, opacity), new Rect(0, 0, 1024, 256));
                    }
                    drawingContext.DrawGeometry(SecondaryColor, null, dGeo);
                    drawingContext.DrawText(formattedText, textLocation);

                    formattedText =
                        new FormattedText(
                            "{LAST FOLDER HERE}",
                            CultureInfo.CurrentUICulture,
                            FlowDirection.LeftToRight,
                            typeface,
                            30,
                            SecondaryColor,
                            IconCreator.PPD
                            );
                    formattedText.TextAlignment = TextAlignment.Left;
                    formattedText.MaxTextWidth  = 768;
                    formattedText.MaxLineCount  = 1;
                    textLocation = new Point(50, 100 - formattedText.Height);
                    Geometry geometry = formattedText.BuildGeometry(textLocation);
                    Pen      pen      = new Pen(ChallengesUtility.DarkBrush(SecondaryColor, 0.3f), 1);
                    pen.LineJoin = PenLineJoin.Round;
                    drawingContext.DrawGeometry(SecondaryColor, pen, geometry);

                    typeface      = new Typeface(TextsUtility.FBurbank, FontStyles.Normal, FontWeights.Normal, FontStretches.Normal);
                    formattedText =
                        new FormattedText(
                            watermark,
                            CultureInfo.CurrentUICulture,
                            FlowDirection.LeftToRight,
                            typeface,
                            20,
                            new SolidColorBrush(Color.FromArgb(150, 255, 255, 255)),
                            IconCreator.PPD
                            );
                    formattedText.TextAlignment = TextAlignment.Right;
                    formattedText.MaxTextWidth  = 1014;
                    formattedText.MaxLineCount  = 1;
                    textLocation = new Point(0, 205);
                    drawingContext.DrawText(formattedText, textLocation);

                    LinearGradientBrush linGrBrush = new LinearGradientBrush();
                    linGrBrush.StartPoint = new Point(0, 0);
                    linGrBrush.EndPoint   = new Point(0, 1);
                    linGrBrush.GradientStops.Add(new GradientStop(Color.FromArgb(75, SecondaryColor.Color.R, SecondaryColor.Color.G, SecondaryColor.Color.B), 0));
                    linGrBrush.GradientStops.Add(new GradientStop(Color.FromArgb(25, PrimaryColor.Color.R, PrimaryColor.Color.G, PrimaryColor.Color.B), 0.15));
                    linGrBrush.GradientStops.Add(new GradientStop(Color.FromArgb(0, 0, 0, 0), 1));

                    drawingContext.DrawRectangle(ChallengesUtility.DarkBrush(PrimaryColor, 0.3f), null, new Rect(0, 256, 1024, 144));
                    drawingContext.DrawRectangle(linGrBrush, null, new Rect(0, 256, 1024, 144));

                    typeface = new Typeface(TextsUtility.Burbank, FontStyles.Normal, FontWeights.Black, FontStretches.Normal);
                    int y = 300;

                    drawingContext.DrawRectangle(ChallengesUtility.DarkBrush(PrimaryColor, 0.3f), null, new Rect(0, y, 1024, 90));
                    drawingContext.DrawRectangle(PrimaryColor, null, new Rect(25, y, 1024 - 50, 70));

                    dStart    = new Point(32, y + 5);
                    dSegments = new[]
                    {
                        new LineSegment(new Point(29, y + 67), true),
                        new LineSegment(new Point(1024 - 160, y + 62), true),
                        new LineSegment(new Point(1024 - 150, y + 4), true)
                    };
                    dFigure = new PathFigure(dStart, dSegments, true);
                    dGeo    = new PathGeometry(new[] { dFigure });
                    drawingContext.DrawGeometry(ChallengesUtility.LightBrush(PrimaryColor, 0.04f), null, dGeo);

                    drawingContext.DrawRectangle(SecondaryColor, null, new Rect(60, y + 47, 500, 7));

                    dStart    = new Point(39, y + 35);
                    dSegments = new[]
                    {
                        new LineSegment(new Point(45, y + 32), true),
                        new LineSegment(new Point(48, y + 37), true),
                        new LineSegment(new Point(42, y + 40), true)
                    };
                    dFigure = new PathFigure(dStart, dSegments, true);
                    dGeo    = new PathGeometry(new[] { dFigure });
                    drawingContext.DrawGeometry(SecondaryColor, null, dGeo);
                }

                if (drawingVisual != null)
                {
                    RenderTargetBitmap RTB = new RenderTargetBitmap(1024, 410, 96, 96, PixelFormats.Pbgra32);
                    RTB.Render(drawingVisual);
                    RTB.Freeze(); //We freeze to apply the RTB to our imagesource from the UI Thread

                    FWindow.FMain.Dispatcher.InvokeAsync(() =>
                    {
                        ImageBox_ChallengePreview.Source = BitmapFrame.Create(RTB); //thread safe and fast af
                    });
                }
            }
            else
            {
                BitmapImage source = new BitmapImage(new Uri("pack://application:,,,/Resources/Template_Challenge.png"));
                ImageBox_ChallengePreview.Source = source;
            }
        }
예제 #23
0
        private static void DrawHeader(string displayName, string lastfolder, SolidColorBrush PrimaryColor, SolidColorBrush SecondaryColor, Stream image)
        {
            Point dStart = new Point(0, 256);

            LineSegment[] dSegments = new[]
            {
                new LineSegment(new Point(1024, 256), true),
                new LineSegment(new Point(1024, 241), true),
                new LineSegment(new Point(537, 236), true),
                new LineSegment(new Point(547, 249), true),
                new LineSegment(new Point(0, 241), true)
            };
            PathFigure   dFigure = new PathFigure(dStart, dSegments, true);
            PathGeometry dGeo    = new PathGeometry(new[] { dFigure });

            Typeface      typeface      = new Typeface(TextsUtility.Burbank, FontStyles.Normal, FontWeights.Black, FontStretches.Normal);
            FormattedText formattedText =
                new FormattedText(
                    displayName.ToUpperInvariant(),
                    CultureInfo.CurrentUICulture,
                    FlowDirection.LeftToRight,
                    typeface,
                    55,
                    Brushes.White,
                    IconCreator.PPD
                    );

            formattedText.TextAlignment = TextAlignment.Left;
            formattedText.MaxTextWidth  = 768;
            formattedText.MaxLineCount  = 1;
            Point textLocation = new Point(isBanner || !hasDisplayStyle ? 50 : 310, 165 - formattedText.Height);

            IconCreator.ICDrawingContext.DrawRectangle(PrimaryColor, null, new Rect(0, 0, 1024, 256));

            #region IMAGE
            if (FProp.Default.FUseChallengeWatermark)
            {
                if (!string.IsNullOrEmpty(FProp.Default.FBannerFilePath))
                {
                    BitmapImage bmp = new BitmapImage(new Uri(FProp.Default.FBannerFilePath));
                    IconCreator.ICDrawingContext.DrawImage(ImagesUtility.CreateTransparency(bmp, FProp.Default.FBannerOpacity), new Rect(0, 0, 1024, 256));
                }
                else if (image != null)
                {
                    using (image)
                    {
                        BitmapImage bmp = new BitmapImage();
                        bmp.BeginInit();
                        bmp.CacheOption  = BitmapCacheOption.OnLoad;
                        bmp.StreamSource = image;
                        bmp.EndInit();
                        bmp.Freeze();

                        IconCreator.ICDrawingContext.DrawImage(isBanner ? ImagesUtility.CreateTransparency(bmp, 50) : bmp, new Rect(0, 0, isBanner ? 1024 : 256, 256));
                    }
                }
            }
            else if (image != null)
            {
                using (image)
                {
                    BitmapImage bmp = new BitmapImage();
                    bmp.BeginInit();
                    bmp.CacheOption  = BitmapCacheOption.OnLoad;
                    bmp.StreamSource = image;
                    bmp.EndInit();
                    bmp.Freeze();

                    IconCreator.ICDrawingContext.DrawImage(isBanner ? ImagesUtility.CreateTransparency(bmp, 50) : bmp, new Rect(0, 0, isBanner ? 1024 : 256, 256));
                }
            }
            #endregion

            IconCreator.ICDrawingContext.DrawGeometry(SecondaryColor, null, dGeo);
            IconCreator.ICDrawingContext.DrawText(formattedText, textLocation);

            formattedText =
                new FormattedText(
                    lastfolder.ToUpperInvariant(),
                    CultureInfo.CurrentUICulture,
                    FlowDirection.LeftToRight,
                    typeface,
                    30,
                    SecondaryColor,
                    IconCreator.PPD
                    );
            formattedText.TextAlignment = TextAlignment.Left;
            formattedText.MaxTextWidth  = 768;
            formattedText.MaxLineCount  = 1;
            textLocation = new Point(isBanner || !hasDisplayStyle ? 50 : 310, 100 - formattedText.Height);
            Geometry geometry = formattedText.BuildGeometry(textLocation);
            Pen      pen      = new Pen(ChallengesUtility.DarkBrush(SecondaryColor, 0.3f), 1);
            pen.LineJoin = PenLineJoin.Round;
            IconCreator.ICDrawingContext.DrawGeometry(SecondaryColor, pen, geometry);

            string watermark = FProp.Default.FChallengeWatermark;
            if (watermark.Contains("{BundleName}"))
            {
                watermark = watermark.Replace("{BundleName}", displayName);
            }
            if (watermark.Contains("{Date}"))
            {
                watermark = watermark.Replace("{Date}", DateTime.Now.ToString("dd/MM/yyyy"));
            }
            typeface      = new Typeface(TextsUtility.FBurbank, FontStyles.Normal, FontWeights.Normal, FontStretches.Normal);
            formattedText =
                new FormattedText(
                    watermark,
                    CultureInfo.CurrentUICulture,
                    FlowDirection.LeftToRight,
                    typeface,
                    20,
                    new SolidColorBrush(Color.FromArgb(150, 255, 255, 255)),
                    IconCreator.PPD
                    );
            formattedText.TextAlignment = TextAlignment.Right;
            formattedText.MaxTextWidth  = 1014;
            formattedText.MaxLineCount  = 1;
            textLocation = new Point(0, 205);
            IconCreator.ICDrawingContext.DrawText(formattedText, textLocation);
        }
예제 #24
0
 protected Sprite LoadSprite(string name) => ImagesUtility.LoadSpriteFromResources($"CountersPlus.UI.Images.{name}.png");
예제 #25
0
        private async Task UpdateImageWithWatermark()
        {
            bool   watermarkEnabled = (bool)bWatermarkIcon.IsChecked;
            string rarityDesign     = ((ComboBoxItem)ComboBox_Design.SelectedItem).Content.ToString();
            bool   isFeatured       = (bool)bFeaturedIcon.IsChecked;
            int    opacity          = Convert.ToInt32(Opacity_Slider.Value);
            double scale            = Scale_Slider.Value;
            double xPos             = xPos_Slider.Value;
            double yPos             = yPos_Slider.Value;

            await Task.Run(() =>
            {
                DrawingVisual drawingVisual = new DrawingVisual();
                using (DrawingContext drawingContext = drawingVisual.RenderOpen())
                {
                    //INITIALIZATION
                    drawingContext.DrawRectangle(Brushes.Transparent, null, new Rect(new Point(0, 0), new Size(515, 515)));

                    BitmapImage source = null;
                    switch (rarityDesign)
                    {
                    case "Default":
                        source = new BitmapImage(new Uri(isFeatured ? "pack://application:,,,/Resources/Template_D_F.png" : "pack://application:,,,/Resources/Template_D_N.png"));
                        break;

                    case "Flat":
                        source = new BitmapImage(new Uri(isFeatured ? "pack://application:,,,/Resources/Template_F_F.png" : "pack://application:,,,/Resources/Template_F_N.png"));
                        break;

                    case "Minimalist":
                        source = new BitmapImage(new Uri(isFeatured ? "pack://application:,,,/Resources/Template_M_F.png" : "pack://application:,,,/Resources/Template_M_N.png"));
                        break;
                    }
                    drawingContext.DrawImage(source, new Rect(new Point(0, 0), new Size(515, 515)));

                    if (!string.IsNullOrEmpty(FProp.Default.FWatermarkFilePath) && watermarkEnabled)
                    {
                        using (StreamReader image = new StreamReader(FProp.Default.FWatermarkFilePath))
                        {
                            if (image != null)
                            {
                                BitmapImage bmp = new BitmapImage();
                                bmp.BeginInit();
                                bmp.CacheOption  = BitmapCacheOption.OnLoad;
                                bmp.StreamSource = image.BaseStream;
                                bmp.EndInit();

                                drawingContext.DrawImage(ImagesUtility.CreateTransparency(bmp, opacity), new Rect(xPos, yPos, scale, scale));
                            }
                        }
                    }
                }

                if (drawingVisual != null)
                {
                    RenderTargetBitmap RTB = new RenderTargetBitmap(515, 515, 96, 96, PixelFormats.Pbgra32);
                    RTB.Render(drawingVisual);
                    RTB.Freeze(); //We freeze to apply the RTB to our imagesource from the UI Thread

                    FWindow.FMain.Dispatcher.InvokeAsync(() =>
                    {
                        ImageBox_RarityPreview.Source = BitmapFrame.Create(RTB); //thread safe and fast af
                    });
                }
            }).ContinueWith(TheTask =>
            {
                TasksUtility.TaskCompleted(TheTask.Exception);
            });
        }
예제 #26
0
 protected Texture2D LoadTexture(string name) => ImagesUtility.LoadTextureFromResources($"CountersPlus.UI.Images.{name}.png");
예제 #27
0
 public virtual string GetThumbnailImageUrl()
 {
     return(ImagesUtility.GetExistingImagePath(Fs, ImageUrl, "thumb"));
 }
예제 #28
0
        public static void DrawIconAmmoData(string path)
        {
            string jsonData = AssetsUtility.GetAssetJsonDataByPath(path);

            if (jsonData != null && AssetsUtility.IsValidJson(jsonData))
            {
                dynamic AssetData = JsonConvert.DeserializeObject(jsonData);
                JToken  AssetAmmo = JArray.FromObject(AssetData)[0];

                JToken largePreviewImage = AssetAmmo["properties"].Value <JArray>().FirstOrDefault(x => string.Equals(x["name"].Value <string>(), "LargePreviewImage"));
                JToken smallPreviewImage = AssetAmmo["properties"].Value <JArray>().FirstOrDefault(x => string.Equals(x["name"].Value <string>(), "SmallPreviewImage"));
                if (largePreviewImage != null || smallPreviewImage != null)
                {
                    JToken assetPathName =
                        largePreviewImage != null ? largePreviewImage["tag_data"]["asset_path_name"] :
                        smallPreviewImage != null ? smallPreviewImage["tag_data"]["asset_path_name"] : null;

                    if (assetPathName != null)
                    {
                        string texturePath = FoldersUtility.FixFortnitePath(assetPathName.Value <string>());
                        using (Stream image = AssetsUtility.GetStreamImageFromPath(texturePath))
                        {
                            if (image != null)
                            {
                                BitmapImage bmp = new BitmapImage();
                                bmp.BeginInit();
                                bmp.CacheOption  = BitmapCacheOption.OnLoad;
                                bmp.StreamSource = image;
                                bmp.EndInit();
                                bmp.Freeze();

                                //RESIZE
                                IconCreator.ICDrawingContext.DrawRectangle(Brushes.Transparent, null, new Rect(new Point(0, 0), new Size(515, 560)));

                                //background
                                IconCreator.ICDrawingContext.DrawRectangle(new SolidColorBrush(ImagesUtility.ParseColorFromHex("#6D6D6D")), null, new Rect(0, 518, 515, 34));

                                JToken name_namespace     = AssetsUtility.GetPropertyTagText <JToken>(AssetAmmo["properties"].Value <JArray>(), "DisplayName", "namespace");
                                JToken name_key           = AssetsUtility.GetPropertyTagText <JToken>(AssetAmmo["properties"].Value <JArray>(), "DisplayName", "key");
                                JToken name_source_string = AssetsUtility.GetPropertyTagText <JToken>(AssetAmmo["properties"].Value <JArray>(), "DisplayName", "source_string");
                                if (name_namespace != null && name_key != null && name_source_string != null)
                                {
                                    string displayName = AssetTranslations.SearchTranslation(name_namespace.Value <string>(), name_key.Value <string>(), name_source_string.Value <string>());

                                    Typeface typeface = new Typeface(Properties.Settings.Default.FLanguage.Equals("Japanese") ? TextsUtility.JPBurbank : TextsUtility.FBurbank, FontStyles.Normal, FontWeights.Normal, FontStretches.Normal);

                                    FormattedText formattedText =
                                        new FormattedText(
                                            displayName.ToUpperInvariant(),
                                            CultureInfo.CurrentUICulture,
                                            FlowDirection.LeftToRight,
                                            typeface,
                                            25,
                                            Brushes.White,
                                            IconCreator.PPD
                                            );
                                    formattedText.TextAlignment = TextAlignment.Center;
                                    formattedText.MaxTextWidth  = 515;
                                    formattedText.MaxLineCount  = 1;

                                    Point textLocation = new Point(0, (Properties.Settings.Default.FLanguage.Equals("Japanese") ? 548 : 550) - formattedText.Height);

                                    IconCreator.ICDrawingContext.DrawText(formattedText, textLocation);
                                }

                                IconCreator.ICDrawingContext.DrawImage(bmp, new Rect(9, 519, 32, 32));
                            }
                        }
                    }
                }
            }
        }
예제 #29
0
        public ApiResult <string> Add([FromBody] ArticlePostViewModel vm)
        {
            // 以接口的形式返回数据
            var res = new ApiResult <string>()
            {
                statusCode = (int)ApiEnum.ParameterError
            };

            if (!string.IsNullOrWhiteSpace(vm.Title) && !string.IsNullOrWhiteSpace(vm.ArticleMenuIDs))
            {
                Article m = new Article();
                m.Title      = vm.Title;
                m.AddDate    = C.DateTimes(vm.AddDate);
                m.ImgUrl     = vm.ImgUrl;
                m.Type       = vm.Type;
                m.FileUrl    = vm.FileUrl;
                m.Keyword    = vm.Keyword;
                m.Sorting    = vm.Sorting;
                m.IsTop      = vm.IsTop;
                m.State      = vm.State;
                m.Synopsis   = vm.Synopsis;
                m.Contents   = vm.Contents;
                m.Source     = vm.Source;
                m.PageView   = vm.PageView;
                m.Author     = vm.Author;
                m.AddDate    = C.DateTimes(m.AddDate);
                m.FileSize   = m.FileSize + "";
                m.FileFormat = m.FileFormat + "";
                try
                {
                    if (vm.ImgUrl != null && !string.IsNullOrWhiteSpace(vm.ImgUrl))
                    {
                        //如有图片上传则保存到本地
                        if (vm.ImgUrl.Contains("base64"))
                        {
                            string path  = "UploadFiles/article/";
                            string path2 = Utility.HostAddress + "article\\";
                            m.ImgUrl = ImagesUtility.Base64StringToFile(vm.ImgUrl, path2, DateTime.Now.ToString("yyyyMMddHHmmssfff"));
                            if (m.ImgUrl != "")
                            {
                                m.ImgUrl = path + m.ImgUrl;
                            }
                        }
                    }
                    //if (vm.FileUrl != null && !string.IsNullOrWhiteSpace(vm.FileUrl))
                    //{
                    //    //如有图片上传则保存到本地
                    //    if (vm.FileUrl.Contains("base64"))
                    //    {
                    //        string path = "UploadFiles/article/";
                    //        string path2 = Utility.HostAddress + "article\\";
                    //        m.FileUrl = ImagesUtility.Base64StringToFile(vm.FileUrl, path2, DateTime.Now.ToString("yyyyMMddHHmmssfff"));
                    //        if (m.FileUrl != "")
                    //            m.FileUrl = path + m.FileUrl;
                    //    }
                    //}
                    m.ID        = db.Insert(m);
                    res.success = m.ID > 0;
                    // 处理文章栏目
                    if (res.success)
                    {
                        string[] array = vm.ArticleMenuIDs.Split(',');
                        if (array.Length > 0)
                        {
                            List <ArticleMenu_Article> list = new List <ArticleMenu_Article>();
                            foreach (string item in array)
                            {
                                list.Add(new ArticleMenu_Article
                                {
                                    ArticleID     = m.ID,
                                    ArticleMenuID = C.Int(item)
                                });
                            }
                            if (articleMenu_ArticleService.Add(list) > 0)
                            {
                                res.msg = "添加成功";
                            }
                            else
                            {
                                res.msg        = "栏目添加失败";
                                res.success    = false;
                                res.statusCode = (int)ApiEnum.Status;
                            }
                        }
                    }
                    else
                    {
                        res.msg        = "文章添加失败";
                        res.success    = false;
                        res.statusCode = (int)ApiEnum.Status;
                    }
                }
                catch (Exception ex)
                {
                    res.statusCode = (int)ApiEnum.Error;
                    res.msg        = ApiEnum.Error.GetEnumText() + ex.Message;
                }
            }
            else
            {
                res.msg = "参数丢失";
            }
            return(res);
        }
예제 #30
0
        private static void DrawNormalRarity(JToken rarityToken)
        {
            switch (rarityToken != null ? rarityToken.Value <string>() : string.Empty)
            {
            case "EFortRarity::Transcendent":
                DrawBackground(ImagesUtility.ParseColorFromHex("#D51944"), ImagesUtility.ParseColorFromHex("#86072D"), ImagesUtility.ParseColorFromHex("#FF3F58"));
                break;

            case "EFortRarity::Mythic":
                DrawBackground(ImagesUtility.ParseColorFromHex("#BA9C36"), ImagesUtility.ParseColorFromHex("#73581A"), ImagesUtility.ParseColorFromHex("#EED951"));
                break;

            case "EFortRarity::Legendary":
                DrawBackground(ImagesUtility.ParseColorFromHex("#C06A38"), ImagesUtility.ParseColorFromHex("#73331A"), ImagesUtility.ParseColorFromHex("#EC9650"));
                break;

            case "EFortRarity::Epic":
            case "EFortRarity::Quality":
                DrawBackground(ImagesUtility.ParseColorFromHex("#8138C2"), ImagesUtility.ParseColorFromHex("#421A73"), ImagesUtility.ParseColorFromHex("#B251ED"));
                break;

            case "EFortRarity::Rare":
                DrawBackground(ImagesUtility.ParseColorFromHex("#3669BB"), ImagesUtility.ParseColorFromHex("#1A4473"), ImagesUtility.ParseColorFromHex("#5180EE"));
                break;

            case "EFortRarity::Common":
                DrawBackground(ImagesUtility.ParseColorFromHex("#6D6D6D"), ImagesUtility.ParseColorFromHex("#464646"), ImagesUtility.ParseColorFromHex("#9E9E9E"));
                break;

            default:
                DrawBackground(ImagesUtility.ParseColorFromHex("#5EBC36"), ImagesUtility.ParseColorFromHex("#3C731A"), ImagesUtility.ParseColorFromHex("#74EF52"));
                break;
            }
        }