/* * Adds a new Lua version. The widget name and all the complete file list is needed */ public void addLuaVersionAndFiles(decimal version, string widgetName, string changelog, ArrayList fileList) { fileList = Utils.normalizePathnames(fileList); WidgetName wn = this.getNameByWidgetName(widgetName); int luaId = this.addLuaVersion(version, wn.Id); this.updateLuaVersion(luaId, changelog, 1); for (int i = 0; i < fileList.Count; i++) { string sourceFilename = Utils.normalizePathname((string)fileList[i]); string localGamePath = sourceFilename.Substring(sourceFilename.IndexOf("/LuaUI/")); this.addLuaFile(sourceFilename, localGamePath, luaId); } }
static protected SortedList <string, WidgetName> xml2NamesList(XmlDocument doc) { XmlNode root = doc.DocumentElement; IEnumerator ienum = root.GetEnumerator(); XmlNode fileXml; SortedList <string, WidgetName> table = new SortedList <string, WidgetName>(); while (ienum.MoveNext()) { fileXml = (XmlNode)ienum.Current; WidgetName info = WidgetBrowserAdmin.xml2NameInfo(fileXml); table.Add(info.Name, info); } return(table); }
static protected WidgetName xml2NameInfo(XmlNode xml) { WidgetName winfo = new WidgetName(); winfo.Id = int.Parse(xml.Attributes.GetNamedItem("ID").InnerText); winfo.Name = xml.SelectSingleNode("Name").InnerText; winfo.SupportedMods = xml.SelectSingleNode("Mods").InnerText; winfo.ownerId = int.Parse(xml.SelectSingleNode("OwnerId").InnerText); winfo.Hidden = (int.Parse(xml.SelectSingleNode("Hidden").InnerText) == 1); winfo.VoteCount = int.Parse(xml.SelectSingleNode("VoteCount").InnerText); winfo.CommentCount = int.Parse(xml.SelectSingleNode("CommentCount").InnerText); try { winfo.CategoryId = int.Parse(xml.SelectSingleNode("CategoryId").InnerText); } catch { winfo.CategoryId = 0; } if (xml.SelectSingleNode("Rating").InnerText.Length == 0) { winfo.Rating = 0.0f; } else { string t = xml.SelectSingleNode("Rating").InnerText; winfo.Rating = float.Parse(xml.SelectSingleNode("Rating").InnerText, CultureInfo.CreateSpecificCulture("en-US").NumberFormat); } if (xml.SelectSingleNode("Author") != null) { winfo.Author = xml.SelectSingleNode("Author").InnerText; } if (xml.SelectSingleNode("Description") != null) { winfo.Description = xml.SelectSingleNode("Description").InnerText; } return(winfo); }
static protected WidgetName xml2NameInfo(XmlNode xml) { WidgetName winfo = new WidgetName(); winfo.Id = int.Parse(xml.Attributes.GetNamedItem("ID").InnerText); winfo.Name = xml.SelectSingleNode("Name").InnerText; winfo.SupportedMods = xml.SelectSingleNode("Mods").InnerText; winfo.ownerId = int.Parse(xml.SelectSingleNode("OwnerId").InnerText); winfo.Hidden = ( int.Parse(xml.SelectSingleNode("Hidden").InnerText) == 1 ); winfo.VoteCount = int.Parse(xml.SelectSingleNode("VoteCount").InnerText); winfo.CommentCount = int.Parse(xml.SelectSingleNode("CommentCount").InnerText); try { winfo.CategoryId = int.Parse(xml.SelectSingleNode("CategoryId").InnerText); } catch { winfo.CategoryId = 0; } if (xml.SelectSingleNode("Rating").InnerText.Length == 0) { winfo.Rating = 0.0f; } else { string t = xml.SelectSingleNode("Rating").InnerText; winfo.Rating = float.Parse(xml.SelectSingleNode("Rating").InnerText, CultureInfo.CreateSpecificCulture("en-US").NumberFormat); } if (xml.SelectSingleNode("Author") != null) { winfo.Author = xml.SelectSingleNode("Author").InnerText; } if (xml.SelectSingleNode("Description") != null) { winfo.Description = xml.SelectSingleNode("Description").InnerText; } return winfo; }