예제 #1
0
 public static FormElementInfo[] ReadFormElements(BinaryReader r)
 {
     return(r.ReadBlocksWithIdAndOffest((reader, id, length) =>
     {
         var dataType = reader.ReadInt32();
         FormElementInfo elem;
         if (dataType == 65539)
         {
             elem = FormMenuInfo.ReadWithoutDataType(r, length - 4);
         }
         else
         {
             elem = FormControlInfo.ReadWithoutDataType(r, length - 4);
         }
         elem.Id = id;
         elem.DataType = dataType;
         return elem;
     }));
 }
예제 #2
0
        internal static FormMenuInfo ReadWithoutDataType(BinaryReader reader, Encoding encoding, int length)
        {
            var startPosition = reader.BaseStream.Position;
            var elem          = new FormMenuInfo()
            {
            };

            elem.UnknownBeforeName = reader.ReadBytes(20);
            elem.Name = reader.ReadCStyleString(encoding);
            reader.ReadCStyleString(encoding); // 菜单没有Comment
            elem.HotKey = reader.ReadInt32();
            elem.Level  = reader.ReadInt32();
            {
                int showStatus = reader.ReadInt32();
                elem.Visible  = (showStatus & 0x1) == 0;
                elem.Disable  = (showStatus & 0x2) != 0;
                elem.Selected = (showStatus & 0x4) != 0;
            }
            elem.Text                   = reader.ReadCStyleString(encoding);
            elem.ClickEvent             = reader.ReadInt32();
            elem.UnknownAfterClickEvent = reader.ReadBytes(length - (int)(reader.BaseStream.Position - startPosition));
            return(elem);
        }