Пример #1
0
        private async Task MainAsync()
        {
            _client = new DiscordSocketClient(new DiscordSocketConfig
            {
                AlwaysDownloadUsers = true
            });

            _config = new ConfigModule(BuildConfig());

            RegisterSub();

            var services = ConfigureServices();

            services.GetRequiredService <LogService>();
            services.GetRequiredService <WalletService>();
            await services.GetRequiredService <CommandHandlingService>().InitializeAsync(services);

            await _client.LoginAsync(TokenType.Bot, _config["token"]);

            await _client.StartAsync();

            services.GetRequiredService <RainService>();

            await Task.Delay(-1);
        }
Пример #2
0
        /// <summary>
        /// Create a new instance of the game engine. A user
        /// is required to know how to run the engine.
        /// </summary>
        /// <param name="context">The executing context of the engine.</param>
        /// <param name="serviceLocator">The dependency locator.</param>
        protected GameEngine(IContext context, ServiceLocator serviceLocator)
        {
            if (instance != null)
            {
                throw new Exception("Two or more instances of the game engine exist!");
            }

            this.Context        = context;
            this.serviceLocator = serviceLocator;

            LogModule     = new LogModule(this);
            ConfigModule  = new ConfigModule(this);
            UserModule    = new UserModule(this);
            CommandModule = new CommandConsoleModule(this);
            UIModule      = new UIModule(this);
            NetModule     = new NetModule(this);
            InputModule   = new InputModule(this);

            this.Context.EngineTicker.OnInit   += OnTickerInit;
            this.Context.EngineTicker.OnStart  += OnTickerStart;
            this.Context.EngineTicker.OnUpdate += OnTickerUpdate;
            this.Context.EngineTicker.OnEnd    += OnTickerEnd;

            SceneManager.sceneLoaded += SceneManagerSceneLoaded;
            instance = this;
            Core.Context.SetContext(context);
        }
Пример #3
0
 public void OnClickConfirm()
 {
     UpdateValues();
     ConfigModule.Apply();
     ConfigState.Save();
     Modal.PushMessageModal("Applied settings changes!", "Changes Applied", null, OnConfirmed, true);
 }
Пример #4
0
        static void Main(string[] args)
        {
            ConfigModule conf = ConfigLoader.loadConfig("test_config.xml");
            Dictionary <string, ConfigModule> parts = conf.SubModules;

            foreach (KeyValuePair <string, ConfigModule> configModule in parts)
            {
                Console.WriteLine(configModule.Key);
                if (configModule.Value.SubModules != null)
                {
                    foreach (KeyValuePair <string, ConfigModule> subModule in configModule.Value.SubModules)
                    {
                        Console.WriteLine(subModule.Key);
                    }
                }
            }

            ConfigModule dbConf = conf.getSubModule("DatabaseConnection");

            foreach (KeyValuePair <string, ConfigModule> connection in dbConf.SubModules)
            {
                Console.WriteLine("Database connection: " + connection.Key);
                foreach (KeyValuePair <string, string> attribute in connection.Value.Attributes)
                {
                    Console.WriteLine("\t" + attribute.Key + " = " + attribute.Value);
                }
            }

            ConfigModule onBaseConn = dbConf.getSubModule("onbase");

            Console.WriteLine(onBaseConn.getAttribute("server"));
        }
Пример #5
0
 public void OnClickConfirm()
 {
     UpdateValues();
     ConfigState.Save();
     ConfigModule.Apply();
     //MappedInput.SetMapper(ConfigState.Instance.InputMapper); //we need to do this manually unfortunately...
     Modal.PushMessageModal("Applied settings changes!", "Changes Applied", null, OnConfirmed, true);
 }
Пример #6
0
 void Update()
 {
     if (CCBase.Initialized)
     {
         ConfigModule.Apply();
         GameObject.Find("Text").GetComponent <Text>().text = "Loaded!";
         SceneManager.LoadScene("MainMenuScene");
     }
 }
