public static bool HasExeForEdition(GameEdition gameEdition) { if (GetLatest(gameEdition) != null) { return(true); } return(false); }
public void Update(GameEdition entity) { if (_db.Entry(entity).State == EntityState.Detached) { _db.GameEditions.Attach(entity); } _db.Entry(entity).State = EntityState.Modified; }
public void Delete(GameEdition entity) { if (_db.Entry(entity).State == EntityState.Detached) { _db.Attach(entity); } _db.GameEditions.Remove(entity); }
public static ConvertDataExe GetLatest(GameEdition gameEdition, bool allowCustom = true) { var candidates = _exeList.Where(x => x.GameEdition == gameEdition); if (!allowCustom) { candidates = candidates.Where(x => !x.IsCustom); } return(candidates.OrderByDescending(x => x.GameVersion).FirstOrDefault()); }
public void ChangeGameEdition(GameEdition edition) { //bool reloadRequired = (this.GameEdition == GameEdition.MSStore && edition != GameEdition.MSStore) || (this.GameEdition != GameEdition.MSStore && edition == GameEdition.MSStore); //this.GameEdition = edition; /*if (reloadRequired) * LoadGameInis();*/ LegacyIniFiles.Instance.Set(LegacyIniFile.Config, "Preferences", "uGameEdition", (int)edition); UpdateLastModifiedDates(); }
public string GetIniPath(LegacyIniFile iniFile, GameEdition edition) { switch (iniFile) { case LegacyIniFile.F76: case LegacyIniFile.F76Prefs: case LegacyIniFile.F76Custom: return(Path.Combine(this.iniParentPath, GetIniName(iniFile, edition))); case LegacyIniFile.Config: return(this.configPath); } return(null); }
private static bool _addFromDirectoryPath(string path, string filename, GameEdition gameEdition) { var directory = new DirectoryInfo(path); var convertData = directory?.GetFiles(filename); if (convertData.FirstOrDefault() != null) { Add(new ConvertDataExe { File = convertData.FirstOrDefault(), GameEdition = gameEdition, }); return(true); } return(false); }
private int GetImageIndex(GameEdition edition) { switch (edition) { case GameEdition.BethesdaNet: case GameEdition.BethesdaNetPTS: return(1); case GameEdition.Steam: return(2); case GameEdition.MSStore: return(3); default: return(0); } }
public static void ChangeGameEdition(GameEdition gameEdition) { Shared.GameEdition = gameEdition; // ManagedMods: ManagedMods.Instance.CopyINILists(); ManagedMods.Instance.Unload(); // IniFiles: IniFiles.Instance.ChangeGameEdition(Shared.GameEdition); SaveGameEdition(); // ManagedMods: Shared.LoadGamePath(); ManagedMods.Instance.Load(); // FormMods: // formMods.UpdateUI(); }
public void BuyGame(GameEdition edition, Member customer, int discount = 0) // Satın alım metodu { edition.Price -= edition.Price * discount / 100; // Olası bir kupona karşı indirim hesaplaması _salesList.Add(new Sale { Name = edition.Name, GameEditionId = edition.Id, CustomerId = customer.Id, Id = sales, Price = edition.Price // Satın alımın satış geçmişi listesine eklenmesi }); sales++; //Yukarıda belirtilen sales değişkeni yeni satış Id'sini belirlemektedir. Console.WriteLine("\n" + customer.Name + ", bought " + edition.Name + " edition for " + edition.Price + " TL\n"); if (!_customerList.Contains(customer)) { _customerList.Add(customer); // Satış yapıldığı için <Member> formatında oluşturulan Customers listesine müşteri kaydedildi // Fakat müşteri liste içerisinde mevcut ise kaydedilmiyor. } }
public static String GetEditionSuffix(GameEdition gameEdition) { switch (gameEdition) { case GameEdition.Steam: return("Steam"); case GameEdition.BethesdaNet: return("BethesdaNet"); case GameEdition.BethesdaNetPTS: return("BethesdaNetPTS"); case GameEdition.MSStore: return("MSStore"); default: return(""); } }
public static string AutoDetectGamePath() { // Search most common installation directories (probably good enough for now): string foundPath = null; string steamPath = @"C:\Program Files(x86)\Steam\steamapps\common\Fallout76"; string bethNetPath = @"C:\Program Files (x86)\Bethesda.net Launcher\games\Fallout76"; string xboxPathC = @"C:\Program Files\ModifiableWindowsApps\Fallout76"; string xboxPathD = @"D:\Program Files\ModifiableWindowsApps\Fallout76"; GameEdition edition = ProfileManager.SelectedGame.Edition; if (edition == GameEdition.Steam && GameInstance.ValidateGamePath(steamPath)) { foundPath = steamPath; } if ((edition == GameEdition.BethesdaNet || edition == GameEdition.BethesdaNetPTS) && GameInstance.ValidateGamePath(bethNetPath)) { foundPath = bethNetPath; } if (edition == GameEdition.MSStore && GameInstance.ValidateGamePath(xboxPathC)) { foundPath = xboxPathC; } if (edition == GameEdition.MSStore && GameInstance.ValidateGamePath(xboxPathD)) { foundPath = xboxPathD; } /* * Registry? I only found this: * Path: Computer\HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\Fallout 76 * Name: Path * Type: REG_SZ * Data: "D:\Bethesda.net\Fallout76" */ return(foundPath); }
public static Bitmap Get128pxBitmap(GameEdition edition) { switch (edition) { case GameEdition.Steam: return(Resources.steam); case GameEdition.BethesdaNet: return(Resources.bethesda); case GameEdition.BethesdaNetPTS: return(Resources.bethesda_pts); case GameEdition.MSStore: //return Resources.msstore; return(Resources.xbox); default: return(Resources.help_128); } }
public static Bitmap Get128pxHoverBitmap(GameEdition edition) { switch (edition) { case GameEdition.Steam: return(Resources.steam_hover); case GameEdition.BethesdaNet: return(Resources.bethesda_hover); case GameEdition.BethesdaNetPTS: return(Resources.bethesda_pts_hover); case GameEdition.MSStore: //return Resources.msstore_hover; return(Resources.xbox_hover); default: return(Resources.help_128_hover); } }
/// <summary> /// Sets the default settings (such as executable name, ini prefix, and launcher url) for the game edition. /// </summary> public void SetDefaultSettings(GameEdition edition) { switch (edition) { case GameEdition.Steam: this.ExecutableName = "Fallout76.exe"; this.IniPrefix = "Fallout76"; this.LauncherURL = "steam://run/1151340"; this.PreferredLaunchOption = LaunchOption.OpenURL; break; case GameEdition.BethesdaNet: this.ExecutableName = "Fallout76.exe"; this.IniPrefix = "Fallout76"; this.LauncherURL = "bethesdanet://run/20"; this.PreferredLaunchOption = LaunchOption.OpenURL; break; case GameEdition.BethesdaNetPTS: this.ExecutableName = "Fallout76.exe"; this.IniPrefix = "Fallout76"; this.LauncherURL = "bethesdanet://run/57"; this.PreferredLaunchOption = LaunchOption.OpenURL; break; case GameEdition.MSStore: this.ExecutableName = "Project76_GamePass.exe"; this.IniPrefix = "Project76"; this.LauncherURL = "ms-windows-store://pdp/?ProductId=9nkgnmnk3k3z"; this.PreferredLaunchOption = LaunchOption.OpenURL; break; default: this.ExecutableName = "Fallout76.exe"; this.IniPrefix = "Fallout76"; this.LauncherURL = ""; this.PreferredLaunchOption = LaunchOption.RunExec; break; } }
public static FormExceptionDialog OpenDialog(Exception ex) { FormExceptionDialog form = new FormExceptionDialog(); try { string currentIniPrefix = "Fallout76"; string currentGamePath = null; GameEdition currentGameEdition = GameEdition.Unknown; if (ProfileManager.SelectedGame != null) { currentIniPrefix = ProfileManager.SelectedGame.IniPrefix; if (ProfileManager.SelectedGame.ValidateGamePath()) { currentGamePath = ProfileManager.SelectedGame.GamePath; } currentGameEdition = ProfileManager.SelectedGame.Edition; } form.textBoxDebugText.Text = $"Operating system: {Utils.GetOSName()} {Utils.GetOSArchitecture()}\r\n" + $"Program version: {Shared.VERSION}\r\n" + $"User agent: {Shared.AppUserAgent}\r\n" + $"Running as admin: " + (Utils.HasAdminRights() ? "Yes" : "No") + "\r\n" + $"Game edition: {currentGameEdition}" + $"System locale: {System.Globalization.CultureInfo.CurrentUICulture.Name}\r\n" + $"App locale: {Localization.Locale}" + "\r\n"; } catch { } form.textBoxDebugText.Text += $"************** Stack trace **************\r\n" + $"If any files are listed (like \"D:\\Workspace\\...\\*.cs:line 123\"):\r\nThose are files on *my* computer, so don't worry if you can't find them.\r\n\r\n" + $"{ex.GetType()}: {ex.Message}\r\n{ex.StackTrace}\r\n"; form.ShowDialog(); return(form); }
public string GetIniName(LegacyIniFile iniFile, GameEdition edition = GameEdition.Unknown) { if (edition == GameEdition.Unknown) { edition = Shared.GameEdition; } bool msstore = edition == GameEdition.MSStore; switch (iniFile) { case LegacyIniFile.F76: return(msstore ? "Project76.ini" : "Fallout76.ini"); case LegacyIniFile.F76Prefs: return(msstore ? "Project76Prefs.ini" : "Fallout76Prefs.ini"); case LegacyIniFile.F76Custom: return(msstore ? "Project76Custom.ini" : "Fallout76Custom.ini"); default: throw new NotSupportedException("Ini name unknown"); } }
public async Task <ActionResult> AddGameEdition(GameAddGameEditionViewModel model, string gameId) { if (string.IsNullOrEmpty(gameId) || !model.gameEditions.Any()) { _notification.AddWarningToastMessage("مقادیر را به درستی وارد نمایید"); return(View(model)); } foreach (var item in model.gameEditions) { var gameEdition = new GameEdition() { GameId = gameId, IsDeleted = false, Price = item.Price, Title = item.Title, CreatedTime = DateTime.Now, LastModifiedTime = DateTime.Now }; await _db.GameEditionRepository.InsertAsync(gameEdition); } _db.SaveChange(); return(RedirectToAction(nameof(Index))); }
public String GetIniName(IniFile iniFile, GameEdition edition = GameEdition.Unknown) { if (edition == GameEdition.Unknown) { edition = Shared.GameEdition; } bool msstore = edition == GameEdition.MSStore; switch (iniFile) { case IniFile.F76: return(msstore ? "Project76.ini" : "Fallout76.ini"); case IniFile.F76Prefs: return(msstore ? "Project76Prefs.ini" : "Fallout76Prefs.ini"); case IniFile.F76Custom: return(msstore ? "Project76Custom.ini" : "Fallout76Custom.ini"); case IniFile.Config: return("QuickConfiguration.ini"); } return(null); }
/// <summary> /// Loads and converts legacy managed mods to the new format. /// It adds them to an already existing ManagedMods object. /// </summary> public static void ConvertLegacy(ManagedMods mods, GameEdition edition, Action <Progress> ProgressChanged = null) { Directory.CreateDirectory(Path.Combine(mods.GamePath, "FrozenData")); XDocument xmlDoc = XDocument.Load(Path.Combine(mods.ModsPath, "manifest.xml")); // I added a doNotImport="true" attribute, so I can check, whether the manifest.xml has only been generated for backwards-compatibility. // If it exists, we can just skip the import: if (xmlDoc.Root.Attribute("doNotImport") != null) { ProgressChanged?.Invoke(Progress.Aborted("Import skipped.")); return; } // Make backups: File.Copy(Path.Combine(mods.ModsPath, "manifest.xml"), Path.Combine(mods.ModsPath, "manifest.old.xml"), true); if (File.Exists(Path.Combine(mods.ModsPath, "managed.xml"))) { File.Copy(Path.Combine(mods.ModsPath, "managed.xml"), Path.Combine(mods.ModsPath, "managed.old.xml"), true); } // Converting the legacy list will completely erase the current mod list: mods.Mods.Clear(); /* * Converting: */ int modCount = xmlDoc.Descendants("Mod").Count(); int modIndex = 0; foreach (XElement xmlMod in xmlDoc.Descendants("Mod")) { modIndex++; if (xmlMod.Attribute("modFolder") == null) { continue; } ManagedMod mod = new ManagedMod(mods.GamePath); string managedFolderName = xmlMod.Attribute("modFolder").Value; string managedFolderPath = Path.Combine(mods.ModsPath, managedFolderName); string frozenArchivePath = Path.Combine(mods.ModsPath, managedFolderName, "frozen.ba2"); bool isFrozen = File.Exists(frozenArchivePath); mod.ManagedFolderName = managedFolderName; if (xmlMod.Attribute("title") != null) { mod.Title = xmlMod.Attribute("title").Value; } string progressTitle = $"Converting \"{mod.Title}\" ({modIndex} of {modCount})"; float progressPercentage = (float)modIndex / (float)modCount; // In case the mod was "frozen" before, // we'll need to move the *.ba2 archive into the FrozenData folder and then extract it. if (isFrozen) { ProgressChanged?.Invoke(Progress.Ongoing($"{progressTitle}: Extracting *.ba2 archive...", progressPercentage)); File.Move(frozenArchivePath, mod.FrozenArchivePath); Archive2.Extract(mod.FrozenArchivePath, managedFolderPath); mod.Frozen = true; mod.Freeze = true; } // OBSOLETE: We need to rename the old folder to fit with the new format. /*if (Directory.Exists(managedFolderPath)) * { * ProgressChanged?.Invoke(Progress.Ongoing($"{progressTitle}: Moving managed folder...", progressPercentage)); * if (Directory.Exists(mod.ManagedFolderPath)) * Directory.Delete(mod.ManagedFolderPath, true); * Directory.Move(managedFolderPath, mod.ManagedFolderPath); * }*/ ProgressChanged?.Invoke(Progress.Ongoing($"{progressTitle}: Parsing XML...", progressPercentage)); if (xmlMod.Attribute("url") != null) { mod.URL = xmlMod.Attribute("url").Value; } if (xmlMod.Attribute("version") != null) { mod.Version = xmlMod.Attribute("version").Value; } if (xmlMod.Attribute("enabled") != null) { try { mod.Deployed = XmlConvert.ToBoolean(xmlMod.Attribute("enabled").Value); } catch { mod.Deployed = false; } mod.Enabled = mod.Deployed; } if (xmlMod.Attribute("installType") != null) { switch (xmlMod.Attribute("installType").Value) { case "Loose": mod.PreviousMethod = ManagedMod.DeploymentMethod.LooseFiles; break; case "SeparateBA2": mod.PreviousMethod = ManagedMod.DeploymentMethod.SeparateBA2; break; case "BA2Archive": // Backward compatibility case "BundledBA2": case "BundledBA2Textures": // Backward compatibility default: mod.PreviousMethod = ManagedMod.DeploymentMethod.BundledBA2; break; } mod.Method = mod.PreviousMethod; } if (xmlMod.Attribute("format") != null) { switch (xmlMod.Attribute("format").Value) { case "General": mod.CurrentFormat = ManagedMod.ArchiveFormat.General; break; case "DDS": // Backward compatibility case "Textures": mod.CurrentFormat = ManagedMod.ArchiveFormat.Textures; break; case "Auto": default: mod.CurrentFormat = ManagedMod.ArchiveFormat.Auto; break; } mod.Format = mod.CurrentFormat; } if (xmlMod.Attribute("compression") != null) { switch (xmlMod.Attribute("compression").Value) { case "Default": // Backward compatibility case "Compressed": mod.CurrentCompression = ManagedMod.ArchiveCompression.Compressed; break; case "None": // Backward compatibility case "Uncompressed": mod.CurrentCompression = ManagedMod.ArchiveCompression.Uncompressed; break; case "Auto": default: mod.CurrentCompression = ManagedMod.ArchiveCompression.Auto; break; } mod.Compression = mod.CurrentCompression; } if (xmlMod.Attribute("archiveName") != null) { mod.CurrentArchiveName = xmlMod.Attribute("archiveName").Value; mod.ArchiveName = mod.CurrentArchiveName; } if (xmlMod.Attribute("root") != null) { mod.CurrentRootFolder = xmlMod.Attribute("root").Value; mod.RootFolder = mod.CurrentRootFolder; foreach (XElement xmlFile in xmlMod.Descendants("File")) { if (xmlFile.Attribute("path") != null) { mod.LooseFiles.Add(xmlFile.Attribute("path").Value); } } } /*if (xmlMod.Attribute("frozen") != null) * { * frozen = XmlConvert.ToBoolean(xmlMod.Attribute("frozen").Value); * }*/ mods.Add(mod); } // Legacy resource list: if (IniFiles.Config.GetBool("Preferences", "bMultipleGameEditionsUsed", false)) { string backedUpList = IniFiles.Config.GetString("Mods", $"sResourceIndexFileList{edition}", ""); string actualList = IniFiles.F76Custom.GetString("Archive", "sResourceIndexFileList", ""); if (backedUpList != "") { mods.Resources.ReplaceRange(ResourceList.FromString(backedUpList)); } else if (actualList != "") { mods.Resources.ReplaceRange(ResourceList.FromString(actualList)); } } ProgressChanged?.Invoke(Progress.Ongoing("Saving XML...", 1f)); mods.Save(); ProgressChanged?.Invoke(Progress.Done("Legacy mods imported.")); }
public void Insert(GameEdition entity) { _db.GameEditions.Add(entity); }
public async Task InsertAsync(GameEdition entity) { await _db.GameEditions.AddAsync(entity); }
public static FileInfo GetFile(GameEdition gameEdition, bool allowCustom = true) { return(GetLatest(gameEdition, allowCustom)?.File); }
public static void LoadGameEdition() { Shared.GameEdition = (GameEdition)(IniFiles.Instance.GetInt(IniFile.Config, "Preferences", "uGameEdition", 0)); }
public static FileInfo GetFile(GameEdition gameEdition, string gameVersion) { throw new NotImplementedException("Getting an EXE by version is not yet implemented"); }
public static String GetGamePathKey(GameEdition gameEdition) { return("sGamePath" + GetEditionSuffix(gameEdition)); }
/// <summary> /// Sets the default settings (such as executable name, ini prefix, and launcher url) for the game edition. /// </summary> public void SetDefaultSettings(GameEdition edition) { switch (edition) { case GameEdition.Steam: this.ExecutableName = "Fallout76.exe"; this.IniPrefix = "Fallout76"; this.LauncherURL = "steam://run/1151340"; this.PreferredLaunchOption = LaunchOption.OpenURL; break; case GameEdition.BethesdaNet: this.ExecutableName = "Fallout76.exe"; this.IniPrefix = "Fallout76"; this.LauncherURL = "bethesdanet://run/20"; this.PreferredLaunchOption = LaunchOption.OpenURL; break; case GameEdition.BethesdaNetPTS: this.ExecutableName = "Fallout76.exe"; this.IniPrefix = "Fallout76"; this.LauncherURL = "bethesdanet://run/57"; this.PreferredLaunchOption = LaunchOption.OpenURL; break; case GameEdition.MSStore: this.ExecutableName = "Project76_GamePass.exe"; this.IniPrefix = "Project76"; /* * Store link: @"ms-windows-store://pdp/?ProductId=9nkgnmnk3k3z" * Launch URL: @"shell:appsfolder\BethesdaSoftworks.Fallout76-PC_3275kfvn8vcwc!Fallout76" * * Found a solution to launch the Xbox version of Fallout 76: * https://stackoverflow.com/questions/32074404/launching-windows-10-store-apps * https://stackoverflow.com/a/67156442 * * Enter in PowerShell: * PS C:\> Get-StartApps * ^ The above will return a list: * * Name AppID * ---- ----- * ... * Fallout 76 BethesdaSoftworks.Fallout76-PC_3275kfvn8vcwc!Fallout76 * * To start the app, enter in CMD: * C:\> explorer shell:appsfolder\BethesdaSoftworks.Fallout76-PC_3275kfvn8vcwc!Fallout76 * * This also works with Process.Start(@"shell:appsfolder\BethesdaSoftworks.Fallout76-PC_3275kfvn8vcwc!Fallout76"); */ this.LauncherURL = @"shell:appsfolder\BethesdaSoftworks.Fallout76-PC_3275kfvn8vcwc!Fallout76"; this.PreferredLaunchOption = LaunchOption.OpenURL; break; default: this.ExecutableName = "Fallout76.exe"; this.IniPrefix = "Fallout76"; this.LauncherURL = ""; this.PreferredLaunchOption = LaunchOption.RunExec; break; } }