/// <summary> /// Sets the Reloaded Mod Loader DLL paths for a launcher config. /// </summary> private static void SetLoaderPaths(LoaderConfig config, string launcherDirectory) { if (String.IsNullOrEmpty(launcherDirectory)) { throw new DllNotFoundException("The provided launcher directory is null or empty. This is a bug. Report this to the developer."); } config.UpdatePaths(launcherDirectory, Resources.ErrorLoaderNotFound.Get()); // Update Environment Variables Task.Run(() => Environment.SetEnvironmentVariable("RELOADEDIIMODS", config.GetModConfigDirectory(), EnvironmentVariableTarget.User)); }
public static ValidFileInfo GetValidationInfo(LoaderConfig loaderConfig, IProgress <ProgressManager> progress) { var validFileInfo = new ValidFileInfo(loaderConfig.FileLocation, loaderConfig.Source, FileTypes.Txt); if (progress != null) { validFileInfo.ProgressLogger = progress; } return(validFileInfo); }
/// <summary> /// Saves the last selected game such that it may be re-selected on launch. /// </summary> public void SaveLastGame() { // No game config selected (yet) at initialization. if (Global.CurrentGameConfig == null) { return; } // Write the loader config with the last saved game. Global.LoaderConfiguration.LastGameFolder = Global.CurrentGameConfig.ConfigLocation; LoaderConfig.WriteConfig(Global.LoaderConfiguration); }
public void Setup() { var db = new MongoClient( LoaderConfig.Get("DataLayer:CSVAnalysis:url")). GetDatabase(LoaderConfig.Get("DataLayer:CSVAnalysis:db")); nppes_csv = db.GetCollection <BsonDocument> (LoaderConfig.Get("DataLayer:CSVAnalysis:nppes_csv_roaster")); nppes_api = db.GetCollection <BsonDocument> (LoaderConfig.Get("DataLayer:CSVAnalysis:nppes_api_roaster")); }
/// <summary> /// Loads all configurations to be used by the program, alongside with their parsers. /// </summary> private void InitializeGlobalProperties() { // Initialize other Properties. Global.Theme = new Theme(); // Grab relevant configs. // Note: Game list is grabbed upon entry to the main screen form. Global.LoaderConfiguration = LoaderConfig.ParseConfig(); // Set the initial menu name. Global.CurrentMenuName = "Main Menu"; }
/// <summary> /// Creates the service instance given an instance of the configuration. /// </summary> /// <param name="config">Mod loader config.</param> /// <param name="context">Context to which background events should be synchronized.</param> /// <param name="modConfigService">Allows to receive notifications on mods being deleted/created.</param> public ModUserConfigService(LoaderConfig config, ModConfigService modConfigService, SynchronizationContext context = null) { this.OnAddItem += OnAddItemHandler; this.OnRemoveItem += OnRemoveItemHandler; Initialize(config.GetModUserConfigDirectory(), ModUserConfig.ConfigFileName, GetAllConfigs, context, true); SetItemsById(); _modConfigService = modConfigService; modConfigService.OnAddItem += CreateUserConfigOnNewConfigCreated; CreateConfigsForModsWithoutAny(context); }
public MongoData() { db = new MongoClient(LoaderConfig.Get(url_name)). GetDatabase(LoaderConfig.Get(db_name)); nppes = db.GetCollection <BsonDocument> (LoaderConfig.Get(roaster_name)); zipEntries = db.GetCollection <ZipcodeMetadata> (LoaderConfig.Get(zip_codes)); RefreshCache(); }
/* Before Test */ public TempLoaderConfigCreator() { _configReader = new LoaderConfigReader(); if (_configReader.ConfigurationExists()) { _originalConfig = _configReader.ReadConfiguration(); } else { _configReader.WriteConfiguration(new LoaderConfig()); } }
/// <summary> /// Writes a new mod loader configuration to disk. /// </summary> /// <param name="modConfig">The new mod loader configuration to write.</param> public void WriteConfiguration(LoaderConfig modConfig) { string directory = Path.GetDirectoryName(StaticConfigFilePath); if (!Directory.Exists(directory)) { Directory.CreateDirectory(directory); } string jsonFile = JsonConvert.SerializeObject(modConfig, Formatting.Indented); File.WriteAllText(StaticConfigFilePath, jsonFile); }
/// <summary> /// Gets a list of all mods from filesystem and returns a mod with a matching ModId. /// </summary> /// <param name="modId">The modId to find.</param> /// <param name="allMods">List of all mod configurations, read during the operation.</param> /// <exception cref="ReloadedException">A mod to load has not been found.</exception> public PathTuple <ModConfig> FindMod(string modId, out List <PathTuple <ModConfig> > allMods) { // Get mod with ID allMods = ModConfig.GetAllMods(LoaderConfig.GetModConfigDirectory()); var mod = allMods.FirstOrDefault(x => x.Config.ModId == modId); if (mod != null) { var dllPath = mod.Config.GetDllPath(mod.Path); return(new PathTuple <ModConfig>(dllPath, mod.Config)); } throw new ReloadedException(Errors.ModToLoadNotFound(modId)); }
public ManageModsViewModel(MainPageViewModel mainPageViewModel, LoaderConfig loaderConfig) { Mods = new ObservableCollection <ImageModPathTuple>(); Mods.CollectionChanged += (sender, args) => ModsChanged(sender, args); GetModifications(); _mainPageViewModel = mainPageViewModel; string modDirectory = loaderConfig.ModConfigDirectory; _createWatcher = CreateGeneric(modDirectory, ExecuteGetModifications, FileSystemWatcherEvents.Changed | FileSystemWatcherEvents.Created); _deleteFileWatcher = CreateChangeCreateDelete(modDirectory, OnDeleteFile, FileSystemWatcherEvents.Deleted); _deleteDirectoryWatcher = CreateChangeCreateDelete(modDirectory, OnDeleteDirectory, FileSystemWatcherEvents.Deleted, false, "*.*"); ExecuteWithApplicationDispatcherAsync(() => Icon = new BitmapImage(new Uri(Paths.PLACEHOLDER_IMAGE, UriKind.Absolute))); }
public SettingsPageViewModel(MainPageViewModel mainPageViewModel, ManageModsViewModel manageModsViewModel, LoaderConfig loaderConfig) { LoaderConfig = loaderConfig; MainPageViewModel = mainPageViewModel; ManageModsViewModel = manageModsViewModel; UpdateTotalApplicationsInstalled(); UpdateTotalModsInstalled(); MainPageViewModel.ApplicationsChanged += MainPageViewModelOnApplicationsChanged; ManageModsViewModel.ModsChanged += ManageModsViewModelOnModsChanged; var version = FileVersionInfo.GetVersionInfo(Assembly.GetEntryAssembly().Location); Copyright = version.LegalCopyright; }
public static void PopulateData(LoaderConfig loaderConfig, IEnumerable <PortfolioRisk> portfolioRisks) { if (!Directory.Exists(loaderConfig.FileLocation)) { Directory.CreateDirectory(loaderConfig.FileLocation); } using (TextWriter tw = new StreamWriter(loaderConfig.FileLocation + loaderConfig.FileName)) { foreach (var item in portfolioRisks) { tw.WriteLine(item.ToString()); } } }
/* * TODO LIST * Change servername on new clients with encrypted Server.dat (Maybe the best option is find the String of first Server in Server.dat (Decrypting it with the tool in the oc forum) in memory and remplace this with the custom string of LoaderConfig.SelectedServer.ServerName * Create a page with wordpress and storefront theme for anounce the ConquerLoader with the domain conquerloader.com (Simple page only for now, in future have complements for sell and implement in this loader) * Premium Features (Control with IP of servername in some AccessList, json or via Database) with the features are payed for the user (User = Server IP) * */ private void Main_Load(object sender, EventArgs e) { LoaderConfig = Core.GetLoaderConfig(); if (LoaderConfig == null) { Settings s = new Settings(); s.ShowDialog(this); } else { LoadConfigInForm(); } RefreshServerList(); AllStarted = true; }
public void OverrideDatabase(string overrideDb, string expectedConnection) { var appConfig = Substitute.For <IConfiguration>(); appConfig["connection"].Returns("Server=(local);Database=Timetable;Trusted_Connection=True;"); var options = new Options() { Database = overrideDb }; var config = new LoaderConfig(appConfig, options); Assert.Equal(expectedConnection, config.ConnectionString); }
public void Load <T>(CacheLoaderBase <T> loader, string cahceName) { loader.OnComplete.AddEventListener((l) => { Debug.Log("complete:" + loader.Data); }); loader.OnError.AddEventListener((l) => { Debug.Log("Error"); }); LoaderConfig config = new LoaderConfig(); config.CacheName = cahceName; loader.Config = config; loader.Execute(); }
private void BtnEdit_Click(object sender, EventArgs e) { if (gridViewSettings.CurrentRow != null) { if (WizardEditForm != null) { WizardEditForm.Dispose(); } if (Core.GetLoaderConfig().Servers.Count > gridViewSettings.CurrentRow.Index) { WizardEditForm = new Wizard(gridViewSettings.CurrentRow.Index); WizardEditForm.ShowDialog(); CurrentLoaderConfig = Core.GetLoaderConfig(); gridViewSettings.DataSource = CurrentLoaderConfig.Servers; } } }
public SettingsPageViewModel(MainPageViewModel mainPageViewModel, ManageModsViewModel manageModsViewModel, LoaderConfig loaderConfig) { LoaderConfig = loaderConfig; MainPageViewModel = mainPageViewModel; ManageModsViewModel = manageModsViewModel; UpdateTotalApplicationsInstalled(); UpdateTotalModsInstalled(); MainPageViewModel.ApplicationsChanged += MainPageViewModelOnApplicationsChanged; ManageModsViewModel.ModsChanged += ManageModsViewModelOnModsChanged; var version = FileVersionInfo.GetVersionInfo(Assembly.GetEntryAssembly().Location); Copyright = version.LegalCopyright; RuntimeVersion = $"Core: {System.Runtime.InteropServices.RuntimeInformation.FrameworkDescription}"; SelectCurrentLanguage(); }
public DependencyChecker(LoaderConfig config, bool is64Bit) { var deps = new List <IDependency>(); var core32 = GetRuntimeOptionsForDll(config.LoaderPath32); deps.Add(new NetCoreDependency($".NET Core {core32.Framework.Version} x86", ResolveCore(core32, false))); deps.Add(new RedistributableDependency("Visual C++ Redistributable x86", RedistributablePackage.IsInstalled(RedistributablePackageVersion.VC2015to2019x86), false)); if (is64Bit) { var core64 = GetRuntimeOptionsForDll(config.LoaderPath64); deps.Add(new NetCoreDependency($".NET Core {core64.Framework.Version} x64", ResolveCore(core64, true))); deps.Add(new RedistributableDependency("Visual C++ Redistributable x64", RedistributablePackage.IsInstalled(RedistributablePackageVersion.VC2015to2019x64), true)); } Dependencies = deps.ToArray(); }
/* Before and After Test. */ public ConfigCleanupTest() { _loaderConfigCreator = new TempLoaderConfigCreator(); _tempLoaderConfig = new LoaderConfigReader().ReadConfiguration(); _modConfigLoader = new ConfigLoader <ModConfig>(); _appConfigLoader = new ConfigLoader <ApplicationConfig>(); // Make real sample configurations. _realModConfig = new ModConfig(); _realAppConfig = new ApplicationConfig(); _realModConfigFilePath = Path.Combine(_tempLoaderConfig.ModConfigDirectory, RandomString(RandomDirectoryLength), ModConfig.ConfigFileName); _realAppConfigFilePath = Path.Combine(_tempLoaderConfig.ApplicationConfigDirectory, RandomString(RandomDirectoryLength), ApplicationConfig.ConfigFileName); _modConfigLoader.WriteConfiguration(_realModConfigFilePath, _realModConfig); _appConfigLoader.WriteConfiguration(_realAppConfigFilePath, _realAppConfig); }
public void ReadWriteConfig() { // Read back config first. (It will exist because of constructor) var config = new LoaderConfig(); // Add some random app support entries. config.ModSupportMatrix.Add("reloaded.sample.app", new string[] { "sample.mod.a", "sample.mod.b" }); config.ApplicationConfigDirectory = "Apps"; config.ModConfigDirectory = "Mods"; config.PluginConfigDirectory = "Plugins"; config.InstallDirectory = Environment.CurrentDirectory; // Write and read back the config. _configReader.WriteConfiguration(config); var newConfig = _configReader.ReadConfiguration(); Assert.Equal(config, newConfig); }
private void Settings_Load(object sender, EventArgs e) { if ((MetroFramework.Forms.MetroForm)Tag != null) { tbxTitle.WaterMark = ((MetroFramework.Forms.MetroForm)Tag).Text; } langSelector.Items.Add("English"); langSelector.Items.Add("Español"); langSelector.Items.Add("Português"); pbFlag.Visible = Directory.Exists("es") || Directory.Exists("pt"); langSelector.Visible = Directory.Exists("es") || Directory.Exists("pt"); CurrentLoaderConfig = Core.GetLoaderConfig(); if (CurrentLoaderConfig != null) { string findStr = "English"; if (CurrentLoaderConfig.Lang == "es") { findStr = "Español"; } if (CurrentLoaderConfig.Lang == "pt") { findStr = "Português"; } langSelector.SelectedIndex = langSelector.FindString(findStr); } if (!File.Exists(Core.ConfigJsonPath) && !File.Exists(Core.ConfigJsonPath + ".lock")) { LoaderConfig lc = new LoaderConfig(); Core.SaveLoaderConfig(lc); MetroFramework.MetroMessageBox.Show(this, "Cannot load config.json. Creating one... Restart App!", this.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Warning); Environment.Exit(0); } else { tglDebugMode.Checked = CurrentLoaderConfig.DebugMode; tglCloseOnFinish.Checked = CurrentLoaderConfig.CloseOnFinish; tglHighResolution.Checked = CurrentLoaderConfig.HighResolution; tglFullscreen.Checked = CurrentLoaderConfig.FullScreen; tglServerNameChange.Checked = CurrentLoaderConfig.ServernameChange; tglDisableAutoFixFlash.Checked = CurrentLoaderConfig.DisableAutoFixFlash; tbxTitle.Text = CurrentLoaderConfig.Title; gridViewSettings.DataSource = CurrentLoaderConfig.Servers; } }
/// <summary> /// Sets the Reloaded Mod Loader DLL paths for a launcher config. /// </summary> private static void SetLoaderPaths(LoaderConfig config, string launcherDirectory) { if (String.IsNullOrEmpty(launcherDirectory)) { throw new DllNotFoundException("The provided launcher directory is null or empty. This is a bug. Report this to the developer."); } // Loader configuration. var loaderPath32 = Path.Combine(launcherDirectory, $"Loader\\x86\\{LoaderConfig.LoaderDllName}"); if (!File.Exists(loaderPath32)) { throw new DllNotFoundException($"(x86) {LoaderConfig.LoaderDllName} {Errors.LoaderNotFound()}"); } var loaderPath64 = Path.Combine(launcherDirectory, $"Loader\\x64\\{LoaderConfig.LoaderDllName}"); if (!File.Exists(loaderPath64)) { throw new DllNotFoundException($"(x64) {LoaderConfig.LoaderDllName} {Errors.LoaderNotFound()}"); } // Bootstrappers. var bootstrapper32Path = Path.Combine(launcherDirectory, $"Loader\\X86\\{LoaderConfig.Bootstrapper32Name}"); if (!File.Exists(bootstrapper32Path)) { throw new DllNotFoundException($"{LoaderConfig.Bootstrapper32Name} {Errors.LoaderNotFound()}"); } var bootstrapper64Path = Path.Combine(launcherDirectory, $"Loader\\X64\\{LoaderConfig.Bootstrapper64Name}"); if (!File.Exists(bootstrapper64Path)) { throw new DllNotFoundException($"{LoaderConfig.Bootstrapper64Name} {Errors.LoaderNotFound()}"); } // Set to config. config.LauncherPath = Path.ChangeExtension(Assembly.GetExecutingAssembly().Location, ".exe"); config.LoaderPath32 = loaderPath32; config.LoaderPath64 = loaderPath64; config.Bootstrapper32Path = bootstrapper32Path; config.Bootstrapper64Path = bootstrapper64Path; }
/// <summary> /// Sets the Reloaded Mod Loader DLL paths for a launcher config. /// </summary> private static void SetLoaderPaths(LoaderConfig config, string launcherDirectory) { if (String.IsNullOrEmpty(launcherDirectory)) { throw new DllNotFoundException("The provided launcher directory is null or empty. This is a bug. Report this to the developer."); } // Loader configuration. var loaderPath32 = Paths.GetLoaderPath32(launcherDirectory); if (!File.Exists(loaderPath32)) { throw new DllNotFoundException($"(x86) {Path.GetFileName(loaderPath32)} {Errors.LoaderNotFound()}"); } var loaderPath64 = Paths.GetLoaderPath64(launcherDirectory); if (!File.Exists(loaderPath64)) { throw new DllNotFoundException($"(x64) {Path.GetFileName(loaderPath64)} {Errors.LoaderNotFound()}"); } // Bootstrappers. var bootstrapper32Path = Paths.GetBootstrapperPath32(launcherDirectory); if (!File.Exists(bootstrapper32Path)) { throw new DllNotFoundException($"{Path.GetFileName(bootstrapper32Path)} {Errors.LoaderNotFound()}"); } var bootstrapper64Path = Paths.GetBootstrapperPath64(launcherDirectory); if (!File.Exists(bootstrapper64Path)) { throw new DllNotFoundException($"{Path.GetFileName(bootstrapper64Path)} {Errors.LoaderNotFound()}"); } // Set to config. config.LauncherPath = Process.GetCurrentProcess().MainModule.FileName; config.LoaderPath32 = loaderPath32; config.LoaderPath64 = loaderPath64; config.Bootstrapper32Path = bootstrapper32Path; config.Bootstrapper64Path = bootstrapper64Path; }
/// <summary> /// Initializes all of the windows forms to be used by the application. /// </summary> private void InitializeForms() { // Display the Welcome Message. if (Global.LoaderConfiguration.FirstLaunch) { // Display the welcome dialog. new WelcomeScreen().ShowDialog(); // Save without prompt. Global.LoaderConfiguration.FirstLaunch = false; LoaderConfig.WriteConfig(Global.LoaderConfiguration); } // Store the base form in Global Global.BaseForm = new Base(); // Launches the first window. Application.Run(Global.BaseForm); }
private void BtnAdd_Click(object sender, System.EventArgs e) { LoaderConfig lConfig = Core.GetLoaderConfig(); lConfig.Servers.Add(new ServerConfiguration() { GameHost = tbxIP.Text, LoginHost = tbxIP.Text, ExecutableName = tbxConquerExe.Text, ServerName = tbxServerName.Text, UseDirectX9 = tglUseDX9.Checked, ServerVersion = uint.Parse(tbxVersion.Text), LoginPort = 9958, GamePort = 5816 }); Core.SaveLoaderConfig(lConfig); this.DialogResult = System.Windows.Forms.DialogResult.OK; this.Close(); }
public void ValidDirectoryOnDeserialization() { // Make new config first and backup old. var config = new LoaderConfig(); // Add some random app support entries. config.ApplicationConfigDirectory = "0Apps"; config.ModConfigDirectory = "0Mods"; config.PluginConfigDirectory = "0Plugins"; // Write and read back the config. Mod.Loader.IO.LoaderConfigReader.WriteConfiguration(config); var newConfig = Mod.Loader.IO.LoaderConfigReader.ReadConfiguration(); // Restore old config and assert. Assert.True(Directory.Exists(newConfig.ApplicationConfigDirectory)); Assert.True(Directory.Exists(newConfig.ModConfigDirectory)); Assert.True(Directory.Exists(newConfig.PluginConfigDirectory)); }
public Main() { InitializeComponent(); this.Resizable = false; this.Theme = MetroFramework.MetroThemeStyle.Light; LoaderConfig = Core.GetLoaderConfig(); LoaderEvents.LauncherLoaded += LoaderEvents_LauncherLoaded; LoaderEvents.ConquerLaunched += LoaderEvents_ConquerLaunched; LoaderEvents.LauncherExit += LoaderEvents_LauncherExit; Constants.ClientPath = Directory.GetCurrentDirectory(); if (LoaderConfig != null) { Constants.CloseOnFinish = LoaderConfig.CloseOnFinish; } Constants.MainWorker = worker; Core.LoadAvailablePlugins(); //Core.LoadRemotePlugins(); Is a slow method for this :( for now this is disabled Core.InitPlugins(); }
private void Settings_Load(object sender, EventArgs e) { Resizable = false; if (!File.Exists(Core.ConfigJsonPath)) { LoaderConfig lc = new LoaderConfig(); Core.SaveLoaderConfig(lc); MetroFramework.MetroMessageBox.Show(this, "Cannot load config.json. Creating one... Restart App!", this.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Warning); Environment.Exit(0); } else { CurrentLoaderConfig = Core.GetLoaderConfig(); tglDebugMode.Checked = CurrentLoaderConfig.DebugMode; tglCloseOnFinish.Checked = CurrentLoaderConfig.CloseOnFinish; tbxTitle.Text = CurrentLoaderConfig.Title; gridViewSettings.DataSource = CurrentLoaderConfig.Servers; } }
/// <summary> /// Retrieves all of the dependencies for a given set of mods. /// </summary> /// <exception cref="FileNotFoundException">A dependency for any of the mods has not been found.</exception> private HashSet <ModConfig> GetDependenciesForMods(IEnumerable <ModConfig> mods, IEnumerable <ModConfig> allMods, string modDirectory) { if (allMods == null) { allMods = ModConfig.GetAllMods(LoaderConfig.GetModConfigDirectory()).Select(x => x.Config); } var dependencies = ModConfig.GetDependencies(mods, allMods, modDirectory); if (dependencies.MissingConfigurations.Count > 0 && !IsTesting) { string missingMods = String.Join(",", dependencies.MissingConfigurations); throw new FileNotFoundException($"Reloaded II was unable to find all dependencies for the mod(s) to be loaded.\n" + $"Aborting load.\n" + $"Missing dependencies: {missingMods}"); } return(dependencies.Configurations); }