Ejemplo n.º 1
0
        static void TestCommandServer(TransportInterface ti, ushort port)
        {
            ConsoleServer consoleServer = new ConsoleServer();
            RakNetCommandParser rcp = new RakNetCommandParser();
            LogCommandParser lcp = new LogCommandParser();
            uint lastlog = 0;
            RakPeerInterface rakPeer = RakNetworkFactory.GetRakPeerInterface();
            IntPtr testChannel = System.Runtime.InteropServices.Marshal.StringToHGlobalAnsi("TestChannel");  // you must call FreeHGlobal

            Console.Write("This sample demonstrates the command console server, which can be.\n");
            Console.Write("a standalone application or part of your game server.  It allows you to\n");
            Console.Write("easily parse text strings sent from a client using either secure RakNet\n");
            Console.Write("or Telnet.\n");
            Console.Write("See the 'CommandConsoleClient' project for the RakNet client.\n");
            Console.Write("Difficulty: Intermediate\n\n");

            Console.Write("Command server started on port {0}.\n", port);
            consoleServer.AddCommandParser(rcp);
            consoleServer.AddCommandParser(lcp);
            consoleServer.SetTransportProvider(ti, port);
            rcp.SetRakPeerInterface(rakPeer);
            lcp.AddChannel(testChannel);
            while (true)
            {
                consoleServer.Update();

                if (RakNetBindings.GetTime() > lastlog + 4000)
                {
                    lcp.WriteLog(testChannel, "Test of logger");
                    lastlog = RakNetBindings.GetTime();
                }

                System.Threading.Thread.Sleep(30);
            }
        }
Ejemplo n.º 2
0
 public override void SendHelp(TransportInterface transport, SystemAddress systemAddress)
 {
     RakNetPINVOKE.LogCommandParser_SendHelp(swigCPtr, TransportInterface.getCPtr(transport), SystemAddress.getCPtr(systemAddress));
     if (RakNetPINVOKE.SWIGPendingException.Pending)
     {
         throw RakNetPINVOKE.SWIGPendingException.Retrieve();
     }
 }
Ejemplo n.º 3
0
 public override void OnConnectionLost(SystemAddress systemAddress, TransportInterface transport)
 {
     RakNetPINVOKE.LogCommandParser_OnConnectionLost(swigCPtr, SystemAddress.getCPtr(systemAddress), TransportInterface.getCPtr(transport));
     if (RakNetPINVOKE.SWIGPendingException.Pending)
     {
         throw RakNetPINVOKE.SWIGPendingException.Retrieve();
     }
 }
 public virtual void SendCommandList(TransportInterface transport, SystemAddress systemAddress)
 {
     RakNetPINVOKE.CommandParserInterface_SendCommandList(swigCPtr, TransportInterface.getCPtr(transport), SystemAddress.getCPtr(systemAddress));
     if (RakNetPINVOKE.SWIGPendingException.Pending)
     {
         throw RakNetPINVOKE.SWIGPendingException.Retrieve();
     }
 }
 public virtual void OnNewIncomingConnection(SystemAddress systemAddress, TransportInterface transport)
 {
     RakNetPINVOKE.CommandParserInterface_OnNewIncomingConnection(swigCPtr, SystemAddress.getCPtr(systemAddress), TransportInterface.getCPtr(transport));
     if (RakNetPINVOKE.SWIGPendingException.Pending)
     {
         throw RakNetPINVOKE.SWIGPendingException.Retrieve();
     }
 }
 public virtual void ReturnResult(string command, TransportInterface transport, SystemAddress systemAddress)
 {
     RakNetPINVOKE.CommandParserInterface_ReturnResult__SWIG_4(swigCPtr, command, TransportInterface.getCPtr(transport), SystemAddress.getCPtr(systemAddress));
     if (RakNetPINVOKE.SWIGPendingException.Pending)
     {
         throw RakNetPINVOKE.SWIGPendingException.Retrieve();
     }
 }
Ejemplo n.º 7
0
        public override bool OnCommand(string command, uint numParameters, string[] parameterList, TransportInterface transport, SystemAddress systemAddress, string originalString)
        {
            bool ret = RakNetPINVOKE.LogCommandParser_OnCommand(swigCPtr, command, numParameters, parameterList, TransportInterface.getCPtr(transport), SystemAddress.getCPtr(systemAddress), originalString);

            if (RakNetPINVOKE.SWIGPendingException.Pending)
            {
                throw RakNetPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Ejemplo n.º 8
0
 public override void OnTransportChange(TransportInterface transport)
 {
     RakNetPINVOKE.LogCommandParser_OnTransportChange(swigCPtr, TransportInterface.getCPtr(transport));
 }
Ejemplo n.º 9
0
 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(TransportInterface obj)
 {
     return((obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr);
 }
 public virtual void OnTransportChange(TransportInterface transport)
 {
     RakNetPINVOKE.CommandParserInterface_OnTransportChange(swigCPtr, TransportInterface.getCPtr(transport));
 }