Ejemplo n.º 1
0
        private void WriteAtomDeltasSection(PacketStream stream)
        {
            stream.WriteByte((byte)SectionID.AtomDeltas);
            stream.WriteUInt16((UInt16)DeltaState.AtomDeltas.Count);

            foreach (KeyValuePair <UInt32, DreamDeltaState.AtomDelta> atomDeltaPair in DeltaState.AtomDeltas)
            {
                UInt32 atomID = atomDeltaPair.Key;
                DreamDeltaState.AtomDelta atomDelta = atomDeltaPair.Value;

                stream.WriteUInt32(atomID);

                if (atomDelta.ScreenLocation.HasValue)
                {
                    stream.WriteByte((byte)AtomDeltaValueID.ScreenLocation);
                    stream.WriteScreenLocation(atomDelta.ScreenLocation.Value);
                }

                if (atomDelta.NewIconAppearanceID.HasValue)
                {
                    stream.WriteByte((byte)AtomDeltaValueID.IconAppearance);
                    stream.WriteUInt32((UInt32)atomDelta.NewIconAppearanceID.Value);
                }

                stream.WriteByte((byte)AtomDeltaValueID.End);
            }
        }
Ejemplo n.º 2
0
 public void WriteToStream(PacketStream stream)
 {
     stream.WriteUInt32(AtomID);
     stream.WriteByte((byte)IconX);
     stream.WriteByte((byte)IconY);
     stream.WriteScreenLocation(ScreenLocation);
     stream.WriteBool(ModifierShift);
     stream.WriteBool(ModifierCtrl);
     stream.WriteBool(ModifierAlt);
 }
Ejemplo n.º 3
0
        public void WriteToStream(PacketStream stream)
        {
            stream.WriteByte((byte)StatPanels.Count);
            foreach (KeyValuePair <string, List <string> > statPanel in StatPanels)
            {
                stream.WriteString(statPanel.Key);

                stream.WriteByte((byte)statPanel.Value.Count);
                foreach (string line in statPanel.Value)
                {
                    stream.WriteString(line);
                }
            }
        }
Ejemplo n.º 4
0
        public void WriteToStream(PacketStream stream)
        {
            stream.WriteString((File != null) ? File : String.Empty);
            stream.WriteUInt16(Channel);

            if (File != null)
            {
                stream.WriteByte((byte)Volume);
            }
        }
Ejemplo n.º 5
0
        private void WriteAtomDeletionsSection(PacketStream stream)
        {
            stream.WriteByte((byte)SectionID.AtomDeletions);
            stream.WriteUInt16((UInt16)DeltaState.AtomDeletions.Count);

            foreach (UInt32 atomDeletion in DeltaState.AtomDeletions)
            {
                stream.WriteUInt32(atomDeletion);
            }
        }
Ejemplo n.º 6
0
        private void WriteAtomCreationsSection(PacketStream stream)
        {
            stream.WriteByte((byte)SectionID.AtomCreations);
            stream.WriteUInt16((UInt16)DeltaState.AtomCreations.Count);

            foreach (KeyValuePair <UInt32, DreamDeltaState.AtomCreation> atomCreationPair in DeltaState.AtomCreations)
            {
                DreamDeltaState.AtomCreation atomCreation = atomCreationPair.Value;

                stream.WriteUInt32(atomCreationPair.Key);
                stream.WriteByte((byte)atomCreation.Type);
                stream.WriteUInt32((UInt32)atomCreation.IconAppearanceID);
                stream.WriteUInt32(atomCreation.LocationID);
                if (atomCreation.Type == AtomType.Movable)
                {
                    stream.WriteScreenLocation(atomCreation.ScreenLocation);
                }
            }
        }
Ejemplo n.º 7
0
        private void WriteAtomLocationDeltasSection(PacketStream stream)
        {
            stream.WriteByte((byte)SectionID.AtomLocationDeltas);
            stream.WriteUInt32((UInt32)DeltaState.AtomLocationDeltas.Count);

            foreach (DreamDeltaState.AtomLocationDelta atomLocationDelta in DeltaState.AtomLocationDeltas)
            {
                stream.WriteUInt32(atomLocationDelta.AtomID);
                stream.WriteUInt32(atomLocationDelta.LocationID);
            }
        }
Ejemplo n.º 8
0
        private void WriteAtomsSection(PacketStream stream)
        {
            stream.WriteUInt32((UInt32)FullState.Atoms.Count);

            foreach (KeyValuePair <UInt32, DreamFullState.Atom> atom in FullState.Atoms)
            {
                stream.WriteUInt32(atom.Value.AtomID);
                stream.WriteByte((byte)atom.Value.Type);
                stream.WriteUInt32(atom.Value.LocationID);
                stream.WriteUInt32((UInt32)atom.Value.IconAppearanceID);
                if (atom.Value.Type == AtomType.Movable)
                {
                    stream.WriteScreenLocation(atom.Value.ScreenLocation);
                }
            }
        }
