private void Form_Load(object sender, EventArgs e) { StringBuilder sFormattedVersion = new StringBuilder(); try { //Is there a "" in the same directory as the application? If so, load it up and display it as the version history string sVersionHistoryXML = ResourceExtensions.GetResourceTextFile("VersionHistory.xml"); if (sVersionHistoryXML.Length > 0) { try { //Attempt to load up xml XmlDocument oDoc = new XmlDocument(); oDoc.LoadXml(sVersionHistoryXML); XmlNodeList oVersionNodes = oDoc.SelectNodes("versions/version"); foreach (XmlNode oNode in oVersionNodes) { sFormattedVersion.AppendLine("Version: " + oNode.Attributes["id"].Value); XmlNodeList oChangeNodes = oNode.SelectNodes("change"); foreach (XmlNode oChange in oChangeNodes) { sFormattedVersion.AppendLine(" " + oChange.InnerText); } } } catch (Exception ex) { sFormattedVersion.AppendLine("Unable to load version history: " + ex.Message); } } else { sFormattedVersion.AppendLine("No version history available."); } } catch (Exception ex) { sFormattedVersion.AppendLine("The following error occurred: " + ex.Message.ToString()); } txtVersion.Text = sFormattedVersion.ToString(); }
private void LoadList() { //sample file contents: //32D0;CIRCLED KATAKANA A;So;0;L;<circle> 30A2;;;;N;;;;; string rawTextOfList = ResourceExtensions.GetResourceTextFile("UnicodeCharSet.txt"); //split by <CR> string[] lines = rawTextOfList.Split('\r'); foreach (string oneLine in lines) { string[] elements = oneLine.Replace("\n", "").Split(';'); CharEntry oneEntry = new CharEntry(); oneEntry.CodeHex = elements[0]; oneEntry.CodeDec = Int64.Parse(elements[0], System.Globalization.NumberStyles.HexNumber).ToString(); oneEntry.Desc = elements[1]; oneEntry.AltDesc = elements[10]; _charCodes.Add(oneEntry); } }