Clean up some old files

This commit is contained in:
RaidMax 2019-07-17 12:29:51 -05:00
parent 68f6be23a6
commit 2542b7de12
15 changed files with 20 additions and 236 deletions

View File

@ -6,7 +6,7 @@
<RuntimeFrameworkVersion>2.2.2</RuntimeFrameworkVersion> <RuntimeFrameworkVersion>2.2.2</RuntimeFrameworkVersion>
<MvcRazorExcludeRefAssembliesFromPublish>false</MvcRazorExcludeRefAssembliesFromPublish> <MvcRazorExcludeRefAssembliesFromPublish>false</MvcRazorExcludeRefAssembliesFromPublish>
<PackageId>RaidMax.IW4MAdmin.Application</PackageId> <PackageId>RaidMax.IW4MAdmin.Application</PackageId>
<Version>2.2.7.7</Version> <Version>2.2.8.1</Version>
<Authors>RaidMax</Authors> <Authors>RaidMax</Authors>
<Company>Forever None</Company> <Company>Forever None</Company>
<Product>IW4MAdmin</Product> <Product>IW4MAdmin</Product>
@ -32,8 +32,8 @@
<PropertyGroup> <PropertyGroup>
<ServerGarbageCollection>true</ServerGarbageCollection> <ServerGarbageCollection>true</ServerGarbageCollection>
<TieredCompilation>true</TieredCompilation> <TieredCompilation>true</TieredCompilation>
<AssemblyVersion>2.2.7.7</AssemblyVersion> <AssemblyVersion>2.2.8.1</AssemblyVersion>
<FileVersion>2.2.7.7</FileVersion> <FileVersion>2.2.8.1</FileVersion>
<LangVersion>7.1</LangVersion> <LangVersion>7.1</LangVersion>
</PropertyGroup> </PropertyGroup>

View File

