- Timestamp:
- Jul 24, 2014, 3:25:58 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
binary-improvements/7dtd-server-fixes/src/TelnetCommands/GetGamePrefs.cs
r91 r103 45 45 public override void Run (string[] _params) 46 46 { 47 EnumGamePrefs enumGamePrefs = EnumGamePrefs.Last; 47 try { 48 EnumGamePrefs enumGamePrefs = EnumGamePrefs.Last; 48 49 49 if (_params.Length > 0) { 50 try { 51 enumGamePrefs = (EnumGamePrefs)((int)Enum.Parse (typeof(EnumGamePrefs), _params [0])); 52 } catch (Exception) { 50 if (_params.Length > 0) { 51 try { 52 enumGamePrefs = (EnumGamePrefs)((int)Enum.Parse (typeof(EnumGamePrefs), _params [0])); 53 } catch (Exception) { 54 } 53 55 } 54 }55 56 56 if (enumGamePrefs == EnumGamePrefs.Last) { 57 SortedList<string, string> sortedList = new SortedList<string, string> (); 58 foreach (EnumGamePrefs gp in Enum.GetValues(typeof(EnumGamePrefs))) { 59 if ((_params.Length == 0) || (gp.ToString ().ToLower ().Contains (_params [0].ToLower ()))) { 60 if (prefAccessAllowed (gp)) { 61 sortedList.Add (gp.ToString (), string.Format ("{0} = {1}", gp.ToString (), GamePrefs.GetObject (gp))); 57 if (enumGamePrefs == EnumGamePrefs.Last) { 58 SortedList<string, string> sortedList = new SortedList<string, string> (); 59 foreach (EnumGamePrefs gp in Enum.GetValues(typeof(EnumGamePrefs))) { 60 if ((_params.Length == 0) || (gp.ToString ().ToLower ().Contains (_params [0].ToLower ()))) { 61 if (prefAccessAllowed (gp)) { 62 sortedList.Add (gp.ToString (), string.Format ("{0} = {1}", gp.ToString (), GamePrefs.GetObject (gp))); 63 } 62 64 } 63 65 } 66 foreach (string s in sortedList.Keys) { 67 m_Console.md000a (sortedList [s]); 68 } 69 } else { 70 if (prefAccessAllowed (enumGamePrefs)) 71 m_Console.md000a (string.Format ("{0} = {1}", enumGamePrefs, GamePrefs.GetObject (enumGamePrefs))); 72 else 73 m_Console.md000a ("Access to requested preference is forbidden"); 64 74 } 65 foreach (string s in sortedList.Keys) { 66 m_Console.md000a (sortedList [s]); 67 } 68 } else { 69 if (prefAccessAllowed (enumGamePrefs)) 70 m_Console.md000a (string.Format ("{0} = {1}", enumGamePrefs, GamePrefs.GetObject (enumGamePrefs))); 71 else 72 m_Console.md000a ("Access to requested preference is forbidden"); 75 } catch (Exception e) { 76 Log.Out ("Error in GetGamePrefs.Run: " + e); 73 77 } 74 78 }
Note:
See TracChangeset
for help on using the changeset viewer.