예제 #1
0
 private void ServerThread()
 {
     try
     {
         fatimaServer?.Close();
         fatimaServer = new HTTPFAtiMAServer()
         {
             IatFilePath = iat._currentScenarioFilePath, AssetFilePath = iat.textBoxPathAssetStorage.Text, Port = int.Parse(this.textBoxPort.Text)
         };
         fatimaServer.OnServerEvent += ServerNotificationHandler;
         fatimaServer.Run();
     }
     catch (Exception ex)
     {
         this.Invoke(this.updateUIDelegate, new string[] { "Error while loading the assets!", UIELEMENT_SERVERSTATUS, "Red" });
         fatimaServer?.Close();
         return;
     }
 }
예제 #2
0
        static void Main(string[] args)
        {
            HTTPFAtiMAServer server = null;

            try
            {
                if (args.Length == 1)
                {
                    string httpPort = args[0];
                    server = new HTTPFAtiMAServer()
                    {
                        Port = int.Parse(httpPort)
                    };
                }
                else if (args.Length == 2)
                {
                    string httpPort  = args[0];
                    string httpsPort = args[1];
                    server = new HTTPFAtiMAServer()
                    {
                        Port = int.Parse(httpPort), HTTPSPort = int.Parse(httpsPort)
                    };
                }
                else
                {
                    server = new HTTPFAtiMAServer();
                }

                server.OnServerEvent += ServerNotificationHandler;
                foreach (var r in APIResource.Set)
                {
                    Console.WriteLine(r.URLFormat + " | [" + string.Join(",", r.ValidOperations) + "]");
                }
                server.Run();
            }catch (Exception ex)
            {
                Console.WriteLine(ex);
                server?.Close();
            }
        }