Ejemplo n.º 1
0
 /// <summary>
 ///     Serializes the payload of this message to a memory buffer.
 /// </summary>
 /// <param name="serializer">Serializer to read/write payload to.</param>
 protected override void SerializePayload(NetMessageSerializer serializer)
 {
     serializer.Serialize(ref SourceTagId);
     serializer.Serialize(ref DestinationTagId);
     serializer.Serialize(ref Blacklisted);
     serializer.Serialize(ref BandwidthLimit);
 }
 /// <summary>
 ///     Serializes the payload of this message to a memory buffer.
 /// </summary>
 /// <param name="serializer">Serializer to read/write payload to.</param>
 protected override void SerializePayload(NetMessageSerializer serializer)
 {
     serializer.Serialize(ref License.LicensedTo);
     serializer.Serialize(ref License.ExpirationTime);
     serializer.Serialize(ref License.MaxSeats);
     serializer.Serialize(ref License.Signature);
 }
Ejemplo n.º 3
0
        /// <summary>
        ///     Serializes the payload of this message to a memory buffer.
        /// </summary>
        /// <param name="serializer">Serializer to read/write payload to.</param>
        protected override void SerializePayload(NetMessageSerializer serializer)
        {
            serializer.Serialize(ref Version);

            // Serialize users.
            int Count = TagIds.Count;

            serializer.Serialize(ref Count);

            for (int i = 0; i < Count; i++)
            {
                if (serializer.IsLoading)
                {
                    TagIds.Add(new Guid());
                }

                Guid value = TagIds[i];
                serializer.Serialize(ref value);
                TagIds[i] = value;
            }

            if (serializer.Version > 100000584)
            {
                serializer.Serialize(ref Username);
            }

            if (serializer.Version >= 100000690 && Version >= 10)
            {
                serializer.Serialize(ref MachineName);
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        ///     Serializes the payload of this message to a memory buffer.
        /// </summary>
        /// <param name="serializer">Serializer to read/write payload to.</param>
        protected override void SerializePayload(NetMessageSerializer serializer)
        {
            serializer.Serialize(ref ManifestId);
            serializer.Serialize(ref BlockIndex);

            if (serializer.Version >= 100000641)
            {
                serializer.Serialize(ref QueueSequence);
            }
        }
        /// <summary>
        ///     Serializes the payload of this message to a memory buffer.
        /// </summary>
        /// <param name="serializer">Serializer to read/write payload to.</param>
        protected override void SerializePayload(NetMessageSerializer serializer)
        {
            string Address = PeerConnectionAddress.Address.ToString();
            int    Port    = PeerConnectionAddress.Port;

            serializer.Serialize(ref Address);
            serializer.Serialize(ref Port);
            PeerConnectionAddress = new IPEndPoint(IPAddress.Parse(Address), Port);

            serializer.Serialize(ref DEPRECATED_Username);
        }
Ejemplo n.º 6
0
 /// <summary>
 ///     Serializes the payload of this message to a memory buffer.
 /// </summary>
 /// <param name="serializer">Serializer to read/write payload to.</param>
 protected override void SerializePayload(NetMessageSerializer serializer)
 {
     serializer.Serialize(ref Name);
     if (serializer.Version > 100000655)
     {
         serializer.Serialize(ref Color);
     }
     if (serializer.Version > 100000657)
     {
         serializer.Serialize(ref Unique);
         serializer.Serialize(ref DecayTagId);
     }
 }
Ejemplo n.º 7
0
        /// <summary>
        ///     Serializes the payload of this message to a memory buffer.
        /// </summary>
        /// <param name="serializer">Serializer to read/write payload to.</param>
        protected override void SerializePayload(NetMessageSerializer serializer)
        {
            int BuildCount = Builds.Length;

            serializer.Serialize(ref BuildCount);

            Array.Resize(ref Builds, BuildCount);

            for (int i = 0; i < BuildCount; i++)
            {
                serializer.Serialize(ref Builds[i].VirtualPath);
                serializer.Serialize(ref Builds[i].Guid);
            }
        }
Ejemplo n.º 8
0
    public void SendClient(int connectionId, int recHostId, NetMessage netMessage, bool reliable = true)
    {
        int host    = recHostId == 0 ? hostId : webHostId;
        int channel = reliable ? reliableChannel : unreliableChannel;

        NetworkTransport.Send(host, connectionId, channel, NetMessageSerializer.Serialize(netMessage, BYTE_SIZE), BYTE_SIZE, out error);
    }
Ejemplo n.º 9
0
        /// <summary>
        ///     Serializes the payload of this message to a memory buffer.
        /// </summary>
        /// <param name="serializer">Serializer to read/write payload to.</param>
        protected override void SerializePayload(NetMessageSerializer serializer)
        {
            serializer.Serialize(ref ManifestId);
            serializer.Serialize(ref BlockIndex);

            if (serializer.Version >= 100000641)
            {
                serializer.Serialize(ref QueueDepthMs);
                serializer.Serialize(ref QueueSequence);
            }

            // TODO: Modify this so it stores a reference to the deserializing buffer
            // rather than doing a pointless and time consuming copy.
            if (!serializer.Serialize(ref Data, (int)BuildManifest.DefaultBlockSize, true))
            {
            }
        }
Ejemplo n.º 10
0
        /// <summary>
        /// </summary>
        /// <param name="serializer"></param>
        public void Serialize(NetMessageSerializer serializer)
        {
            int StateCount = States.Length;

            serializer.Serialize(ref StateCount);

            Array.Resize(ref States, StateCount);

            for (int i = 0; i < StateCount; i++)
            {
                if (serializer.IsLoading)
                {
                    States[i] = new ManifestBlockListState();
                }

                ManifestBlockListState State = States[i];
                serializer.Serialize(ref State.Id);
                serializer.Serialize(ref State.IsActive);

                if (State.BlockState.Ranges == null)
                {
                    State.BlockState.Ranges = new List <SparseStateArray.Range>();
                }

                int RangeCount = State.BlockState.Ranges.Count;
                serializer.Serialize(ref RangeCount);

                int Size = State.BlockState.Size;
                serializer.Serialize(ref Size);
                State.BlockState.Size = Size;

                for (int j = 0; j < RangeCount; j++)
                {
                    if (serializer.IsLoading)
                    {
                        State.BlockState.Ranges.Add(new SparseStateArray.Range());
                    }

                    SparseStateArray.Range Range = State.BlockState.Ranges[j];

                    int TempStart = Range.Start;
                    serializer.Serialize(ref TempStart);
                    Range.Start = TempStart;

                    int TempEnd = Range.End;
                    serializer.Serialize(ref TempEnd);
                    Range.End = TempEnd;

                    bool TmpState = Range.State;
                    serializer.Serialize(ref TmpState);
                    Range.State = TmpState;

                    State.BlockState.Ranges[j] = Range;
                }
            }
        }
Ejemplo n.º 11
0
        /// <summary>
        ///     Serializes the payload of this message to a memory buffer.
        /// </summary>
        /// <param name="serializer">Serializer to read/write payload to.</param>
        protected override void SerializePayload(NetMessageSerializer serializer)
        {
            int BuildCount = Builds.Length;

            serializer.Serialize(ref RootPath);
            serializer.Serialize(ref BuildCount);

            Array.Resize(ref Builds, BuildCount);

            for (int i = 0; i < BuildCount; i++)
            {
                serializer.Serialize(ref Builds[i].VirtualPath);
                serializer.Serialize(ref Builds[i].Guid);
                serializer.Serialize(ref Builds[i].CreateTime);

                if (serializer.Version > 100000397)
                {
                    serializer.Serialize(ref Builds[i].TotalSize);
                    serializer.Serialize(ref Builds[i].AvailablePeers);
                    serializer.Serialize(ref Builds[i].LastSeenOnPeer);
                }
                if (serializer.Version > 100000546)
                {
                    if (Builds[i].Tags == null)
                    {
                        Builds[i].Tags = new Tag[0];
                    }

                    int TagCount = Builds[i].Tags.Length;
                    serializer.Serialize(ref TagCount);

                    if (serializer.IsLoading)
                    {
                        Builds[i].Tags = new Tag[TagCount];
                    }

                    for (int j = 0; j < TagCount; j++)
                    {
                        if (serializer.IsLoading)
                        {
                            Builds[i].Tags[j] = new Tag();
                        }
                        Builds[i].Tags[j].Serialize(serializer);
                    }
                }
            }
        }
Ejemplo n.º 12
0
 public void SendServer(NetMessage netMessage, bool reliable = true)
 {
     if (reliable)
     {
         NetworkTransport.Send(hostId, connectionId, reliableChannel, NetMessageSerializer.Serialize(netMessage, BYTE_SIZE), BYTE_SIZE, out error);
     }
     else
     {
         NetworkTransport.Send(hostId, connectionId, unreliableChannel, NetMessageSerializer.Serialize(netMessage, BYTE_SIZE), BYTE_SIZE, out error);
     }
 }
Ejemplo n.º 13
0
        /// <summary>
        ///     Serializes the payload of this message to a memory buffer.
        /// </summary>
        /// <param name="serializer">Serializer to read/write payload to.</param>
        protected override void SerializePayload(NetMessageSerializer serializer)
        {
            serializer.Serialize(ref BandwidthLimitGlobal);

            int Count = BandwidthLimitRoutes.Count;

            serializer.Serialize(ref Count);
            for (int i = 0; i < Count; i++)
            {
                if (serializer.IsLoading)
                {
                    BandwidthLimitRoutes.Add(new RoutePair());
                }

                RoutePair Pair = BandwidthLimitRoutes[i];

                serializer.Serialize(ref Pair.Bandwidth);
                serializer.Serialize(ref Pair.DestinationTagId);
                serializer.Serialize(ref Pair.SourceTagId);

                BandwidthLimitRoutes[i] = Pair;
            }
        }
Ejemplo n.º 14
0
        /// <summary>
        ///     Serializes the payload of this message to a memory buffer.
        /// </summary>
        /// <param name="serializer">Serializer to read/write payload to.</param>
        protected override void SerializePayload(NetMessageSerializer serializer)
        {
            int Count = PeerAddresses.Count;

            serializer.Serialize(ref Count);

            for (int i = 0; i < Count; i++)
            {
                if (serializer.IsLoading)
                {
                    PeerAddresses.Add(new IPEndPoint(IPAddress.Any, 0));
                }

                string AddressStr = PeerAddresses[i].Address.ToString();
                serializer.Serialize(ref AddressStr);

                PeerAddresses[i].Address = IPAddress.Parse(AddressStr);

                int Port = PeerAddresses[i].Port;
                serializer.Serialize(ref Port);
                PeerAddresses[i].Port = Port;
            }
        }
Ejemplo n.º 15
0
 /// <summary>
 ///     Serializes the payload of this message to a memory buffer.
 /// </summary>
 /// <param name="serializer">Serializer to read/write payload to.</param>
 protected override void SerializePayload(NetMessageSerializer serializer)
 {
     serializer.Serialize(ref ActionId);
     serializer.Serialize(ref Completed);
     serializer.Serialize(ref Failed);
     serializer.Serialize(ref ResultMessage);
     serializer.Serialize(ref Progress);
     serializer.Serialize(ref ProgressText);
 }
Ejemplo n.º 16
0
        /// <summary>
        ///     Serializes the payload of this message to a memory buffer.
        /// </summary>
        /// <param name="serializer">Serializer to read/write payload to.</param>
        protected override void SerializePayload(NetMessageSerializer serializer)
        {
            serializer.Serialize(ref UploadRate);
            serializer.Serialize(ref DownloadRate);
            serializer.Serialize(ref TotalUploaded);
            serializer.Serialize(ref TotalDownloaded);
            serializer.Serialize(ref ConnectedPeerCount);
            serializer.Serialize(ref DiskUsage);
            serializer.Serialize(ref Version);

            if (serializer.Version >= 100000613)
            {
                serializer.Serialize(ref DiskQuota);
            }

            if (serializer.Version >= 100000683)
            {
                serializer.Serialize(ref AllowRemoteActions);
            }
        }
Ejemplo n.º 17
0
        /// <summary>
        ///     Serializes the payload of this message to a memory buffer.
        /// </summary>
        /// <param name="serializer">Serializer to read/write payload to.</param>
        protected override void SerializePayload(NetMessageSerializer serializer)
        {
            // Serialize users.
            int Count = Tags.Count;

            serializer.Serialize(ref Count);

            for (int i = 0; i < Count; i++)
            {
                if (serializer.IsLoading)
                {
                    Tags.Add(new Tag());
                }

                Tags[i].Serialize(serializer);
            }
        }
        /// <summary>
        ///     Serializes the payload of this message to a memory buffer.
        /// </summary>
        /// <param name="serializer">Serializer to read/write payload to.</param>
        protected override void SerializePayload(NetMessageSerializer serializer)
        {
            // Serialize users.
            int Count = Users.Count;

            serializer.Serialize(ref Count);

            for (int i = 0; i < Count; i++)
            {
                if (serializer.IsLoading)
                {
                    Users.Add(new User());
                }

                string Username = Users[i].Username;
                serializer.Serialize(ref Username);

                Users[i].Username = Username;

                int GroupCount = Users[i].Groups.Count;
                serializer.Serialize(ref GroupCount);
                for (int j = 0; j < GroupCount; j++)
                {
                    if (serializer.IsLoading)
                    {
                        Users[i].Groups.Add("");
                    }

                    string GroupName = Users[i].Groups[j];
                    serializer.Serialize(ref GroupName);
                    Users[i].Groups[j] = GroupName;
                }
            }

            // Serialize usergroups
            Count = UserGroups.Count;
            serializer.Serialize(ref Count);

            for (int i = 0; i < Count; i++)
            {
                if (serializer.IsLoading)
                {
                    UserGroups.Add(new UserGroup());
                }

                string Name = UserGroups[i].Name;
                serializer.Serialize(ref Name);

                UserGroups[i].Name = Name;
                UserGroups[i].Permissions.Serialize(serializer);
            }
        }
 /// <summary>
 ///     Serializes the payload of this message to a memory buffer.
 /// </summary>
 /// <param name="serializer">Serializer to read/write payload to.</param>
 protected override void SerializePayload(NetMessageSerializer serializer)
 {
     serializer.Serialize(ref ManifestId);
     serializer.SerializeEnum(ref Result);
 }
Ejemplo n.º 20
0
 /// <summary>
 ///     Serializes the payload of this message to a memory buffer.
 /// </summary>
 /// <param name="serializer">Serializer to read/write payload to.</param>
 protected override void SerializePayload(NetMessageSerializer serializer)
 {
     serializer.Serialize(ref TagId);
 }
 /// <summary>
 ///     Serializes the payload of this message to a memory buffer.
 /// </summary>
 /// <param name="serializer">Serializer to read/write payload to.</param>
 protected override void SerializePayload(NetMessageSerializer serializer)
 {
     serializer.Serialize(ref BandwidthLimit);
 }
Ejemplo n.º 22
0
 /// <summary>
 ///     Serializes the payload of this message to a memory buffer.
 /// </summary>
 /// <param name="serializer">Serializer to read/write payload to.</param>
 protected override void SerializePayload(NetMessageSerializer serializer)
 {
     serializer.Serialize(ref GroupName);
     serializer.Serialize(ref Username);
 }
 /// <summary>
 ///     Serializes the payload of this message to a memory buffer.
 /// </summary>
 /// <param name="serializer">Serializer to read/write payload to.</param>
 protected override void SerializePayload(NetMessageSerializer serializer)
 {
     serializer.Serialize(ref ManifestId);
     serializer.Serialize(ref Data);
 }
 /// <summary>
 ///     Serializes the payload of this message to a memory buffer.
 /// </summary>
 /// <param name="serializer">Serializer to read/write payload to.</param>
 protected override void SerializePayload(NetMessageSerializer serializer)
 {
     serializer.Serialize(ref ActionId);
     serializer.SerializeEnum(ref Type);
     serializer.Serialize(ref Settings);
 }
Ejemplo n.º 25
0
 /// <summary>
 ///     Serializes the payload of this message to a memory buffer.
 /// </summary>
 /// <param name="serializer">Serializer to read/write payload to.</param>
 protected override void SerializePayload(NetMessageSerializer serializer)
 {
     serializer.SerializeList(ref SelectTags);
     serializer.SerializeList(ref IgnoreTags);
     serializer.Serialize(ref NewerThan);
 }
Ejemplo n.º 26
0
 /// <summary>
 ///     Serializes the payload of this message to a memory buffer.
 /// </summary>
 /// <param name="serializer">Serializer to read/write payload to.</param>
 protected override void SerializePayload(NetMessageSerializer serializer)
 {
     serializer.Serialize(ref RootPath);
 }
Ejemplo n.º 27
0
        /// <summary>
        ///     Serializes the payload of this message to a memory buffer.
        /// </summary>
        /// <param name="serializer">Serializer to read/write payload to.</param>
        protected override void SerializePayload(NetMessageSerializer serializer)
        {
            serializer.Serialize(ref BandwidthLimit);

            int Count = ClientStates.Count;

            serializer.Serialize(ref Count);

            for (int i = 0; i < Count; i++)
            {
                if (serializer.IsLoading)
                {
                    ClientStates.Add(new ClientState());
                }

                if (serializer.Version > 100000584)
                {
                    serializer.Serialize(ref ClientStates[i].Username);
                }
                if (serializer.Version >= 100000690)
                {
                    serializer.Serialize(ref ClientStates[i].MachineName);
                }

                serializer.Serialize(ref ClientStates[i].Address);
                serializer.Serialize(ref ClientStates[i].DownloadRate);
                serializer.Serialize(ref ClientStates[i].UploadRate);
                serializer.Serialize(ref ClientStates[i].TotalDownloaded);
                serializer.Serialize(ref ClientStates[i].TotalUploaded);
                serializer.Serialize(ref ClientStates[i].ConnectedPeerCount);
                serializer.Serialize(ref ClientStates[i].DiskUsage);
                serializer.Serialize(ref ClientStates[i].Version);

                if (serializer.Version >= 100000613)
                {
                    serializer.Serialize(ref ClientStates[i].DiskQuota);
                }

                int TagCount = ClientStates[i].TagIds.Count;
                serializer.Serialize(ref TagCount);

                for (int j = 0; j < TagCount; j++)
                {
                    if (serializer.IsLoading)
                    {
                        ClientStates[i].TagIds.Add(new Guid());
                    }

                    Guid id = ClientStates[i].TagIds[j];
                    serializer.Serialize(ref id);
                    ClientStates[i].TagIds[j] = id;
                }
            }

            if (serializer.Version > 100000689)
            {
                Count = InstallStates.Count;
                serializer.Serialize(ref Count);

                for (int i = 0; i < Count; i++)
                {
                    if (serializer.IsLoading)
                    {
                        InstallStates.Add(new RemoteInstallState());
                    }

                    serializer.SerializeEnum(ref InstallStates[i].Type);
                    serializer.Serialize(ref InstallStates[i].Requester);
                    serializer.Serialize(ref InstallStates[i].AssignedTo);
                    serializer.Serialize(ref InstallStates[i].Progress);
                    serializer.Serialize(ref InstallStates[i].ProgressText);
                    serializer.Serialize(ref InstallStates[i].Id);
                }
            }
        }
 /// <summary>
 ///     Serializes the payload of this message to a memory buffer.
 /// </summary>
 /// <param name="serializer">Serializer to read/write payload to.</param>
 protected override void SerializePayload(NetMessageSerializer serializer)
 {
     serializer.Serialize(ref GroupName);
     serializer.SerializeEnum(ref PermissionType);
     serializer.Serialize(ref PermissionPath);
 }