Sql syntax fix and onelog fix

This commit is contained in:
RaidMax 2015-10-10 18:31:24 -05:00
parent ea1ffeeb4a
commit 04899040fe
9 changed files with 76 additions and 34 deletions

View File

@ -10,6 +10,7 @@ namespace IW4MAdmin
{
public static List<Command> potentialCommands = new List<Command>();
public static List<Plugin> potentialPlugins = new List<Plugin>();
public static Plugin webFront = null;
public static bool Load()
{
@ -50,23 +51,26 @@ namespace IW4MAdmin
{
Object notifyObject = Activator.CreateInstance(assemblyType);
Plugin newNotify = (Plugin)notifyObject;
potentialPlugins.Add(newNotify);
try
if (potentialPlugins.Find(x => x.Name == newNotify.Name) == null)
{
newNotify.onLoad();
}
potentialPlugins.Add(newNotify);
catch (Exception E)
{
Program.getManager().mainLog.Write("There was an error starting \"" + newNotify.Name + "\" plugin", Log.Level.Debug);
Program.getManager().mainLog.Write("Error Message: " + E.Message, Log.Level.Debug);
Program.getManager().mainLog.Write("Error Trace: " + E.StackTrace, Log.Level.Debug);
continue;
try
{
newNotify.onLoad();
}
catch (Exception E)
{
Program.getManager().mainLog.Write("There was an error starting \"" + newNotify.Name + "\" plugin", Log.Level.Debug);
Program.getManager().mainLog.Write("Error Message: " + E.Message, Log.Level.Debug);
Program.getManager().mainLog.Write("Error Trace: " + E.StackTrace, Log.Level.Debug);
continue;
}
Program.getManager().mainLog.Write("Loaded plugin \"" + newNotify.Name + "\"" + " [" + newNotify.Version + "]", Log.Level.Debug);
totalLoaded++;
}
Program.getManager().mainLog.Write("Loaded plugin \"" + newNotify.Name + "\"" + " [" + newNotify.Version + "]", Log.Level.Debug);
totalLoaded++;
}
else if (assemblyType.IsClass && assemblyType.BaseType.Name == "Command")
@ -91,7 +95,10 @@ namespace IW4MAdmin
{
try
{
P.onUnload();
if (P.Name != "Webfront")
P.onUnload();
else
webFront = P;
}
catch (Exception E)
@ -105,6 +112,8 @@ namespace IW4MAdmin
potentialCommands = new List<Command>();
potentialPlugins = new List<Plugin>();
if (webFront != null)
potentialPlugins.Add(webFront);
}
}

View File

@ -574,7 +574,9 @@ namespace IW4MAdmin
override public bool intializeBasics()
{
#if DEBUG == false
try
#endif
{
// clear out any lingering instances
Utilities.shutdownInterface(PID);
@ -587,8 +589,12 @@ namespace IW4MAdmin
}
// basic info dvars
hostname = SharedLibrary.Utilities.stripColors(getDvar("sv_hostname").current);
mapname = getDvar("mapname").current;
do
{
hostname = SharedLibrary.Utilities.stripColors(getDvar("sv_hostname").current);
mapname = getDvar("mapname").current;
} while (hostname == "0" || mapname == "0");
Map localizedMapName = maps.Find(x => x.Name.Equals(mapname));
if (localizedMapName != null)
@ -608,11 +614,25 @@ namespace IW4MAdmin
Gametype = getDvar("g_gametype").current;
// important log variables
Basepath = getDvar("fs_basepath").current;
Mod = getDvar("fs_game").current;
logPath = getDvar("g_log").current;
do
{
Basepath = getDvar("fs_basepath").current;
Mod = getDvar("fs_game").current;
logPath = getDvar("g_log").current;
} while (Basepath == "0" || Mod == "0" || logPath == "0");
int oneLog = -1;
Int32.TryParse(getDvar("iw4m_onelog").current, out oneLog);
logPath = logPath.Replace("/", "\\");
Mod = Mod.Replace("/", "\\");
int count = 0;
while(count < 15)
{
Int32.TryParse(getDvar("iw4m_onelog").current, out oneLog);
if (oneLog == 1)
break;
count++;
}
if (oneLog == -1)
{
@ -626,7 +646,7 @@ namespace IW4MAdmin
if (Website == "0" || Website == null)
Website = "this server's website";
int logSync = -1;
Int32.TryParse(getDvar("g_logSync").current, out oneLog);
@ -657,12 +677,13 @@ namespace IW4MAdmin
Bans = clientDB.getBans();
return true;
}
#if DEBUG == false
catch (Exception E)
{
Log.Write("Error during initialization - " + E.Message + "--" + E.StackTrace, Log.Level.All);
return false;
}
#endif
}
//Process any server event

View File

@ -27,5 +27,6 @@ mp_fuel2:Fuel
mp_storm:Storm
mp_complex:Bailout
mp_compact:Salvage
mp_nuked:Nuketown
iw4_credits:IW4 Credits
mp_raidmax:^1L^23^33^4T^5M^6A^75^8T^93^0R

Binary file not shown.

Binary file not shown.

View File

@ -1,4 +1,10 @@
VERSION 0.9.5
VERSION 0.9.6
CHANGELOG:
-fixed issue with log path sometimes not reading properly
-webfront no long crashes on reload
-
VERSION 0.9.5
-Major refactoring to support plugins
-*web front redux*
-lots of little fixes and stability improvements

View File

@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.40629.0
VisualStudioVersion = 12.0.30723.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IW4M ADMIN", "Admin\IW4M ADMIN.csproj", "{DD5DCDA2-51DB-4B1A-922F-5705546E6115}"
ProjectSection(ProjectDependencies) = postProject
@ -30,16 +30,16 @@ Global
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{DD5DCDA2-51DB-4B1A-922F-5705546E6115}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DD5DCDA2-51DB-4B1A-922F-5705546E6115}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DD5DCDA2-51DB-4B1A-922F-5705546E6115}.Release|Any CPU.ActiveCfg = Debug|Any CPU
{DD5DCDA2-51DB-4B1A-922F-5705546E6115}.Release|Any CPU.Build.0 = Debug|Any CPU
{DD5DCDA2-51DB-4B1A-922F-5705546E6115}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DD5DCDA2-51DB-4B1A-922F-5705546E6115}.Release|Any CPU.Build.0 = Release|Any CPU
{99E36EBD-1FA1-494C-8A66-BECE64EFF378}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{99E36EBD-1FA1-494C-8A66-BECE64EFF378}.Debug|Any CPU.Build.0 = Debug|Any CPU
{99E36EBD-1FA1-494C-8A66-BECE64EFF378}.Release|Any CPU.ActiveCfg = Debug|Any CPU
{99E36EBD-1FA1-494C-8A66-BECE64EFF378}.Release|Any CPU.Build.0 = Debug|Any CPU
{99E36EBD-1FA1-494C-8A66-BECE64EFF378}.Release|Any CPU.ActiveCfg = Release|Any CPU
{99E36EBD-1FA1-494C-8A66-BECE64EFF378}.Release|Any CPU.Build.0 = Release|Any CPU
{4785AB75-66F3-4391-985D-63A5A049A0FA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4785AB75-66F3-4391-985D-63A5A049A0FA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4785AB75-66F3-4391-985D-63A5A049A0FA}.Release|Any CPU.ActiveCfg = Debug|Any CPU
{4785AB75-66F3-4391-985D-63A5A049A0FA}.Release|Any CPU.Build.0 = Debug|Any CPU
{4785AB75-66F3-4391-985D-63A5A049A0FA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4785AB75-66F3-4391-985D-63A5A049A0FA}.Release|Any CPU.Build.0 = Release|Any CPU
{D51EECEB-438A-47DA-870F-7D7B41BC24D6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D51EECEB-438A-47DA-870F-7D7B41BC24D6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D51EECEB-438A-47DA-870F-7D7B41BC24D6}.Release|Any CPU.ActiveCfg = Release|Any CPU

