Exemplo n.º 1
0
        public ACCCServerManager(ACCCServerConfig aCCCServerConfig)
        {
            this.ACServerConfig = aCCCServerConfig;
            ServerName          = this.ACServerConfig.Settings.ServerName;

            var configurationJson = File.ReadAllText(Path.Combine("./containers/" + this.ACServerConfig.Settings.ServerName, _keyValues.Where(m => m.Key == nameof(ACServerConfig.Configuration)).First().Value));
            var eventJson         = File.ReadAllText(Path.Combine("./containers/" + this.ACServerConfig.Settings.ServerName, _keyValues.Where(m => m.Key == nameof(ACServerConfig.Event)).First().Value));
            var settingsJson      = File.ReadAllText(Path.Combine("./containers/" + this.ACServerConfig.Settings.ServerName, _keyValues.Where(m => m.Key == nameof(ACServerConfig.Settings)).First().Value));
            var assisRulesJson    = File.ReadAllText(Path.Combine("./containers/" + this.ACServerConfig.Settings.ServerName, _keyValues.Where(m => m.Key == nameof(ACServerConfig.AssistRules)).First().Value));

            if (ACServerConfig.Configuration == null)
            {
                ACServerConfig.Configuration = JsonConvert.DeserializeObject <Configuration>(configurationJson);
            }

            if (ACServerConfig.Event == null)
            {
                ACServerConfig.Event = JsonConvert.DeserializeObject <Event>(eventJson);
            }

            //if(ACServerConfig.Settings == null)
            //{
            ACServerConfig.Settings = JsonConvert.DeserializeObject <Settings>(settingsJson);
            //}

            ACServerConfig.AssistRules = JsonConvert.DeserializeObject <AssistRules>(assisRulesJson);

            _processHandler = new ProcessHandler();
        }
        public ACCCServerResult Start(ACCCServerConfig acServerConfig)
        {
            //CreateContainer(acServerConfig.Settings.ServerName);
            if (Containers.Count > 0)
            {
                return(new ACCCServerResult()
                {
                    HasError = true,
                    Message = "No support normal version, plz buy pro version."
                });
            }
            IACCCServerManager serverManager = new ACCCServerManager(acServerConfig);

            Containers.Add(acServerConfig.Settings.ServerName, serverManager);
            return(serverManager.Start());
        }