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 void WriteForms(BinaryWriter writer, FormInfo[] forms) { writer.Write(forms.Length * 8); Array.ForEach(forms, x => writer.Write(x.Id)); Array.ForEach(forms, x => writer.Write(x.UnknownAfterId)); foreach (var form in forms) { writer.Write(form.UnknownBeforeClass); writer.Write(form.Class); writer.WriteStringWithLengthPrefix(form.Name); writer.WriteStringWithLengthPrefix(form.Comment); FormElementInfo.WriteFormElements(writer, form.Elements); } }
public static FormInfo[] ReadForms(BinaryReader reader) { int num = reader.ReadInt32(); int num2 = num / 8; int[] array = reader.ReadInt32sWithFixedLength(num2); int[] array2 = reader.ReadInt32sWithFixedLength(num2); FormInfo[] array3 = new FormInfo[num2]; for (int i = 0; i < num2; i++) { FormInfo formInfo = array3[i] = new FormInfo { Id = array[i], UnknownAfterId = array2[i], UnknownBeforeClass = reader.ReadInt32(), Class = reader.ReadInt32(), Name = reader.ReadStringWithLengthPrefix(), Comment = reader.ReadStringWithLengthPrefix(), Elements = FormElementInfo.ReadFormElements(reader) }; } return(array3); }
public static FormInfo[] ReadForms(BinaryReader reader) { var headerSize = reader.ReadInt32(); int count = headerSize / 8; var ids = reader.ReadInt32sWithFixedLength(count); var unknownsAfterIds = reader.ReadInt32sWithFixedLength(count); var forms = new FormInfo[count]; for (int i = 0; i < count; i++) { var form = new FormInfo() { Id = ids[i], UnknownAfterId = unknownsAfterIds[i], UnknownBeforeClass = reader.ReadInt32(), Class = reader.ReadInt32(), Name = reader.ReadStringWithLengthPrefix(), Comment = reader.ReadStringWithLengthPrefix(), Elements = FormElementInfo.ReadFormElements(reader) }; forms[i] = form; } return(forms); }