diff --git a/Admin/Plugins.cs b/Admin/Plugins.cs index 03c6a8eb9..b255ec9f5 100644 --- a/Admin/Plugins.cs +++ b/Admin/Plugins.cs @@ -10,6 +10,7 @@ namespace IW4MAdmin { public static List potentialCommands = new List(); public static List potentialPlugins = new List(); + 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(); potentialPlugins = new List(); + if (webFront != null) + potentialPlugins.Add(webFront); } } diff --git a/Admin/Server.cs b/Admin/Server.cs index 73e7385b9..782f29150 100644 --- a/Admin/Server.cs +++ b/Admin/Server.cs @@ -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 diff --git a/Admin/config/maps.cfg b/Admin/config/maps.cfg index e58d9666d..194a917ad 100644 --- a/Admin/config/maps.cfg +++ b/Admin/config/maps.cfg @@ -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 \ No newline at end of file diff --git a/Admin/plugins/SimpleStatsPlugin.dll b/Admin/plugins/SimpleStatsPlugin.dll index 1b7646a48..b37634519 100644 Binary files a/Admin/plugins/SimpleStatsPlugin.dll and b/Admin/plugins/SimpleStatsPlugin.dll differ diff --git a/Admin/plugins/WebfrontPlugin.dll b/Admin/plugins/WebfrontPlugin.dll index 6d31dbe70..8b9a4ec5f 100644 Binary files a/Admin/plugins/WebfrontPlugin.dll and b/Admin/plugins/WebfrontPlugin.dll differ diff --git a/Admin/version.txt b/Admin/version.txt index 11c36203d..1087ec930 100644 --- a/Admin/version.txt +++ b/Admin/version.txt @@ -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 diff --git a/IW4M Admin.sln b/IW4M Admin.sln index 0fb903947..0ae1ef359 100644 --- a/IW4M Admin.sln +++ b/IW4M Admin.sln @@ -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 diff --git a/SharedLibrary/Database.cs b/SharedLibrary/Database.cs index 44a9a6217..16781a42f 100644 --- a/SharedLibrary/Database.cs +++ b/SharedLibrary/Database.cs @@ -292,6 +292,7 @@ namespace SharedLibrary //Returns a list of players matching name parameter, null if no players found matching public List findPlayers(String name) { + name = name.Replace("'", "''"); String Query = String.Format("SELECT * FROM CLIENTS WHERE Name LIKE '%{0}%' LIMIT 32", name); DataTable Result = GetDataTable(Query); diff --git a/SharedLibrary/Utilities.cs b/SharedLibrary/Utilities.cs index bff5200fa..d00bdd387 100644 --- a/SharedLibrary/Utilities.cs +++ b/SharedLibrary/Utilities.cs @@ -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(""", "''").Replace("&", "&").Replace("\"", "''"); + return str.Replace("`", "").Replace("\\", "").Replace("\"", "").Replace(""", "").Replace("&", "&").Replace("\"", "''").Replace("'", ""); else return String.Empty; }