8,497
社区成员
发帖
与我相关
我的任务
分享
IEnumerable<XElement> iEnumerable = from xx in temp
orderby Convert.ToInt32(xx.Element("item").Element("index").Value)
select xx;
<!--数据库升级-->
<SQLUpdate>
<!--DBName:数据库名-->
<item type="Microsoft SQL Server (SqlClient)">
<!--name:数据库创建脚本文件名;index:执行顺序;describe:描述;path:路径-->
<name>Update_1.0to1.1_kj222.sql</name>
<index>1</index>
<describe>KJ222项目版本_v1.0升级到1.1</describe>
<path>数据库升级脚本\Update_1.0to1.1_kj222.sql</path>
</item>
<item type="Microsoft SQL Server (SqlClient)">
<!--name:数据库创建脚本文件名;index:执行顺序;describe:描述;path:路径-->
<name>Update_1.1to1.2_kj222.sql</name>
<index>4</index>
<describe>KJ222项目版本_v1.1升级到1.2</describe>
<path>数据库升级脚本\Update_1.1to1.2_kj222.sql</path>
</item>
<item type="Microsoft SQL Server (SqlClient)">
<!--name:数据库创建脚本文件名;index:执行顺序;describe:描述;path:路径-->
<name>Update_1.2to1.3_WeightSys.sql</name>
<index>2</index>
<describe>称重防作弊项目版本_v1.2升级到1.3</describe>
<path>数据库升级脚本\Update_1.2to1.3_WeightSys.sql</path>
</item>
<item type="Microsoft SQL Server (SqlClient)">
<!--name:数据库创建脚本文件名;index:执行顺序;describe:描述;path:路径-->
<name>Update_1.3to1.4_WeightSys.sql</name>
<index>3</index>
<describe>称重防作弊项目版本_v1.3升级到1.4</describe>
<path>数据库升级脚本\Update_1.3to1.4_WeightSys.sql</path>
</item>
<item type="Microsoft SQL Server (SqlClient)">
<!--name:数据库创建脚本文件名;index:执行顺序;describe:描述;path:路径-->
<name>Update_1.4to1.5_WeightSys.sql</name>
<index>5</index>
<describe>称重防作弊项目版本_v1.4升级到1.5</describe>
<path>数据库升级脚本\Update_1.4to1.5_WeightSys.sql</path>
</item>
</SQLUpdate>
public void GetXmlConfig(List<ChildNode> list, string items, bool flag)
{
XElement doc = XElement.Load(GlobalCache.FilePath + @"\Config.xml");
try
{
IEnumerable<XElement> temp = doc.Elements("Install").Elements(items);
IEnumerable<XElement> iEnumerable = from xx in temp
orderby Convert.ToInt32(xx.Element("item").Element("index").Value)
select xx;
if (temp.FirstOrDefault().Value != "")
{...}
void Main()
{
string xml = @"<!--数据库升级-->
<SQLUpdate>
<!--DBName:数据库名-->
<item type=""Microsoft SQL Server (SqlClient)"">
<!--name:数据库创建脚本文件名;index:执行顺序;describe:描述;path:路径-->
<name>Update_1.0to1.1_kj222.sql</name>
<index>1</index>
<describe>KJ222项目版本_v1.0升级到1.1</describe>
<path>数据库升级脚本\Update_1.0to1.1_kj222.sql</path>
</item>
<item type=""Microsoft SQL Server (SqlClient)"">
<!--name:数据库创建脚本文件名;index:执行顺序;describe:描述;path:路径-->
<name>Update_1.1to1.2_kj222.sql</name>
<index>4</index>
<describe>KJ222项目版本_v1.1升级到1.2</describe>
<path>数据库升级脚本\Update_1.1to1.2_kj222.sql</path>
</item>
<item type=""Microsoft SQL Server (SqlClient)"">
<!--name:数据库创建脚本文件名;index:执行顺序;describe:描述;path:路径-->
<name>Update_1.2to1.3_WeightSys.sql</name>
<index>2</index>
<describe>称重防作弊项目版本_v1.2升级到1.3</describe>
<path>数据库升级脚本\Update_1.2to1.3_WeightSys.sql</path>
</item>
<item type=""Microsoft SQL Server (SqlClient)"">
<!--name:数据库创建脚本文件名;index:执行顺序;describe:描述;path:路径-->
<name>Update_1.3to1.4_WeightSys.sql</name>
<index>3</index>
<describe>称重防作弊项目版本_v1.3升级到1.4</describe>
<path>数据库升级脚本\Update_1.3to1.4_WeightSys.sql</path>
</item>
<item type=""Microsoft SQL Server (SqlClient)"">
<!--name:数据库创建脚本文件名;index:执行顺序;describe:描述;path:路径-->
<name>Update_1.4to1.5_WeightSys.sql</name>
<index>5</index>
<describe>称重防作弊项目版本_v1.4升级到1.5</describe>
<path>数据库升级脚本\Update_1.4to1.5_WeightSys.sql</path>
</item>
</SQLUpdate>";
XElement xmlPage = XElement.Parse(xml);
var query = from xx in xmlPage.Descendants("item")
orderby Convert.ToInt32(xx.Element("index").Value)
select xx;
}