public static FormElementInfo[] ReadFormElements(BinaryReader r) { return(r.ReadBlocksWithIdAndOffest(delegate(BinaryReader reader, int id, int length) { int num = reader.ReadInt32(); FormElementInfo formElementInfo = (num != 65539) ? ((FormElementInfo)FormControlInfo.ReadWithoutDataType(r, length - 4)) : ((FormElementInfo)FormMenuInfo.ReadWithoutDataType(r, length - 4)); formElementInfo.id = id; formElementInfo.DataType = num; return formElementInfo; })); }
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; })); }
internal static FormMenuInfo ReadWithoutDataType(BinaryReader reader, int length) { long position = reader.BaseStream.Position; FormMenuInfo formMenuInfo = new FormMenuInfo(); formMenuInfo.UnknownBeforeName = reader.ReadBytes(20); formMenuInfo.Name = reader.ReadCStyleString(); reader.ReadCStyleString(); formMenuInfo.HotKey = reader.ReadInt32(); formMenuInfo.Level = reader.ReadInt32(); int num = reader.ReadInt32(); formMenuInfo.Visible = ((num & 1) == 0); formMenuInfo.Disable = ((num & 2) != 0); formMenuInfo.Selected = ((num & 4) != 0); formMenuInfo.Text = reader.ReadCStyleString(); formMenuInfo.ClickEvent = reader.ReadInt32(); formMenuInfo.UnknownAfterClickEvent = reader.ReadBytes(length - (int)(reader.BaseStream.Position - position)); return(formMenuInfo); }
internal static FormMenuInfo ReadWithoutDataType(BinaryReader reader, int length) { var startPosition = reader.BaseStream.Position; var elem = new FormMenuInfo() { }; elem.UnknownBeforeName = reader.ReadBytes(20); elem.Name = reader.ReadCStyleString(); reader.ReadCStyleString();//菜单没有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(); elem.ClickEvent = reader.ReadInt32(); elem.UnknownAfterClickEvent = reader.ReadBytes(length - (int)(reader.BaseStream.Position - startPosition)); return(elem); }