mirror of
https://github.com/RaidMax/IW4M-Admin.git
synced 2025-06-10 15:20:48 -05:00
Enable/Disable fast restart plugin via config
Deleted legacy connection & heartbeat classes Hopefully fixed issues relating to certain web requests throwing recoverable error Modified Serializer class slightly
This commit is contained in:
13
SharedLibrary/Exceptions/SerializationException.cs
Normal file
13
SharedLibrary/Exceptions/SerializationException.cs
Normal file
@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SharedLibrary.Exceptions
|
||||
{
|
||||
public class SerializeException : Exception
|
||||
{
|
||||
public SerializeException(string msg) : base(msg) { }
|
||||
}
|
||||
}
|
@ -11,11 +11,6 @@ namespace SharedLibrary.Interfaces
|
||||
void Write();
|
||||
}
|
||||
|
||||
public class SerializeException : Exception
|
||||
{
|
||||
public SerializeException(string msg) : base(msg) { }
|
||||
}
|
||||
|
||||
public class Serialize<T> : ISerializable<T>
|
||||
{
|
||||
public static T Read(string filename)
|
||||
@ -28,7 +23,7 @@ namespace SharedLibrary.Interfaces
|
||||
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new SerializeException($"Could not desialize file {filename}: {e.Message}");
|
||||
throw new Exceptions.SerializeException($"Could not desialize file {filename}: {e.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
@ -42,10 +37,24 @@ namespace SharedLibrary.Interfaces
|
||||
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new SerializeException($"Could not serialize file {Filename()}: {e.Message}");
|
||||
throw new Exceptions.SerializeException($"Could not serialize file {Filename()}: {e.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
public virtual string Filename() { return this.ToString(); }
|
||||
public static void Write(string filename, T data)
|
||||
{
|
||||
try
|
||||
{
|
||||
string configText = Newtonsoft.Json.JsonConvert.SerializeObject(data);
|
||||
File.WriteAllText(filename, configText);
|
||||
}
|
||||
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new Exceptions.SerializeException($"Could not serialize file {filename}: {e.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
public virtual string Filename() { return ToString(); }
|
||||
}
|
||||
}
|
||||
|
@ -421,6 +421,11 @@ namespace SharedLibrary
|
||||
ruleFile.Close();
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"{IP}_{Port}";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Load up the built in commands
|
||||
/// </summary>
|
||||
|
@ -71,6 +71,7 @@
|
||||
<Compile Include="Exceptions\CommandException.cs" />
|
||||
<Compile Include="Exceptions\DvarException.cs" />
|
||||
<Compile Include="Exceptions\NetworkException.cs" />
|
||||
<Compile Include="Exceptions\SerializationException.cs" />
|
||||
<Compile Include="Exceptions\ServerException.cs" />
|
||||
<Compile Include="Interfaces\ILogger.cs" />
|
||||
<Compile Include="Interfaces\IManager.cs" />
|
||||
|
Reference in New Issue
Block a user