Browse Source

fix 增加layout解析Config step

jiangjy 2 weeks ago
parent
commit
2619b3b407

+ 27 - 2
Furnace/FurnaceRT/Equipments/Systems/EquipmentManager_FA.cs

@@ -664,9 +664,34 @@ namespace FurnaceRT.Equipments.Systems
         }
         }
         public string GetRecipeBody(string recipename)
         public string GetRecipeBody(string recipename)
         {
         {
-            
+            var recipeContent = RecipeFileManager.Instance.LoadRecipeByFullPathForFA(recipename);
 
 
-            return RecipeFileManager.Instance.LoadRecipeByFullPathForFA(recipename);
+            if (recipename.StartsWith("Furnace\\Layout"))
+            {
+                // 解析XML
+                XDocument doc = XDocument.Parse(recipeContent);
+                // 获取Config节点
+                XElement configElement = doc.Descendants("Config").Last();
+                // 获取Name为"Normal"的Step节点
+                XElement normalStepElement = doc.Descendants("Step").FirstOrDefault(step => step.Attribute("Name")?.Value == "Normal");
+
+                if (normalStepElement != null && configElement != null)
+                {
+                    // 将Config节点的所有属性添加到Normal Step节点
+                    foreach (XAttribute attr in configElement.Attributes())
+                    {
+                        // 检查属性是否已存在,如果不存在则添加
+                        if (normalStepElement.Attribute(attr.Name) == null)
+                        {
+                            normalStepElement.Add(new XAttribute(attr.Name, attr.Value));
+                        }
+                    }
+
+                    recipeContent = doc.ToString();
+                }
+            }
+
+            return recipeContent;
         }
         }
         public bool DeleteRecipes(string[] recipenames)
         public bool DeleteRecipes(string[] recipenames)
         {
         {

BIN
Furnace/FurnaceRT/dependence/MECF.Framework.MyFA.Core.dll