Ejemplo n.º 1
0
        /// <summary>
        /// Clones this header and adds the specified job ID
        /// </summary>
        /// <param name="jobId"></param>
        /// <returns></returns>
        public Header WithJobId(SteamGid jobId)
        {
            Header header = Clone();

            header._jobId = jobId;
            return(header);
        }
        public static GameCoordinatorMessage CreateFromByteArray(GameCoordinatorMessageType type, bool protobuf, byte[] data)
        {
            using (MemoryStream stream = new MemoryStream(data))
                using (BinaryReader reader = new BinaryReader(stream))
                {
                    if (protobuf)
                    {
                        reader.ReadUInt32(); // read message type we already have
                        CMsgProtoBufHeader header;
                        using (MemoryStream protoStream = new MemoryStream(reader.ReadBytes(reader.ReadInt32())))
                            header = Serializer.Deserialize <CMsgProtoBufHeader>(protoStream);

                        return(new GameCoordinatorMessage(type, protobuf, new GameCoordinatorProtobufHeader(header), new ArraySegment <byte>(data, (int)stream.Position, (int)stream.Length - (int)stream.Position)));
                    }
                    else
                    {
                        reader.ReadUInt16(); // version, always 1
                        SteamGid target = reader.ReadUInt64();
                        SteamGid source = reader.ReadUInt64();
                        return(new GameCoordinatorMessage(type, protobuf, new Header(source), new ArraySegment <byte>(data, (int)stream.Position, (int)stream.Length - (int)stream.Position)));
                    }
                }
        }
 internal ClientHeader(SteamGid job, SteamId id, int sessionId) : base(job)
 {
     _steamId   = id;
     _sessionId = sessionId;
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Creates a new <see cref="NetworkMessage"/> with the specified job ID in its header
 /// </summary>
 /// <param name="job"></param>
 /// <returns></returns>
 public NetworkMessage WithJobId(SteamGid job)
 {
     return(new NetworkMessage(MessageType, Header.WithJobId(job), _body));
 }
 internal ProtobufClientHeader(uint routingAppId, ulong traceTag, string targetJobName, SteamGid jobId, SteamId steamId, int sessionId) : base(jobId, steamId, sessionId)
 {
     _routingAppId = routingAppId;
     _traceTag     = traceTag;
     TargetJobName = targetJobName;
 }
 internal GameCoordinatorProtobufHeader(SteamGid gid) : base(gid)
 {
 }
 public GameCoordinatorMessage WithJobId(SteamGid jobId)
 {
     return(new GameCoordinatorMessage(MessageType, Protobuf, Header.WithJobId(jobId), _body));
 }
Ejemplo n.º 8
0
 internal Header(SteamGid gid)
 {
     _jobId = gid;
 }
 public DestinationJobFailedException(SteamGid job) : base($"The destination job ({job.ToUInt64()}) failed unexpectedly")
 {
     JobId = job;
 }