通过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.
相关文章
- How to: Read Object Data from an XML File
- 技术分享 | 接口自动化测试中如何对xml 格式做断言验证?
- ASP.NET MVC WebApi 返回数据类型序列化控制(json,xml) 用javascript在客户端删除某一个cookie键值对 input点击链接另一个页面,各种操作。 C# 往线程里传参数的方法总结 TCP/IP 协议 用C#+Selenium+ChromeDriver 生成我的咕咚跑步路线地图 (转)值得学习百度开源70+项目
- 能源项目xml文件标签释义--DataSource
- 09dwr - dwr.xml配置(纵览)
- 将XML格式文件转换JSON文件格式
- XML、XML约束、XML解析、常用的xml解析器(DOM4J)、XPATH
- XML解析之SAX方式解析xml文件
- Qt操作xml文件(增删改功能)
- 自定义控件三部曲之动画篇(一)——alpha、scale、translate、rotate、set的xml属性及用法
- php xml操作
- java中XML操作:xml与string互转、读取XML文档节点及对XML节点增删改查
- maven的pom.xml举例
- MyBatis-Plus 使用xml文件
- Solr 配置文件之schema.xml
- Unity 中读取XML文件
- 【spring框架】XML配置AOP
- Python获取xml数据
- 【Android】使用Pull生成/解析XML文件