Пример #7
0
        protected sealed override void Init()
        {
            logSource = base.logger;
            Log.Message("Sniper initializing");
            instance = this;


            base.awake += () =>
            {
                SetModdedModule.SetModded();
                ReinCore.AddModHash(guid, Properties.Info.ver, useBuild, useRev, networkVer);
                ConfigModule.CreateAndLoadConfig(this);

                Properties.Tools.RegisterLanguageTokens();
                SoundModule.LoadBank();
                NetworkModule.SetupNetworking();

                Default <Sprite> .value = UIModule.GetUnfinishedIcon();
                UIModule.EditHudPrefab();

                PrefabModule.CreatePrefab();
                DisplayModule.CreateDisplayPrefab();

                CatalogModule.RegisterBody();
                CatalogModule.RegisterSurvivor();
                CatalogModule.RegisterDoTType();
                CatalogModule.RegisterDamageTypes();
                CatalogModule.RegisterBuffTypes();
                CatalogModule.RegisterOrbs();
                CatalogModule.RegisterOverlays();

                VFXModule.Init();

                //UnlocksCore.AddUnlockable<WIPUnlockable>(false);
            };

            base.start += () =>
            {
                //MetaCatalog.LogCatalogState();

                try
                {
                    RoR2.Console.instance.SubmitCmd(null, "spp_disable_survivor Sniper");
                } catch { }
                _ = TextureModule.GetExplosiveAmmoRamp();
                _ = TextureModule.GetPlasmaAmmoRamp();
                _ = TextureModule.GetStandardAmmoRamp();
                _ = TextureModule.GetShockAmmoRamp();
                _ = TextureModule.GetScatterAmmoRamp();
            };

            base.enable      += HooksModule.Add;
            base.disable     += HooksModule.Remove;
            base.fixedUpdate += () => dt = Time.fixedDeltaTime;
            Log.Message("Sniper loaded successfully");
        }
Пример #8
0
 static DiscordService()
 {
     // Service Setup //
     provider      = ConfigureServices();
     client        = provider.GetRequiredService <DiscordSocketClient>();
     funModule     = provider.GetRequiredService <FunModule>();
     configService = provider.GetRequiredService <ConfigModule>();
     interactivity = provider.GetRequiredService <InteractivityService>();
     commands      = provider.GetRequiredService <CommandService>();
     // Discord Events //
     client.Ready += ReadyAsync;
     client.Log   += LogAsync;
 }
Пример #9
0
        //To be completed
        private void LoadModule(Type moduleType)
        {
            BaseModule bm = null;

            if (moduleType == typeof(ConfigModule))
            {
                bm = new ConfigModule();
            }

            if (bm != null)
            {
                bm.IsAutoResiger = true;
                bm.Load();
            }
        }
Пример #10
0
    void Start()
    {
        if (mainCamera == null)
        {
            mainCamera = Camera.main;
        }

        rotatePoint     = mainCamera.transform.position;
        LookAtCamera    = transform.Find("LevelAxis").GetChild(0);
        gyroController  = mainCamera.GetComponent <GyroController>();
        configModule    = ModuleManager.Instance.Get <ConfigModule>();
        screenAnimation = transform.GetChild(0).GetComponent <Animation>();
        _pet            = LookAtCamera.GetChild(0);
        InitialRotate();
        //StartCoroutine(GameHelper(28));
    }
Пример #11
0
        private void LoadElements(XDocument doc)
        {
            var root = doc.Root;

            if (root == null)
            {
                return;
            }

            var moduleElement = root.Element(XName.Get("modules", SchemaUrn));

            if (moduleElement != null)
            {
                foreach (var componentNode in moduleElement.Elements(XName.Get("module", SchemaUrn)))
                {
                    var attr    = componentNode.Attribute("assembly");
                    var element = new ConfigModule(attr?.Value);

                    _modules.Add(element);
                }
            }

            var sectionElement = root.Element(XName.Get("sections", SchemaUrn));

            if (sectionElement != null)
            {
                foreach (var sectionNode in sectionElement.Elements(XName.Get("section", SchemaUrn)))
                {
                    var nameAttr = sectionNode.Attribute("name");
                    var typeAttr = sectionNode.Attribute("type");

                    var element = new ConfigSection(nameAttr?.Value, typeAttr?.Value);

                    _sections.Add(element);
                }
            }

            var configElement = root.Element(XName.Get("config", SchemaUrn));

            if (configElement != null)
            {
                foreach (var element in configElement.Elements())
                {
                    _configElements.Add(element.Name.LocalName, element.ToString(SaveOptions.DisableFormatting));
                }
            }
        }
