/// <summary> /// PluginManager class constructor. /// </summary> /// <param name="FullAppPath">Path to SRC Repair installation directory.</param> public PluginManager(string FullAppPath) { // Initializing an empty dictionary... Plugins = new Dictionary <string, PluginTarget>(); // Fetching the list of available plugins from the XML database file... using (FileStream XMLFS = new FileStream(Path.Combine(FullAppPath, StringsManager.PluginsDatabaseName), FileMode.Open, FileAccess.Read)) { // Loading XML file from file stream... XmlDocument XMLD = new XmlDocument(); XMLD.Load(XMLFS); // Parsing XML and filling our structures... foreach (XmlNode XmlItem in XMLD.SelectNodes("Plugins/Plugin")) { try { Plugins.Add(XmlItem.SelectSingleNode("IntName").InnerText, new PluginTarget(XmlItem.SelectSingleNode("Name").InnerText, Path.Combine(FullAppPath, XmlItem.SelectSingleNode("ExeName").InnerText), XmlItem.SelectSingleNode("ElevationRequired").InnerText == "1")); } catch (Exception Ex) { Logger.Warn(Ex, DebugStrings.AppDbgExCorePluginManConstructor); } } } }
/// <summary> /// ConfigManager class constructor. /// </summary> /// <param name="GameID">Game ID.</param> /// <param name="FullAppPath">Full path to application's directory</param> /// <param name="AppHUDDir">Full HUD directory installation path</param> /// <param name="HideOutdated">Enable hiding of outdated HUDs.</param> public HUDManager(string GameID, string FullAppPath, string AppHUDDir, bool HideOutdated = true) { // Initializing empty dictionary... HUDsAvailable = new Dictionary <string, HUDSingle>(); // Fetching list of available HUDs from XML database file... using (FileStream XMLFS = new FileStream(Path.Combine(FullAppPath, StringsManager.HudDatabaseName), FileMode.Open, FileAccess.Read)) { // Loading XML file from file stream... XmlDocument XMLD = new XmlDocument(); XMLD.Load(XMLFS); // Parsing XML and filling our structures... foreach (XmlNode XmlItem in XMLD.SelectNodes("HUDs/HUD")) { try { if ((!HideOutdated || XmlItem.SelectSingleNode("IsUpdated").InnerText == "1") && (XmlItem.SelectSingleNode("Game").InnerText == GameID)) { HUDsAvailable.Add(XmlItem.SelectSingleNode("Name").InnerText, new HUDSingle(XmlItem.SelectSingleNode("Name").InnerText, XmlItem.SelectSingleNode("Game").InnerText, XmlItem.SelectSingleNode("URI").InnerText, XmlItem.SelectSingleNode("Mirror").InnerText, XmlItem.SelectSingleNode("UpURI").InnerText, XmlItem.SelectSingleNode("IsUpdated").InnerText == "1", XmlItem.SelectSingleNode("Preview").InnerText, XmlItem.SelectSingleNode("LastUpdate").InnerText, XmlItem.SelectSingleNode("Site").InnerText, XmlItem.SelectSingleNode("ArchiveDir").InnerText, XmlItem.SelectSingleNode("InstallDir").InnerText, XmlItem.SelectSingleNode("Hash2").InnerText, Path.Combine(AppHUDDir, Path.ChangeExtension(Path.GetFileName(XmlItem.SelectSingleNode("Name").InnerText), ".zip")))); } } catch (Exception Ex) { Logger.Warn(Ex, DebugStrings.AppDbgExCoreHudManConstructor); } } } }
/// <summary> /// CleanupManager class constructor. /// </summary> /// <param name="FullAppPath">Path to SRC Repair installation directory.</param> /// <param name="SelectedGame">Instance of SourceGame class with selected in main window game.</param> /// <param name="AllowUnsafe">Allow or disallow to use unsafe cleanup methods.</param> public CleanupManager(string FullAppPath, SourceGame SelectedGame, bool AllowUnsafe = false) { // Filling some private fields... GamePath = SelectedGame.GamePath; FullGamePath = SelectedGame.FullGamePath; AppWorkshopDir = SelectedGame.AppWorkshopDir; CloudScreenshotsPath = SelectedGame.CloudScreenshotsPath; // Initializing empty dictionary... CleanupTargets = new Dictionary <string, CleanupTarget>(); // Fetching list of available cleanup targets from XML database file... using (FileStream XMLFS = new FileStream(Path.Combine(FullAppPath, StringsManager.CleanupDatabaseName), FileMode.Open, FileAccess.Read)) { // Loading XML file from file stream... XmlDocument XMLD = new XmlDocument(); XMLD.Load(XMLFS); // Parsing XML and filling our structures... foreach (XmlNode XmlItem in XMLD.SelectNodes("Targets/Target")) { try { CleanupTargets.Add(XmlItem.SelectSingleNode("ID").InnerText, new CleanupTarget(XmlItem.SelectSingleNode("Name").InnerText, GetDirListFromNode(XmlItem, AllowUnsafe))); } catch (Exception Ex) { Logger.Warn(Ex, DebugStrings.AppDbgExCoreClnManConstructor); } } } }
/// <summary> /// ConfigManager class constructor. /// </summary> /// <param name="FullAppPath">Path to SRC Repair installation directory.</param> /// <param name="AppCfgDir">Full path to the local FPS-configs download directory.</param> /// <param name="Destination">Full path FPS-config installation directory.</param> /// <param name="LangPrefix">SRC Repair language code.</param> public ConfigManager(string FullAppPath, string AppCfgDir, string Destination, string LangPrefix) { // Initializing empty dictionary... Configs = new Dictionary <string, FPSConfig>(); FPSConfigInstallPath = Destination; // Fetching list of available FPS-configs from XML database file... using (FileStream XMLFS = new FileStream(Path.Combine(FullAppPath, StringsManager.ConfigDatabaseName), FileMode.Open, FileAccess.Read)) { // Loading XML file from file stream... XmlDocument XMLD = new XmlDocument(); XMLD.Load(XMLFS); // Parsing XML and filling our structures... foreach (XmlNode XmlItem in XMLD.SelectNodes("Configs/Config")) { try { Configs.Add(XmlItem.SelectSingleNode("Name").InnerText, new FPSConfig(XmlItem.SelectSingleNode("Name").InnerText, XmlItem.SelectSingleNode("URI").InnerText, XmlItem.SelectSingleNode("Mirror").InnerText, XmlItem.SelectSingleNode(LangPrefix).InnerText, XmlItem.SelectSingleNode("SupportedGames").InnerText.Split(';'), XmlItem.SelectSingleNode("ArchiveDir").InnerText, GetFilesListFromNode(XmlItem), XmlItem.SelectSingleNode("InstallDir").InnerText, XmlItem.SelectSingleNode("Hash2").InnerText, Path.Combine(AppCfgDir, Path.GetFileName(XmlItem.SelectSingleNode("URI").InnerText)))); } catch (Exception Ex) { Logger.Warn(Ex, DebugStrings.AppDbgExCoreConfManConstructor); } } } }
/// <summary> /// GameManager class constructor. /// </summary> /// <param name="App">CurrentApp class instance.</param> /// <param name="HideUnsupported">Enable or disable adding unsupported games to list.</param> public GameManager(CurrentApp App, bool HideUnsupported = true) { // Creating empty dictionary... SourceGames = new Dictionary <string, SourceGame>(); // Fetching game libraries... List <String> GameDirs = App.SteamClient.FormatInstallDirs(App.Platform.SteamAppsFolderName); // Creating FileStream for XML database... using (FileStream XMLFS = new FileStream(Path.Combine(App.FullAppPath, Properties.Resources.GameListFile), FileMode.Open, FileAccess.Read)) { // Loading XML file from file stream... XmlDocument XMLD = new XmlDocument(); XMLD.Load(XMLFS); // Parsing XML and filling our structures... foreach (XmlNode XmlItem in XMLD.SelectNodes("Games/Game")) { try { if (XmlItem.SelectSingleNode("Enabled").InnerText == "1" || !HideUnsupported) { SourceGame SG = new SourceGame(XmlItem.Attributes["Name"].Value, XmlItem.SelectSingleNode("DirName").InnerText, XmlItem.SelectSingleNode("SmallName").InnerText, XmlItem.SelectSingleNode("Executable").InnerText, XmlItem.SelectSingleNode("SID").InnerText, Convert.ToInt32(XmlItem.SelectSingleNode("SVer").InnerText), XmlItem.SelectSingleNode("VFDir").InnerText, XmlItem.SelectSingleNode("UserDir").InnerText == "1", XmlItem.SelectSingleNode("HUDsAvail").InnerText == "1", App.AppUserDir, App.SteamClient.FullSteamPath, App.Platform.SteamAppsFolderName, App.SteamClient.SteamID, GameDirs, App.Platform.OS); if (SG.IsInstalled) { SourceGames.Add(XmlItem.Attributes["Name"].Value, SG); } } } catch (Exception Ex) { Logger.Warn(Ex, DebugStrings.AppDbgExCoreGameManConstructor); } } } }