public void ReadFromStream(PacketStream stream) { AtomID = stream.ReadUInt32(); IconX = stream.ReadByte(); IconY = stream.ReadByte(); ScreenLocation = stream.ReadScreenLocation(); ModifierShift = stream.ReadBool(); ModifierCtrl = stream.ReadBool(); ModifierAlt = stream.ReadBool(); }
public void ReadFromStream(PacketStream stream) { ConnectionSuccessful = stream.ReadBool(); if (!ConnectionSuccessful) { ErrorMessage = stream.ReadString(); } }
public void ReadFromStream(PacketStream stream) { Window = stream.ReadString(); if (Window == String.Empty) { Window = null; } bool hasHtmlSource = stream.ReadBool(); if (hasHtmlSource) { HtmlSource = stream.ReadString(); } else { HtmlSource = null; } Size = new Size(stream.ReadUInt16(), stream.ReadUInt16()); }
public void ReadFromStream(PacketStream stream) { List <WindowDescriptor> windowDescriptors = new List <WindowDescriptor>(); int windowCount = stream.ReadByte(); for (int i = 0; i < windowCount; i++) { string windowName = stream.ReadString(); List <ElementDescriptor> elementDescriptors = new List <ElementDescriptor>(); int elementCount = stream.ReadByte(); for (int j = 0; j < elementCount; j++) { string elementName = stream.ReadString(); DescriptorType elementType = (DescriptorType)stream.ReadByte(); ElementDescriptor elementDescriptor; switch (elementType) { case DescriptorType.Main: elementDescriptor = new ElementDescriptorMain(elementName); break; case DescriptorType.Input: elementDescriptor = new ElementDescriptorInput(elementName); break; case DescriptorType.Button: elementDescriptor = new ElementDescriptorButton(elementName); break; case DescriptorType.Child: elementDescriptor = new ElementDescriptorChild(elementName); break; case DescriptorType.Output: elementDescriptor = new ElementDescriptorOutput(elementName); break; case DescriptorType.Info: elementDescriptor = new ElementDescriptorInfo(elementName); break; case DescriptorType.Map: elementDescriptor = new ElementDescriptorMap(elementName); break; case DescriptorType.Browser: elementDescriptor = new ElementDescriptorBrowser(elementName); break; default: throw new Exception("Invalid descriptor type '" + elementType + "'"); } elementDescriptors.Add(elementDescriptor); AttributeType valueType; do { valueType = (AttributeType)stream.ReadByte(); switch (valueType) { case AttributeType.Pos: elementDescriptor.Pos = new Point(stream.ReadUInt16(), stream.ReadUInt16()); break; case AttributeType.Size: elementDescriptor.Size = new Size(stream.ReadUInt16(), stream.ReadUInt16()); break; case AttributeType.Anchor1: elementDescriptor.Anchor1 = new Point(stream.ReadUInt16(), stream.ReadUInt16()); break; case AttributeType.Anchor2: elementDescriptor.Anchor2 = new Point(stream.ReadUInt16(), stream.ReadUInt16()); break; case AttributeType.BackgroundColor: elementDescriptor.BackgroundColor = Color.FromArgb(stream.ReadByte(), stream.ReadByte(), stream.ReadByte()); break; case AttributeType.IsVisible: elementDescriptor.IsVisible = stream.ReadBool(); break; case AttributeType.IsDefault: elementDescriptor.IsDefault = stream.ReadBool(); break; case AttributeType.IsPane: ((ElementDescriptorMain)elementDescriptor).IsPane = stream.ReadBool(); break; case AttributeType.Left: ((ElementDescriptorChild)elementDescriptor).Left = stream.ReadString(); break; case AttributeType.Right: ((ElementDescriptorChild)elementDescriptor).Right = stream.ReadString(); break; case AttributeType.IsVert: ((ElementDescriptorChild)elementDescriptor).IsVert = stream.ReadBool(); break; case AttributeType.Text: if (elementDescriptor is ElementDescriptorButton) { ((ElementDescriptorButton)elementDescriptor).Text = stream.ReadString(); } break; case AttributeType.End: break; default: throw new Exception("Invalid attribute type '" + valueType + "'"); } } while (valueType != AttributeType.End); } WindowDescriptor windowDescriptor = new WindowDescriptor(windowName, elementDescriptors); windowDescriptors.Add(windowDescriptor); } InterfaceDescriptor = new InterfaceDescriptor(windowDescriptors); }