示例#1
0
        public void SaveEditorModel(EditorModel model)
        {
            var container = new FileContainer {
                MontageModel = model.Montage, WindowState = model.WindowState
            };

            HeadedJsonFormat.Write(model.ModelFileLocation, container);
        }
示例#2
0
        static FileInfo CreateDefaultStartup(string location)
        {
            var data  = new VideothequeStartupSettings();
            var finfo = new FileInfo(location);

            HeadedJsonFormat.Write(
                finfo,
                data);
            return(finfo);
        }
示例#3
0
        static FileInfo CreateVideothequeForSetup(string location)
        {
            var finfo = new FileInfo(location);
            var data  = new VideothequeData();

            data.PathsSettings.TempPath = CreateDefaultFolder(finfo, Names.DefaultTempFolder);

            HeadedJsonFormat.Write(
                finfo,
                data);
            return(finfo);
        }
示例#4
0
        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();
            }
        }
示例#5
0
        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);
            }
        }
示例#6
0
 public void Save()
 {
     Data.PathsSettings.RawPath    = RelativeOrAbsoluteDirection(RawFolder);
     Data.PathsSettings.OutputPath = RelativeOrAbsoluteDirection(OutputFolder);
     Data.PathsSettings.ModelPath  = RelativeOrAbsoluteDirection(ModelsFolder);
     Data.PathsSettings.TempPath   = RelativeOrAbsoluteDirection(TempFolder);
     Data.PathsSettings.PatchPath  = RelativeOrAbsoluteDirection(PatchFolder);
     HeadedJsonFormat.Write(VideothequeSettingsFile, Data);
     if (!string.IsNullOrEmpty(Data.OutputSettings.SummaryJsonFile) && EditorModels != null)
     {
         var path = Path.Combine(this.VideothequeSettingsFile.Directory.FullName, Data.OutputSettings.SummaryJsonFile);
         CreateSummary(path);
     }
 }
示例#7
0
        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;
        }
示例#8
0
        static FileInfo CreateEmptyVideotheque(string location)
        {
            var data  = new VideothequeData();
            var finfo = new FileInfo(location);

            data.PathsSettings.RawPath    = CreateDefaultFolder(finfo, Names.DefaultRawFolder);
            data.PathsSettings.ModelPath  = CreateDefaultFolder(finfo, Names.DefaultModelFolder);
            data.PathsSettings.OutputPath = CreateDefaultFolder(finfo, Names.DefaultOutputFolder);
            data.PathsSettings.TempPath   = CreateDefaultFolder(finfo, Names.DefaultTempFolder);
            data.PathsSettings.PatchPath  = CreateDefaultFolder(finfo, Names.DefaultPatchFolder);

            HeadedJsonFormat.Write(
                finfo,
                data);
            return(finfo);
        }
示例#9
0
 void SaveStartupFile()
 {
     HeadedJsonFormat.Write(Locations.StartupSettings, StartupSettings);
 }