public void GetMovie(IMovie m) { _selectedMovie = m; var subs = new SubtitleList(); subs.AddRange(m.Subtitles); for (int x = 0; x < subs.Count; x++) { var s = subs[x]; SubGrid.Rows.Add(); var c = SubGrid.Rows[x].Cells[0]; c.Value = s.Frame; c = SubGrid.Rows[x].Cells[1]; c.Value = s.X; c = SubGrid.Rows[x].Cells[2]; c.Value = s.Y; c = SubGrid.Rows[x].Cells[3]; c.Value = s.Duration; c = SubGrid.Rows[x].Cells[4]; c.Value = String.Format("{0:X8}", s.Color); c.Style.BackColor = Color.FromArgb((int)s.Color); c = SubGrid.Rows[x].Cells[5]; c.Value = s.Message; } }
public virtual void MapToEntity(IMovieModel model, ref IMovie entity, int currentDepth = 1) { currentDepth++; // Assign Base properties NameableEntityMapper.MapToEntity(model, ref entity); // Movie Properties entity.HasStaffReview = model.HasStaffReview; entity.Distributor = model.Distributor; entity.BoxOfficeRevenue = model.BoxOfficeRevenue; entity.TotalRevenue = model.TotalRevenue; entity.Budget = model.Budget; entity.Rating = model.Rating; entity.ReleaseDate = model.ReleaseDate; entity.RunTime = model.RunTime; // Related Objects entity.PrimaryImageFileId = model.PrimaryImageFileId; entity.PrimaryImageFile = (ImageFile)model.PrimaryImageFile?.MapToEntity(); // Associated Objects entity.MovieCharacters = model.MovieCharacters?.Where(i => i.Active).Select(MovieCharacterMapperExtensions.MapToEntity).ToList(); entity.MovieConcepts = model.MovieConcepts?.Where(i => i.Active).Select(MovieConceptMapperExtensions.MapToEntity).ToList(); entity.MovieLocations = model.MovieLocations?.Where(i => i.Active).Select(MovieLocationMapperExtensions.MapToEntity).ToList(); entity.MovieObjects = model.MovieObjects?.Where(i => i.Active).Select(MovieObjectMapperExtensions.MapToEntity).ToList(); entity.MovieProducers = model.MovieProducers?.Where(i => i.Active).Select(MovieProducerMapperExtensions.MapToEntity).ToList(); entity.MovieStoryArcs = model.MovieStoryArcs?.Where(i => i.Active).Select(MovieStoryArcMapperExtensions.MapToEntity).ToList(); entity.MovieStudios = model.MovieStudios?.Where(i => i.Active).Select(MovieStudioMapperExtensions.MapToEntity).ToList(); entity.MovieTeams = model.MovieTeams?.Where(i => i.Active).Select(MovieTeamMapperExtensions.MapToEntity).ToList(); entity.MovieWriters = model.MovieWriters?.Where(i => i.Active).Select(MovieWriterMapperExtensions.MapToEntity).ToList(); }
public void StartNewMovie(IMovie movie, bool record) { Global.MovieSession.QueueNewMovie(movie, record); LoadRom(GlobalWin.MainForm.CurrentlyOpenRom); Global.Config.RecentMovies.Add(movie.Filename); if (Global.MovieSession.Movie.StartsFromSavestate) { if (Global.MovieSession.Movie.TextSavestate != null) { Global.Emulator.LoadStateText(new StringReader(Global.MovieSession.Movie.TextSavestate)); } else { Global.Emulator.LoadStateBinary(new BinaryReader(new MemoryStream(Global.MovieSession.Movie.BinarySavestate, false))); } Global.Emulator.ResetCounters(); } Global.MovieSession.RunQueuedMovie(record); SetMainformMovieInfo(); UpdateStatusSlots(); GlobalWin.Tools.Restart<VirtualpadTool>(); GlobalWin.DisplayManager.NeedsToPaint = true; }
/// <summary> /// Setup the movie /// </summary> protected override void GivenThat() { base.GivenThat(); this._movie = Mock<IMovie>(); this._handler = Mock<EventHandler<MediaLibraryArgs>>(); }
private double Fps(IMovie movie) { var system = movie.HeaderEntries[HeaderKeys.PLATFORM]; var pal = movie.HeaderEntries.ContainsKey(HeaderKeys.PAL) && movie.HeaderEntries[HeaderKeys.PAL] == "1"; return this[system, pal]; }
/// <summary> /// Setup the movie /// </summary> protected override void GivenThat() { base.GivenThat(); this._movie = MockIt(this._movie); this._handler = MockIt(this._handler); }
/// <summary> /// Setup the movie and poster /// </summary> protected override void GivenThat() { base.GivenThat(); this._movie = Mock<IMovie>(); Dep<IPosterService>().Stub(s => s.FindPoster(this._movie)).Return("MyPoster"); }
/// <summary> /// Adds a movie to the library /// </summary> /// <param name="movie">Movie to add</param> public void Add(IMovie movie) { var stars = this._critic.Rate(movie); if (stars > 2) { this._contents.Add(movie); this._notifier.Notify(movie, stars); } }
/// <summary> /// Setup the movie to be added and the session /// </summary> protected override void GivenThat() { base.GivenThat(); this._movie = MockIt(this._movie); Stub<ISessionFactory, ISession>(factory => factory.OpenSession()); Stub<ISession, ITransaction>(s => s.BeginTransaction()); }
/// <summary> /// Resolve the service /// </summary> protected override void WhenIRun() { var dictionary = new Dictionary<string, object>() { { "title", "Blazing Saddles" }, { "date", new DateTime(2010, 01, 01) } }; this._actual = this.Sut.Resolve<IMovie>(dictionary); }
public TimeSpan MovieTime(IMovie movie) { var dblseconds = GetSeconds(movie); var seconds = (int)(dblseconds % 60); var days = seconds / 86400; var hours = seconds / 3600; var minutes = (seconds / 60) % 60; var milliseconds = (int)((dblseconds - seconds) * 1000); return new TimeSpan(days, hours, minutes, seconds, milliseconds); }
/// <summary> /// Register a movie /// </summary> protected override void AndGivenThatAfterCreated() { base.AndGivenThatAfterCreated(); this.Sut.Register(Component.For<IMovie>() .Instance(this._expected = Mock<IMovie>()) .Named("Blazing"), Component.For<IMovie>() .ImplementedBy<DummyMovie>() .Named("YoungF")); }
private double GetSeconds(IMovie movie) { double frames = movie.InputLogLength; if (frames < 1) { return 0; } return frames / Fps(movie); }
public void Before_Each_Test() { _critic = MockRepository.GenerateMock<IMovieCritic>(); // By default a dynamic mock returns false _movie1 = MockRepository.GenerateMock<IMovie>(); _movie2 = MockRepository.GenerateMock<IMovie>(); _movie3 = MockRepository.GenerateMock<IMovie>(); _sut = new MovieLibrary(_critic); }
/// <summary> /// Gets the critic opinion /// </summary> /// <param name="movie"></param> /// <returns></returns> public string Review(IMovie movie) { var result = "Needs more Bacon!"; if (movie.Title.ToLower().IndexOf("bacon") > 0) { result = "Awesome movie! Loved the Bacon part!"; } return result; }
/// <summary> /// Setup the movie /// </summary> protected override void GivenThat() { base.GivenThat(); this._movie = Mock<IMovie>(); this._expected = "Blazing Saddles.png"; this.Dep<IPosterService>() .Stub(srv => srv.Find(this._movie)) .Return(_expected); }
/// <summary> /// Setup the movie /// </summary> protected override void GivenThat() { base.GivenThat(); // Create all the dependencies this._critic = new MockMovieCritic(); this._notifier = new MockSocialMediaNotifier(); // Initialize the SUT this.Sut = new MovieLibrary(this._critic, this._notifier); this._movie = new MockMovie(); }
private Boolean AreShowsSame(IMovie movie1, IMovie movie2) { // Check if show has details extracted. if(!movie1.HasDetails) { throw new Exception(String.Format("Show1 must have details extracted for comparison. {0}", movie1.MediaFile.FullName)); } if(!movie2.HasDetails) { throw new Exception(String.Format("Show2 must have details extracted for comparison. {0}", movie2.MediaFile.FullName)); } return string.Compare(movie1.Name, movie2.Name, StringComparison.InvariantCultureIgnoreCase)==0 && (movie1.Year == movie2.Year); }
public MovieZone(IMovie movie, int start, int length, string key = "") { Bk2LogEntryGenerator lg = Global.MovieSession.LogGeneratorInstance() as Bk2LogEntryGenerator; lg.SetSource(Global.MovieSession.MovieControllerAdapter); targetController = new Bk2ControllerAdapter(); targetController.Type = Global.Emulator.ControllerDefinition; targetController.LatchFromSource(targetController); // Reference and create all buttons if (key == "") key = lg.GenerateLogKey(); key = key.Replace("LogKey:", "").Replace("#", ""); key = key.Substring(0, key.Length - 1); _inputKey = key; Length = length; _log = new string[length]; // Get a IController that only contains buttons in key. string[] keys = key.Split('|'); ControllerDefinition d = new ControllerDefinition(); for (int i = 0; i < keys.Length; i++) { if (Global.Emulator.ControllerDefinition.BoolButtons.Contains(keys[i])) d.BoolButtons.Add(keys[i]); else d.FloatControls.Add(keys[i]); } controller = new Bk2ControllerAdapter() { Type = d }; Bk2LogEntryGenerator logGenerator = new Bk2LogEntryGenerator(""); logGenerator.SetSource(controller); logGenerator.GenerateLogEntry(); // Reference and create all buttons. string movieKey = logGenerator.GenerateLogKey().Replace("LogKey:", "").Replace("#", ""); movieKey = movieKey.Substring(0, movieKey.Length - 1); if (key == movieKey) { for (int i = 0; i < length; i++) _log[i] = movie.GetInputLogEntry(i + start); } else { for (int i = 0; i < length; i++) { controller.LatchFromSource(movie.GetInputState(i + start)); _log[i] = logGenerator.GenerateLogEntry(); } } }
public void GetMovie(IMovie m) { _selectedMovie = m; if (!m.Comments.Any()) { return; } for (int i = 0; i < m.Comments.Count; i++) { CommentGrid.Rows.Add(); var c = CommentGrid.Rows[i].Cells[0]; c.Value = m.Comments[i]; } }
public virtual bool AreEqual(IMovieModel model, IMovie entity) { return NameableEntityMapper.AreEqual(model, entity) // Movie Properties && model.HasStaffReview == entity.HasStaffReview && model.Distributor == entity.Distributor && model.BoxOfficeRevenue == entity.BoxOfficeRevenue && model.TotalRevenue == entity.TotalRevenue && model.Budget == entity.Budget && model.Rating == entity.Rating && model.ReleaseDate == entity.ReleaseDate && model.RunTime == entity.RunTime // Related Objects && model.PrimaryImageFileId == entity.PrimaryImageFileId ; }
public void GetMovie(IMovie m) { _selectedMovie = m; if (m.Comments.Count == 0) return; for (int i = 0; i < m.Comments.Count; i++) { var str = m.Comments[i]; if (str.Length >= 7 && str.Substring(0, 7) == "comment") { str = str.Remove(0, 7); } CommentGrid.Rows.Add(); var c = CommentGrid.Rows[i].Cells[0]; c.Value = str; } }
public static TasMovie ToTasMovie(this IMovie old) { var newFilename = old.Filename + "." + TasMovie.Extension; var tas = new TasMovie(newFilename); tas.HeaderEntries.Clear(); foreach (var kvp in old.HeaderEntries) { tas.HeaderEntries[kvp.Key] = kvp.Value; } tas.SyncSettingsJson = old.SyncSettingsJson; tas.Comments.Clear(); foreach (var comment in old.Comments) { tas.Comments.Add(comment); } tas.Subtitles.Clear(); foreach (var sub in old.Subtitles) { tas.Subtitles.Add(sub); } tas.TextSavestate = old.TextSavestate; tas.BinarySavestate = old.BinarySavestate; for (var i = 0; i < old.InputLogLength; i++) { var input = old.GetInputState(i); tas.AppendFrame(input); } return(tas); }
private bool StartNewMovieWrapper(bool record, IMovie movie = null) { _initializing = true; if (movie == null) { movie = CurrentTasMovie; } SetTasMovieCallbacks(movie as TasMovie); bool result = Mainform.StartNewMovie(movie, record); if (result) { CurrentTasMovie.TasStateManager.Capture(); // Capture frame 0 always. BookMarkControl.UpdateTextColumnWidth(); } TastudioPlayMode(); _initializing = false; return result; }
/// <summary> /// Set the movie /// </summary> /// <param name="movie">Movie</param> public async Task SetMovieAsync(IMovie movie) { var watch = Stopwatch.StartNew(); try { var movieToUpdate = User.MovieHistory.FirstOrDefault(a => a.ImdbId == movie.ImdbCode); if (movieToUpdate == null) { User.MovieHistory.Add(new MovieHistory { ImdbId = movie.ImdbCode, Favorite = movie.IsFavorite, Seen = movie.HasBeenSeen }); } else { movieToUpdate.Seen = movie.HasBeenSeen; movieToUpdate.Favorite = movie.IsFavorite; } await UpdateUser(User).ConfigureAwait(false); } catch (Exception exception) { Logger.Error( $"SetMovieAsync: {exception.Message}"); } finally { watch.Stop(); var elapsedMs = watch.ElapsedMilliseconds; Logger.Debug( $"SetMovieAsync ({movie.ImdbCode}) in {elapsedMs} milliseconds."); } }
public D3DMovieTexture(string texturename) : base(texturename, true, (TextureManager.Instance as D3DTextureManager).Device) { materialnames = new List <string>(); codec = null; movie = null; parameters = new Hashtable(); codecname = null; moviename = null; path = null; alt = null; loadcount = 0; stopload = false; if (TextureManager.Instance.GetByName(texturename) != null) { log.ErrorFormat("MovieD3DTexture: A texture already exists in the system named {0}, not replacing it.", texturename); } else { TextureManager.Instance.Add(this); } }
public static IMovie ToBk2(this IMovie old) { var bk2 = MovieService.Get(old.Filename.Replace(old.PreferredExtension, Bk2Movie.Extension)); for (var i = 0; i < old.InputLogLength; i++) { var input = old.GetInputState(i); bk2.AppendFrame(input); } bk2.HeaderEntries.Clear(); foreach (var kvp in old.HeaderEntries) { bk2.HeaderEntries[kvp.Key] = kvp.Value; } bk2.SyncSettingsJson = old.SyncSettingsJson; bk2.Comments.Clear(); foreach (var comment in old.Comments) { bk2.Comments.Add(comment); } bk2.Subtitles.Clear(); foreach (var sub in old.Subtitles) { bk2.Subtitles.Add(sub); } bk2.TextSavestate = old.TextSavestate; bk2.BinarySavestate = old.BinarySavestate; bk2.SaveRam = old.SaveRam; return(bk2); }
public async Task <NewProjectionSummary> NewAsync(IProjectionCreation proj) { IEnumerable <IProjection> movieProjectionsInRoom = await projectRepo.GetActiveProjectionsAsync(proj.RoomId); IProjection nextProjection = movieProjectionsInRoom.Where(x => x.StartDate > proj.StartDate) .OrderBy(x => x.StartDate) .FirstOrDefault(); if (nextProjection != null) { IMovie curMovie = await movieRepo.GetByIdAsync(proj.MovieId); IMovie nextProjectionMovie = await movieRepo.GetByIdAsync(nextProjection.MovieId); DateTime curProjectionEndTime = proj.StartDate.AddMinutes(curMovie.DurationMinutes); if (curProjectionEndTime >= nextProjection.StartDate) { return(new NewProjectionSummary(false, $"Projection overlaps with next one: {nextProjectionMovie.Name} at {nextProjection.StartDate}")); } } return(await newProj.NewAsync(proj)); }
public static ITasMovie ToTasMovie(this IMovie old) { string newFilename = ConvertFileNameToTasMovie(old.Filename); var tas = (ITasMovie)old.Session.Get(newFilename); tas.CopyLog(old.GetLogEntries()); old.Truncate(0); // Trying to minimize ram usage tas.HeaderEntries.Clear(); foreach (var kvp in old.HeaderEntries) { tas.HeaderEntries[kvp.Key] = kvp.Value; } tas.SyncSettingsJson = old.SyncSettingsJson; tas.Comments.Clear(); foreach (var comment in old.Comments) { tas.Comments.Add(comment); } tas.Subtitles.Clear(); foreach (var sub in old.Subtitles) { tas.Subtitles.Add(sub); } tas.StartsFromSavestate = old.StartsFromSavestate; tas.TextSavestate = old.TextSavestate; tas.BinarySavestate = old.BinarySavestate; tas.SaveRam = old.SaveRam; return(tas); }
public bool StartNewMovie(IMovie movie, bool record) { if (movie == null) { throw new ArgumentNullException($"{nameof(movie)} cannot be null."); } try { MovieSession.QueueNewMovie(movie, record, Emulator.SystemId, Config.PreferredCores); } catch (MoviePlatformMismatchException ex) { using var ownerForm = new Form { TopMost = true }; MessageBox.Show(ownerForm, ex.Message, "Movie/Platform Mismatch", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } if (!_isLoadingRom) { RebootCore(); } Config.RecentMovies.Add(movie.Filename); MovieSession.RunQueuedMovie(record, Emulator, Config.PreferredCores); SetMainformMovieInfo(); if (MovieSession.Movie.Hash != Game.Hash) { AddOnScreenMessage("Warning: Movie hash does not match the ROM"); } return(!Emulator.IsNull()); }
public static string SaveRamAbsolutePath(this PathEntryCollection collection, IGameInfo game, IMovie movie) { var name = game.FilesystemSafeName(); if (movie.IsActive()) { name += $".{Path.GetFileNameWithoutExtension(movie.Filename)}"; } var pathEntry = collection[game.System, "Save RAM"] ?? collection[game.System, "Base"]; return($"{Path.Combine(collection.AbsolutePathFor(pathEntry.Path, game.System), name)}.SaveRAM"); }
public MovieController(IConfiguration config, IWebHostEnvironment hostingEnvironment, IMovie movieService) { _config = config; _movieService = movieService; _hostingEnvironment = hostingEnvironment; posterFolderPath = Path.Combine(_hostingEnvironment.ContentRootPath, "Poster"); }
public void Initialize() { _movieBase = new Movie("1", "Deadpool 2", 2018, 8.5m); }
// TODO: This doesn't really belong here, but not sure where to put it public static void PopulateWithDefaultHeaderValues(this IMovie movie, string author = null) { movie.Author = author ?? Global.Config.DefaultAuthor; movie.EmulatorVersion = VersionInfo.GetEmuVersion(); movie.SystemID = Global.Emulator.SystemId; var settable = new SettingsAdapter(Global.Emulator); if (settable.HasSyncSettings) { movie.SyncSettingsJson = ConfigService.SaveWithType(settable.GetSyncSettings()); } if (Global.Game != null) { movie.GameName = PathManager.FilesystemSafeName(Global.Game); movie.Hash = Global.Game.Hash; if (Global.Game.FirmwareHash != null) { movie.FirmwareHash = Global.Game.FirmwareHash; } } else { movie.GameName = "NULL"; } if (Global.Emulator.BoardName != null) { movie.BoardName = Global.Emulator.BoardName; } if (Global.Emulator.HasRegions()) { var region = Global.Emulator.AsRegionable().Region; if (region == Emulation.Common.DisplayType.PAL) { movie.HeaderEntries.Add(HeaderKeys.PAL, "1"); } } if (Global.FirmwareManager.RecentlyServed.Any()) { foreach (var firmware in Global.FirmwareManager.RecentlyServed) { var key = firmware.SystemId + "_Firmware_" + firmware.FirmwareId; if (!movie.HeaderEntries.ContainsKey(key)) { movie.HeaderEntries.Add(key, firmware.Hash); } } } if (Global.Emulator is Gameboy && (Global.Emulator as Gameboy).IsCGBMode()) { movie.HeaderEntries.Add("IsCGBMode", "1"); } if (Global.Emulator is SMS && (Global.Emulator as SMS).IsSG1000) { movie.HeaderEntries.Add("IsSGMode", "1"); } if (Global.Emulator is GPGX && (Global.Emulator as GPGX).IsSegaCD) { movie.HeaderEntries.Add("IsSegaCDMode", "1"); } movie.Core = ((CoreAttributes)Attribute .GetCustomAttribute(Global.Emulator.GetType(), typeof(CoreAttributes))) .CoreName; }
public static bool NotActive(this IMovie movie) => movie == null || movie.Mode == MovieMode.Inactive;
/// <summary> /// Adds a movie to the library /// </summary> /// <param name="movie">Movie to add</param> public void Add(IMovie movie) { this._contents.Add(movie); this.Added(this, new MediaLibraryArgs { Movie = movie }); }
public static bool IsPlayingOrRecording(this IMovie movie) => movie?.Mode == MovieMode.Play || movie?.Mode == MovieMode.Record;
public static bool IsFinished(this IMovie movie) => movie.Mode == MovieMode.Finished;
/// <summary> /// Generate the review /// </summary> /// <param name="builder"></param> /// <param name="critic"></param> /// <param name="movie"></param> /// <returns></returns> private static StringBuilder CriticReview(StringBuilder builder, IMovieCritic critic, IMovie movie) { const string CriticOpinion = "{0} says on {1}: {2}"; return(builder .AppendFormat(CriticOpinion, critic.Name, movie.Title, critic.Review(movie)) .AppendLine()); }
public override void Load() { if (!Param.ContainsKey("PPDGameUtility")) { throw new PPDException(PPDExceptionType.SkinIsNotCorrectlyImplemented); } ppdgameutility = Param["PPDGameUtility"] as PPDGameUtility; currentLatency = ppdgameutility.SongInformation.Latency; if (Param.ContainsKey("ExitOnReturn")) { exitonreturn = true; } if (Param.ContainsKey("StartTime")) { ppdgameutility.IsDebug = true; startTime = (float)Param["StartTime"] - 3; mmStartTime = (float)Param["StartTime"]; } else if (Param.ContainsKey("StartTimeEx")) { ppdgameutility.IsDebug = true; startTime = (float)Param["StartTimeEx"]; mmStartTime = (float)Param["StartTimeEx"]; } else { startTime = ppdgameutility.SongInformation.StartTime; mmStartTime = startTime; } black = new PictureObject("img\\default\\black.png", 0, 0, false, ResourceManager, Device); black.Alpha = 0; black.Hidden = true; string moviefile = ppdgameutility.SongInformation.MoviePath; #if x64 if (Path.GetExtension(moviefile) == ".mp4") { PlatformGap = 0.03f; } #endif if (moviefile != "") { m = GameHost.GetMovie(moviefile); try { if (m.Initialize() == -1) { throw new PPDException(PPDExceptionType.CannotOpenMovie); } readmoviesetting(); initialized = true; } catch (Exception e) { MessageBox.Show(e.Message); initialized = false; ReturnToMenu(); return; } } else { MessageBox.Show("No moviefile"); black.Hidden = false; if (exitonreturn) { Application.Exit(); } else { ReturnToMenu(); return; } } keychange = new int[(int)ButtonType.Start]; for (int i = 0; i < keychange.Length; i++) { keychange[i] = i; } if (ppdgameutility.Random) { randomchange(); } readprofile(); hm = new HoldManager(Device, ResourceManager); hm.ScoreGained += new HoldManager.GainScoreEventHandler(hm_ScoreGained); ppdem = new PPDEffectManager(Device, ResourceManager); km = new KasiManager(ppdgameutility); km.KasiChanged += new KasiManager.KasiChangeEventHandler(km_KasiChanged); cgi = GameHost.GetCGameInterface(); cgi.PPDGameUtility = ppdgameutility; cgi.ResourceManager = ResourceManager; cgi.Load(); sm = new SoundManager(Sound as ExSound, ppdgameutility); if (ppdgameutility.SongInformation.IsOld) { em = new EventManager(ppdgameutility); mm = new MarkManager(Device, em, ppdgameutility, keychange, ppdem, GameHost.GetMarkImagePath(), ResourceManager); } else { string path = Path.Combine(ppdgameutility.SongInformation.DirectoryPath, DifficultyUtility.ConvertDifficulty(ppdgameutility.Difficulty) + ".ppd"); PackReader reader = new PackReader(path); PPDPackStreamReader ppdpsr = reader.Read("evd"); em = new EventManager(ppdgameutility, ppdpsr); ppdpsr.Close(); ppdpsr = reader.Read("ppd"); mm = new MarkManager(Device, em, ppdgameutility, keychange, ppdem, GameHost.GetMarkImagePath(), ppdpsr, ResourceManager); ppdpsr.Close(); reader.Close(); } grm = new GameResultManager(); gr = GameHost.GetGameResult(); gr.PPDGameUtility = ppdgameutility; gr.ResourceManager = ResourceManager; gr.TweetManager = this; gr.Load(); pd = GameHost.GetPauseMenu(); pd.PPDGameUtility = ppdgameutility; pd.ResourceManager = ResourceManager; pd.Load(); pd.Resumed += new EventHandler(pd_Resumed); pd.Retryed += new EventHandler(pd_Retryed); pd.Returned += new EventHandler(pd_Returned); pd.LatencyChanged += new ChangeLatencyEventHandler(pd_LatencyChanged); gr.Retryed += new EventHandler(this.Retry); gr.Returned += new EventHandler(this.Return); mm.ChangeCombo += new MarkManager.ChangeComboHandler(mm_ChangeCombo); mm.PlaySound += new MarkManager.SpecialSoundHandler(this.SpecialPlaySound); mm.StopSound += new MarkManager.SpecialSoundHandler(this.SpecialStopSound); mm.EvaluateCount += new MarkManager.EvaluateCountHandler(this.EvaluateCount); mm.PressingButton += new MarkManager.PressingButtonHandler(mm_PressingButton); em.ChangeMovieVolume += new EventManager.VolumeHandler(ChangeMovieVolume); //seek mm.Seek(mmStartTime); em.Seek(startTime > 0 ? startTime : 0); sm.Seek(startTime); km.Seek(startTime); if (m != null && m.Initialized) { m.Play(); m.Pause(); m.Seek(startTime); } if (startTime < 0) { waitingmoviestart = true; lasttime = Win32API.timeGetTime(); } else { if (m != null && m.Initialized) { m.Play(); } } this.AddChild(black); }
public static string AutoSaveRamAbsolutePath(this PathEntryCollection collection, IGameInfo game, IMovie movie) { var path = collection.SaveRamAbsolutePath(game, movie); return(path.Insert(path.Length - 8, ".AutoSaveRAM")); }
// TODO: This doesn't really belong here, but not sure where to put it public static void PopulateWithDefaultHeaderValues( this IMovie movie, IEmulator emulator, IGameInfo game, FirmwareManager firmwareManager, string author) { movie.Author = author; movie.EmulatorVersion = VersionInfo.GetEmuVersion(); movie.OriginalEmulatorVersion = VersionInfo.GetEmuVersion(); movie.SystemID = emulator.SystemId; var settable = new SettingsAdapter(emulator); if (settable.HasSyncSettings) { movie.SyncSettingsJson = ConfigService.SaveWithType(settable.GetSyncSettings()); } if (game.IsNullInstance()) { movie.GameName = "NULL"; } else { movie.GameName = game.FilesystemSafeName(); movie.Hash = game.Hash; if (game.FirmwareHash != null) { movie.FirmwareHash = game.FirmwareHash; } } if (emulator.HasBoardInfo()) { movie.BoardName = emulator.AsBoardInfo().BoardName; } if (emulator.HasRegions()) { var region = emulator.AsRegionable().Region; if (region == Emulation.Common.DisplayType.PAL) { movie.HeaderEntries.Add(HeaderKeys.Pal, "1"); } } if (firmwareManager.RecentlyServed.Any()) { foreach (var firmware in firmwareManager.RecentlyServed) { var key = $"{firmware.SystemId}_Firmware_{firmware.FirmwareId}"; if (!movie.HeaderEntries.ContainsKey(key)) { movie.HeaderEntries.Add(key, firmware.Hash); } } } if (emulator is GBHawk gbHawk && gbHawk.IsCGBMode()) { movie.HeaderEntries.Add("IsCGBMode", "1"); } if (emulator is SubGBHawk subgbHawk) { if (subgbHawk._GBCore.IsCGBMode()) { movie.HeaderEntries.Add("IsCGBMode", "1"); } movie.HeaderEntries.Add(HeaderKeys.CycleCount, "0"); } if (emulator is Gameboy gb) { if (gb.IsCGBMode()) { movie.HeaderEntries.Add("IsCGBMode", "1"); } movie.HeaderEntries.Add(HeaderKeys.CycleCount, "0"); } if (emulator is SMS sms) { if (sms.IsSG1000) { movie.HeaderEntries.Add("IsSGMode", "1"); } if (sms.IsGameGear) { movie.HeaderEntries.Add("IsGGMode", "1"); } } if (emulator is GPGX gpgx && gpgx.IsMegaCD) { movie.HeaderEntries.Add("IsSegaCDMode", "1"); } if (emulator is PicoDrive pico && pico.Is32XActive) { movie.HeaderEntries.Add("Is32X", "1"); } if (emulator is SubNESHawk) { movie.HeaderEntries.Add(HeaderKeys.VBlankCount, "0"); } movie.Core = ((CoreAttribute)Attribute .GetCustomAttribute(emulator.GetType(), typeof(CoreAttribute))) .CoreName; }
public void QueueNewMovie(IMovie movie, bool record, IEmulator emulator) { if (!record) // The semantics of record is that we are starting a new movie, and even wiping a pre-existing movie with the same path, but non-record means we are loading an existing movie into playback mode { movie.Load(false); if (movie.SystemID != emulator.SystemId) { throw new MoviePlatformMismatchException( $"Movie system Id ({movie.SystemID}) does not match the currently loaded platform ({emulator.SystemId}), unable to load"); } } // Note: this populates MovieControllerAdapter's Type with the approparite controller // Don't set it to a movie instance of the adapter or you will lose the definition! InputManager.RewireInputChain(); if (!record && emulator.SystemId == "NES") // For NES we need special logic since the movie will drive which core to load { var quicknesName = ((CoreAttribute)Attribute.GetCustomAttribute(typeof(QuickNES), typeof(CoreAttribute))).CoreName; var neshawkName = ((CoreAttribute)Attribute.GetCustomAttribute(typeof(NES), typeof(CoreAttribute))).CoreName; // If either is specified use that, else use whatever is currently set if (movie.Core == quicknesName) { PreviousNES_InQuickNES = Global.Config.NES_InQuickNES; Global.Config.NES_InQuickNES = true; } else if (movie.Core == neshawkName) { PreviousNES_InQuickNES = Global.Config.NES_InQuickNES; Global.Config.NES_InQuickNES = false; } } else if (!record && emulator.SystemId == "SNES") // ditto with snes9x vs bsnes { var snes9xName = ((CoreAttribute)Attribute.GetCustomAttribute(typeof(Snes9x), typeof(CoreAttribute))).CoreName; var bsnesName = ((CoreAttribute)Attribute.GetCustomAttribute(typeof(LibsnesCore), typeof(CoreAttribute))).CoreName; if (movie.Core == snes9xName) { PreviousSNES_InSnes9x = Global.Config.SNES_InSnes9x; Global.Config.SNES_InSnes9x = true; } else if (movie.Core == bsnesName) { PreviousSNES_InSnes9x = Global.Config.SNES_InSnes9x; Global.Config.SNES_InSnes9x = false; } } else if (!record && emulator.SystemId == "GBA") // ditto with GBA, we should probably architect this at some point, this isn't sustainable { var mGBAName = ((CoreAttribute)Attribute.GetCustomAttribute(typeof(MGBAHawk), typeof(CoreAttribute))).CoreName; var vbaNextName = ((CoreAttribute)Attribute.GetCustomAttribute(typeof(VBANext), typeof(CoreAttribute))).CoreName; if (movie.Core == mGBAName) { PreviousGBA_UsemGBA = Global.Config.GBA_UsemGBA; Global.Config.GBA_UsemGBA = true; } else if (movie.Core == vbaNextName) { PreviousGBA_UsemGBA = Global.Config.GBA_UsemGBA; Global.Config.GBA_UsemGBA = false; } } if (record) // This is a hack really, we need to set the movie to its propert state so that it will be considered active later { movie.SwitchToRecord(); } else { movie.SwitchToPlay(); } QueuedMovie = movie; }
public bool StartNewMovie(IMovie movie, bool record) { // SuuperW: Check changes. adelikat: this could break bk2 movies // TODO: Clean up the saving process if (movie.IsActive && (movie.Changes || !(movie is TasMovie))) { movie.Save(); } try { Global.MovieSession.QueueNewMovie(movie, record, Global.Emulator); } catch (MoviePlatformMismatchException ex) { MessageBox.Show(this, ex.Message, "Movie/Platform Mismatch", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } LoadRom(CurrentlyOpenRom); if (Global.MovieSession.PreviousNES_InQuickNES.HasValue) { Global.Config.NES_InQuickNES = Global.MovieSession.PreviousNES_InQuickNES.Value; Global.MovieSession.PreviousNES_InQuickNES = null; } if (Global.MovieSession.PreviousSNES_InSnes9x.HasValue) { Global.Config.SNES_InSnes9x = Global.MovieSession.PreviousSNES_InSnes9x.Value; Global.MovieSession.PreviousSNES_InSnes9x = null; } Global.Config.RecentMovies.Add(movie.Filename); if (Global.Emulator.HasSavestates() && movie.StartsFromSavestate) { if (movie.TextSavestate != null) { Global.Emulator.AsStatable().LoadStateText(new StringReader(movie.TextSavestate)); } else { Global.Emulator.AsStatable().LoadStateBinary(new BinaryReader(new MemoryStream(movie.BinarySavestate, false))); } if (movie.SavestateFramebuffer != null) { var b1 = movie.SavestateFramebuffer; var b2 = Global.Emulator.VideoProvider().GetVideoBuffer(); int len = Math.Min(b1.Length, b2.Length); for (int i = 0; i < len; i++) { b2[i] = b1[i]; } } Global.Emulator.ResetCounters(); } Global.MovieSession.RunQueuedMovie(record); SetMainformMovieInfo(); GlobalWin.Tools.Restart <VirtualpadTool>(); GlobalWin.DisplayManager.NeedsToPaint = true; return(true); }
public bool StartNewMovie(IMovie movie, bool record) { // SuuperW: Check changes. adelikat: this could break bk2 movies // TODO: Clean up the saving process if (movie.IsActive && (movie.Changes || !(movie is TasMovie))) { movie.Save(); } try { Global.MovieSession.QueueNewMovie(movie, record, Global.Emulator); } catch (MoviePlatformMismatchException ex) { MessageBox.Show(this, ex.Message, "Movie/Platform Mismatch", MessageBoxButtons.OK, MessageBoxIcon.Error); return false; } LoadRom(CurrentlyOpenRom); if (Global.MovieSession.PreviousNES_InQuickNES.HasValue) { Global.Config.NES_InQuickNES = Global.MovieSession.PreviousNES_InQuickNES.Value; Global.MovieSession.PreviousNES_InQuickNES = null; } if (Global.MovieSession.PreviousSNES_InSnes9x.HasValue) { Global.Config.SNES_InSnes9x = Global.MovieSession.PreviousSNES_InSnes9x.Value; Global.MovieSession.PreviousSNES_InSnes9x = null; } if (Global.MovieSession.PreviousGBA_UsemGBA.HasValue) { Global.Config.GBA_UsemGBA = Global.MovieSession.PreviousGBA_UsemGBA.Value; Global.MovieSession.PreviousGBA_UsemGBA = null; } Global.Config.RecentMovies.Add(movie.Filename); if (Global.Emulator.HasSavestates() && movie.StartsFromSavestate) { if (movie.TextSavestate != null) { Global.Emulator.AsStatable().LoadStateText(new StringReader(movie.TextSavestate)); } else { Global.Emulator.AsStatable().LoadStateBinary(new BinaryReader(new MemoryStream(movie.BinarySavestate, false))); } if (movie.SavestateFramebuffer != null) { var b1 = movie.SavestateFramebuffer; var b2 = Global.Emulator.VideoProvider().GetVideoBuffer(); int len = Math.Min(b1.Length, b2.Length); for (int i = 0; i < len; i++) { b2[i] = b1[i]; } } Global.Emulator.ResetCounters(); } Global.MovieSession.RunQueuedMovie(record); SetMainformMovieInfo(); GlobalWin.Tools.Restart<VirtualpadTool>(); GlobalWin.DisplayManager.NeedsToPaint = true; return true; }
public static bool IsActive(this IMovie movie) => movie?.Mode != MovieMode.Inactive;
public CategoryController(ICategory categoryService, IMovie movieService) { _categoryService = categoryService; _movieService = movieService; _mapper = new Mapper(); }
protected void Page_PreLoad(object sender, EventArgs e) { this.queryId = Request.QueryString["Id"]; this.Movie = this.Presenter.GetMovieById(this.queryId); }
/// <summary> /// Finds the poster for the movie /// </summary> /// <param name="movie">Movie to search for</param> /// <returns>The name of the poster</returns> public string Poster(IMovie movie) { return this._posterService.FindPoster(movie); }
public HomeController(IMovie movieService) { _movieService = movieService; _mapper = new Mapper(); }
/// <summary> /// Adds a new element to the library /// </summary> /// <param name="element">New media element to add to the library</param> public void Add(IMovie element) { this._factory.SaveOrUpdate(element); }
/// <summary> /// Adds a new element to the library /// </summary> /// <param name="element">New media element to add to the library</param> public void Add(IMovie element) { this._storage.Save(element); }
public static TasMovie ToTasMovie(this IMovie old, bool copy = false) { string newFilename = old.Filename + "." + TasMovie.Extension; if (File.Exists(newFilename)) { int fileNum = 1; bool fileConflict = true; while (fileConflict) { if (File.Exists(newFilename)) { newFilename = old.Filename + " (" + fileNum + ")" + "." + TasMovie.Extension; fileNum++; } else { fileConflict = false; } } } var tas = new TasMovie(newFilename, old.StartsFromSavestate); tas.TasStateManager.MountWriteAccess(); for (var i = 0; i < old.InputLogLength; i++) { var input = old.GetInputState(i); tas.AppendFrame(input); } if (!copy) { old.Truncate(0); // Trying to minimize ram usage } tas.HeaderEntries.Clear(); foreach (var kvp in old.HeaderEntries) { tas.HeaderEntries[kvp.Key] = kvp.Value; } tas.SyncSettingsJson = old.SyncSettingsJson; tas.Comments.Clear(); foreach (var comment in old.Comments) { tas.Comments.Add(comment); } tas.Subtitles.Clear(); foreach (var sub in old.Subtitles) { tas.Subtitles.Add(sub); } tas.TextSavestate = old.TextSavestate; tas.BinarySavestate = old.BinarySavestate; tas.SaveRam = old.SaveRam; return(tas); }
public void QueueNewMovie(IMovie movie, bool record) { if (!record) // The semantics of record is that we are starting a new movie, and even wiping a pre-existing movie with the same path, but non-record means we are loading an existing movie into playback mode { movie.Load(); if (movie.SystemID != Global.Emulator.SystemId) { MessageCallback("Movie does not match the currently loaded system, unable to load"); return; } } //If a movie is already loaded, save it before starting a new movie if (Global.MovieSession.Movie.IsActive && !string.IsNullOrEmpty(Global.MovieSession.Movie.Filename)) { Global.MovieSession.Movie.Save(); } // Note: this populates MovieControllerAdapter's Type with the approparite controller // Don't set it to a movie instance of the adapter or you will lose the definition! InputManager.RewireInputChain(); if (!record && Global.Emulator.SystemId == "NES") // For NES we need special logic since the movie will drive which core to load { var quicknesName = ((CoreAttributes)Attribute.GetCustomAttribute(typeof(QuickNES), typeof(CoreAttributes))).CoreName; var neshawkName = ((CoreAttributes)Attribute.GetCustomAttribute(typeof(NES), typeof(CoreAttributes))).CoreName; // If either is specified use that, else use whatever is currently set if (Global.MovieSession.Movie.Core == quicknesName) { Global.Config.NES_InQuickNES = true; } else if (Global.MovieSession.Movie.Core == neshawkName) { Global.Config.NES_InQuickNES = false; } } else if (!record && Global.Emulator.SystemId == "SNES") // ditto with snes9x vs bsnes { var snes9xName = ((CoreAttributes)Attribute.GetCustomAttribute(typeof(Snes9x), typeof(CoreAttributes))).CoreName; var bsnesName = ((CoreAttributes)Attribute.GetCustomAttribute(typeof(LibsnesCore), typeof(CoreAttributes))).CoreName; if (Global.MovieSession.Movie.Core == snes9xName) { Global.Config.SNES_InSnes9x = true; } else { Global.Config.SNES_InSnes9x = false; } } if (record) // This is a hack really, we need to set the movie to its propert state so that it will be considered active later { movie.SwitchToRecord(); } else { movie.SwitchToPlay(); } QueuedMovie = movie; }
public bool StartNewMovie(IMovie movie, bool record) { if (movie.IsActive) { movie.Save(); } try { Global.MovieSession.QueueNewMovie(movie, record, Global.Emulator); } catch (MoviePlatformMismatchException ex) { MessageBox.Show(this, ex.Message, "Movie/Platform Mismatch", MessageBoxButtons.OK, MessageBoxIcon.Error); return false; } RebootCoresMenuItem_Click(null, null); Global.Emulator = EmulatorWindows.Master.Emulator; if (Global.MovieSession.PreviousNES_InQuickNES.HasValue) { Global.Config.NES_InQuickNES = Global.MovieSession.PreviousNES_InQuickNES.Value; Global.MovieSession.PreviousNES_InQuickNES = null; } if (Global.MovieSession.PreviousSNES_InSnes9x.HasValue) { Global.Config.SNES_InSnes9x = Global.MovieSession.PreviousSNES_InSnes9x.Value; Global.MovieSession.PreviousSNES_InSnes9x = null; } if (Global.MovieSession.PreviousGBA_UsemGBA.HasValue) { Global.Config.GBA_UsemGBA = Global.MovieSession.PreviousGBA_UsemGBA.Value; Global.MovieSession.PreviousGBA_UsemGBA = null; } Global.Config.RecentMovies.Add(movie.Filename); if (EmulatorWindows.Master.Emulator.HasSavestates() && movie.StartsFromSavestate) { if (movie.TextSavestate != null) { EmulatorWindows.Master.Emulator.AsStatable().LoadStateText(new StringReader(movie.TextSavestate)); } else { EmulatorWindows.Master.Emulator.AsStatable().LoadStateBinary(new BinaryReader(new MemoryStream(movie.BinarySavestate, false))); } foreach (var ew in EmulatorWindows) { ew.Emulator.ResetCounters(); } } Global.MovieSession.RunQueuedMovie(record); SetMainformMovieInfo(); UpdateAfterFrameChanged(); return true; }
private bool StartNewMovieWrapper(bool record, IMovie movie = null) { _initializing = true; if (movie == null) movie = CurrentTasMovie; SetTasMovieCallbacks(movie as TasMovie); bool result = GlobalWin.MainForm.StartNewMovie(movie, record); _initializing = false; return result; }
public static bool IsPlaying(this IMovie movie) => movie?.Mode == MovieMode.Play || movie?.Mode == MovieMode.Finished;
public MovieCatalogController(IMovie movieRepository) { _movieRepository = movieRepository; }
protected override void WhenIRun() { this._actual = this.Sut.Resolve <IMovie>(); }
public static bool IsRecording(this IMovie movie) => movie?.Mode == MovieMode.Record;