Exemple #1
0
        public static void GenerateSettings()
        {
            if (!File.Exists("UlteriusServer.ini"))
            {
                var settings = new Settings();

                settings.Write("WebServer", "UseWebServer", false);
                settings.Write("WebServer", "WebServerPort", 9999);
                settings.Write("WebServer", "WebFilePath", "");
                settings.Write("TaskServer", "TaskServerPort", 8387);
                settings.Write("Network", "SkipHostNameResolve", false);
            }
        }
 public static void Start()
 {
     AllClients = new ConcurrentDictionary<string, AuthClient>();
     ApiControllers = new ConcurrentDictionary<string, ApiController>();
     var settings = new Settings();
     var port = settings.Read("TaskServer", "TaskServerPort", 8387);
     var cancellation = new CancellationTokenSource();
     var endpoint = new IPEndPoint(IPAddress.Parse(/*NetworkUtilities.GetIPv4Address()*/ "0.0.0.0"), port);
     var server = new WebSocketEventListener(endpoint);
     server.OnConnect += HandleConnect;
     server.OnDisconnect += HandleDisconnect;
     server.OnMessage += HandleMessage;
     server.OnError += HandleError;
     server.Start();
     Log("Task TServer started at " + endpoint);
 }
 public void StartVncServer()
 {
     try
     {
         var settings = new Settings();
         var vncProxyPort = settings.Read("Vnc", "VncProxyPort", 5901);
         var vncPort = settings.Read("Vnc", "VncPort", 5900);
         var vncPass = settings.Read("Vnc", "VncPass", "");
         vncServer = new VncServer(vncPass, vncProxyPort, vncPort, "Ulterius VNC");
         Task.Run(() => { vncServer.Start(); });
         var endData = new
         {
             vncStarted = true,
             proxyPort = vncProxyPort,
             port = vncPort,
             message = "VNC Server Started"
         };
         serializator.Serialize(_client, packet.endpoint, packet.syncKey, endData);
     }
     catch (ArgumentNullException)
     {
         vncServer?.Stop();
     }
 }
 public static void Setup()
 {
     var settings = new Settings();
     var useWebServer = settings.Read("WebServer", "UseWebServer", false);
     if (useWebServer)
     {
         var root = settings.Read("WebServer", "WebFilePath", "");
         var port = settings.Read("WebServer", "WebServerPort", 9999);
         var httpServer = new HttpServer(root, port);
         Console.WriteLine(Resources.Program_Main_Web_Server_is_running_on_this_port__ + httpServer.Port);
     }
 }