Beispiel #1
0
 void directoriesReconstructor(DirectoryNode curentNode, string curPath)
 {
     if (curentNode.xmlNode.Attributes["Name"] != null)
         curPath += @"\"+curentNode.xmlNode.Attributes["Name"].Value;
     else
         curPath += @"\"+curentNode.xmlNode.Attributes["Id"].Value;
     if (!Directory.Exists(curPath)) Directory.CreateDirectory(curPath);
     if (curentNode.files.Count > 0) {
         XmlAttribute fileSourceAttr = curentNode.xmlNode.OwnerDocument.CreateAttribute("FileSource");
         fileSourceAttr.Value = curPath;
         curentNode.xmlNode.Attributes.Append(fileSourceAttr);
     }
     foreach (XmlNode fileElement in curentNode.files) {
         if (fileElement.Attributes["Vital"] != null)
             if (fileElement.Attributes["Vital"].Value == "no") fileElement.Attributes.RemoveNamedItem("Vital");
         if (fileElement.Attributes["DiskId"] != null)
             if (fileElement.Attributes["DiskId"].Value == "1") fileElement.Attributes.RemoveNamedItem("DiskId");
         if (fileElement.Attributes["KeyPath"] != null)
             if (fileElement.Attributes["KeyPath"].Value == "no") fileElement.Attributes.RemoveNamedItem("KeyPath");
         //Logger.Log("File copy: "+SourcePath+fileElement.Attributes["Source"].Value +" --> "+ curPath + "\\" + fileElement.Attributes["Name"].Value);
         File.Copy(SourcePath+fileElement.Attributes["Source"].Value, curPath + "\\" + fileElement.Attributes["Name"].Value, true);
         if (fileElement.Attributes["Source"] != null) fileElement.Attributes.RemoveNamedItem("Source");
     }
     foreach (var childDir in curentNode.childDirs) {
         directoriesReconstructor(childDir, curPath);
     }
 }
Beispiel #2
0
        void Parse(XmlNode part, DirectoryNode parentFolder)
        {
            if (part.Name == "Directory") {
                DirectoryNode dirNode = new DirectoryNode();
                parentFolder.childDirs.Add(dirNode);
                parentFolder = dirNode;
                dirNode.xmlNode = part;
            }
            if (part.Name == "File") {
                parentFolder.files.Add(part);
            }

            foreach (XmlNode node in part.ChildNodes)
                Parse(node, parentFolder);

            if (part.Name == "Component" && GetNodes(part, "wixns:File").Count == 0)
            {
                if (!part.InnerXml.Contains("CreateFolder")) {
                    regComponents.Add(part);
                }
            }
        }