Ejemplo n.º 1
0
        protected override void OnSubModuleLoad()
        {
            if (File.Exists(System.IO.Path.Combine(TaleWorlds.Engine.Utilities.GetConfigsPath(), ModuleFolderName, "Logs")))
            {
                File.Delete(System.IO.Path.Combine(TaleWorlds.Engine.Utilities.GetConfigsPath(), ModuleFolderName, "Logs"));
            }
            string logpath = System.IO.Path.Combine(TaleWorlds.Engine.Utilities.GetConfigsPath(), ModuleFolderName, "Logs", "logfile.txt");

            if (!Directory.Exists(System.IO.Path.GetDirectoryName(logpath)))
            {
                Directory.CreateDirectory(System.IO.Path.GetDirectoryName(logpath));
            }
            ErrorLog.LogPath = logpath;

            try
            {
                FileDatabase.Initialise(ModuleFolderName);
                BMRandomTweaksConfiguration settings = FileDatabase.Get <BMRandomTweaksConfiguration>(BMRandomTweaksConfiguration.InstanceID);
                if (settings == null)
                {
                    settings = new BMRandomTweaksConfiguration();
                }
                SettingsDatabase.RegisterSettings(settings);
            }
            catch (Exception ex)
            {
                ErrorLog.Log("TournamentsXPanded failed to initialize settings data.\n\n" + ex.ToStringFull());
            }
        }
Ejemplo n.º 2
0
        protected override void OnSubModuleLoad()
        {
            try
            {
                FileDatabase.Initialise(ModuleFolderName);
                BMRandomTweaksConfiguration settings = FileDatabase.Get <BMRandomTweaksConfiguration>(BMRandomTweaksConfiguration.InstanceID);
                if (settings == null)
                {
                    settings = new BMRandomTweaksConfiguration();
                }

                SettingsDatabase.RegisterSettings(settings);
            }
            catch (Exception ex)
            {
                ErrorLog.Log("TournamentsXPanded failed to initialize settings data.\n\n" + ex.ToStringFull());
            }
        }