@ -45,7 +45,6 @@ namespace IW4MAdmin.Application
public string ExternalIPAddress { get; private set; } public string ExternalIPAddress { get; private set; }
public bool IsRestartRequested { get; private set; } public bool IsRestartRequested { get; private set; }
static ApplicationManager Instance; static ApplicationManager Instance;
private readonly List<AsyncStatus> _taskStatuses;
List<Command> Commands; List<Command> Commands;
readonly List<MessageToken> MessageTokens; readonly List<MessageToken> MessageTokens;
ClientService ClientSvc; ClientService ClientSvc;
@ -64,7 +63,6 @@ namespace IW4MAdmin.Application
{ {
_servers = new ConcurrentBag<Server>(); _servers = new ConcurrentBag<Server>();
Commands = new List<Command>(); Commands = new List<Command>();
_taskStatuses = new List<AsyncStatus>();
MessageTokens = new List<MessageToken>(); MessageTokens = new List<MessageToken>();
ClientSvc = new ClientService(); ClientSvc = new ClientService();
AliasSvc = new AliasService(); AliasSvc = new AliasService();

View File

@ -14,9 +14,8 @@ namespace IW4MAdmin.Plugins.Stats.Helpers
{ {
float X = vector.X >= 0 ? vector.X : 360.0f + vector.X; float X = vector.X >= 0 ? vector.X : 360.0f + vector.X;
float Y = vector.Y >= 0 ? vector.Y : 360.0f + vector.Y; float Y = vector.Y >= 0 ? vector.Y : 360.0f + vector.Y;
float Z = vector.Z >= 0 ? vector.Z : 360.0f + vector.Z;
return new Vector3(Y, X, Z); return new Vector3(Y, X, vector.Z);
} }
public static float ToRadians(this float value) => (float)Math.PI * value / 180.0f; public static float ToRadians(this float value) => (float)Math.PI * value / 180.0f;

View File

@ -1,70 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SharedLibraryCore.Helpers;
using SharedLibraryCore.Interfaces;
namespace IW4MAdmin.Plugins.Stats
{
public class MinimapInfo
{
public string MapName { get; set; }
// distance from the edge of the minimap image
// to the "playable" area
public int Top { get; set; }
public int Bottom { get; set; }
public int Left { get; set; }
public int Right { get; set; }
// maximum coordinate values for the map
public int MaxTop { get; set; }
public int MaxBottom { get; set; }
public int MaxLeft { get; set; }
public int MaxRight { get; set; }
public int Width => MaxLeft - MaxRight;
public int Height => MaxTop - MaxBottom;
}
public class MinimapConfig : Serialize<MinimapConfig>
{
public List<MinimapInfo> MapInfo;
public static MinimapConfig IW4Minimaps()
{
return new MinimapConfig()
{
MapInfo = new List<MinimapInfo>()
{
new MinimapInfo()
{
MapName = "mp_terminal",
Top = 85,
Bottom = 89,
Left = 7,
Right = 6,
MaxTop = 2929,
MaxBottom = -513,
MaxLeft = 7520,
MaxRight = 2447
},
new MinimapInfo()
{
MapName = "mp_rust",
Top = 122,
Bottom = 104,
Left = 155,
Right = 82,
MaxRight = -225,
MaxLeft = 1809,
MaxTop = 1641,
MaxBottom = -469
}
}
};
}
}
}

View File

@ -10,7 +10,7 @@ namespace SharedLibraryCore.Configuration
{ {
[LocalizedDisplayName("SETUP_ENABLE_WEBFRONT")] [LocalizedDisplayName("SETUP_ENABLE_WEBFRONT")]
[ConfiguratinLinked("WebfrontBindUrl", "ManualWebfrontUrl")] [ConfigurationLinked("WebfrontBindUrl", "ManualWebfrontUrl")]
public bool EnableWebFront { get; set; } public bool EnableWebFront { get; set; }
[LocalizedDisplayName("WEBFRONT_CONFIGURATION_BIND_URL")] [LocalizedDisplayName("WEBFRONT_CONFIGURATION_BIND_URL")]
public string WebfrontBindUrl { get; set; } public string WebfrontBindUrl { get; set; }
@ -27,14 +27,14 @@ namespace SharedLibraryCore.Configuration
[LocalizedDisplayName("WEBFRONT_CONFIGURATION_IGNORE_BOTS")] [LocalizedDisplayName("WEBFRONT_CONFIGURATION_IGNORE_BOTS")]
public bool IgnoreBots { get; set; } public bool IgnoreBots { get; set; }
[ConfiguratinLinked("CustomSayName")] [ConfigurationLinked("CustomSayName")]
[LocalizedDisplayName("SETUP_ENABLE_CUSTOMSAY")] [LocalizedDisplayName("SETUP_ENABLE_CUSTOMSAY")]
public bool EnableCustomSayName { get; set; } public bool EnableCustomSayName { get; set; }
[LocalizedDisplayName("SETUP_SAY_NAME")] [LocalizedDisplayName("SETUP_SAY_NAME")]
public string CustomSayName { get; set; } public string CustomSayName { get; set; }
[LocalizedDisplayName("SETUP_DISPLAY_SOCIAL")] [LocalizedDisplayName("SETUP_DISPLAY_SOCIAL")]
[ConfiguratinLinked("SocialLinkAddress", "SocialLinkTitle")] [ConfigurationLinked("SocialLinkAddress", "SocialLinkTitle")]
public bool EnableSocialLink { get; set; } public bool EnableSocialLink { get; set; }
[LocalizedDisplayName("SETUP_SOCIAL_LINK")] [LocalizedDisplayName("SETUP_SOCIAL_LINK")]
public string SocialLinkAddress { get; set; } public string SocialLinkAddress { get; set; }
@ -42,19 +42,19 @@ namespace SharedLibraryCore.Configuration
public string SocialLinkTitle { get; set; } public string SocialLinkTitle { get; set; }
[LocalizedDisplayName("SETUP_USE_CUSTOMENCODING")] [LocalizedDisplayName("SETUP_USE_CUSTOMENCODING")]
[ConfiguratinLinked("CustomParserEncoding")] [ConfigurationLinked("CustomParserEncoding")]
public bool EnableCustomParserEncoding { get; set; } public bool EnableCustomParserEncoding { get; set; }
[LocalizedDisplayName("WEBFRONT_CONFIGURATION_ENCODING")] [LocalizedDisplayName("WEBFRONT_CONFIGURATION_ENCODING")]
public string CustomParserEncoding { get; set; } public string CustomParserEncoding { get; set; }
[LocalizedDisplayName("WEBFRONT_CONFIGURATION_ENABLE_WHITELIST")] [LocalizedDisplayName("WEBFRONT_CONFIGURATION_ENABLE_WHITELIST")]
[ConfiguratinLinked("WebfrontConnectionWhitelist")] [ConfigurationLinked("WebfrontConnectionWhitelist")]
public bool EnableWebfrontConnectionWhitelist { get; set; } public bool EnableWebfrontConnectionWhitelist { get; set; }
[LocalizedDisplayName("WEBFRONT_CONFIGURATION_WHITELIST_LIST")] [LocalizedDisplayName("WEBFRONT_CONFIGURATION_WHITELIST_LIST")]
public List<string> WebfrontConnectionWhitelist { get; set; } public List<string> WebfrontConnectionWhitelist { get; set; }
[LocalizedDisplayName("WEBFRONT_CONFIGURATION_CUSTOM_LOCALE")] [LocalizedDisplayName("WEBFRONT_CONFIGURATION_CUSTOM_LOCALE")]
[ConfiguratinLinked("CustomLocale")] [ConfigurationLinked("CustomLocale")]
public bool EnableCustomLocale { get; set; } public bool EnableCustomLocale { get; set; }
[LocalizedDisplayName("WEBFRONT_CONFIGURATION_CUSTOM_LOCALE")] [LocalizedDisplayName("WEBFRONT_CONFIGURATION_CUSTOM_LOCALE")]
public string CustomLocale { get; set; } public string CustomLocale { get; set; }

View File

@ -3,11 +3,11 @@
namespace SharedLibraryCore.Configuration.Attributes namespace SharedLibraryCore.Configuration.Attributes
{ {
[AttributeUsage(AttributeTargets.Property, Inherited = false)] [AttributeUsage(AttributeTargets.Property, Inherited = false)]
public class ConfiguratinLinked : Attribute public class ConfigurationLinked : Attribute
{ {
public string[] LinkedPropertyNames { get; set; } public string[] LinkedPropertyNames { get; set; }
public ConfiguratinLinked(params string[] linkedPropertyNames) public ConfigurationLinked(params string[] linkedPropertyNames)
{ {
LinkedPropertyNames = linkedPropertyNames; LinkedPropertyNames = linkedPropertyNames;
} }

View File

@ -4,7 +4,7 @@ using System.ComponentModel.DataAnnotations.Schema;
namespace SharedLibraryCore.Database.Models namespace SharedLibraryCore.Database.Models
{ {
public partial class EFAlias : SharedEntity public partial class EFAlias
{ {
[Key] [Key]
public int AliasId { get; set; } public int AliasId { get; set; }

View File

@ -1,21 +0,0 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace SharedLibraryCore.Events
{
/// <summary>
/// represents change from one value to another
/// </summary>
class Change
{
/// <summary>
/// represents the previous value of the item
/// </summary>
public string PreviousValue { get; set; }
/// <summary>
/// represents the new/current value of the item
/// </summary>
public string NewValue { get; set; }
}
}

View File

@ -1,62 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace SharedLibraryCore.Helpers
{
public sealed class AsyncStatus
{
DateTime StartTime;
int TimesRun;
int UpdateFrequency;
public double RunAverage { get; private set; }
public object Dependant { get; private set; }
public Task RequestedTask { get; private set; }
public CancellationTokenSource TokenSrc { get; private set; }
public AsyncStatus(object dependant, int frequency)
{
TokenSrc = new CancellationTokenSource();
StartTime = DateTime.Now;
Dependant = dependant;
UpdateFrequency = frequency;
// technically 0 but it's faster than checking for division by 0
TimesRun = 1;
}
public CancellationToken GetToken()
{
return TokenSrc.Token;
}
public double ElapsedMillisecondsTime()
{
return (DateTime.Now - StartTime).TotalMilliseconds;
}
public void Update(Task<bool> T)
{
// reset the token source
TokenSrc.Dispose();
TokenSrc = new CancellationTokenSource();
RequestedTask = T;
// Console.WriteLine($"Starting Task {T.Id} ");
RequestedTask.Start();
if (TimesRun > 25)
TimesRun = 1;
RunAverage = RunAverage + ((DateTime.Now - StartTime).TotalMilliseconds - RunAverage - UpdateFrequency) / TimesRun;
StartTime = DateTime.Now;
}
public void Abort()
{
RequestedTask = null;
}
}
}

View File

@ -1,60 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
namespace SharedLibraryCore.Interfaces
{
interface ISerializable<T>
{
void Write();
}
public class Serialize<T> : ISerializable<T>
{
public static T Read(string filename)
{
try
{
string configText = File.ReadAllText(filename);
return Newtonsoft.Json.JsonConvert.DeserializeObject<T>(configText);
}
catch (Exception e)
{
throw new Exceptions.SerializeException($"Could not deserialize file {filename}: {e.Message}");
}
}
public void Write()
{
try
{
string configText = Newtonsoft.Json.JsonConvert.SerializeObject(this);
File.WriteAllText(Filename(), configText);
}
catch (Exception e)
{
throw new Exceptions.SerializeException($"Could not serialize file {Filename()}: {e.Message}");
}
}
public static void Write(string filename, T data)
{
try
{
string configText = Newtonsoft.Json.JsonConvert.SerializeObject(data, Newtonsoft.Json.Formatting.Indented);
File.WriteAllText(filename, configText);
}
catch (Exception e)
{
throw new Exceptions.SerializeException($"Could not serialize file {filename}: {e.Message}");
}
}
public virtual string Filename() { return ToString(); }
}
}

View File

@ -1,6 +1,6 @@
namespace SharedLibraryCore.Database.Models namespace SharedLibraryCore.Database.Models
{ {
public partial class EFAlias public partial class EFAlias : SharedEntity
{ {
} }

View File

@ -55,7 +55,7 @@ namespace SharedLibraryCore.RCon
/// </summary> /// </summary>
public static readonly int FloodProtectionInterval = 650; public static readonly int FloodProtectionInterval = 650;
/// <summary> /// <summary>
/// how mant failed connection attempts before aborting connection /// how many failed connection attempts before aborting connection
/// </summary> /// </summary>
public static readonly int AllowedConnectionFails = 3; public static readonly int AllowedConnectionFails = 3;
} }

View File

@ -500,7 +500,7 @@ namespace SharedLibraryCore
/// <returns></returns> /// <returns></returns>
public static PenaltyType[] LinkedPenaltyTypes() public static PenaltyType[] LinkedPenaltyTypes()
{ {
return new PenaltyType[] return new[]
{ {
PenaltyType.Ban, PenaltyType.Ban,
PenaltyType.Unban, PenaltyType.Unban,

View File

@ -15,8 +15,8 @@
string[] getLinkedPropertyName(System.Reflection.PropertyInfo info) string[] getLinkedPropertyName(System.Reflection.PropertyInfo info)
{ {
var test = (info.GetCustomAttributes(false) var test = (info.GetCustomAttributes(false)
.Where(_attr => _attr.GetType() == typeof(ConfiguratinLinked)) .Where(_attr => _attr.GetType() == typeof(ConfigurationLinked))
.FirstOrDefault() as ConfiguratinLinked); .FirstOrDefault() as ConfigurationLinked);
return test?.LinkedPropertyNames ?? new string[0]; return test?.LinkedPropertyNames ?? new string[0];
} }

View File

@ -6,8 +6,8 @@ init()
{ {
SetDvarIfUninitialized("sv_customcallbacks", true); SetDvarIfUninitialized("sv_customcallbacks", true);
SetDvarIfUninitialized("sv_framewaittime", 0.05); SetDvarIfUninitialized("sv_framewaittime", 0.05);
SetDvarIfUninitialized("sv_additionalwaittime", 0.05); SetDvarIfUninitialized("sv_additionalwaittime", 0.1);
SetDvarIfUninitialized("sv_maxstoredframes", 3); SetDvarIfUninitialized("sv_maxstoredframes", 4);
level thread onPlayerConnect(); level thread onPlayerConnect();