通过HearthDb生成带PlayReq的CardDefs.xml
HearthDb项目从另外一个项目导入了初始的xml文件
https://github.com/HearthSim/HearthDb/blob/master/HearthDb/HearthDb.csproj
<PropertyGroup> <PreBuildEvent>if exist $(ProjectDir)hsdata ( git -C "$(ProjectDir)hsdata" fetch git -C "$(ProjectDir)hsdata" reset --hard origin/master ) else ( git clone --depth=1 https://github.com/HearthSim/hsdata.git "$(ProjectDir)hsdata" ) if "$(ConfigurationName)" == "Release" ( powershell -ExecutionPolicy Unrestricted -file "$(ProjectDir)verify.ps1" "$(ProjectDir)\" ) xcopy /Y "$(ProjectDir)hsdata\CardDefs.xml" "$(ProjectDir)CardDefs.xml*"</PreBuildEvent> </PropertyGroup>
加载卡牌文件的代码
https://github.com/HearthSim/HearthDb/blob/master/HearthDb/Cards.cs#L23
var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("HearthDb.CardDefs.xml"); if(stream == null) return;
需要注意的是xml文件,是以embedded resource嵌入项目的
<ItemGroup> <EmbeddedResource Include="CardDefs.xml" /> </ItemGroup>
Visual Studio: How to store an image resource as an Embedded Resource?
Note: This answer is not the recommended way of handling image resources. It just addresses the particular problem as described by the question (i.e. to include an image as an embedded resourse).
Don't add the image as a resource. I would rather do the following:
- Create the image/icon and save it to a file
- Choose Project -> Add Existing Item and add the file
- Set the Build Action to Embedded Resource
You can then access this resource using
Assembly.GetExecutingAssembly().GetManifestResourceStream(resourceUri)
This way the image is not magically added to the projects resource file and you will only have one copy of the image stored in the assembly's resources.
从版本16.0.0.37060开始,就不附带playreq了
https://github.com/HearthSim/HearthDb/issues/18
patch 15.6.2.36393 still has the PlayRequirement section, when it comes to patch 16.0.0.37060, the section lost.
作者:Chuck Lu GitHub |
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
2016-04-06 ConfigSections配置