Ejemplo n.º 9
0
        public void WriteToStream(PacketStream stream)
        {
            stream.WriteByte((byte)InterfaceDescriptor.WindowDescriptors.Count);

            foreach (WindowDescriptor windowDescriptor in InterfaceDescriptor.WindowDescriptors)
            {
                stream.WriteString(windowDescriptor.Name);

                stream.WriteByte((byte)windowDescriptor.ElementDescriptors.Count);
                foreach (ElementDescriptor elementDescriptor in windowDescriptor.ElementDescriptors)
                {
                    stream.WriteString(elementDescriptor.Name);

                    if (elementDescriptor is ElementDescriptorMain)
                    {
                        stream.WriteByte((byte)DescriptorType.Main);
                    }
                    else if (elementDescriptor is ElementDescriptorChild)
                    {
                        stream.WriteByte((byte)DescriptorType.Child);
                    }
                    else if (elementDescriptor is ElementDescriptorInput)
                    {
                        stream.WriteByte((byte)DescriptorType.Input);
                    }
                    else if (elementDescriptor is ElementDescriptorButton)
                    {
                        stream.WriteByte((byte)DescriptorType.Button);
                    }
                    else if (elementDescriptor is ElementDescriptorOutput)
                    {
                        stream.WriteByte((byte)DescriptorType.Output);
                    }
                    else if (elementDescriptor is ElementDescriptorInfo)
                    {
                        stream.WriteByte((byte)DescriptorType.Info);
                    }
                    else if (elementDescriptor is ElementDescriptorMap)
                    {
                        stream.WriteByte((byte)DescriptorType.Map);
                    }
                    else if (elementDescriptor is ElementDescriptorBrowser)
                    {
                        stream.WriteByte((byte)DescriptorType.Browser);
                    }
                    else
                    {
                        throw new Exception("Invalid descriptor");
                    }

                    if (elementDescriptor.Pos.HasValue)
                    {
                        stream.WriteByte((byte)AttributeType.Pos);
                        stream.WriteUInt16((UInt16)elementDescriptor.Pos.Value.X);
                        stream.WriteUInt16((UInt16)elementDescriptor.Pos.Value.Y);
                    }

                    if (elementDescriptor.Size.HasValue)
                    {
                        stream.WriteByte((byte)AttributeType.Size);
                        stream.WriteUInt16((UInt16)elementDescriptor.Size.Value.Width);
                        stream.WriteUInt16((UInt16)elementDescriptor.Size.Value.Height);
                    }

                    if (elementDescriptor.Anchor1.HasValue)
                    {
                        stream.WriteByte((byte)AttributeType.Anchor1);
                        stream.WriteUInt16((UInt16)elementDescriptor.Anchor1.Value.X);
                        stream.WriteUInt16((UInt16)elementDescriptor.Anchor1.Value.Y);
                    }

                    if (elementDescriptor.Anchor2.HasValue)
                    {
                        stream.WriteByte((byte)AttributeType.Anchor2);
                        stream.WriteUInt16((UInt16)elementDescriptor.Anchor2.Value.X);
                        stream.WriteUInt16((UInt16)elementDescriptor.Anchor2.Value.Y);
                    }

                    if (elementDescriptor.BackgroundColor.HasValue)
                    {
                        stream.WriteByte((byte)AttributeType.BackgroundColor);
                        stream.WriteByte(elementDescriptor.BackgroundColor.Value.R);
                        stream.WriteByte(elementDescriptor.BackgroundColor.Value.G);
                        stream.WriteByte(elementDescriptor.BackgroundColor.Value.B);
                    }

                    if (elementDescriptor.IsVisible != default)
                    {
                        stream.WriteByte((byte)AttributeType.IsVisible);
                        stream.WriteBool(elementDescriptor.IsVisible.Value);
                    }

                    if (elementDescriptor.IsDefault != default)
                    {
                        stream.WriteByte((byte)AttributeType.IsDefault);
                        stream.WriteBool(elementDescriptor.IsDefault);
                    }

                    ElementDescriptorMain elementMainDescriptor = elementDescriptor as ElementDescriptorMain;
                    if (elementMainDescriptor != null)
                    {
                        if (elementMainDescriptor.IsPane != default)
                        {
                            stream.WriteByte((byte)AttributeType.IsPane);
                            stream.WriteBool(elementMainDescriptor.IsPane);
                        }
                    }

                    ElementDescriptorChild elementChildDescriptor = elementDescriptor as ElementDescriptorChild;
                    if (elementChildDescriptor != null)
                    {
                        if (elementChildDescriptor.Left != null)
                        {
                            stream.WriteByte((byte)AttributeType.Left);
                            stream.WriteString(elementChildDescriptor.Left);
                        }

                        if (elementChildDescriptor.Right != null)
                        {
                            stream.WriteByte((byte)AttributeType.Right);
                            stream.WriteString(elementChildDescriptor.Right);
                        }

                        if (elementChildDescriptor.IsVert != default)
                        {
                            stream.WriteByte((byte)AttributeType.IsVert);
                            stream.WriteBool(elementChildDescriptor.IsVert);
                        }
                    }

                    ElementDescriptorButton elementButtonDescriptor = elementDescriptor as ElementDescriptorButton;
                    if (elementButtonDescriptor != null)
                    {
                        if (elementButtonDescriptor.Text != null)
                        {
                            stream.WriteByte((byte)AttributeType.Text);
                            stream.WriteString(elementButtonDescriptor.Text);
                        }
                    }

                    stream.WriteByte((byte)AttributeType.End);
                }
            }
        }