通过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    
posted @   ChuckLu  阅读(1469)  评论(0编辑  收藏  举报
编辑推荐:
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
历史上的今天:
2016-04-06 ConfigSections配置
点击右上角即可分享
微信分享提示