public void OnAfterGameLaunched(IGame game, IAdditionalApplication app, IEmulator emulator) { //serializes json string jsonString = Newtonsoft.Json.JsonConvert.SerializeObject(game); //Check if folder exists, if not, creates. Directory.CreateDirectory(path + "\\obs"); //Write Json to folder File.WriteAllText(path + "\\obs\\game.json", jsonString); //Write individual files File.WriteAllText(path + "\\obs\\title.txt", game.Title); File.WriteAllText(path + "\\obs\\platform.txt", game.Platform); File.WriteAllText(path + "\\obs\\year.txt", game.ReleaseYear.ToString()); File.WriteAllText(path + "\\obs\\publisher.txt", game.Publisher); File.WriteAllText(path + "\\obs\\developer.txt", game.Developer); File.WriteAllText(path + "\\obs\\notes.txt", game.Notes); File.WriteAllText(path + "\\obs\\DetailsWithPlatform.txt", game.DetailsWithPlatform); //Copy Some Images copyFiles(game.ScreenshotImagePath, "screenshot"); copyFiles(game.FrontImagePath, "frontImage"); copyFiles(game.ClearLogoImagePath, "clearlogo"); copyFiles(game.Box3DImagePath, "3dbox"); copyFiles(game.BackImagePath, "backImage"); copyFiles(game.BackImagePath, "backImage"); }
protected virtual void RenameAppTitle(IAdditionalApplication app) { string filename = Path.GetFileNameWithoutExtension(app.ApplicationPath); string discnum = GetDiscNumber(filename); app.Name = "Play Disc " + discnum; }
protected virtual void RenameApp(IAdditionalApplication app) { FileInfo appfile = new FileInfo(app.ApplicationPath); string filename = Path.GetFileNameWithoutExtension(app.ApplicationPath); string discnum = GetDiscNumber(filename); string traknum = GetTrackNumber(filename); string newname = Name + CreateDiscMeta(discnum) + CreateTrackMeta(traknum); FSOperations.Move(appfile, Container.FullName, newname); app.ApplicationPath = appfile.FullName; }
protected virtual bool AppHasCorrectTitle(IAdditionalApplication app) { string filename = Path.GetFileNameWithoutExtension(app.ApplicationPath); string discnum = GetDiscNumber(filename); string expectedTitle = "Play Disc " + discnum; if (app.Name != expectedTitle) { return(false); } return(true); }
/// <summary> /// Verifies if an 'additional app' is properly set up with all the expected arguments. /// </summary> /// <param name="app">The Additional App entry.</param> public static bool IsAppCorrectlySetup(IAdditionalApplication app) { if (app.ApplicationPath != VlcUtilities.GetVlcExecutablePath()) { return(false); } // Checking if the app's command line string is missing any of the VLC arguments expected by our plugin foreach (var expectedArg in _commonVlcArguments) { if (!app.CommandLine.Contains(expectedArg)) { return(false); } } return(true); }
protected virtual bool AppHasCorrectFileName(IAdditionalApplication app) { if (!File.Exists(app.ApplicationPath)) { throw new FileNotFoundException("Additional app (" + app.Name + ") for game " + Game.Title + " not found"); } string filename = Path.GetFileNameWithoutExtension(app.ApplicationPath); string discnum = GetDiscNumber(filename); string traknum = GetTrackNumber(filename); string expectedName = Name + CreateDiscMeta(discnum) + CreateTrackMeta(traknum); if (Path.GetFileNameWithoutExtension(app.ApplicationPath) != expectedName) { return(false); } return(true); }
/// <summary> /// Parses a LaunchBox Game additional application as a Game Video. /// </summary> /// <param name="app"></param> public GameVideo(IAdditionalApplication app) { Title = app.Name.Replace(TitlePrefix, ""); var cmdArgsList = app.CommandLine.Split(' '); VideoPath = cmdArgsList.Last(); var startTimeArg = cmdArgsList.Where(x => x.StartsWith("--start-time=")).SingleOrDefault(); if (!string.IsNullOrEmpty(startTimeArg)) { StartTime = int.Parse(startTimeArg.Replace("--start-time=", "")); } var stopTimeArg = cmdArgsList.Where(x => x.StartsWith("--stop-time=")).SingleOrDefault(); if (!string.IsNullOrEmpty(stopTimeArg)) { StopTime = int.Parse(stopTimeArg.Replace("--stop-time=", "")); } }
public void OnBeforeGameLaunching(IGame game, IAdditionalApplication app, IEmulator emulator) { return; }
public void OnAfterGameLaunched(IGame game, IAdditionalApplication app, IEmulator emulator) { _game = game; _GameId = game.Id; _Started = DateTime.UtcNow; }
public bool TryRemoveAdditionalApplication(IAdditionalApplication additionalApplication) { throw new NotImplementedException(); }
public Result Process(IProgress <ProcessProgress> progress = null) { Result result = new Result(); IDataManager dm = PluginHelper.DataManager; IPlatform platform = dm.GetPlatformByName(Platform); IGame[] games = platform.GetAllGames(true, true); List <IGame> clones = new List <IGame>(); List <IGame> parents = new List <IGame>(); Dictionary <IGame, XmlNode> lb2niMap = new Dictionary <IGame, XmlNode>(); Dictionary <XmlNode, IGame> ni2lbMap = new Dictionary <XmlNode, IGame>(); ProcessProgress state = new ProcessProgress() { TotalGames = games.Length }; Report(progress, state); foreach (IGame game in games) { string path = game.ApplicationPath; string name = Path.GetFileNameWithoutExtension(path); state.CurrentGame = path; try { string md5 = RomIOHelper.GetMD5(path); XmlNode niGame = Md5ToNoIntroMap[md5] ?? NameToNoIntroMap[name]; if (niGame == null) { result.Skipped.Add(Tuple.Create(path, $"md5 ({md5}) doesn't match any entry")); continue; } if (niGame.Attributes["cloneof"] != null) { clones.Add(game); } else { parents.Add(game); } lb2niMap.Add(game, niGame); ni2lbMap.Add(niGame, game); } catch (Exception e) { result.Skipped.Add(Tuple.Create(path, e.Message)); } state.ProcessedGames++; Report(progress, state); } state.GamesScanFinished = true; state.TotalClones = clones.Count; state.CurrentGame = ""; Report(progress, state); foreach (IGame clone in clones) { string path = clone.ApplicationPath; state.CurrentGame = path; dm.TryRemoveGame(clone); string parentName = lb2niMap[clone].Attributes["cloneof"].Value; string cloneName = lb2niMap[clone].Attributes["name"].Value; IGame parent = ni2lbMap[NameToNoIntroMap[parentName]]; IAdditionalApplication additionalApplication = parent.AddNewAdditionalApplication(); additionalApplication.ApplicationPath = clone.ApplicationPath; additionalApplication.Name = $@"Play {cloneName}"; state.ProcessedClones++; Report(progress, state); } state.CloneProcessFinished = true; Report(progress, state); dm.Save(); return(result); }
public void OnBeforeGameLaunching(IGame game, IAdditionalApplication app, IEmulator emulator) { throw new NotImplementedException(); }
/// <summary> /// This method updates an existing Additional App with the current video details. /// </summary> /// <param name="additionalApplication"></param> public void UpdateExistingApp(IAdditionalApplication additionalApplication) { additionalApplication.Name = TitleWithPrefix; additionalApplication.ApplicationPath = VlcUtilities.GetVlcExecutablePath(); additionalApplication.CommandLine = GetVlcCmdArguments(); }
public bool TryRemoveAdditionalApplication(IAdditionalApplication additionalApplication) { return(AdditionalApplications.Remove(additionalApplication)); }