Example #1
0
        static void Recursive(DirectoryInfo currentDirectory, DirectoryInfo inputRoot, DirectoryInfo newModelsDirectory, string prefix)
        {
            Console.WriteLine("Processing " + currentDirectory.FullName);
            var files = currentDirectory.GetFiles();

            if (!files.Any(z => z.Name == Names.FaceFileName))
            {
                foreach (var d in currentDirectory.GetDirectories())
                {
                    Recursive(d, inputRoot, newModelsDirectory, prefix);
                }
                return;
            }
            var tutoFile = files.Where(z => z.Name == "local.tuto").FirstOrDefault();

            if (tutoFile == null)
            {
                Console.WriteLine("No tuto file is found. Press any key");
                Console.ReadKey();
                return;
            }

            var hash      = Videotheque.ComputeHash(currentDirectory, Names.FaceFileName, Names.HashFileName, true);
            var container = HeadedJsonFormat.Read <FileContainer>(tutoFile, "Tuto local file", 3);

            container.MontageModel.SetHash(hash);
            var relativePath = prefix + MyPath.RelativeTo(tutoFile.Directory.FullName, inputRoot.FullName);

            container.MontageModel.DisplayedRawLocation = relativePath;
            var fname = Path.Combine(newModelsDirectory.FullName, MyPath.CreateHierarchicalName(relativePath) + "." + Names.ModelExtension);

            HeadedJsonFormat.Write(new FileInfo(fname), container);
        }
Example #2
0
        public FileInfo GetFinalOutputFile(int episodeNumber)
        {
            var fname = model.Montage.DisplayedRawLocation;

            fname  = MyPath.CreateHierarchicalName(fname);
            fname += "-" + episodeNumber + " " + model.Montage.Information.Episodes[episodeNumber].Name;
            if (model.Videotheque.Data.OutputSettings.IncludeGUIDInOutputFileName)
            {
                fname += " [" + model.Montage.Information.Episodes[episodeNumber].Guid.ToString() + "]";
            }
            fname += ".avi";
            return(new FileInfo(Path.Combine(model.Videotheque.OutputFolder.FullName, fname)));
        }
Example #3
0
        EditorModel CreateNewModel(DirectoryInfo location, string hash)
        {
            var path = MyPath.RelativeTo(location.FullName, RawFolder.FullName);

            path = MyPath.CreateHierarchicalName(path);
            var finfo = new FileInfo(Path.Combine(ModelsFolder.FullName, path + "." + Names.ModelExtension));
            var model = new EditorModel(finfo, location, this, new MontageModel(3600000, hash), new WindowState());

            model.Montage.DisplayedRawLocation             = path;
            model.Montage.Information.CreationTime         = DateTime.Now;
            model.Montage.Information.LastModificationTime = DateTime.Now;
            return(model);
        }