Exemple #1
0
        public static List <WpcEntry> ParseDataEntry(string str)
        {
            Buf             src = new Buf(Str.AsciiEncoding.GetBytes(str));
            List <WpcEntry> o   = new List <WpcEntry>();

            while (true)
            {
                byte[] entryNameByte = src.Read(4);
                if (entryNameByte.Length != 4)
                {
                    break;
                }
                byte[] sizeStrByte = src.Read(10);
                if (sizeStrByte.Length != 10)
                {
                    break;
                }
                string sizeStr = Str.AsciiEncoding.GetString(sizeStrByte);
                uint   size    = Str.StrToUInt(sizeStr);

                byte[] strData = src.Read(size);
                if ((uint)strData.Length != size)
                {
                    break;
                }

                string payload = Str.AsciiEncoding.GetString(strData);
                byte[] data    = Wpc.StrToByte(payload);

                WpcEntry e = new WpcEntry(entryNameByte, data);

                o.Add(e);
            }

            return(o);
        }
Exemple #2
0
 public static void AddDataEntry(Buf buf, string entryName, byte[] data)
 {
     AddDataEntry(buf, entryName, Wpc.ByteToStr(data));
 }