Ejemplo n.º 1
0
 public void ReadFromStream(PacketStream stream)
 {
     Value   = stream.ReadString();
     Control = stream.ReadString();
     if (Control == String.Empty)
     {
         Control = null;
     }
 }
 public void ReadFromStream(PacketStream stream)
 {
     ConnectionSuccessful = stream.ReadBool();
     if (!ConnectionSuccessful)
     {
         ErrorMessage = stream.ReadString();
     }
 }
Ejemplo n.º 3
0
        public void ReadFromStream(PacketStream stream)
        {
            PromptId = stream.ReadUInt16();

            Type = (DMValueType)stream.ReadUInt16();
            switch (Type)
            {
            case DMValueType.Null: Value = null; break;

            case DMValueType.Text: Value = stream.ReadString(); break;

            case DMValueType.Num: Value = stream.ReadInt32(); break;

            case DMValueType.Message: Value = stream.ReadString(); break;

            default: throw new Exception("Invalid prompt response type '" + Type + "'");
            }
        }
Ejemplo n.º 4
0
        public void ReadFromStream(PacketStream stream)
        {
            StatPanels = new Dictionary <string, List <string> >();

            int statPanelCount = stream.ReadByte();

            for (int i = 0; i < statPanelCount; i++)
            {
                string        panelName = stream.ReadString();
                List <string> lines     = new();

                int lineCount = stream.ReadByte();
                for (int j = 0; j < lineCount; j++)
                {
                    lines.Add(stream.ReadString());
                }

                StatPanels.Add(panelName, lines);
            }
        }
Ejemplo n.º 5
0
        public void ReadFromStream(PacketStream stream)
        {
            File = stream.ReadString();
            if (File == String.Empty)
            {
                File = null;
            }

            Channel = stream.ReadUInt16();
            Volume  = (File != null) ? stream.ReadByte() : 100;
        }
Ejemplo n.º 6
0
        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());
        }
Ejemplo n.º 7
0
 public void ReadFromStream(PacketStream stream)
 {
     Filename = stream.ReadString();
     Data     = stream.ReadBuffer();
 }
Ejemplo n.º 8
0
 public void ReadFromStream(PacketStream stream)
 {
     PromptId = stream.ReadUInt16();
     Types    = (DMValueType)stream.ReadUInt16();
     Message  = stream.ReadString();
 }
Ejemplo n.º 9
0
 public void ReadFromStream(PacketStream stream)
 {
     ResourcePath = stream.ReadString();
     ResourceData = stream.ReadBuffer();
 }
Ejemplo n.º 10
0
        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);
        }
Ejemplo n.º 11
0
 public void ReadFromStream(PacketStream stream)
 {
     Query = stream.ReadString();
 }