예제 #1
0
        public void patchIso2(ListView lvw, string gamesPath, string isoPath, string inputxml, string inputfolder)
        {
            foreach (ListViewItem item in lvw.Items)
            {
                string optionName = item.Text;
                string choiceName = item.Tag.ToString();

                XmlDocument xmlDoc = new XmlDocument();
                xmlDoc.Load(inputxml);

                XmlNodeList sections = xmlDoc.SelectNodes("//wiidisc/options/section");
                string      patchid  = "";
                foreach (XmlNode section in sections)
                {
                    parseXML    xmlParser = new parseXML();
                    XmlNodeList options   = xmlDoc.SelectNodes(xmlParser.GetXPathToNode(section) + "/node()");
                    foreach (XmlNode option in options)
                    {
                        if (option.Attributes["name"].Value == item.Text)
                        {
                            XmlNodeList choices = xmlDoc.SelectNodes(xmlParser.GetXPathToNode(option) + "/node()");
                            foreach (XmlNode choice in choices)
                            {
                                if (choice.Attributes["name"].Value == item.Tag.ToString())
                                {
                                    patchid = xmlDoc.SelectSingleNode(xmlParser.GetXPathToNode(choice) + "/node()").Attributes["id"].Value;

                                    XmlNodeList patches = xmlDoc.SelectNodes("//wiidisc/patch");
                                    foreach (XmlNode patch in patches)
                                    {
                                        if (patch.Attributes["id"].Value == patchid)
                                        {
                                            {
                                                XmlNodeList folders = xmlDoc.SelectNodes(xmlParser.GetXPathToNode(patch) + "/node()");
                                                foreach (XmlNode folder in folders)
                                                {
                                                    if (folder.Name == "folder")
                                                    {
                                                        string external = folder.Attributes["external"].Value;
                                                        string disc     = "";
                                                        try
                                                        {
                                                            disc = folder.Attributes["disc"].Value;
                                                        }
                                                        catch { }

                                                        if (Directory.Exists(Path.GetFileName(gamesPath + "/rii/" + Path.GetFileNameWithoutExtension(isoPath)) + "/DATA/"))
                                                        {
                                                            MessageBox.Show(@inputfolder + external, gamesPath + "/rii/" + Path.GetFileName(gamesPath + "/" + Path.GetFileNameWithoutExtension(isoPath)) + "/DATA/files/" + disc);
                                                            CopyDir(@inputfolder + external, gamesPath + "/rii/" + Path.GetFileName(gamesPath + "/" + Path.GetFileNameWithoutExtension(isoPath)) + "/DATA/files/" + disc);

                                                            //worker.RunWorkerAsync();
                                                        }
                                                        else
                                                        {
                                                            CopyDir(@inputfolder + external, gamesPath + "/rii/" + Path.GetFileName(gamesPath + "/" + Path.GetFileNameWithoutExtension(isoPath)) + "/files/" + disc);
                                                        }
                                                    }

                                                    if (folder.Name == "file")
                                                    {
                                                        string external = folder.Attributes["external"].Value;
                                                        string disc     = "";

                                                        try
                                                        {
                                                            disc = folder.Attributes["disc"].Value;
                                                        }
                                                        catch { }
                                                        if (!(disc == ""))
                                                        {
                                                            //MessageBox.Show(@inputfolder + external, gamesPath + "/rii/" + Path.GetFileName(gamesPath + "/" + Path.GetFileNameWithoutExtension(isoPath)) + "/DATA/files/" + disc);
                                                            if (Directory.Exists(Path.GetFileName(gamesPath + "/rii/" + Path.GetFileNameWithoutExtension(isoPath)) + "/DATA/"))
                                                            {
                                                                File.Copy(@inputfolder + external, Path.GetFileName(gamesPath + "/" + Path.GetFileNameWithoutExtension(isoPath)) + "/DATA/files/" + disc);
                                                            }
                                                            else
                                                            {
                                                                File.Copy(@inputfolder + external, Path.GetFileName(gamesPath + "/" + Path.GetFileNameWithoutExtension(isoPath)) + "/files/" + disc);
                                                            }
                                                            //worker.RunWorkerAsync();
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
예제 #2
0
        public void patchIso(ListView lvw, string outputpath, string inputxml, string inputfolder)
        {
            foreach (ListViewItem item in lvw.Items)
            {
                string optionName = item.Text;
                string choiceName = item.Tag.ToString();

                XmlDocument xmlDoc = new XmlDocument();
                xmlDoc.Load(inputxml);

                XmlNodeList sections = xmlDoc.SelectNodes("//wiidisc/options/section");
                string      patchid  = "";
                foreach (XmlNode section in sections)
                {
                    parseXML    xmlParser = new parseXML();
                    XmlNodeList options   = xmlDoc.SelectNodes(xmlParser.GetXPathToNode(section) + "/node()");
                    foreach (XmlNode option in options)
                    {
                        if (option.Attributes["name"].Value == item.Text)
                        {
                            XmlNodeList choices = xmlDoc.SelectNodes(xmlParser.GetXPathToNode(option) + "/node()");
                            foreach (XmlNode choice in choices)
                            {
                                if (choice.Attributes["name"].Value == item.Tag.ToString())
                                {
                                    patchid = xmlDoc.SelectSingleNode(xmlParser.GetXPathToNode(choice) + "/node()").Attributes["id"].Value;

                                    XmlNodeList patches = xmlDoc.SelectNodes("//wiidisc/patch");
                                    foreach (XmlNode patch in patches)
                                    {
                                        if (patch.Attributes["id"].Value == patchid)
                                        {
                                            {
                                                XmlNodeList folders = xmlDoc.SelectNodes(xmlParser.GetXPathToNode(patch) + "/node()");
                                                foreach (XmlNode folder in folders)
                                                {
                                                    string external = folder.Attributes["external"].Value;
                                                    string disc     = "";
                                                    try
                                                    {
                                                        disc = folder.Attributes["disc"].Value;
                                                    }
                                                    catch {}

                                                    if (!(disc == ""))
                                                    {
                                                        MessageBox.Show(inputfolder + external, Application.StartupPath + "/ex" + disc);
                                                        CopyDir(@inputfolder + external, Application.StartupPath + "/ex" + disc);

                                                        worker.RunWorkerAsync();
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }