首页 > 代码库 > 获取xml文件
获取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个数
}
获取xml文件