public static int LoadStringsFile(string filePath) { if (!File.Exists(filePath)) { File.WriteAllBytes(filePath, Properties.Resources.strings); } int v = 0; int h; XmlDocument doc = new XmlDocument(); doc.Load(filePath); foreach (XmlElement e in doc.GetElementsByTagName("Item")) { int i = XH.GetXmlInt(e, "idx", -1); if (i >= 0) { for (h = gstr.Count; h <= i; h++) { gstr.Add(string.Empty); } gstr[i] = XH.GetXmlString(e, "val", ""); v++; } } RawVersionNumber = "11, Build 4"; ShortVersionText = "GCal " + RawVersionNumber; FullVersionText = "Gaurabda Calendar " + RawVersionNumber; return(v); }
public void LoadFromNode(XmlElement e) { Type = XH.GetXmlInt(e, "Type", 0); Week = XH.GetXmlInt(e, "Week", 0); Month = XH.GetXmlInt(e, "Month", 0); Day = XH.GetXmlInt(e, "Day", 0); }
public void SaveToNode(XmlElement e) { XH.SetXmlInt(e, "Type", Type); XH.SetXmlInt(e, "Week", Week); XH.SetXmlInt(e, "Month", Month); XH.SetXmlInt(e, "Day", Day); }
public void LoadFromNode(XmlElement e) { Name = XH.GetXmlString(e, "Name", "(Unknown)"); OffsetMinutes = XH.GetXmlInt(e, "Offset", 0); BiasMinutes = XH.GetXmlInt(e, "Bias", 0); StartDst.LoadFromNode(e["StartDst"]); EndDst.LoadFromNode(e["EndDst"]); }
public void LoadFromNode(XmlElement e) { GeonameID = XH.GetXmlInt(e, "ID", -1); CityName = XH.GetXmlString(e, "Name", ""); ASCIIName = XH.GetXmlString(e, "AS", ""); AlternativeNames = XH.GetXmlString(e, "Alt", ""); Latitude = XH.GetXmlDouble(e, "Y", 0); Longitude = XH.GetXmlDouble(e, "X", 0); Elevation = XH.GetXmlDouble(e, "Z", 0); CountryISOCode = XH.GetXmlString(e, "Cnt", ""); Population = XH.GetXmlInt(e, "P", 0); TimeZoneName = XH.GetXmlString(e, "TZ", "Undefined"); }
public void SaveToNode(XmlElement e) { XH.SetXmlInt(e, "ID", GeonameID); XH.SetXmlString(e, "Name", CityName); XH.SetXmlString(e, "AS", ASCIIName); if (AlternativeNames.Length > 0) { XH.SetXmlString(e, "Alt", AlternativeNames); } XH.SetXmlDouble(e, "Y", Latitude); XH.SetXmlDouble(e, "X", Longitude); if (Elevation > 0.1) { XH.SetXmlDouble(e, "Z", Elevation); } XH.SetXmlString(e, "Cnt", CountryISOCode); if (Population > 0) { XH.SetXmlInt(e, "P", Population); } XH.SetXmlString(e, "TZ", TimeZoneName); }
public static void SaveStringsFile(string filePath) { XmlDocument doc = new XmlDocument(); XmlElement e = doc.CreateElement("Strings"); doc.AppendChild(e); for (int i = 0; i < gstr.Count; i++) { if (gstr[i].Length > 0) { XmlElement e2 = doc.CreateElement("Item"); e.AppendChild(e2); XH.SetXmlInt(e2, "idx", i); XH.SetXmlString(e2, "val", getString(i)); } } doc.Save(filePath); }