Example #1
0
        public XmlDocument export()
        {
            XmlDocument doc    = LureCommon.makeXml("lure-decoder");
            int         maxlen = 0;

            foreach (Letter l in letters)
            {
                if (l.len > maxlen)
                {
                    maxlen = l.len;
                }
            }
            procNode(0, 1, doc.DocumentElement, maxlen);
            procNode(1, 1, doc.DocumentElement, maxlen);
            return(doc);
        }
Example #2
0
        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);
        }
Example #3
0
 public LureTexts()
 {
     texts = LureCommon.makeXml("lure-texts");
 }
Example #4
0
        public XmlDocument export(bool arts)
        {
            XmlDocument res        = LureCommon.makeXml("lure-text");
            ushort      skipTblOfs = BinaryHelper.readU16_LE(data, 0);
            ushort      textData   = BinaryHelper.readU16_LE(data, 2);
            int         ofs        = 4;
            int         bglob      = 0;
            int         blkid      = 0;

            while (ofs <= skipTblOfs)
            {
                XmlElement bNode = (XmlElement)res.DocumentElement.AppendChild(res.CreateElement("block"));
                bNode.Attributes.Append(res.CreateAttribute("id")).Value = blkid.ToString();
                int tid   = 0;
                int tofs  = skipTblOfs + 32 * blkid;
                int tglob = 0;
                while (tid < 32 && tofs < textData)
                {
                    XmlElement tNode = (XmlElement)bNode.AppendChild(res.CreateElement("text"));
                    tNode.Attributes.Append(res.CreateAttribute("id")).Value = tid.ToString();
                    int glob = bglob + tglob;
                    int bit  = glob & 3;
                    if ((bit & 3) != 0)
                    {
                        bit = 0x80 >> (bit * 2);
                    }
                    else
                    {
                        bit = 0x80;
                    }
                    glob >>= 2;
                    glob  += textData;
                    //final pos
                    while (getBit(ref glob, ref bit))
                    {
                        glob += 2;
                    }
                    //bool b1 = getBit(ref ofs, ref bit);
                    bool art = getBit(ref glob, ref bit);
                    if (arts)
                    {
                        tNode.Attributes.Append(res.CreateAttribute("art")).Value = art?"1":"0";
                    }
                    readString(tNode, glob, bit);
                    if ((data[tofs] & 0x80) == 0)
                    {
                        tglob += data[tofs];
                    }
                    else
                    {
                        tglob += (data[tofs] & 0x7f) << 3;
                    }
                    tofs++;
                    tid++;
                }
                blkid++;
                bglob += BinaryHelper.readU16_LE(data, ofs);
                ofs   += 2;
            }
            return(res);
        }