private static GraphicPack Process(ZipArchiveEntry entry) { try { var entries = entry.Archive?.Entries; var files = entries?.Where(x => Match(x, entry) && !x.FullName.Contains("Cheats")).ToList(); var rules = files?.Find(x => x.Name.ToLower() == "rules.txt")?.GetString(); var sources = files?.Where(x => !x.Name.ToLower().Contains("rules.txt")).ToList(); if (string.IsNullOrEmpty(rules)) { return(null); } var iniFile = new IniManager(rules); var titleIdsValue = iniFile.GetValue("Definition", "titleIds", null); var nameValue = iniFile.GetValue("Definition", "name", null); if (titleIdsValue == null || nameValue == null) { return(null); } var value = titleIdsValue.ToUpper(); if (string.IsNullOrEmpty(value)) { return(null); } var titleIds = value.Split(','); var name = nameValue.Replace("\"", "").Trim(); var pack = new GraphicPack { Name = name, Rules = rules }; pack.TitleIds.AddRange(titleIds); foreach (var source in sources) { var graphicPackSource = new GraphicPack.GraphicPackSource { FileName = source.Name, Data = source.GetString() }; pack.Sources.Add(graphicPackSource); } return(pack); } catch (Exception e) { TextLog.MesgLog.WriteLog($"{e.Message}\n{e.StackTrace}"); return(null); } }
public static bool LaunchCemu(string game, GraphicPack pack) { try { var cemuPath = Path.Combine(Settings.CemuDirectory, "cemu.exe"); if (game.IsNullOrEmpty() && File.Exists(cemuPath)) { RunCemu(Path.Combine(Settings.CemuDirectory, "cemu.exe"), string.Empty); } else { string rpx = null; var dir = Path.GetDirectoryName(Path.GetDirectoryName(game)); if (string.IsNullOrEmpty(dir)) { return(false); } var files = Directory.GetFiles(dir, "*.rpx", SearchOption.AllDirectories); if (files.Any()) { rpx = files.First(); } if (File.Exists(cemuPath) && File.Exists(rpx)) { pack?.Apply(); RunCemu(cemuPath, rpx); pack?.Remove(); } else { SetStatus("Could not find a valid .rpx"); } } } catch (Exception e) { AppendLog($"{e.Message}\n{e.StackTrace}", Color.DarkRed); return(false); } return(true); }
private async void OnLoadComplete(object sender, EventArgs e) { (sender as DispatcherTimer)?.Stop(); CheckUpdate(); await Task.Run(() => { GraphicPack.Init().Wait(); Database.Load(); Config.SelectedItem = Config.TitleList.Random(); Config.LaunchCemuText = "Launch Cemu"; TextLog.MesgLog.WriteLog($"Game Directory [{Settings.TitleDirectory}]"); }); }