void LoadVideotheque(string videothequeFileName, IVideothequeLoadingUI ui) { var options = new List <VideothequeLoadingRequestItem>(); options.Add(new VideothequeLoadingRequestItem { Prompt = "Create new videotheque, and keep all files inside its folder", Type = VideothequeLoadingRequestItemType.SaveFile, InitFile = CreateEmptyVideotheque }); options.Add(new VideothequeLoadingRequestItem { Prompt = "Create new videotheque, and use it with external folders with data (data will be located later)", Type = VideothequeLoadingRequestItemType.SaveFile, InitFile = CreateVideothequeForSetup }); options.Add(new VideothequeLoadingRequestItem { Prompt = "Load existing videotheque", Type = VideothequeLoadingRequestItemType.OpenFile, }); options.AddRange(StartupSettings.LastLoadedProjects.Where(z => File.Exists(z)).Take(3).Select(z => new VideothequeLoadingRequestItem { Prompt = "Load videotheque " + z, Type = VideothequeLoadingRequestItemType.NoFile, SuggestedPath = z })); FileInfo vfinfo = null; if (videothequeFileName != null) { vfinfo = new FileInfo(videothequeFileName); } vfinfo = CheckFile(vfinfo, ui, "Don't see videotheque", options.ToArray() ); VideothequeSettingsFile = vfinfo; Data = HeadedJsonFormat.Read <VideothequeData>(VideothequeSettingsFile); if (Data.EditorSettings == null) { Data.EditorSettings = new VideothequeEditorSettings(); } if (Data.OutputSettings == null) { Data.OutputSettings = new OutputSettings(); } }
static void LoadFiles <T>(DirectoryInfo dir, string extension, List <Tuple <T, FileInfo> > list) where T : new() { foreach (var e in dir.GetFiles("*." + extension)) { var container = HeadedJsonFormat.Read <T>(e); list.Add(Tuple.Create(container, e)); } foreach (var e in dir.GetDirectories()) { LoadFiles(e, extension, list); } }
void LoadExternalReferences(IVideothequeLoadingUI ui) { //loading startup settings CheckFile(Locations.StartupSettings, ui, "Startup settings are not found. It is probably the first time you start Tuto. ", new VideothequeLoadingRequestItem { Prompt = "Create default startup settings. Be ready to locate external software", SuggestedPath = Locations.StartupSettings.FullName, Type = VideothequeLoadingRequestItemType.NoFile, InitFile = CreateDefaultStartup }); StartupSettings = HeadedJsonFormat.Read <VideothequeStartupSettings>(Locations.StartupSettings); FileInfo file; file = CheckFile(Locations.FFmpegExecutable, ui, "FFMPEG is a free software that processes videofiles. You have to install x64 version of it from http://ffmpeg.zeranoe.com/builds/ prior to using Tuto.", new VideothequeLoadingRequestItem { Prompt = "FFMPEG is installed. I'm ready to locate ffmpeg.exe", Type = VideothequeLoadingRequestItemType.OpenFile, RequestedFileName = "ffmpeg.exe", } ); StartupSettings.FFMPEGPath = file.FullName; file = CheckFile(Locations.SoxExecutable, ui, "SOX is a free software that processes audiofiles. You have to install it from http://sox.sourceforge.net/ prior to using Tuto.", new VideothequeLoadingRequestItem { Prompt = "SOX is installed. I'm ready to locate sox.exe", Type = VideothequeLoadingRequestItemType.OpenFile, RequestedFileName = "sox.exe", } ); StartupSettings.SoxPath = file.FullName; var directory = CheckFolder(Locations.AviSynth, ui, "AviSynth is a free software that enables scripting of videofiles. You have to install it from http://avisynth.nl/index.php/AviSynth+#Development_branch , version greater than r1800, prior to using Tuto.", new VideothequeLoadingRequestItem { Prompt = "AviSynth is installed. I'm ready to locate its folder", Type = VideothequeLoadingRequestItemType.Directory, } ); StartupSettings.AviSynthPath = directory.FullName; }