public static ListItemComponentNode Read(BinaryReader br) { ListItemComponentNode ret = new ListItemComponentNode(); ret.Toggle = br.ReadBoolean(); ret.Unk1 = br.ReadBytes(3); return(ret); }
public static ComponentNode Read(BinaryReader br, ComponentData.ComponentType parentType) { ComponentNode ret = new ComponentNode(); ret.Index = br.ReadByte(); ret.Up = br.ReadByte(); ret.Down = br.ReadByte(); ret.Left = br.ReadByte(); ret.Right = br.ReadByte(); ret.Cursor = br.ReadByte(); ret.field1 = br.ReadByte(); ret.RepeatUp = (ret.field1 & 0x80) == 0x80; ret.RepeatDown = (ret.field1 & 0x40) == 0x40; ret.RepeatLeft = (ret.field1 & 0x20) == 0x20; ret.RepeatRight = (ret.field1 & 0x10) == 0x10; ret.Unk1 = (byte)(ret.field1 & 0x0F); ret.Unk2 = br.ReadByte(); ret.OffsetX = br.ReadInt16(); ret.OffsetY = br.ReadInt16(); // the commented types seem to not have extra data switch (parentType) { case ComponentData.ComponentType.Button: ret.ComponentNodeData = ButtonComponentNode.Read(br); break; case ComponentData.ComponentType.Window: ret.ComponentNodeData = WindowComponentNode.Read(br); break; case ComponentData.ComponentType.CheckBox: ret.ComponentNodeData = CheckBoxComponentNode.Read(br); break; case ComponentData.ComponentType.RadioButton: ret.ComponentNodeData = RadioButtonComponentNode.Read(br); break; case ComponentData.ComponentType.Gauge: ret.ComponentNodeData = GaugeComponentNode.Read(br); break; case ComponentData.ComponentType.Slider: ret.ComponentNodeData = SliderComponentNode.Read(br); break; case ComponentData.ComponentType.TextInput: ret.ComponentNodeData = TextInputComponentNode.Read(br); break; case ComponentData.ComponentType.NumericInput: ret.ComponentNodeData = NumericInputComponentNode.Read(br); break; case ComponentData.ComponentType.List: ret.ComponentNodeData = ListComponentNode.Read(br); break; //? // case ComponentData.ComponentType.DropDown: ret.ComponentNodeData = DropDownComponentNode.Read( br ); break; case ComponentData.ComponentType.Tabbed: ret.ComponentNodeData = TabbedComponentNode.Read(br); break; // case ComponentData.ComponentType.TreeList: ret.ComponentNodeData = TreeListComponentNode.Read( br ); break; // case ComponentData.ComponentType.ScrollBar: ret.ComponentNodeData = ScrollBarComponentNode.Read( br ); break; case ComponentData.ComponentType.ListItem: ret.ComponentNodeData = ListItemComponentNode.Read(br); break; // case ComponentData.ComponentType.Icon: ret.ComponentNodeData = IconComponentNode.Read( br ); break; // case ComponentData.ComponentType.IconWithText: ret.ComponentNodeData = IconWithTextComponentNode.Read( br ); break; // case ComponentData.ComponentType.DragDrop: ret.ComponentNodeData = DragDropComponentNode.Read( br ); break; // case ComponentData.ComponentType.LeveCard: ret.ComponentNodeData = LeveCardComponentNode.Read( br ); break; case ComponentData.ComponentType.NineGridText: ret.ComponentNodeData = NineGridTextComponentNode.Read(br); break; // case ComponentData.ComponentType.Journal: ret.ComponentNodeData = JournalComponentNode.Read( br ); break; // case ComponentData.ComponentType.Multipurpose: ret.ComponentNodeData = MultipurposeComponentNode.Read( br ); break; // case ComponentData.ComponentType.Map: ret.ComponentNodeData = MapComponentNode.Read( br ); break; // case ComponentData.ComponentType.Preview: ret.ComponentNodeData = PreviewComponentNode.Read( br ); break; default: // Console.WriteLine( $"No custom node for type {parentType}..." ); break; } return(ret); }