XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet

XFEEDToolBox

【WinUI】XFE精英危险工具箱

公开
关注 0 Fork 0 Star 0
UTF-8
using System.Text.Json;
namespace XFEEDToolBox.Core.Outfitting;
public static class ModulePrices
{
    private static readonly Lazy<Dictionary<string,decimal>> Prices=new(()=>
    {
        using var source=typeof(ModulePrices).Assembly.GetManifestResourceStream("XFEEDToolBox.Core.Outfitting.prices.json")!;
        using var document=JsonDocument.Parse(source);
        return document.RootElement.GetProperty("prices").EnumerateObject().ToDictionary(x=>x.Name,x=>x.Value.GetDecimal(),StringComparer.OrdinalIgnoreCase);
    });
    public static decimal? Find(string item)=>Prices.Value.TryGetValue(item.Trim('$',';'),out var price)?price:null;
}