示例#1
0
        private void WorkOnCreateEvent(FileSystemEvent fileSystemEvent)
        {
            var fileSystemObject = new FileSystemItem(fileSystemEvent.EventArgs.FullPath);

            if (!fileSystemObject.Exists || fileSystemObject.ShouldBeIgnored)
            {
                return;
            }
            _logger.InfoFormat("New {0} is created on {1}", fileSystemObject.FullPath,
                               fileSystemEvent.OccurredTime.ToString("dd-MM-yyyy hh:mm:ss"));


            if (fileSystemObject.IsFile && !fileSystemObject.IsFileReadyToRead(MaxFileAttempt))
            {
                _logger.ErrorFormat(
                    "It has exceeded the max number of attempts. File {0} is in use and cannot be read",
                    fileSystemObject.FullPath);
                return;
            }

            if (_svnClient.SvnAdd(fileSystemObject.FullPath))
            {
                _svnClient.SvnCommit(fileSystemObject.FullPath);
            }
        }
示例#2
0
        private static void ConverAviFileToMp4(FileSystemEventArgs e)
        {
            var outputPath = Path.Combine(Config["SoundDesignerSvnPath"], $"{Path.GetFileNameWithoutExtension(e.Name)}.mp4");

            if (File.Exists(outputPath))
            {
                File.Delete(outputPath);
            }

            var ffMpeg = new FFMpegConverter();

            Task.Run(() =>
            {
                ffMpeg.ConvertMedia(e.FullPath, outputPath, Format.mp4);

                if (_svnClient.SvnAdd(outputPath))
                {
                    _svnClient.SvnCommit(outputPath);
                }
            });
        }