Beispiel #1
0
        /// <summary>
        /// Prédit les référentiels potentiels à merger.
        /// </summary>
        /// <param name="projectId">L'identifiant du projet.</param>
        /// <param name="stream">Le flux de données contenant l'export.</param>
        public virtual async Task <VideoDecompositionImport> PredictMergedReferentialsVideoDecomposition(int projectId, Stream stream) =>
        await Task.Run(async() =>
        {
            using (var context = ContextFactory.GetNewContext())
            {
                NetDataContractSerializer ser = new NetDataContractSerializer()
                {
                    Binder = new SerializationOperations.AnyVersionSerializationBinder(),
                };
                VideoDecompositionExport videoDecomposition = (VideoDecompositionExport)ser.ReadObject(stream);

                stream.Close();

                // Charger les référentiels
                Referentials dbStandardReferentials = await LoadAllStandardReferentials(context);
                Referentials dbProjectReferentials  = await LoadAllProjectReferentials(context, (await context.Projects.SingleAsync(p => p.ProjectId == projectId)).ProcessId);

                Dictionary <IActionReferentialProcess, IActionReferential> referentialsProject = new Dictionary <IActionReferentialProcess, IActionReferential>();
                Dictionary <IActionReferential, IActionReferential> referentialsStd            = new Dictionary <IActionReferential, IActionReferential>();

                DetermineMergeCandidates(videoDecomposition.ReferentialsProject, dbStandardReferentials, referentialsProject);
                DetermineMergeCandidates(videoDecomposition.ReferentialsStandard, dbStandardReferentials, referentialsStd);

                DetermineMergeCandidates(videoDecomposition.ReferentialsProject, dbProjectReferentials, referentialsProject);
                DetermineMergeCandidates(videoDecomposition.ReferentialsStandard, dbProjectReferentials, referentialsStd);

                return(new VideoDecompositionImport()
                {
                    ExportedVideoDecomposition = videoDecomposition,
                    ProjectReferentialsMergeCandidates = referentialsProject,
                    StandardReferentialsMergeCandidates = referentialsStd,
                });
            }
        });
Beispiel #2
0
        /// <summary>
        /// Crée l'élément exportable.
        /// </summary>
        /// <param name="actions">Les tâches.</param>
        /// <returns>La décomposition.</returns>
        private VideoDecompositionExport CreateExport(IList <KAction> actions)
        {
            var projectExport = new VideoDecompositionExport()
            {
                AppVersion           = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString(),
                Video                = _video,
                Actions              = actions.ToArray(),
                ReferentialsStandard = _refStandard.ToArray(),
                ReferentialsProject  = _refProject.ToArray(),
                CustomTextLabel      = _project.CustomTextLabel,
                CustomTextLabel2     = _project.CustomTextLabel2,
                CustomTextLabel3     = _project.CustomTextLabel3,
                CustomTextLabel4     = _project.CustomTextLabel4,
                CustomNumericLabel   = _project.CustomNumericLabel,
                CustomNumericLabel2  = _project.CustomNumericLabel2,
                CustomNumericLabel3  = _project.CustomNumericLabel3,
                CustomNumericLabel4  = _project.CustomNumericLabel4,
            };

            return(projectExport);
        }