示例#1
0
        public ExportVideoOptionsViewModel(ILoggerFacade loggerFacade, IAviSynthScripter aviSynthScripter, IEventAggregator ea,
                                           ISettingsHypermint settings, ISelectedService selected) : base(loggerFacade)
        {
            _avisynthScripter = aviSynthScripter;
            _eventAggregator  = ea;
            _settings         = settings;
            _selectedService  = selected;
            exportPath        = Path.Combine(settings.HypermintSettings.ExportPath, "Videos");

            AviSynthOptions = new AviSynthOption();

            _eventAggregator.GetEvent <SystemSelectedEvent>().Subscribe(x => SystemChanged(x));

            //Save the process videos to a an avi synth script.
            SaveScriptCommand = new DelegateCommand(() =>
            {
                _eventAggregator.GetEvent <GetProcessVideosEvent>().Publish();
            });

            _eventAggregator.GetEvent <ReturnProcessVideosEvent>().Subscribe(x =>
            {
                SaveScript(x);
            });

            ProcessScriptCommand = new DelegateCommand(() =>
            {
                ProcessScript();
            });

            OpenExportFolderCommand = new DelegateCommand(() =>
            {
                var dir    = GetSystemExportPath();
                var result = new DirectoryInfo(dir).Open();
            });
        }
示例#2
0
        /// <summary>
        /// Saves the script.
        /// </summary>
        /// <param name="videos">The videos.</param>
        private void SaveScript(IEnumerable <string> videos)
        {
            Log("");
            var aviSynthOptions = new AviSynthOption()
            {
                DissolveAmount = DissolveAmount,
                StartFrame     = StartFrame,
                EndFrame       = EndFrame,
                FadeIn         = FadeIn,
                FadeOut        = FadeOut,
                ResizeHeight   = ResizeHeight,
                ResizeWidth    = ResizeWidth,
                WheelPosX      = WheelPosX,
                WheelPosY      = WheelPosY,
            };

            var wheelPath = _settings.HypermintSettings.HsPath + "\\Media\\" + _selectedService.CurrentSystem + "\\" +
                            Images.Wheels + "\\";

            //Setup script export options
            var scriptOptions = new ScriptOptions(videos.ToArray(), aviSynthOptions,
                                                  _selectedService.CurrentSystem, Overlay, ResizeOverlay, wheelPath,
                                                  GetSystemExportPath());

            //Create script from builder
            string scriptCreated = _avisynthScripter.CreateScript(scriptOptions);

            Log($"Script created: {scriptCreated}");

            //Get scripts and select the created
            GetScriptsInExportFolder();

            if (Scripts == null)
            {
                Scripts = new ListCollectionView(_scripts);
            }

            Scripts.MoveCurrentTo(scriptCreated);
        }