Initial .net 6 upgrades
This commit is contained in:
@ -3,55 +3,65 @@
|
||||
namespace SharedLibraryCore.Dtos
|
||||
{
|
||||
/// <summary>
|
||||
/// data transfer class for audit information
|
||||
/// data transfer class for audit information
|
||||
/// </summary>
|
||||
public class AuditInfo
|
||||
{
|
||||
private string newValue;
|
||||
|
||||
private string oldValue;
|
||||
|
||||
/// <summary>
|
||||
/// name of the origin entity
|
||||
/// name of the origin entity
|
||||
/// </summary>
|
||||
public string OriginName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// id of the origin entity
|
||||
/// id of the origin entity
|
||||
/// </summary>
|
||||
public int OriginId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// name of the target entity
|
||||
/// name of the target entity
|
||||
/// </summary>
|
||||
public string TargetName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// id of the target entity
|
||||
/// id of the target entity
|
||||
/// </summary>
|
||||
public int? TargetId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// when the audit event occured
|
||||
/// when the audit event occured
|
||||
/// </summary>
|
||||
public DateTime When { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// what audit action occured
|
||||
/// what audit action occured
|
||||
/// </summary>
|
||||
public string Action { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// additional comment data about the audit event
|
||||
/// additional comment data about the audit event
|
||||
/// </summary>
|
||||
public string Data { get; set; }
|
||||
|
||||
private string oldValue;
|
||||
/// <summary>
|
||||
/// previous value
|
||||
/// previous value
|
||||
/// </summary>
|
||||
public string OldValue { get => oldValue ?? "--"; set => oldValue = value; }
|
||||
public string OldValue
|
||||
{
|
||||
get => oldValue ?? "--";
|
||||
set => oldValue = value;
|
||||
}
|
||||
|
||||
private string newValue;
|
||||
/// <summary>
|
||||
/// new value
|
||||
/// new value
|
||||
/// </summary>
|
||||
public string NewValue { get => newValue ?? "--"; set => newValue = value; }
|
||||
public string NewValue
|
||||
{
|
||||
get => newValue ?? "--";
|
||||
set => newValue = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,10 +1,12 @@
|
||||
namespace SharedLibraryCore.Dtos
|
||||
using Data.Models.Client;
|
||||
|
||||
namespace SharedLibraryCore.Dtos
|
||||
{
|
||||
public class ClientInfo
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public int ClientId { get; set; }
|
||||
public int LinkId { get; set; }
|
||||
public Database.Models.EFClient.Permission Level { get; set; }
|
||||
public EFClient.Permission Level { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
@ -1,14 +1,8 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SharedLibraryCore.Dtos
|
||||
namespace SharedLibraryCore.Dtos
|
||||
{
|
||||
public class CommandResponseInfo
|
||||
{
|
||||
public string Response { get; set; }
|
||||
public int ClientId { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
@ -1,15 +1,11 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace SharedLibraryCore.Dtos
|
||||
namespace SharedLibraryCore.Dtos
|
||||
{
|
||||
/// <summary>
|
||||
/// This class holds the basic info for api entities
|
||||
/// This class holds the basic info for api entities
|
||||
/// </summary>
|
||||
public class EntityInfo
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
@ -3,13 +3,13 @@
|
||||
public class ErrorResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// todo: type of error
|
||||
/// todo: type of error
|
||||
/// </summary>
|
||||
public string Type { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// relevant error messages
|
||||
/// relevant error messages
|
||||
/// </summary>
|
||||
public string[] Messages { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
@ -1,10 +1,9 @@
|
||||
using System;
|
||||
using static SharedLibraryCore.GameEvent;
|
||||
|
||||
namespace SharedLibraryCore.Dtos
|
||||
{
|
||||
/// <summary>
|
||||
/// This class wraps the information related to a generated event for the API
|
||||
/// This class wraps the information related to a generated event for the API
|
||||
/// </summary>
|
||||
public class EventInfo
|
||||
{
|
||||
@ -15,6 +14,6 @@ namespace SharedLibraryCore.Dtos
|
||||
public EntityInfo OwnerEntity { get; set; }
|
||||
public DateTime EventTime { get; set; }
|
||||
public string ExtraInfo { get; set; }
|
||||
public string Id { get; private set; } = Guid.NewGuid().ToString();
|
||||
public string Id { get; } = Guid.NewGuid().ToString();
|
||||
}
|
||||
}
|
@ -3,15 +3,18 @@
|
||||
public class FindClientRequest : PaginationRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// name of client
|
||||
/// name of client
|
||||
/// </summary>
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// network id of client
|
||||
/// network id of client
|
||||
/// </summary>
|
||||
public string Xuid { get; set; }
|
||||
|
||||
public string ToDebugString() => $"[Name={Name}, Xuid={Xuid}]";
|
||||
public string ToDebugString()
|
||||
{
|
||||
return $"[Name={Name}, Xuid={Xuid}]";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -3,18 +3,18 @@
|
||||
public class FindClientResult
|
||||
{
|
||||
/// <summary>
|
||||
/// client identifier
|
||||
/// client identifier
|
||||
/// </summary>
|
||||
public int ClientId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// networkid of client
|
||||
/// networkid of client
|
||||
/// </summary>
|
||||
public string Xuid { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// name of client
|
||||
/// name of client
|
||||
/// </summary>
|
||||
public string Name { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
@ -13,13 +13,13 @@ namespace SharedLibraryCore.Dtos
|
||||
public DateTime MaxConcurrentClientsTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// specifies the game name filter
|
||||
/// specifies the game name filter
|
||||
/// </summary>
|
||||
public Game? Game { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// collection of unique game names being monitored
|
||||
/// collection of unique game names being monitored
|
||||
/// </summary>
|
||||
public Game[] ActiveServerGames { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
@ -1,11 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace SharedLibraryCore.Dtos.Meta.Requests
|
||||
namespace SharedLibraryCore.Dtos.Meta.Requests
|
||||
{
|
||||
public class BaseClientMetaRequest : PaginationRequest
|
||||
{
|
||||
public int ClientId { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
@ -1,11 +1,6 @@
|
||||
using SharedLibraryCore.QueryHelper;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace SharedLibraryCore.Dtos.Meta.Requests
|
||||
namespace SharedLibraryCore.Dtos.Meta.Requests
|
||||
{
|
||||
public class ReceivedPenaltyRequest : BaseClientMetaRequest
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
@ -1,10 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace SharedLibraryCore.Dtos.Meta.Responses
|
||||
namespace SharedLibraryCore.Dtos.Meta.Responses
|
||||
{
|
||||
public class AdministeredPenaltyResponse : ReceivedPenaltyResponse
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
@ -1,17 +1,17 @@
|
||||
using SharedLibraryCore.Interfaces;
|
||||
using System;
|
||||
using System;
|
||||
using SharedLibraryCore.Interfaces;
|
||||
|
||||
namespace SharedLibraryCore.Dtos.Meta.Responses
|
||||
{
|
||||
public class BaseMetaResponse : IClientMeta, IClientMetaResponse
|
||||
{
|
||||
public long MetaId { get; set; }
|
||||
public int ClientId { get; set; }
|
||||
public MetaType Type { get; set; }
|
||||
public DateTime When { get; set; }
|
||||
public bool IsSensitive { get; set; }
|
||||
public bool ShouldDisplay { get; set; }
|
||||
public int? Column { get; set; }
|
||||
public int? Order { get; set; }
|
||||
public long MetaId { get; set; }
|
||||
public int ClientId { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
@ -1,9 +1,4 @@
|
||||
using SharedLibraryCore.Interfaces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace SharedLibraryCore.Dtos.Meta.Responses
|
||||
namespace SharedLibraryCore.Dtos.Meta.Responses
|
||||
{
|
||||
public class InformationResponse : BaseMetaResponse
|
||||
{
|
||||
@ -11,4 +6,4 @@ namespace SharedLibraryCore.Dtos.Meta.Responses
|
||||
public string Value { get; set; }
|
||||
public string ToolTipText { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
@ -9,30 +9,30 @@ namespace SharedLibraryCore.Dtos.Meta.Responses
|
||||
public bool IsHidden { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// name of the client
|
||||
/// name of the client
|
||||
/// </summary>
|
||||
public string ClientName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// hostname of the server
|
||||
/// hostname of the server
|
||||
/// </summary>
|
||||
public string ServerName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// specifies the game the chat occured on
|
||||
/// specifies the game the chat occured on
|
||||
/// </summary>
|
||||
public Server.Game GameName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// indicates if the chat message is a quick message phrase
|
||||
/// indicates if the chat message is a quick message phrase
|
||||
/// </summary>
|
||||
public bool IsQuickMessage { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// indicates if the message was sent ingame
|
||||
/// indicates if the message was sent ingame
|
||||
/// </summary>
|
||||
public bool SentIngame { get; set; }
|
||||
|
||||
public string HiddenMessage => string.Concat(Enumerable.Repeat('●', Message.Length));
|
||||
}
|
||||
}
|
||||
}
|
@ -14,9 +14,16 @@ namespace SharedLibraryCore.Dtos.Meta.Responses
|
||||
public string Offense { get; set; }
|
||||
public string AutomatedOffense { get; set; }
|
||||
public DateTime? ExpirationDate { get; set; }
|
||||
public string ExpiresInText => ExpirationDate.HasValue && ExpirationDate.Value > DateTime.UtcNow ? (ExpirationDate - DateTime.UtcNow).Value.HumanizeForCurrentCulture() : "";
|
||||
public string LengthText => ExpirationDate.HasValue ? (ExpirationDate.Value.AddMinutes(1) - When).HumanizeForCurrentCulture() : "";
|
||||
|
||||
public string ExpiresInText => ExpirationDate.HasValue && ExpirationDate.Value > DateTime.UtcNow
|
||||
? (ExpirationDate - DateTime.UtcNow).Value.HumanizeForCurrentCulture()
|
||||
: "";
|
||||
|
||||
public string LengthText => ExpirationDate.HasValue
|
||||
? (ExpirationDate.Value.AddMinutes(1) - When).HumanizeForCurrentCulture()
|
||||
: "";
|
||||
|
||||
public bool IsLinked { get; set; }
|
||||
public int LinkedClientId { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
@ -15,6 +15,9 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
public override int GetHashCode() => $"{Name.StripColors()}{IPAddress}".GetStableHashCode();
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return $"{Name.StripColors()}{IPAddress}".GetStableHashCode();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,8 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace SharedLibraryCore.Dtos.Meta
|
||||
namespace SharedLibraryCore.Dtos.Meta
|
||||
{
|
||||
public class WebfrontTranslationHelper
|
||||
{
|
||||
@ -10,4 +6,4 @@ namespace SharedLibraryCore.Dtos.Meta
|
||||
public string MatchValue { get; set; }
|
||||
public string TranslationValue { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
@ -5,4 +5,4 @@
|
||||
public string Name { get; set; }
|
||||
public string Location { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
@ -3,27 +3,27 @@
|
||||
namespace SharedLibraryCore.Dtos
|
||||
{
|
||||
/// <summary>
|
||||
/// pagination information holder class
|
||||
/// pagination information holder class
|
||||
/// </summary>
|
||||
public class PaginationRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// how many items to skip
|
||||
/// how many items to skip
|
||||
/// </summary>
|
||||
public int Offset { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// how many itesm to take
|
||||
/// how many itesm to take
|
||||
/// </summary>
|
||||
public int Count { get; set; } = 100;
|
||||
|
||||
/// <summary>
|
||||
/// filter query
|
||||
/// filter query
|
||||
/// </summary>
|
||||
public string Filter { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// direction of ordering
|
||||
/// direction of ordering
|
||||
/// </summary>
|
||||
public SortDirection Direction { get; set; } = SortDirection.Descending;
|
||||
|
||||
@ -35,4 +35,4 @@ namespace SharedLibraryCore.Dtos
|
||||
Ascending,
|
||||
Descending
|
||||
}
|
||||
}
|
||||
}
|
@ -22,11 +22,20 @@ namespace SharedLibraryCore.Dtos
|
||||
public string PenaltyTypeText => PenaltyType.ToString();
|
||||
public DateTime TimePunished { get; set; }
|
||||
public string TimePunishedString => TimePunished.HumanizeForCurrentCulture();
|
||||
public string TimeRemaining => DateTime.UtcNow > Expires ? "" : $"{((Expires ?? DateTime.MaxValue).Year == DateTime.MaxValue.Year ? TimePunishedString : ((Expires ?? DateTime.MaxValue) - DateTime.UtcNow).HumanizeForCurrentCulture())}";
|
||||
|
||||
public string TimeRemaining => DateTime.UtcNow > Expires
|
||||
? ""
|
||||
: $"{((Expires ?? DateTime.MaxValue).Year == DateTime.MaxValue.Year ? TimePunishedString : ((Expires ?? DateTime.MaxValue) - DateTime.UtcNow).HumanizeForCurrentCulture())}";
|
||||
|
||||
public bool Expired => Expires.HasValue && Expires <= DateTime.UtcNow;
|
||||
public DateTime? Expires { get; set; }
|
||||
public override bool Sensitive => PenaltyType == EFPenalty.PenaltyType.Flag || PenaltyType == EFPenalty.PenaltyType.Unflag;
|
||||
|
||||
public override bool Sensitive =>
|
||||
PenaltyType == EFPenalty.PenaltyType.Flag || PenaltyType == EFPenalty.PenaltyType.Unflag;
|
||||
|
||||
public bool IsEvade { get; set; }
|
||||
public string AdditionalPenaltyInformation => $"{(!string.IsNullOrEmpty(AutomatedOffense) ? $" ({AutomatedOffense})" : "")}{(IsEvade ? $" ({Utilities.CurrentLocalization.LocalizationIndex["WEBFRONT_PENALTY_EVADE"]})" : "")}";
|
||||
|
||||
public string AdditionalPenaltyInformation =>
|
||||
$"{(!string.IsNullOrEmpty(AutomatedOffense) ? $" ({AutomatedOffense})" : "")}{(IsEvade ? $" ({Utilities.CurrentLocalization.LocalizationIndex["WEBFRONT_PENALTY_EVADE"]})" : "")}";
|
||||
}
|
||||
}
|
||||
}
|
@ -1,8 +1,8 @@
|
||||
using SharedLibraryCore.Dtos.Meta.Responses;
|
||||
using SharedLibraryCore.Interfaces;
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Data.Models;
|
||||
using SharedLibraryCore.Dtos.Meta.Responses;
|
||||
using SharedLibraryCore.Interfaces;
|
||||
|
||||
namespace SharedLibraryCore.Dtos
|
||||
{
|
||||
@ -30,4 +30,4 @@ namespace SharedLibraryCore.Dtos
|
||||
public MetaType? MetaFilterType { get; set; }
|
||||
public double? ZScore { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
@ -1,8 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using SharedLibraryCore.Helpers;
|
||||
|
||||
namespace SharedLibraryCore.Dtos
|
||||
{
|
||||
@ -16,7 +15,7 @@ namespace SharedLibraryCore.Dtos
|
||||
public int MaxClients { get; set; }
|
||||
public List<ChatInfo> ChatHistory { get; set; }
|
||||
public List<PlayerInfo> Players { get; set; }
|
||||
public Helpers.PlayerHistory[] PlayerHistory { get; set; }
|
||||
public PlayerHistory[] PlayerHistory { get; set; }
|
||||
public List<ClientCountSnapshot> ClientCountHistory { get; set; }
|
||||
public long ID { get; set; }
|
||||
public bool Online { get; set; }
|
||||
@ -31,7 +30,7 @@ namespace SharedLibraryCore.Dtos
|
||||
{
|
||||
var valid = Players.Where(player => player.ZScore != null && player.ZScore != 0)
|
||||
.ToList();
|
||||
|
||||
|
||||
if (!valid.Any())
|
||||
{
|
||||
return null;
|
||||
|
@ -1,5 +1,4 @@
|
||||
|
||||
namespace SharedLibraryCore.Dtos
|
||||
namespace SharedLibraryCore.Dtos
|
||||
{
|
||||
public class SharedInfo
|
||||
{
|
||||
|
Reference in New Issue
Block a user