获取xml文件
<?xml version="1.0" encoding="utf-8" ?>
<ArrayOfSystemRool xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<SystemRool>
<Type>A</Type>
<MasterPlate>win7-1.24</MasterPlate>
<MasterPlateID>0e384ece-4c25-4016-8ca9-7db99f2c421b</MasterPlateID>
<OperatingID>c440a422-7447-49b5-a4ce-bccb7ef17a47</OperatingID>
<SystemName>64-bit edition of Windows 7</SystemName>
<CpuCount>2</CpuCount>
</SystemRool>
<SystemRool>
<Type>B</Type>
<MasterPlate>win7-1.24</MasterPlate>
<MasterPlateID>0e384ece-4c25-4016-8ca9-7db99f2c421b</MasterPlateID>
<OperatingID>c440a422-7447-49b5-a4ce-bccb7ef17a47</OperatingID>
<SystemName>64-bit edition of Windows 7</SystemName>
<CpuCount>2</CpuCount>
</SystemRool>
<SystemRool>
<Type>C</Type>
<MasterPlate>win7-1.24</MasterPlate>
<MasterPlateID>0e384ece-4c25-4016-8ca9-7db99f2c421b</MasterPlateID>
<OperatingID>c440a422-7447-49b5-a4ce-bccb7ef17a47</OperatingID>
<SystemName>64-bit edition of Windows 7</SystemName>
<CpuCount>2</CpuCount>
</SystemRool>
</ArrayOfSystemRool>
/// <summary>
/// 获取类型和模板
/// </summary>
/// <returns></returns>
public static List<SystemRool> GetRool()
{
var _str = File.ReadAllText(HttpContext.Current.Server.MapPath("/masterplate.xml"));
var _rools = NvWa.Common.DataTypeExtend.SerializeHelper.XMLDeserialize<List<SystemRool>>(_str);
return _rools;
}
public class SystemRool
{
public string Type { get; set; }//类型对应模版
public string MasterPlate { get; set; }//模版名称
public string MasterPlateID { get; set; }//模版ID
public string OperatingID { get; set; }//操作系统名称
public string SystemName { get; set; }//操作系统名称
public int CpuCount { get; set; }//CPU个数
}
【推荐】还在用 ECharts 开发大屏?试试这款永久免费的开源 BI 工具!
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步