static void Main(string[] args)
        {
            //Decode config file
            config = JsonConvert.DeserializeObject <ConfigFile>(File.ReadAllText(args[0]));

            //Create Delta connection
            connection = new DeltaConnection(config.delta_config_path, config.server_id, 0, 1, new ManagerCoreNet());
            connection.Connect().GetAwaiter().GetResult();

            //Fetch server list
            server_instances = connection.system_delta_servers.Find(Builders <DbSystemServer> .Filter.Eq("enviornment", connection.config.env)).ToList();

            //Create all server types
            server_types = new Dictionary <CoreNetworkServerType, ManagerServer>();
            foreach (var s in config.servers)
            {
                server_types.Add(s.type, new ManagerServer(s));
            }

            //Start all
            foreach (var t in server_types)
            {
                t.Value.StartAll();
            }

            Console.WriteLine("Ready.");
            Task.Delay(-1).GetAwaiter().GetResult();
        }
Ejemplo n.º 2
0
        public static async Task MainAsync()
        {
            //Connect to database
            conn = new DeltaConnection(config.database_config, "rpc-prod", 1, 0);
            await conn.Connect(false);

            master_key = Convert.FromBase64String(conn.config.rpc_key);

            //Start server
            DeltaWebServer server = new DeltaWebServer(conn, config.port);

            server.AddService(new SenderDefinition());
            server.AddService(new RPCSessionDefinition());
            await server.RunAsync();
        }
Ejemplo n.º 3
0
        static void Main(string[] args)
        {
            Console.WriteLine("Loading config...");
            config = JsonConvert.DeserializeObject <MasterServerConfig>(File.ReadAllText(args[0]));

            Console.WriteLine("Connecting to MongoDB...");
            connection = new DeltaConnection(config.database_config_path, "master", 0, 0);
            connection.Connect().GetAwaiter().GetResult();

            Console.WriteLine("Starting some other timers...");
            Tools.TokenFileDownloadTool.Init();

            Console.WriteLine("Starting Kestrel...");
            MainAsync().GetAwaiter().GetResult();
        }
Ejemplo n.º 4
0
        public static async Task MainAsync()
        {
            //Connect to database
            conn = new DeltaConnection(config.database_config, "canvas", 0, 0);
            await conn.Connect();

            //Set up web server
            var host = new WebHostBuilder()
                       .UseKestrel(options =>
            {
                IPAddress addr = IPAddress.Any;
                options.Listen(addr, config.port);
            })
                       .UseStartup <Program>()
                       .Build();

            await host.RunAsync();
        }
Ejemplo n.º 5
0
        public static async Task MainAsync(string[] args)
        {
            //Get config
            config = Newtonsoft.Json.JsonConvert.DeserializeObject <ServiceConfig>(File.ReadAllText(args[0]));

            //Create adapters
            applications = new Dictionary <string, BaseAdapter>();
            foreach (var a in config.applications)
            {
                //Determine type
                BaseAdapter adapter;
                switch (a.type)
                {
                case "IMAGE":
                    adapter = new FileAdapters.IMAGE.ImageAdapter();
                    break;

                default:
                    throw new Exception($"Cannot start because there is an invalid application. {a.name} ({a.id}) has an invalid type {a.type}!");
                }

                //Set up
                adapter.SetConfig(a);

                //Add to applications list
                applications.Add(a.id, adapter);
            }

            //Connect to database
            conn = new DeltaConnection(config.database_config, "user-content NODE " + config.node_name, 0, 0);
            await conn.Connect();

            //Set up web server
            var host = new WebHostBuilder()
                       .UseKestrel(options =>
            {
                IPAddress addr = IPAddress.Any;
                options.Listen(addr, config.port);
            })
                       .UseStartup <Program>()
                       .Build();

            await host.RunAsync();
        }
Ejemplo n.º 6
0
        public static async Task MainAsync()
        {
            //Connect to database
            conn = new DeltaConnection(config.database_config, "dynamic-tiles-streamable", 0, 0);
            await conn.Connect();

            //Set up builder servers
            builders = new BuilderNetworking(conn, new byte[32], config.builder_port);
            builders.StartServer();

            //Set up web server
            var host = new WebHostBuilder()
                       .UseKestrel(options =>
            {
                IPAddress addr = IPAddress.Any;
                options.Listen(addr, config.port);
            })
                       .UseStartup <Program>()
                       .Build();

            await host.RunAsync();
        }