View File

@ -292,6 +292,7 @@ namespace SharedLibrary
//Returns a list of players matching name parameter, null if no players found matching
public List<Player> findPlayers(String name)
{
name = name.Replace("'", "''");
String Query = String.Format("SELECT * FROM CLIENTS WHERE Name LIKE '%{0}%' LIMIT 32", name);
DataTable Result = GetDataTable(Query);

View File

@ -1,4 +1,5 @@
using System;
#define REPZ_BUILD
using System;
using System.Threading;
using System.Text;
using System.Text.RegularExpressions;
@ -45,8 +46,11 @@ namespace SharedLibrary
public static Player.Permission matchPermission(String str)
{
String lookingFor = str.ToLower();
#if REPZ_BUILD
for (Player.Permission Perm = Player.Permission.User; Perm <= Player.Permission.Owner; Perm++)
#else
for (Player.Permission Perm = Player.Permission.User; Perm < Player.Permission.Owner; Perm++)
#endif
{
if (lookingFor.Contains(Perm.ToString().ToLower()))
return Perm;
@ -58,7 +62,7 @@ namespace SharedLibrary
public static String removeNastyChars(String str)
{
if (str != null)
return str.Replace("`", "").Replace("\\", "").Replace("\"", "").Replace("&quot;", "''").Replace("&amp;", "&").Replace("\"", "''");
return str.Replace("`", "").Replace("\\", "").Replace("\"", "").Replace("&quot;", "").Replace("&amp;", "&").Replace("\"", "''").Replace("'", "");
else
return String.Empty;
}