Changeset 132 for binary-improvements/7dtd-server-fixes/src/NetConnections/ConsoleOutputSeparator.cs
- Timestamp:
- Aug 26, 2014, 7:29:11 PM (10 years ago)
- Location:
- binary-improvements/7dtd-server-fixes/src/NetConnections
- Files:
-
- 1 added
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
binary-improvements/7dtd-server-fixes/src/NetConnections/ConsoleOutputSeparator.cs
r130 r132 4 4 using UnityEngine; 5 5 6 namespace AllocsFixes 6 namespace AllocsFixes.NetConnections 7 7 { 8 8 public class ConsoleOutputSeparator 9 9 { 10 public struct AllocsTelnetCommand10 public struct NetCommand 11 11 { 12 12 public string command; 13 public AllocsTelnetConnection client;13 public IConnection client; 14 14 15 public AllocsTelnetCommand (string _cmd, AllocsTelnetConnection _client)15 public NetCommand (string _cmd, IConnection _client) 16 16 { 17 17 command = _cmd; … … 20 20 } 21 21 22 private static List< AllocsTelnetCommand> telnetCommandQueue = new List<AllocsTelnetCommand> ();22 private static List<NetCommand> netCommandQueue = new List<NetCommand> (); 23 23 private static bool isCurrentCommandFromClient = false; 24 private static AllocsTelnetConnection issuerOfCurrentTelnetCommand;24 private static IConnection issuerOfCurrentCommand; 25 25 26 26 public static void C_ExecuteCmdFromClient (ConsoleSdtd console, NetworkPlayer _networkPlayer, string _playerID, string _command) … … 28 28 Log.Out ("Executed command \"" + _command + "\" from player \"" + _playerID + "\""); 29 29 30 object obj = telnetCommandQueue;30 object obj = netCommandQueue; 31 31 Monitor.Enter (obj); 32 32 try { … … 51 51 ); 52 52 } else { 53 if (console.telnetServer != null && issuerOfCurrent TelnetCommand != null)54 AllocsNetTelnetServer.WriteToClient_Single (_line, issuerOfCurrentTelnetCommand);53 if (console.telnetServer != null && issuerOfCurrentCommand != null) 54 NetTelnetServer.WriteToClient_Single (_line, issuerOfCurrentCommand); 55 55 else if (ControlPanel.IsStarted ()) 56 56 ControlPanel.AddTextToOutputBuffer (_line); … … 60 60 public static void C_Run (ConsoleSdtd console) 61 61 { 62 if ( telnetCommandQueue.Count > 0) {63 object obj = telnetCommandQueue;62 if (netCommandQueue.Count > 0) { 63 object obj = netCommandQueue; 64 64 Monitor.Enter (obj); 65 65 try { 66 issuerOfCurrent TelnetCommand = telnetCommandQueue [0].client;67 console.ExecuteRemoteCmdInternal ( telnetCommandQueue [0].command, false);68 telnetCommandQueue.RemoveAt (0);69 issuerOfCurrent TelnetCommand = null;66 issuerOfCurrentCommand = netCommandQueue [0].client; 67 console.ExecuteRemoteCmdInternal (netCommandQueue [0].command, false); 68 netCommandQueue.RemoveAt (0); 69 issuerOfCurrentCommand = null; 70 70 } finally { 71 71 Monitor.Exit (obj); … … 74 74 } 75 75 76 public static void Queue TelnetCommand (string _line, AllocsTelnetConnection _con)76 public static void QueueNetCommand (string _line, IConnection _con) 77 77 { 78 object obj = telnetCommandQueue;78 object obj = netCommandQueue; 79 79 Monitor.Enter (obj); 80 80 try { 81 telnetCommandQueue.Add (new AllocsTelnetCommand (_line, _con));81 netCommandQueue.Add (new NetCommand (_line, _con)); 82 82 } finally { 83 83 Monitor.Exit (obj);
Note:
See TracChangeset
for help on using the changeset viewer.