using System.Collections.Generic; using System.IO; using System.Linq; namespace BizHawk.Client.Common { public static class MovieService { public static IMovie Get(string path) { // TODO: change IMovies to take HawkFiles only and not path if (Path.GetExtension(path)?.EndsWith("tasproj") ?? false) { return new TasMovie(path); } return new Bk2Movie(path); } /// /// Gets the file extension for the default movie implementation used in the client /// public const string DefaultExtension = "bk2"; /// /// Gets a list of extensions for all implementations /// public static IEnumerable MovieExtensions => new[] { DefaultExtension, TasMovie.Extension }; public static bool IsValidMovieExtension(string ext) { return MovieExtensions.Contains(ext.ToLower().Replace(".", "")); } /// /// Creates a default instance of the default implementation, /// no path is specified so this is in a minimal state that would not be able to be saved /// public static IMovie DefaultInstance => new Bk2Movie(); } }