Ejemplo n.º 1
0
        public ViewPackInfoWindow(ConfigPackInformation cpi)
            : base(Gtk.WindowType.Toplevel)
        {
            _configPackInformation = cpi;
            this.Build();
            this.HideAll(); this.ShowAll();

            InitializeTreeView();
        }
Ejemplo n.º 2
0
    private static ConfigPackInformation IterateThroughHead(XmlNode node, ConfigPackInformation cpi)
    {
        if (node.HasChildNodes)
        {
            foreach (XmlNode child in node.ChildNodes)
            {
                switch (child.Name)
                {
                    case("config"):
                        cpi.PackName = child.Attributes["name"].Value;
                        break;
                    case ("description"):
                        cpi.Description = child.InnerText;
                        break;
                    case("icon"):
                        cpi.IconURL = child.Attributes["img"].Value;
                        break;
                    case("splash"):
                        cpi.SplashURL = child.Attributes["img"].Value;;
                        break;
                    case("smbx64"):
                        if (child.Attributes["true"] != null)
                            cpi.IsSMBX64 = (child.Attributes["true"].Value == "1") ? true : false;
                        break;
                    case("license"):
                        cpi.License = child.InnerText;
                        break;
                    case("credits"):
                        if (child.HasChildNodes)
                        {
                            foreach (XmlNode partNode in child.ChildNodes)
                            {
                                if (partNode.Name == "part")
                                {
                                    string key = "";
                                    List<AuthorStruct> values = new List<AuthorStruct>();

                                    //XmlNode partNode = node.ChildNodes;
                                    key = (partNode.Attributes["name"].Value == null) ? "" : partNode.Attributes["name"].Value;
                                    if (partNode.HasChildNodes)
                                    {
                                        foreach (XmlNode childAuthor in partNode.ChildNodes)
                                        {
                                            if (childAuthor.Name == "author")
                                            {
                                                AuthorStruct temp = new AuthorStruct();
                                                temp.Author = childAuthor.InnerText;
                                                temp.Comment = (childAuthor.Attributes["comment"] == null) ? "" : childAuthor.Attributes["comment"].Value;
                                                temp.Website = (childAuthor.Attributes["url"] == null) ? "" : childAuthor.Attributes["url"].Value;
                                                temp.Email = (childAuthor.Attributes["email"] == null) ? "" : childAuthor.Attributes["email"].Value;
                                                values.Add(temp);
                                            }
                                        }
                                    }
                                    if (values.Count > 0 && key != "")
                                    {
                                        KeyValuePair<string, AuthorStruct[]> k = new KeyValuePair<string, AuthorStruct[]>(key, values.ToArray());
                                        cpi.CreditsParts.Add(k);
                                    }
                                }
                            }
                        }
                        break;
                }
            }
        }
        return cpi;
    }
Ejemplo n.º 3
0
    private static ConfigPackInformation ReadPackInformation(ConfigPack selected)
    {
        WebClient wc = new WebClient();
        string fullXmlText = wc.DownloadString(Program.ProgramSettings.ConfigsRepoURL + selected.URL + "pge_cpack.xml");
        XmlDocument doc = new XmlDocument();
        doc.LoadXml(fullXmlText);

        ConfigPackInformation cpi = new ConfigPackInformation();

        foreach (XmlNode node in doc.DocumentElement.ChildNodes)
        {
            if(cpi.PackName == null)
                cpi.PackName = node.ParentNode.Attributes["name"].Value;
            switch (node.Name)
            {
                case("head"):
                    cpi = IterateThroughHead(node, cpi);
                    break;
                case("files"):
                    if (node.HasChildNodes)
                    {
                        foreach (XmlNode fileNode in node.ChildNodes)
                        {
                            if (fileNode.Name == "file")
                            {
                                FilesStruct temp = new FilesStruct();
                                //temp.Platform = (fileNode.Attributes["platform"].Value);
                                temp.Folder = (fileNode.Attributes["folder"].Value == null) ? "" : fileNode.Attributes["folder"].Value;
                                temp.URL = fileNode.InnerText;

                                if (temp.URL != null && temp.Folder != null)
                                    cpi.FilesParts.Add(temp);
                            }
                        }
                    }
                    break;
            }
        }
        if (cpi.SplashURL != null && cpi.SplashURL != "")
            cpi.SplashURL = Program.ProgramSettings.ConfigsRepoURL + selected.URL + cpi.SplashURL;
        if (cpi.IconURL != null && cpi.IconURL != "")
            cpi.IconURL = Program.ProgramSettings.ConfigsRepoURL + selected.URL + cpi.IconURL;
        return cpi;
    }