Esempio n. 1
0
 public void StartPOSTWork(string name)
 {
     if (innerUI != null)
     {
         innerUI.StartPOSTWork(name);
     }
 }
Esempio n. 2
0
 void CreateModels(IVideothequeLoadingUI ui)
 {
     ui.StartPOSTWork("Creating models");
     models = new List <EditorModel>();
     foreach (var e in loadedContainer)
     {
         var hash = e.Item1.MontageModel.RawVideoHash;
         if (hash == null)
         {
             throw new Exception("No reference to video is specified in the model");
         }
         DirectoryInfo rawDirectory = null;
         if (binaryHashes.ContainsKey(hash))
         {
             rawDirectory = binaryHashes[hash];
         }
         var model = LoadExistingModel(e.Item1, e.Item2, rawDirectory);
         binaryHashes.Remove(hash);
         models.Add(model);
     }
     foreach (var e in binaryHashes)
     {
         var model = CreateNewModel(e.Value, e.Key);
         models.Add(model);
     }
     ui.CompletePOSTWork(true);
 }
Esempio n. 3
0
        static T Check <T>(
            T path,
            IVideothequeLoadingUI ui,
            Func <T, string> name,
            Func <T, bool> isOk,
            Func <T> requestNew
            )
            where T : class
        {
            while (true)
            {
                if (path != null)
                {
                    ui.StartPOSTWork("Checking " + name(path));
                    bool ok = isOk(path);
                    ui.CompletePOSTWork(ok);
                    if (ok)
                    {
                        return(path);
                    }
                }
                path = requestNew();
                if (path == null)
                {
                    break;
                }
            }

            throw new LoadingException();
        }
Esempio n. 4
0
        void LoadContainers(IVideothequeLoadingUI ui)
        {
            ui.StartPOSTWork("Loading models");
            loadedContainer = new List <Tuple <FileContainer, FileInfo> >();
            LoadFiles <FileContainer>(ModelsFolder, Names.ModelExtension, loadedContainer);

            ui.CompletePOSTWork(true);
        }
Esempio 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);
        }