Пример #12
0
        public void Read(TProtocol iprot)
        {
            TField field;

            iprot.ReadStructBegin();
            while (true)
            {
                field = iprot.ReadFieldBegin();
                if (field.Type == TType.Stop)
                {
                    break;
                }
                switch (field.ID)
                {
                case 1:
                    if (field.Type == TType.String)
                    {
                        this.space         = iprot.ReadBinary();
                        this.__isset.space = true;
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 2:
                    if (field.Type == TType.I32)
                    {
                        this.module         = (ConfigModule)iprot.ReadI32();
                        this.__isset.module = true;
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                default:
                    TProtocolUtil.Skip(iprot, field.Type);
                    break;
                }
                iprot.ReadFieldEnd();
            }
            iprot.ReadStructEnd();
        }
Пример #13
0
        protected override void OnStartup(StartupEventArgs e)
        {
            mutex = new Mutex(true, "GBCLV2", out bool ret);
            if (!ret)
            {
                MessageBox.Show("已经有一个我在运行了", "(>ㅂ< )", MessageBoxButton.OK, MessageBoxImage.Information);
                System.Environment.Exit(0);
            }

            Config = ConfigModule.LoadConfig();
            Initialize_LauncherCore();
            Initialize_ThemeColor();

            Dispatcher.UnhandledException += UnhandledExceptionHandler;

            base.OnStartup(e);
        }
Пример #14
0
        private void SelectionChanged(Object sender, int Item)
        {
            try
            {
                ConfigModule M = _ListeConfigModule[((CtrlTextComboBox)sender).Text];
                _GroupeModule.Titre = M.Intitule;

                var ListeParams = M.ListeParametre;

                for (int i = 0; i < _MaxCtrl; i++)
                {
                    if (i < ListeParams.Count)
                    {
                        var P = ListeParams[i];

                        CtrlCheckBox c = _ListeCheckBox[i];
                        CtrlTextBox  t = _ListeTextBox[i];
                        if (P.Type == typeof(Boolean))
                        {
                            c.Visible = true;
                            t.Visible = false;
                            c.Param   = P;
                            c.Caption = P.Intitule;
                            c.ApplyParam();
                        }
                        else if (P.Type == typeof(String))
                        {
                            c.Visible   = false;
                            t.Visible   = true;
                            t.Param     = P;
                            t.LabelText = P.Intitule;
                            t.ApplyParam();
                        }
                    }
                    else
                    {
                        _ListeCheckBox[i].Visible = false;
                        _ListeTextBox[i].Visible  = false;
                    }
                }
            }
            catch (Exception e)
            { this.LogMethode(new Object[] { e }); }
        }
Пример #15
0
        protected void Calque()
        {
            try
            {
                var G = _Calque.AjouterGroupe("Selectionner le module");

                _TextComboBox = G.AjouterTextComboBox("");
                _TextComboBox.OnSelectionChanged += SelectionChanged;

                _GroupeModule = _Calque.AjouterGroupe("Module");

                for (int i = 0; i < _MaxCtrl; i++)
                {
                    var cb = _GroupeModule.AjouterCheckBox("Titre");
                    cb.Visible = false;
                    _ListeCheckBox.Add(cb);

                    var tb = _GroupeModule.AjouterTexteBox("Titre", "Intitule");
                    tb.Visible = false;
                    _ListeTextBox.Add(tb);
                }

                foreach (var nom in ConfigModule.ListeNomConfigModule)
                {
                    ConfigModule M = new ConfigModule(nom);
                    M.ChargerParametreBrut();

                    if (M.ListeParametre.Count > 0)
                    {
                        _ListeConfigModule.Add(nom, M);
                    }
                }

                _TextComboBox.Liste = _ListeConfigModule.Keys.ToList();
            }
            catch (Exception e)
            { this.LogMethode(new Object[] { e }); }
        }
Пример #16
0
        public static void Configuration(ServiceConfigurator <ValidationService> config)
        {
            IKernel kernel = null;

            IDisposable webapiApp = null;

            config.ConstructUsing(() =>
            {
                return(new ValidationService());
            });

            config.BeforeStartingService(h =>
            {
                h.RequestAdditionalTime(ServerSettings.AdditionalStartupTime);

                kernel = ConfigModule.GetKernel();

                log.Info("{0} Service Started", ServiceName);
            });

            config.WhenStarted(s =>
            {
                //configuration for hangfire server.
                //tells it to use in memory storage instead of having to have a SQL backend
                Hangfire.GlobalConfiguration.Configuration.UseMemoryStorage();

                // tells hangfire which IoC to use when newing up jobs.
                Hangfire.GlobalConfiguration.Configuration.UseNinjectActivator(kernel);

                RunValidationServer(kernel);

                webapiApp = WebApp.Start(ServerSettings.WebAPIUrl, builder =>
                {
                    kernel.Get <ValidationService>().Configuration(builder);
                });
            });

            config.AfterStartingService(() =>
            {
#if DEBUG
#endif
            });

            config.WhenStopped(s =>
            {
                if (kernel != null)
                {
                    var busCleanup = kernel.Get <IBusCleanup>();
                    busCleanup.StopAllBuses();

                    log.Info("{0} Service Stopped - bus cleanup and kernel disposed", ServiceName);
                }

                //In theory, IBusCleanup should allow notifications to be sent before an app closes down.
                //However, in this case more time was required.
                //TODO - verify not needed System.Threading.Thread.Sleep(500);

                log.Info("{0} Service Stopped", ServiceName);

                webapiApp.Dispose();

                kernel.Dispose();
            });
        }
Пример #17
0
 public RainModule(RainService rainService, WalletService walletService, ConfigModule config)
 {
     _rainService   = rainService;
     _walletService = walletService;
     _config        = config;
 }
Пример #18
0
        /// <summary>
        /// Creates XML configuration according to the specified configuration data.
        /// </summary>
        /// <param name="configRequirements">Data which describes necessary configuration.</param>
        /// <returns>XML config of service as serialized set of classes.</returns>
        public static ConfigurationXml CreateXmlConfigBasedOnRequirements(
            ConfigRequirements configRequirements)
        {
            configRequirements.ThrowIfNull(nameof(configRequirements));

            var xmlConfigCreator = new XmlConfigCreator();

            xmlConfigCreator.SetMessageHandlerType("ConsoleMessageHandler");
            xmlConfigCreator.AddMessageHandlerParameter(
                new XElement("ConsoleMessageHandlerSetUnicode", "false")
                );

            xmlConfigCreator.SetDefaultInStorageName("thing_names.csv");

            xmlConfigCreator.SetCrawlersOutputFlag(false);

            xmlConfigCreator.SetAppraisersOutputFlag(false);

            xmlConfigCreator.SetDefaultOutStorageName("appraised_things.csv");

            xmlConfigCreator.SetConnectionString(
                ConfigurationManager.AppSettings["ConnectionString"]
                );
            xmlConfigCreator.AddRepository(
                ConfigModule.GetConfigForRepository("BasicInfo")
                );

            foreach (var inputItem in configRequirements.Input)
            {
                ConfigContract.CheckAvailability(inputItem, ConfigContract.AvailableInput);

                xmlConfigCreator.AddInputter(
                    ConfigModule.GetConfigForInputter(inputItem)
                    );
            }

            foreach (var serviceItem in configRequirements.Services)
            {
                ConfigContract.CheckAvailability(serviceItem, ConfigContract.AvailableServices);

                xmlConfigCreator.AddCrawler(
                    ConfigModule.GetConfigForCrawler(serviceItem)
                    );
                xmlConfigCreator.AddRepository(
                    ConfigModule.GetConfigForRepository(serviceItem)
                    );
            }

            foreach (var appraisalItem in configRequirements.Appraisals)
            {
                ConfigContract.CheckAvailability(appraisalItem, ConfigContract.AvailableAppraisals);

                xmlConfigCreator.AddAppraiser(
                    ConfigModule.GetConfigForAppraiser(appraisalItem)
                    );
            }

            foreach (var outputItem in configRequirements.Output)
            {
                ConfigContract.CheckAvailability(outputItem, ConfigContract.AvailableOutput);

                xmlConfigCreator.AddOutputter(
                    ConfigModule.GetConfigForOutputter(outputItem)
                    );
            }

            xmlConfigCreator.SetServiceType(ServiceType.TplDataflow);

            return(xmlConfigCreator.GetResult());
        }
Пример #19
0
        /// <summary>
        /// Creates default configuration of the service. If you want to customize components, use
        /// other methods to define what you want.
        /// </summary>
        /// <returns>Default XML config of service as serialized set of classes.</returns>
        public static ConfigurationXml CreateDefaultXmlConfig()
        {
            var xmlConfig = new ConfigurationXml
            {
                ShellConfig = new ShellConfig
                {
                    MessageHandler = new MessageHandlerConfig
                    {
                        MessageHandlerType       = "ConsoleMessageHandler",
                        MessageHandlerParameters = new[]
                        {
                            ConfigModule.GetConfigForMessageHandlerParameter(
                                "ConsoleMessageHandlerSetUnicode"
                                )
                        }
                    },
                    InputManager = new InputManagerConfig
                    {
                        DefaultInStorageName = "thing_names.csv",
                        Inputters            = new[]
                        {
                            ConfigModule.GetConfigForInputter("LocalFileReaderSimple"),
                        }
                    },
                    CrawlersManager = new CrawlersManagerConfig
                    {
                        CrawlersOutputFlag = false,
                        Crawlers           = new[]
                        {
                            ConfigModule.GetConfigForCrawler("Tmdb")
                        }
                    },
                    AppraisersManager = new AppraisersManagerConfig
                    {
                        AppraisersOutputFlag = false,
                        Appraisers           = new[]
                        {
                            ConfigModule.GetConfigForAppraiser("TmdbCommon")
                        }
                    },
                    OutputManager = new OutputManagerConfig
                    {
                        DefaultOutStorageName = "appraised_thing.csv",
                        Outputters            = new[]
                        {
                            ConfigModule.GetConfigForOutputter("LocalFileWriter"),
                        }
                    },
                    DataBaseManager = new DataBaseManagerConfig
                    {
                        ConnectionString = ConfigurationManager.AppSettings["ConnectionString"],
                        Repositories     = new[]
                        {
                            ConfigModule.GetConfigForRepository("Tmdb")
                        }
                    }
                },
                ServiceType = ServiceType.TplDataflow
            };

            return(xmlConfig);
        }