Ejemplo n.º 1
0
        public void DefineFileByCheckSum([FromRoute] string userName, [FromRoute] string fileName, [FromRoute] string fileCheckSum)
        {
            var user    = userRepository.GetUserByUserName(userName);
            var files   = Directory.GetFiles(@".\Files\");
            var file    = files.First(_ => CalculateMD5(_) == fileCheckSum);
            var newFile = Rename(file, fileName);

            user.Files.Add(
                new ServerAPI.File
            {
                FileName = fileName,
                FilePath = newFile,
                CheckSum = fileCheckSum
            });
            userRepository.UpdateUser(user.UserId, user);

            int fileCount = videoService.SplitVideoToFrames(fileName);

            fileCount = fileCount * 2;
            videoService.StartProcessing(fileName);
            while (fileCount != Directory.GetFiles($@".\{fileName}\").Length)
            {
            }
            videoService.CombineFramesToVideo(fileName);
        }