Exemplo n.º 1
0
 public SetCardPositionMapInfoMessage(CardPositionMapHandle pendingInfo)
 {
     m_id                 = 6097;
     m_strMessageName     = "Set Card Position Map Info";
     m_pendingPositionMap = pendingInfo;
     m_updatedPositionMap = null;
 }
Exemplo n.º 2
0
        public static CardPositionMapHandle SetCardPositionMapInfo(CardPositionMapHandle pendingInfo)
        {
            var msg = new SetCardPositionMapInfoMessage(pendingInfo);

            try
            {
                msg.Send();
            }
            catch (ServerCommException ex)
            {
                throw new Exception(msg.MessageName + " Message: " + ex.Message);
            }

            return(msg.UpdatedPositionMap);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Parses the response received from the server.
        /// </summary>
        protected override void UnpackResponse()
        {
            base.UnpackResponse();

            // Create the streams we will be reading from.
            using (var responseStream = new MemoryStream(m_responsePayload))
                using (var reader = new BinaryReader(responseStream, Encoding.Unicode))
                {
                    // Try to unpack the data.
                    try
                    {
                        // Seek past return code.
                        reader.BaseStream.Seek(sizeof(int), SeekOrigin.Begin);

                        // Get the count of the star maps.
                        ushort count = reader.ReadUInt16();

                        // Clear the Product Item array.
                        m_positionMaps = new List <CardPositionMapHandle>(count);

                        for (ushort x = 0; x < count; x++)
                        {
                            var starMap = new CardPositionMapHandle();

                            starMap.Id = reader.ReadInt32();
                            starMap.PositionMapName  = ReadString(reader);
                            starMap.IsActive         = reader.ReadBoolean();
                            starMap.PositionsCovered = reader.ReadByte();
                            starMap.SequenceLength   = reader.ReadByte();
                            starMap.NumSequences     = reader.ReadInt32();
                            starMap.PositionMapGUID  = ReadString(reader);
                            starMap.PositionMapPath  = ReadString(reader);

                            m_positionMaps.Add(starMap);
                        }
                    }
                    catch (EndOfStreamException e)
                    {
                        throw new MessageWrongSizeException(m_strMessageName, e);
                    }
                    catch (Exception e)
                    {
                        throw new ServerException(m_strMessageName, e);
                    }
                }
        }
Exemplo n.º 4
0
        /// <summary>
        /// Parses the response received from the server.
        /// </summary>
        protected override void UnpackResponse()
        {
            base.UnpackResponse();

            // Create the streams we will be reading from.
            using (var responseStream = new MemoryStream(m_responsePayload))
                using (var reader = new BinaryReader(responseStream, Encoding.Unicode))
                {
                    // Try to unpack the data.
                    try
                    {
                        // Seek past return code.
                        reader.BaseStream.Seek(sizeof(int), SeekOrigin.Begin);

                        var cpm = new CardPositionMapHandle();
                        cpm.Id = reader.ReadInt32();
                        cpm.PositionMapName  = ReadString(reader);
                        cpm.IsActive         = reader.ReadBoolean();
                        cpm.PositionsCovered = reader.ReadByte();
                        cpm.SequenceLength   = reader.ReadByte();
                        cpm.NumSequences     = reader.ReadInt32();
                        cpm.PositionMapGUID  = ReadString(reader);
                        cpm.PositionMapPath  = ReadString(reader);

                        m_updatedPositionMap = cpm;
                    }
                    catch (EndOfStreamException e)
                    {
                        throw new MessageWrongSizeException(m_strMessageName, e);
                    }
                    catch (Exception e)
                    {
                        throw new ServerException(m_strMessageName, e);
                    }
                }
        }