public static RustInterceptor getInstance(string server = "127.0.0.1", int port = 28015, int listenPort = 5678)
 {
     if (instance == null)
     {
         instance = new RustInterceptor(server, port, listenPort);
     }
     else
     {
         instance.serverIP   = server;
         instance.serverPort = port;
         instance.listenPort = listenPort;
     }
     return(instance);
 }
Exemple #2
0
        public SimpleInterceptor()
        {
            Console.Write("Server IP: ");
            string ip   = Console.ReadLine();
            int    port = -1;

            while (port == -1)
            {
                Console.Write("Server Port: ");
                try {
                    port = int.Parse(Console.ReadLine().Trim());
                } catch (Exception) {
                    Console.WriteLine("Try again...");
                }
            }
            Interceptor = RustInterceptor.getInstance(ip, port);
            Interceptor.AddPacketsToFilter(Packet.Rust.Entities, Packet.Rust.EntityDestroy, Packet.Rust.EntityPosition);
            Interceptor.commandCallback       = OnCommand;
            Interceptor.packetHandlerCallback = internalOnPacket;
        }