public void readDecoder(bool old) { byte[] dec = null; if (old) { if (olddec == null) { dec = LureConfig.get().DecodeTable; olddec = new byte[dec.Length]; Array.Copy(dec, olddec, dec.Length); } else { dec = new byte[olddec.Length]; Array.Copy(olddec, dec, dec.Length); } } else { dec = LureConfig.get().DecodeTable; } letters.Clear(); int pos = 0; while (dec[pos] != 0xff) { char c = (char)dec[pos]; pos++; string s = BinaryHelper.readZString(dec, pos); pos += s.Length + 1; letters.Add(new Letter(s, c)); } }
public string processNames(string s) { string res = s; int cnt = BinaryHelper.readU16_LE(data, 0) / 2; for (int i = 1; i < cnt; i++) { int strt = BinaryHelper.readU16_LE(data, i * 2); string nm = BinaryHelper.readZString(data, strt); char code = (char)(i + 0xA0); res.Replace(nm, "" + code); } return(res); }
public XmlDocument export() { XmlDocument res = LureCommon.makeXml("lure-strings"); XmlNode blk = res.DocumentElement.AppendChild(res.CreateElement("block")); ushort count = BinaryHelper.readU16_LE(data, 0); int ofs = 2; for (int i = 0; i < count; i++) { string str = BinaryHelper.readZString(data, ofs); ofs += str.Length + 1; XmlNode txt = blk.AppendChild(res.CreateElement("text")); txt.Attributes.Append(res.CreateAttribute("id")).Value = i.ToString(); if (str != "") { txt.AppendChild(res.CreateTextNode(str)); } } return(res); }
public string getName(int index) { int nmStart = BinaryHelper.readU16_LE(data, index * 2); return(BinaryHelper.readZString(data, nmStart)); }