コード例 #1
0
        private static bool ConfigureServices()
        {
            try
            {
                PyEngine.Initialize();
            }
            catch
            {
                Log.Error("Unable to connect to python driver.");
                Log.Error("Please uninstall all python builds (2.7, 3.5, etc) and reinstall python 3.7");
                return(false);
            }

            var basePath = Directory.GetCurrentDirectory();

            const string configFileName = "config.json";

            try
            {
                var config = new ConfigurationBuilder()
                             .SetBasePath(basePath)
                             .AddJsonFile(configFileName, false)
                             .Build();

                var mainThread = new ServerAppThread(Constants.ServerThreadFPS); //TODO: From config

                var builder = new ContainerBuilder();

                builder.RegisterInstance(config).As <IConfiguration>();
                builder.RegisterInstance(mainThread);

                builder.RegisterType <WvsCenter>().AsSelf().SingleInstance();
                builder.RegisterType <CenterStorage>().AsSelf().SingleInstance();
                builder.RegisterType <CommandHandle>().AsSelf().SingleInstance();
                builder.RegisterType <ScriptManager>().AsSelf().SingleInstance();

                Container = builder.Build();

                return(true);
            }
            catch
            {
                Log.Error("Unable to build config.json file.");
                Log.Error($"File name: {configFileName}");
                Log.Error($"File directory: {basePath}");
                Log.Error($"Full file path: {basePath}\\{configFileName}");
                return(false);
            }
        }
コード例 #2
0
 public ServerAppTask(T client, ServerAppThread parent)
 {
     m_client = client;
     m_parent = parent;
 }