public MKVMergeBatchFileWriteForEncodeService(BatchGuyEAC3ToSettings batchGuyEAC3ToSettings, IDirectorySystemService directorySystemService, IAudioService audioService, AbstractEAC3ToOutputNamingService eac3ToOutputNamingService, IEAC3ToCommonRulesValidatorService eac3ToCommonRulesValidatorService)
 {
     _batchGuyEAC3ToSettings = batchGuyEAC3ToSettings;
     _bluRayDiscInfoList = _batchGuyEAC3ToSettings.BluRayDiscs;
     _eac3toConfiguration = _batchGuyEAC3ToSettings.EAC3ToSettings;
     _directorySystemService = directorySystemService;
     _audioService = audioService;
     _eac3ToOutputNamingService = eac3ToOutputNamingService;
     _eac3ToCommonRulesValidatorService = eac3ToCommonRulesValidatorService;
     _errors = new ErrorCollection();
 }
 public void Save(string settingsFile, BatchGuyEAC3ToSettings batchGuyEAC3ToSettings)
 {
     try
     {
         _jsonSerializationService.WriteToJsonFile(settingsFile, batchGuyEAC3ToSettings, false);
     }
     catch (Exception ex)
     {
         _log.ErrorFormat(Program.GetLogErrorFormat(), ex.Message, ex.StackTrace, MethodBase.GetCurrentMethod().Name);
         _errors.Add(new Error() { Description = "There was a problem saving the BatchGuy eac3to Settings File" });
     }
 }
 private void HandlesLoadToolStripMenuItemClick(string settingsFile)
 {
     try
     {
         if (!string.IsNullOrEmpty(settingsFile))
         {
             IJsonSerializationService<BatchGuyEAC3ToSettings> jsonSerializationService = new JsonSerializationService<BatchGuyEAC3ToSettings>();
             IBatchGuyEAC3ToSettingsService batchGuyEAC3ToSettingsService = new BatchGuyEAC3ToSettingsService(jsonSerializationService);
             _batchGuyEAC3ToSettings = batchGuyEAC3ToSettingsService.GetBatchGuyEAC3ToSettings(settingsFile);
             if (batchGuyEAC3ToSettingsService.Errors.Count() > 0)
             {
                 MessageBox.Show(batchGuyEAC3ToSettingsService.Errors.GetErrorMessage(), "Error Occurred.", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
             else if (_batchGuyEAC3ToSettings.EAC3ToSettings.IsExtractForRemux)
             {
                 MessageBox.Show("You cannot load a (.batchGuyEac3toSettings) file that is for Remuxing!", "Error Occurred.", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
             else
             {
                 this._encodeTypeChangedBecauseOfSettingsLoad = true;
                 this.LoadEpisodeNumbers();
                 this.LoadScreen();
                 gbScreen.SetEnabled(true);
                 saveToolStripMenuItem.Enabled = true;
                 createX264BatchFileToolStripMenuItem.Enabled = true;
                 createMkvmergeBatchFileToolStripMenuItem.Enabled = true;
             }
         }
     }
     catch (Exception ex)
     {
         _displayErrorMessageService.DisplayError(new ErrorMessage() { DisplayMessage = "There was an error trying to load the eac3to Settings File!", DisplayTitle = "Error.", Exception = ex, MethodNameWhereExceptionOccurred = MethodBase.GetCurrentMethod().Name });
     }
 }
        private void HandlesSaveToolStripMenuItemClick()
        {
            this.SetEac3ToConfiguration();
            this.SetEAC3ToRemuxFileNameTemplate();
            if (this.IsAtLeastOneDiscLoaded() && this.IsScreenValid())
            {
                SaveFileDialog sfd = new SaveFileDialog();
                sfd.Filter = "BatchGuy File|*.batchGuyEac3toSettings";
                sfd.Title = "Save eac3to Settings File";
                sfd.ShowDialog();

                if (!string.IsNullOrEmpty(sfd.FileName))
                {
                    dgvBluRayDiscInfo.CurrentCell = null; //force the cell change so cell changed event fires
                    dgvBluRaySummary.CurrentCell = null; //force the cell change so cell changed event fires
                    List<BluRayDiscInfo> discs = this.GetBluRayDiscInfoList();
                    if (_batchGuyEAC3ToSettings == null)
                        _batchGuyEAC3ToSettings = new BatchGuyEAC3ToSettings();

                    _batchGuyEAC3ToSettings.BluRayDiscs = discs;
                    _batchGuyEAC3ToSettings.EAC3ToSettings = _eac3toConfiguration;

                    IJsonSerializationService<BatchGuyEAC3ToSettings> jsonSerializationService = new JsonSerializationService<BatchGuyEAC3ToSettings>();
                    IBatchGuyEAC3ToSettingsService batchGuyEAC3ToSettingsService = new BatchGuyEAC3ToSettingsService(jsonSerializationService);
                    batchGuyEAC3ToSettingsService.Save(sfd.FileName, _batchGuyEAC3ToSettings);
                    if (batchGuyEAC3ToSettingsService.Errors.Count() > 0)
                    {
                        MessageBox.Show(batchGuyEAC3ToSettingsService.Errors.GetErrorMessage(), "Error Occurred.", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
        }
 private void HandlesLoadToolStripMenuItemClick(string settingsFile)
 {
     try
     {
         if (!string.IsNullOrEmpty(settingsFile))
         {
             IJsonSerializationService<BatchGuyEAC3ToSettings> jsonSerializationService = new JsonSerializationService<BatchGuyEAC3ToSettings>();
             IBatchGuyEAC3ToSettingsService batchGuyEAC3ToSettingsService = new BatchGuyEAC3ToSettingsService(jsonSerializationService);
             _batchGuyEAC3ToSettings = batchGuyEAC3ToSettingsService.GetBatchGuyEAC3ToSettings(settingsFile);
             if (batchGuyEAC3ToSettingsService.Errors.Count() > 0)
             {
                 MessageBox.Show(batchGuyEAC3ToSettingsService.Errors.GetErrorMessage(), "Error Occurred.", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
             else
             {
                 this.ReloadEac3ToSettingsAndBluRayDiscs(_batchGuyEAC3ToSettings);
                 this.ReloadRemux();
                 this.SettxtRemuxSeasonNumberEnabledStatus();
             }
         }
     }
     catch (Exception ex)
     {
         _displayErrorMessageService.DisplayError(new ErrorMessage() { DisplayMessage = "There was an error trying to load the eac3to Settings File!", DisplayTitle = "Error.", Exception = ex, MethodNameWhereExceptionOccurred = MethodBase.GetCurrentMethod().Name });
     }
 }
 private void ReloadEac3ToSettingsAndBluRayDiscs(BatchGuyEAC3ToSettings batchGuyEAC3ToSettings)
 {
     _bindingListBluRayDiscInfo = new BindingList<BluRayDiscInfo>();
     _bindingListBluRaySummaryInfo = new BindingList<BluRaySummaryInfo>();
     _bluRaySummaryGridSortConfiguration = new SortConfiguration();
     _bluRayDiscGridSortConfiguration = new SortConfiguration();
     _currentBluRayDiscGridRowIndex = 0;
     _eac3toConfiguration = batchGuyEAC3ToSettings.EAC3ToSettings;
     txtBatFilePath.Text = _eac3toConfiguration.BatchFilePath;
     txtMKVMergeBatFilePath.Text = _eac3toConfiguration.MKVMergeBatchFilePath;
     txtMKVMergeOutputPath.Text = _eac3toConfiguration.MKVMergeOutputPath;
     _eac3toConfiguration.IsVideoNameForEncodeMkvMerge = false;
     txtEac3toOutputDirectory.Text = _eac3toConfiguration.EAC3ToOutputPath;
     foreach (BluRayDiscInfo disc in batchGuyEAC3ToSettings.BluRayDiscs)
     {
         _bindingListBluRayDiscInfo.Add(disc);
     }
     _currentBluRayDiscInfo = _bindingListBluRayDiscInfo[0];
     foreach (BluRaySummaryInfo summary in _currentBluRayDiscInfo.BluRaySummaryInfoList)
     {
         _bindingListBluRaySummaryInfo.Add(summary);
     }
     this.SetcbEac3ToOutputDirectoryType();
     this.BindDgvBluRayDiscInfoGrid();
     this.BindDgvBluRaySummaryGrid();
 }
 private void HandlesLoadToolStripMenuItemClick(string settingsFile)
 {
     if (!string.IsNullOrEmpty(settingsFile))
     {
         IJsonSerializationService<BatchGuyEAC3ToSettings> jsonSerializationService = new JsonSerializationService<BatchGuyEAC3ToSettings>();
         IBatchGuyEAC3ToSettingsService batchGuyEAC3ToSettingsService = new BatchGuyEAC3ToSettingsService(jsonSerializationService);
         _batchGuyEAC3ToSettings = batchGuyEAC3ToSettingsService.GetBatchGuyEAC3ToSettings(settingsFile);
         if (batchGuyEAC3ToSettingsService.Errors.Count() > 0)
         {
             MessageBox.Show(batchGuyEAC3ToSettingsService.Errors.GetErrorMessage(), "Error Occurred.", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
         else if (_batchGuyEAC3ToSettings.EAC3ToSettings.IsExtractForRemux)
         {
             MessageBox.Show("You cannot load a (.batchGuyEac3toSettings) file that is for Remuxing!", "Error Occurred.", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
         else
         {
             this.LoadScreen();
             gbScreen.SetEnabled(true);
             saveToolStripMenuItem.Enabled = true;
             createAviSynthavsFilesToolStripMenuItem.Enabled = true;
         }
     }
 }