Exemplo n.º 1
0
        void CheckGUIDCorrectness(IVideothequeLoadingUI ui)
        {
            var problems = EditorModels
                           .SelectMany(model => model.Montage.Information.Episodes.Select(episode => new { model, episode }))
                           .GroupBy(x => x.episode.Guid)
                           .Where(x => x.Count() > 1)
                           .ToList();

            foreach (var p in problems)
            {
                var prompt  = "Duplicating GUID '" + p.Key + "' for episodes in videotheque. Select which episode gets a new guid";
                var options = p
                              .Select(z => new VideothequeLoadingRequestItem {
                    Type   = VideothequeLoadingRequestItemType.NoFile,
                    Prompt = z.model.Montage.DisplayedRawLocation + ", " + z.episode.Name
                })
                              .ToList();
                options.Add(new VideothequeLoadingRequestItem
                {
                    Type   = VideothequeLoadingRequestItemType.NoFile,
                    Prompt = "Don't change anything yet. I will review the episodes and decide later."
                });
                var item  = ui.Request(prompt, options.ToArray());
                var index = options.IndexOf(item);
                if (index == options.Count - 1)
                {
                    continue;
                }
                var pair = p.Skip(index).First();
                pair.episode.Guid = Guid.NewGuid();
                SaveEditorModel(pair.model);
            }
        }
Exemplo n.º 2
0
 public VideothequeLoadingRequestItem Request(string prompt, VideothequeLoadingRequestItem[] items)
 {
     if (innerUI != null)
     {
         return(innerUI.Request(prompt, items));
     }
     return(null);
 }
Exemplo n.º 3
0
 DirectoryInfo CheckFolder(DirectoryInfo dir, IVideothequeLoadingUI ui, string prompt, params VideothequeLoadingRequestItem[] requestItems)
 {
     return(Check(dir, ui, d => d.FullName, d => d != null && Directory.Exists(d.FullName),
                  () =>
     {
         var option = ui.Request(prompt, requestItems);
         if (option == null)
         {
             return null;
         }
         return option.InitFolder(option.SuggestedPath);
     }));
 }
Exemplo n.º 4
0
 static FileInfo CheckFile(FileInfo file, IVideothequeLoadingUI ui, string prompt, params VideothequeLoadingRequestItem[] requestItems)
 {
     return(Check(file, ui, f => f.FullName, f => f != null && File.Exists(f.FullName),
                  () =>
     {
         var option = ui.Request(prompt, requestItems);
         if (option == null)
         {
             return null;
         }
         return option.InitFile(option.SuggestedPath);
     }));
 }
Exemplo n.º 5
0
        void LoadBinaryHashes(IVideothequeLoadingUI ui)
        {
            ui.StartPOSTWork("Indexing videofiles in " + RawFolder.FullName);
            var hashes = new RawFileHashes <DirectoryInfo>();

            ComputeHashesInRawSubdirectories(RawFolder, Names.FaceFileName, Names.HashFileName, false, hashes);
            if (hashes.DuplicatedHashes.Count != 0)
            {
                var message = "Some input video files are duplicated. This is not acceptable. Please resolve the issue. The duplications are:\r\n";
                foreach (var e in hashes.DuplicatedHashes)
                {
                    message += e.Value.Select(z => z.FullName).Select(z => MyPath.RelativeTo(z, RawFolder.FullName)).Aggregate((a, b) => a + ", " + b) + "\r\n";
                }
                ui.Request(message, new VideothequeLoadingRequestItem[0]);
                throw new LoadingException();
            }
            binaryHashes = hashes.Hashes;
            ui.CompletePOSTWork(true);
        }