mirror of
https://github.com/RaidMax/IW4M-Admin.git
synced 2025-06-10 07:13:58 -05:00
fix duplicate bot welcomes
fix prompt bool incorrect default value rename GameEvent.Remote to GameEvent.IsRemote include NetworkId in webfront claims fix non descript error message appearing when something fails and localization is not initialized
This commit is contained in:
@ -188,7 +188,7 @@ namespace SharedLibraryCore
|
||||
public EFClient Origin;
|
||||
public EFClient Target;
|
||||
public Server Owner;
|
||||
public Boolean Remote = false;
|
||||
public bool IsRemote { get; set; } = false;
|
||||
public object Extra { get; set; }
|
||||
public ManualResetEventSlim OnProcessed { get; set; }
|
||||
public DateTime Time { get; set; }
|
||||
|
@ -1,5 +1,6 @@
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Newtonsoft.Json;
|
||||
using SharedLibraryCore.Exceptions;
|
||||
using SharedLibraryCore.Interfaces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@ -40,7 +41,7 @@ namespace SharedLibraryCore.Configuration
|
||||
return File.WriteAllTextAsync(Path.Join(Utilities.OperatingDirectory, "Configuration", $"{Filename}.json"), appConfigJSON);
|
||||
}
|
||||
|
||||
public T Configuration() => _configuration;
|
||||
public T Configuration() => _configuration == null ? throw new ServerException("Configuration is null") : _configuration;
|
||||
|
||||
public void Set(T config)
|
||||
{
|
||||
|
@ -53,13 +53,6 @@ namespace SharedLibraryCore.Services
|
||||
private async Task UpdateAlias(string name, int? ip, EFClient entity, DatabaseContext context)
|
||||
{
|
||||
// entity is the tracked db context item
|
||||
// todo: move this out
|
||||
#if DEBUG == false
|
||||
if (entity.IsBot)
|
||||
{
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
// get all aliases by IP address and LinkId
|
||||
var iqAliases = context.Aliases
|
||||
.Include(a => a.Link)
|
||||
@ -377,7 +370,8 @@ namespace SharedLibraryCore.Services
|
||||
ClientId = client.ClientId,
|
||||
Level = client.Level,
|
||||
Password = client.Password,
|
||||
PasswordSalt = client.PasswordSalt
|
||||
PasswordSalt = client.PasswordSalt,
|
||||
NetworkId = client.NetworkId
|
||||
};
|
||||
|
||||
#if DEBUG == true
|
||||
|
@ -212,7 +212,7 @@ namespace SharedLibraryCore
|
||||
/// </summary>
|
||||
/// <param name="input">Shorthand gametype reported from server</param>
|
||||
/// <returns></returns>
|
||||
public static String GetLocalizedGametype(String input)
|
||||
public static string GetLocalizedGametype(String input)
|
||||
{
|
||||
switch (input)
|
||||
{
|
||||
@ -284,7 +284,7 @@ namespace SharedLibraryCore
|
||||
public static int? ConvertToIP(this string str)
|
||||
{
|
||||
bool success = System.Net.IPAddress.TryParse(str, out System.Net.IPAddress ip);
|
||||
return success && ip.GetAddressBytes().Count(_byte => _byte == 0) != 4 ?
|
||||
return success && ip.GetAddressBytes().Count(_byte => _byte == 0) != 4 ?
|
||||
(int?)BitConverter.ToInt32(ip.GetAddressBytes(), 0) :
|
||||
null;
|
||||
}
|
||||
@ -294,12 +294,12 @@ namespace SharedLibraryCore
|
||||
return !ip.HasValue ? "" : new System.Net.IPAddress(BitConverter.GetBytes(ip.Value)).ToString();
|
||||
}
|
||||
|
||||
public static String GetTimePassed(DateTime start)
|
||||
public static string GetTimePassed(DateTime start)
|
||||
{
|
||||
return GetTimePassed(start, true);
|
||||
}
|
||||
|
||||
public static String GetTimePassed(DateTime start, bool includeAgo)
|
||||
public static string GetTimePassed(DateTime start, bool includeAgo)
|
||||
{
|
||||
TimeSpan Elapsed = DateTime.UtcNow - start;
|
||||
string ago = includeAgo ? $" {CurrentLocalization.LocalizationIndex["WEBFRONT_PENALTY_TEMPLATE_AGO"]}" : "";
|
||||
@ -480,10 +480,11 @@ namespace SharedLibraryCore
|
||||
/// <param name="description">description of the question's value</param>
|
||||
/// <param name="defaultValue">default value to set if no input is entered</param>
|
||||
/// <returns></returns>
|
||||
public static bool PromptBool(string question, string description = null, char? defaultValue = 'y')
|
||||
public static bool PromptBool(string question, string description = null, bool defaultValue = true)
|
||||
{
|
||||
Console.Write($"{question}?{(string.IsNullOrEmpty(description) ? "" : $" ({description}) ")}[y/n]: ");
|
||||
return (Console.ReadLine().ToLower().FirstOrDefault() as char? ?? defaultValue) == 'y';
|
||||
char response = Console.ReadLine().ToLower().FirstOrDefault();
|
||||
return response != 0 ? response == 'y' : defaultValue;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
Reference in New Issue
Block a user