Ejemplo n.º 1
0
        private void ProcessUpdateNode(MemoryInputStream stream, JORNode node)
        {
            Debug.WriteLine("<- ORef ProcessUpdate CMD {0}", JHI.HexDump(stream.data));

            while (stream.HasData())
            {
                JORMessageCommand command = (JORMessageCommand)stream.ReadU32();

                Debug.WriteLine("<- ORef ProcessUpdate {0}", command);

                if (command == JORMessageCommand.UpdateControl)
                {
                    uint updateMode = stream.ReadU32();
                    uint id         = stream.ReadU32();
                    var  control    = node.FindControlByID(id, 0);

                    if (control == null)
                    {
                        // No clue about this control; can't parse.
                        return;
                    }

                    if (control is JORControlCheckBox)
                    {
                        // Checkboxes can have multiple controls with the same ID.
                        uint subID = stream.ReadU32();
                        control = node.FindControlByID(id, subID);

                        if (control == null)
                        {
                            // Shouldn't happen, but just in case...
                            return;
                        }
                    }

                    control.Update(updateMode, stream);
                }
            }
        }
Ejemplo n.º 2
0
        private void ProcessUpdateNode(MemoryInputStream stream, JORNode node)
        {
            while (stream.HasData())
            {
                JORMessageCommand command = (JORMessageCommand)stream.ReadU32();

                // Debug.WriteLine("<- ORef ProcessUpdate {0}", command);

                if (command == JORMessageCommand.UpdateControl)
                {
                    uint updateMode = stream.ReadU32();
                    uint id         = stream.ReadU32();
                    var  control    = node.FindControlByID(id);

                    if (control == null)
                    {
                        // No clue about this control; can't parse.
                        return;
                    }

                    control.Update(updateMode, stream);
                }
            }
        }
Ejemplo n.º 3
0
        private void ProcessObjectInfo(MemoryInputStream stream)
        {
            JORControlSelector currentSelector = null;
            Stack <JORNode>    nodeStack       = new Stack <JORNode>();
            JORNode            node            = null;

            while (stream.HasData())
            {
                JORMessageCommand command = (JORMessageCommand)stream.ReadU32();

                // Debug.WriteLine("<- ORef MessageCommand {0}", command);

                if (command == JORMessageCommand.StartNode)
                {
                    nodeStack.Push(node);
                    node = ReadGenNodeSub(stream, true);
                    Debug.WriteLine("<- GenObjectInfo Stack {2} Ptr 0x{1:X8} {0}", node.Name, node.NodePtr, nodeStack.Count);

                    JORNode parentNode = nodeStack.Peek();
                    if (parentNode != null)
                    {
                        parentNode.AddChild(node);
                    }

                    // Debug.WriteLine("StartNodeClear  {0}", node);

                    node.Invalidate();
                }
                else if (command == JORMessageCommand.EndNode)
                {
                    node.Status = JORNodeStatus.Valid;
                    if (NodeUpdated != null)
                    {
                        NodeUpdated(node);
                    }
                    node = nodeStack.Pop();
                }
                else if (command == JORMessageCommand.GenNode)
                {
                    JORNode child = ReadGenNodeSub(stream, true);
                    child.Invalidate();
                    node.AddChild(child);
                }
                else if (command == JORMessageCommand.GenControl)
                {
                    var control = ReadControlSub(stream, node);
                }
                else if (command == JORMessageCommand.StartSelector)
                {
                    var control = ReadControlSub(stream, node);
                    Debug.Assert(control is JORControlSelector);
                    currentSelector = control as JORControlSelector;
                }
                else if (command == JORMessageCommand.EndSelector)
                {
                    currentSelector = null;
                }
                else if (command == JORMessageCommand.SelectorItem)
                {
                    var selection = new JORControlSelectorItem();
                    selection.Name  = stream.ReadSJIS();
                    selection.Value = stream.ReadU32();
                    selection.Unk3  = stream.ReadU32();
                    ReadControlLocation(stream, ref selection.Location);

                    if (currentSelector != null)
                    {
                        currentSelector.Items.Add(selection);
                    }
                }
                else
                {
                    throw new Exception("Unknown message type");
                }
            }

            Debug.Assert(nodeStack.Count == 0);
            Debug.Assert(node == null);
        }