internal static void Build14(string projPath, string buildPath, string path) { string fp12, cloneName; string [] cloneVals; List <string> list; XmlDocument mergeSrc = null, mergeTarget = null; DirectoryInfo dir14 = new DirectoryInfo(Path.Combine(projPath, path)); foreach (DirectoryInfo dir in dir14.GetDirectories("*", SearchOption.TopDirectoryOnly)) { Build14(projPath, buildPath, path.TrimEnd('\\') + '\\' + dir.Name); } foreach (FileInfo file in dir14.GetFiles("*", SearchOption.TopDirectoryOnly)) { if (!File.Exists(fp12 = file.FullName.Replace("\\_14\\", "\\12\\").Replace(projPath, buildPath))) { file.CopyTo(fp12, true); } else { try { mergeSrc = new XmlDocument(); mergeTarget = new XmlDocument(); mergeSrc.Load(file.FullName); mergeTarget.Load(fp12); } catch { mergeSrc = null; mergeTarget = null; } if ((mergeSrc != null) && (mergeTarget != null)) { foreach (XmlNode mergeNode in mergeSrc.DocumentElement.ChildNodes) { if (mergeNode.NodeType == XmlNodeType.Element) { foreach (XmlNode targetNode in mergeTarget.SelectNodes(XmlUtil.Attribute(mergeNode, "Path"))) { if (mergeNode.LocalName == "AppendNode") { targetNode.AppendChild(mergeTarget.ImportNode(mergeNode.FirstChild, true)); if ((!string.IsNullOrEmpty(cloneName = XmlUtil.Attribute(mergeNode, "CloneName"))) && ((cloneVals = XmlUtil.Attribute(mergeNode, "CloneValues").Split(new char [] { ',' }, StringSplitOptions.RemoveEmptyEntries)) != null) && (cloneVals.Length > 0)) { list = new List <string> (); foreach (string cv in cloneVals) { if (!cv.Contains("-")) { list.Add(cv); } else { for (int i = int.Parse(cv.Substring(0, cv.IndexOf('-'))); i <= int.Parse(cv.Substring(cv.IndexOf('-') + 1)); i++) { list.Add(i.ToString()); } } } cloneVals = list.ToArray(); foreach (string attVal in cloneVals) { XmlUtil.EnsureAttribute(targetNode.AppendChild(mergeTarget.ImportNode(mergeNode.FirstChild, true)), cloneName, attVal, true); } } } else if (mergeNode.LocalName == "SetAtt") { XmlUtil.EnsureAttribute(targetNode, XmlUtil.Attribute(mergeNode, "Name"), XmlUtil.Attribute(mergeNode, "Value"), true); } } } } mergeTarget.Save(fp12); } } } }