示例#1
0
        public void import(XmlDocument doc)
        {
            XmlNode blk = null;

            if (doc.DocumentElement.Name == "lure-strings")
            {
                blk = LureCommon.findNode(doc.DocumentElement, "block");
            }
            else if (doc.DocumentElement.Name == "lure-texts")
            {
                blk = LureCommon.findNode(LureCommon.findNode(doc.DocumentElement, "file", "id", resnum.ToString()), "block");
            }
            else
            {
                throw new Exception("bad strings xml");
            }
            ushort count  = BinaryHelper.readU16_LE(data, 0);
            int    curofs = 2;

            for (int i = 0; i < count; i++)
            {
                XmlNode nd  = LureCommon.findNode(blk, "text", "id", i.ToString());
                string  val = "";
                if (nd.ChildNodes.Count > 0)
                {
                    val = LureConfig.get().convert(nd.ChildNodes[0].Value);
                }
                data = LureCommon.checkArrLength(data, curofs + val.Length + 1);
                BinaryHelper.writeZString(data, ref curofs, val);
            }
            LureDisks.setResource(resnum, data);
        }
示例#2
0
 public void impNode(XmlNode nd, ref byte[] dec, ref int pos)
 {
     if (nd.NodeType != XmlNodeType.Element || nd.Name != "node")
     {
         return;
     }
     if (nd.Attributes["value"] != null)
     {
         char   c  = replaceString(nd.Attributes["value"].Value);
         string cd = nd.Attributes["code"].Value;
         dec      = LureCommon.checkArrLength(dec, pos + cd.Length + 2);
         dec[pos] = (byte)c;
         pos++;
         BinaryHelper.writeZString(dec, ref pos, cd);
         return;
     }
     foreach (XmlNode n in nd.ChildNodes)
     {
         impNode(n, ref dec, ref pos);
     }
 }