From 050be311e68bb316cfc40fbd23bfd5a812e1a060 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Mon, 14 Jun 2021 20:03:36 -0500 Subject: move stuff around --- src/slskd/API/DTO/ConnectRequest.cs | 27 ----- src/slskd/API/DTO/LoginRequest.cs | 25 ----- src/slskd/API/DTO/PrivateMessageResponse.cs | 74 -------------- src/slskd/API/DTO/QueueDownloadRequest.cs | 37 ------- src/slskd/API/DTO/RoomInfoResponse.cs | 60 ----------- src/slskd/API/DTO/RoomMessageResponse.cs | 62 ------------ src/slskd/API/DTO/RoomResponse.cs | 75 -------------- src/slskd/API/DTO/SearchRequest.cs | 116 ---------------------- src/slskd/API/DTO/TokenResponse.cs | 67 ------------- src/slskd/API/DTO/Transfer.cs | 148 ---------------------------- src/slskd/API/DTO/UserDataResponse.cs | 85 ---------------- 11 files changed, 776 deletions(-) delete mode 100644 src/slskd/API/DTO/ConnectRequest.cs delete mode 100644 src/slskd/API/DTO/LoginRequest.cs delete mode 100644 src/slskd/API/DTO/PrivateMessageResponse.cs delete mode 100644 src/slskd/API/DTO/QueueDownloadRequest.cs delete mode 100644 src/slskd/API/DTO/RoomInfoResponse.cs delete mode 100644 src/slskd/API/DTO/RoomMessageResponse.cs delete mode 100644 src/slskd/API/DTO/RoomResponse.cs delete mode 100644 src/slskd/API/DTO/SearchRequest.cs delete mode 100644 src/slskd/API/DTO/TokenResponse.cs delete mode 100644 src/slskd/API/DTO/Transfer.cs delete mode 100644 src/slskd/API/DTO/UserDataResponse.cs (limited to 'src/slskd/API/DTO') diff --git a/src/slskd/API/DTO/ConnectRequest.cs b/src/slskd/API/DTO/ConnectRequest.cs deleted file mode 100644 index 155db2da..00000000 --- a/src/slskd/API/DTO/ConnectRequest.cs +++ /dev/null @@ -1,27 +0,0 @@ -// -// Copyright (c) slskd Team. All rights reserved. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published -// by the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see https://www.gnu.org/licenses/. -// - -namespace slskd.API.DTO -{ - public class ConnectRequest - { - public string Address { get; set; } - public int? Port { get; set; } - public string Username { get; set; } - public string Password { get; set; } - } -} diff --git a/src/slskd/API/DTO/LoginRequest.cs b/src/slskd/API/DTO/LoginRequest.cs deleted file mode 100644 index 9f3ccf2e..00000000 --- a/src/slskd/API/DTO/LoginRequest.cs +++ /dev/null @@ -1,25 +0,0 @@ -// -// Copyright (c) slskd Team. All rights reserved. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published -// by the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see https://www.gnu.org/licenses/. -// - -namespace slskd.API.DTO -{ - public class LoginRequest - { - public string Username { get; set; } - public string Password { get; set; } - } -} diff --git a/src/slskd/API/DTO/PrivateMessageResponse.cs b/src/slskd/API/DTO/PrivateMessageResponse.cs deleted file mode 100644 index 9794d762..00000000 --- a/src/slskd/API/DTO/PrivateMessageResponse.cs +++ /dev/null @@ -1,74 +0,0 @@ -// -// Copyright (c) slskd Team. All rights reserved. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published -// by the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see https://www.gnu.org/licenses/. -// - -namespace slskd.API.DTO -{ - using slskd.Messaging; - using System; - - public class PrivateMessageResponse - { - /// - /// A value indicating whether the message has been acknowledged. - /// - public bool Acknowledged { get; set; } = false; - - /// - /// The unique message id, used to acknowledge receipt. - /// - public int Id { get; set; } - - /// - /// The message. - /// - public string Message { get; set; } - - /// - /// A value indicating whether the message was replayed. - /// - public bool Replayed { get; set; } - - /// - /// The UTC timestamp of the message. - /// - public DateTime Timestamp { get; set; } = DateTime.UtcNow; - - /// - /// The username of the user who sent the message. - /// - public string Username { get; set; } - - /// - /// A value indicating whether this message was sent by the currently logged in user. - /// - public bool? Self { get; set; } - - public static PrivateMessageResponse FromPrivateMessage(PrivateMessage privateMessage, bool self = false) - { - return new PrivateMessageResponse() - { - Id = privateMessage.Id, - Timestamp = privateMessage.Timestamp, - Username = privateMessage.Username, - Message = privateMessage.Message, - Acknowledged = privateMessage.Acknowledged, - Replayed = privateMessage.Replayed, - Self = self ? self : (bool?)null, - }; - } - } -} diff --git a/src/slskd/API/DTO/QueueDownloadRequest.cs b/src/slskd/API/DTO/QueueDownloadRequest.cs deleted file mode 100644 index a849fefa..00000000 --- a/src/slskd/API/DTO/QueueDownloadRequest.cs +++ /dev/null @@ -1,37 +0,0 @@ -// -// Copyright (c) slskd Team. All rights reserved. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published -// by the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see https://www.gnu.org/licenses/. -// - -namespace slskd.API.DTO -{ - public class QueueDownloadRequest - { - /// - /// Gets or sets the filename to download. - /// - public string Filename { get; set; } - - /// - /// Gets or sets the size of the file. - /// - public long? Size { get; set; } - - /// - /// Gets or sets the optional transfer token. - /// - public int? Token { get; set; } - } -} diff --git a/src/slskd/API/DTO/RoomInfoResponse.cs b/src/slskd/API/DTO/RoomInfoResponse.cs deleted file mode 100644 index 6f135d56..00000000 --- a/src/slskd/API/DTO/RoomInfoResponse.cs +++ /dev/null @@ -1,60 +0,0 @@ -// -// Copyright (c) slskd Team. All rights reserved. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published -// by the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see https://www.gnu.org/licenses/. -// - -namespace slskd.API.DTO -{ - using Soulseek; - - public class RoomInfoResponse - { - /// - /// Gets the room name. - /// - public string Name { get; init; } - - /// - /// Gets the number of users in the room. - /// - public int UserCount { get; init; } - - /// - /// Gets a value indicating whether the room is private. - /// - public bool IsPrivate { get; init; } - - /// - /// Gets a value indicating whether the room is owned by the currently logged in user. - /// - public bool IsOwned { get; init; } - - /// - /// Gets a value indicating whether the room is moderated by the currently logged in user. - /// - public bool IsModerated { get; set; } - - public static RoomInfoResponse FromRoomInfo(RoomInfo info, bool isPrivate = false, bool isOwned = false) - { - return new RoomInfoResponse() - { - Name = info.Name, - UserCount = info.UserCount, - IsPrivate = isPrivate, - IsOwned = isOwned, - }; - } - } -} diff --git a/src/slskd/API/DTO/RoomMessageResponse.cs b/src/slskd/API/DTO/RoomMessageResponse.cs deleted file mode 100644 index 48a77f51..00000000 --- a/src/slskd/API/DTO/RoomMessageResponse.cs +++ /dev/null @@ -1,62 +0,0 @@ -// -// Copyright (c) slskd Team. All rights reserved. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published -// by the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see https://www.gnu.org/licenses/. -// - -namespace slskd.API.DTO -{ - using slskd.Messaging; - using System; - - public class RoomMessageResponse - { - /// - /// The timestamp of the message. - /// - public DateTime Timestamp { get; set; } = DateTime.UtcNow; - - /// - /// The username of the user who sent the message. - /// - public string Username { get; set; } - - /// - /// The message. - /// - public string Message { get; set; } - - /// - /// The room to which the message pertains. - /// - public string RoomName { get; set; } - - /// - /// A value indicating whether this user data belongs to the currently logged in user. - /// - public bool? Self { get; set; } - - public static RoomMessageResponse FromRoomMessage(RoomMessage roomMessage, bool self = false) - { - return new RoomMessageResponse() - { - Timestamp = roomMessage.Timestamp, - Username = roomMessage.Username, - Message = roomMessage.Message, - RoomName = roomMessage.RoomName, - Self = self ? self : (bool?)null, - }; - } - } -} diff --git a/src/slskd/API/DTO/RoomResponse.cs b/src/slskd/API/DTO/RoomResponse.cs deleted file mode 100644 index 552cb7f5..00000000 --- a/src/slskd/API/DTO/RoomResponse.cs +++ /dev/null @@ -1,75 +0,0 @@ -// -// Copyright (c) slskd Team. All rights reserved. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published -// by the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see https://www.gnu.org/licenses/. -// - -namespace slskd.API.DTO -{ - using slskd.Messaging; - using System.Collections.Generic; - using System.Linq; - - public class RoomResponse - { - /// - /// The room name. - /// - public string Name { get; set; } - - /// - /// A value indicating whether the room is private. - /// - public bool IsPrivate { get; set; } - - /// - /// The number of operators in the room, if private. - /// - public int? OperatorCount { get; set; } - - /// - /// The operators in the room, if private. - /// - public IList Operators { get; set; } - - /// - /// The owner of the room, if private. - /// - public string Owner { get; set; } - - /// - /// The list of users in the room. - /// - public IEnumerable Users { get; set; } = new List(); - - /// - /// The list of messages. - /// - public IEnumerable Messages { get; set; } = new List(); - - public static RoomResponse FromRoom(Room room) - { - return new RoomResponse() - { - Name = room.Name, - IsPrivate = room.IsPrivate, - OperatorCount = room.OperatorCount, - Operators = room.Operators?.ToList(), - Owner = room.Owner, - Users = new List(), - Messages = new List(), - }; - } - } -} diff --git a/src/slskd/API/DTO/SearchRequest.cs b/src/slskd/API/DTO/SearchRequest.cs deleted file mode 100644 index 147eb205..00000000 --- a/src/slskd/API/DTO/SearchRequest.cs +++ /dev/null @@ -1,116 +0,0 @@ -// -// Copyright (c) slskd Team. All rights reserved. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published -// by the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see https://www.gnu.org/licenses/. -// - -namespace slskd.API.DTO -{ - using System; - using Soulseek; - - /// - /// A search request. - /// - public class SearchRequest - { - /// - /// Gets or sets the unique search identifier. - /// - public Guid? Id { get; set; } - - /// - /// Gets or sets the maximum number of file results to accept before the search is considered complete. (Default = 10,000). - /// - public int? FileLimit { get; set; } - - /// - /// Gets or sets a value indicating whether responses are to be filtered. (Default = true). - /// - public bool? FilterResponses { get; set; } - - /// - /// Gets or sets the maximum queue depth a peer may have in order for a response to be processed. (Default = 1000000). - /// - public int? MaximumPeerQueueLength { get; set; } - - /// - /// Gets or sets the minimum number of free upload slots a peer must have in order for a response to be processed. - /// (Default = 0). - /// - public int? MinimumPeerFreeUploadSlots { get; set; } - - /// - /// Gets or sets the minimum upload speed a peer must have in order for a response to be processed. (Default = 0). - /// - public int? MinimumPeerUploadSpeed { get; set; } - - /// - /// Gets or sets the minimum number of files a response must contain in order to be processed. (Default = 1). - /// - public int? MinimumResponseFileCount { get; set; } - - /// - /// Gets or sets the maximum number of search results to accept before the search is considered complete. (Default = 100). - /// - public int? ResponseLimit { get; set; } - - /// - /// Gets or sets the search text. - /// - public string SearchText { get; set; } - - /// - /// Gets or sets the search timeout value, in seconds, used to determine when the search is complete. (Default = 15). - /// - /// The timeout duration is from the time of the last response. - public int? SearchTimeout { get; set; } - - /// - /// Gets or sets the search token. - /// - public int? Token { get; set; } - - /// - /// Maps to a new instance of . - /// - /// - /// - /// - /// - /// - public SearchOptions ToSearchOptions( - Func responseFilter = null, - Func fileFilter = null, - Action stateChanged = null, - Action responseReceived = null) - { - var def = new SearchOptions(); - - return new SearchOptions( - searchTimeout: SearchTimeout ?? def.SearchTimeout, - responseLimit: ResponseLimit ?? def.ResponseLimit, - fileLimit: FileLimit ?? def.FileLimit, - filterResponses: FilterResponses ?? def.FilterResponses, - minimumResponseFileCount: MinimumResponseFileCount ?? def.MinimumResponseFileCount, - minimumPeerFreeUploadSlots: MinimumPeerFreeUploadSlots ?? def.MinimumPeerFreeUploadSlots, - maximumPeerQueueLength: MaximumPeerQueueLength ?? def.MaximumPeerQueueLength, - minimumPeerUploadSpeed: MinimumPeerUploadSpeed ?? def.MinimumPeerUploadSpeed, - responseFilter: responseFilter, - fileFilter: fileFilter, - responseReceived: responseReceived, - stateChanged: stateChanged); - } - } -} \ No newline at end of file diff --git a/src/slskd/API/DTO/TokenResponse.cs b/src/slskd/API/DTO/TokenResponse.cs deleted file mode 100644 index c20e325c..00000000 --- a/src/slskd/API/DTO/TokenResponse.cs +++ /dev/null @@ -1,67 +0,0 @@ -// -// Copyright (c) slskd Team. All rights reserved. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published -// by the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see https://www.gnu.org/licenses/. -// - -namespace slskd.API.DTO -{ - using System; - using System.IdentityModel.Tokens.Jwt; - using System.Linq; - using System.Security.Claims; - using System.Text.Json.Serialization; - using Microsoft.AspNetCore.Authentication.JwtBearer; - - public class TokenResponse - { - public TokenResponse(JwtSecurityToken jwtSecurityToken) - { - JwtSecurityToken = jwtSecurityToken; - } - - /// - /// Gets the time at which the Access Token expires. - /// - public long Expires => ((DateTimeOffset)JwtSecurityToken.ValidTo).ToUnixTimeSeconds(); - - /// - /// Gets the time at which the Access Token was issued. - /// - public long Issued => ((DateTimeOffset)JwtSecurityToken.ValidFrom).ToUnixTimeSeconds(); - - /// - /// Gets the value of the Name claim from the Access Token. - /// - public string Name => JwtSecurityToken.Claims.SingleOrDefault(c => c.Type == ClaimTypes.Name)?.Value; - - /// - /// Gets the value of the Not Before claim from the Access Token. - /// - public long NotBefore => long.Parse(JwtSecurityToken.Claims.SingleOrDefault(c => c.Type == "nbf").Value); - - /// - /// Gets the Access Token string. - /// - public string Token => new JwtSecurityTokenHandler().WriteToken(JwtSecurityToken); - - /// - /// Gets the Token type. - /// - public string TokenType => JwtBearerDefaults.AuthenticationScheme; - - [JsonIgnore] - private JwtSecurityToken JwtSecurityToken { get; } - } -} \ No newline at end of file diff --git a/src/slskd/API/DTO/Transfer.cs b/src/slskd/API/DTO/Transfer.cs deleted file mode 100644 index c3e4ac22..00000000 --- a/src/slskd/API/DTO/Transfer.cs +++ /dev/null @@ -1,148 +0,0 @@ -// -// Copyright (c) slskd Team. All rights reserved. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published -// by the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see https://www.gnu.org/licenses/. -// - -namespace slskd.API.DTO -{ - using System; - using System.Net; - using Soulseek; - - /// - /// A single file transfer. - /// - public class Transfer - { - /// - /// Gets the current average transfer speed. - /// - public double AverageSpeed { get; set; } - - /// - /// Gets the number of remaining bytes to be transferred. - /// - public long BytesRemaining { get; set; } - - /// - /// Gets the total number of bytes transferred. - /// - public long BytesTransferred { get; set; } - - /// - /// Gets the transfer direction. - /// - public TransferDirection Direction { get; set; } - - /// - /// Gets the current duration of the transfer, if it has been started. - /// - public double? ElapsedTime { get; set; } - - /// - /// Gets the UTC time at which the transfer transitioned into the state. - /// - public DateTime? EndTime { get; set; } - - /// - /// Gets the filename of the file to be transferred. - /// - public string Filename { get; set; } - - /// - /// Gets the transfer id. - /// - public string Id => Filename.Sha1(); - - /// - /// Gets the ip endpoint of the remote transfer connection, if one has been established. - /// - public IPEndPoint IPEndPoint { get; set; } - - /// - /// Gets the current progress in percent. - /// - public double PercentComplete { get; set; } - - /// - /// Gets the current place in queue, if it has been fetched. - /// - public int? PlaceInQueue { get; set; } - - /// - /// Gets the projected remaining duration of the transfer. - /// - public double? RemainingTime { get; set; } - - /// - /// Gets the remote unique token for the transfer. - /// - public int? RemoteToken { get; set; } - - /// - /// Gets the size of the file to be transferred, in bytes. - /// - public long Size { get; set; } - - /// - /// Gets the starting offset of the transfer, in bytes. - /// - public long StartOffset { get; set; } - - /// - /// Gets the UTC time at which the transfer transitioned into the state. - /// - public DateTime? StartTime { get; set; } - - /// - /// Gets the state of the transfer. - /// - public TransferStates State { get; set; } - - /// - /// Gets the unique token for the transfer. - /// - public int Token { get; set; } - - /// - /// Gets the username of the peer to or from which the file is to be transferred. - /// - public string Username { get; set; } - - public static Transfer FromSoulseekTransfer(Soulseek.Transfer transfer) - { - return new Transfer() - { - AverageSpeed = transfer.AverageSpeed, - BytesRemaining = transfer.BytesRemaining, - BytesTransferred = transfer.BytesTransferred, - Direction = transfer.Direction, - ElapsedTime = transfer.ElapsedTime?.TotalMilliseconds, - EndTime = transfer.EndTime, - Filename = transfer.Filename, - IPEndPoint = transfer.IPEndPoint, - PercentComplete = transfer.PercentComplete, - RemainingTime = transfer.RemainingTime?.TotalMilliseconds, - RemoteToken = transfer.RemoteToken, - Size = transfer.Size, - StartOffset = transfer.StartOffset, - StartTime = transfer.StartTime, - State = transfer.State, - Token = transfer.Token, - Username = transfer.Username, - }; - } - } -} \ No newline at end of file diff --git a/src/slskd/API/DTO/UserDataResponse.cs b/src/slskd/API/DTO/UserDataResponse.cs deleted file mode 100644 index e854922e..00000000 --- a/src/slskd/API/DTO/UserDataResponse.cs +++ /dev/null @@ -1,85 +0,0 @@ -// -// Copyright (c) slskd Team. All rights reserved. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published -// by the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see https://www.gnu.org/licenses/. -// - -namespace slskd.API.DTO -{ - using Soulseek; - - public class UserDataResponse - { - /// - /// The average upload speed of the user. - /// - public int AverageSpeed { get; set; } - - /// - /// The user's country code, if provided. - /// - public string CountryCode { get; set; } - - /// - /// The number of directories shared by the user. - /// - public int DirectoryCount { get; set; } - - /// - /// The number of active user downloads. - /// - public long DownloadCount { get; set; } - - /// - /// The number of files shared by the user. - /// - public int FileCount { get; set; } - - /// - /// A value indicating whether this user data belongs to the currently logged in user. - /// - public bool? Self { get; set; } - - /// - /// The number of the user's free download slots, if provided. - /// - public int? SlotsFree { get; set; } - - /// - /// The status of the user (0 = offline, 1 = away, 2 = online). - /// - public UserPresence Status { get; set; } - - /// - /// The username of the user. - /// - public string Username { get; set; } - - public static UserDataResponse FromUserData(UserData userData, bool self = false) - { - return new UserDataResponse() - { - AverageSpeed = userData.AverageSpeed, - CountryCode = userData.CountryCode, - DirectoryCount = userData.DirectoryCount, - DownloadCount = userData.DownloadCount, - FileCount = userData.FileCount, - SlotsFree = userData.SlotsFree, - Status = userData.Status, - Username = userData.Username, - Self = self ? self : (bool?)null, - }; - } - } -} \ No newline at end of file -- cgit v1.2.3