码迷,mamicode.com
首页 > 数据库 > 详细

通过HearthDb生成带PlayReq的CardDefs.xml

时间:2020-04-06 13:27:08      阅读:109      评论:0      收藏:0      [点我收藏+]

标签:over   tps   lob   导入   cut   only   problem   esc   初始   

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.

 

通过HearthDb生成带PlayReq的CardDefs.xml

标签:over   tps   lob   导入   cut   only   problem   esc   初始   

原文地址:https://www.cnblogs.com/chucklu/p/12641569.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!