/// <summary>Opens a translation file, given its filename and code page.</summary> /// <param name="path">The path of the translation file to open.</param> /// <param name="codePage">The code page of the filename. To use autodetection, set it to -1.</param> /// <remarks>An error dialog is presented if an exception is caught during open.</remarks> private void OpenTranslation (string path, int codePage) { try { Encoding encoding = (codePage == -1 ? null : Encoding.GetEncoding(codePage)); Base.OpenTranslation(path, encoding); } catch (Exception exception) { SubtitleFileOpenErrorDialog errorDialog = new SubtitleFileOpenErrorDialog(path, exception); errorDialog.Show(); bool toOpenAgain = errorDialog.WaitForResponse(); if (toOpenAgain) Open(); } }
/* Private members */ /// <summary>Opens a subtitle file, given its filename, code page and video filename.</summary> /// <param name="path">The path of the subtitles file to open.</param> /// <param name="codePage">The code page of the filename. To use autodetection, set it to -1.</param> /// <param name="videoUri">The URI of the video to open. If null, no video will be opened.</param> /// <remarks>An error dialog is presented if an exception is caught during open.</remarks> private void Open (string path, int codePage, Uri videoUri) { try { Encoding encoding = CodePageToEncoding(codePage); Base.Open(path, encoding, videoUri); } catch (Exception exception) { SubtitleFileOpenErrorDialog errorDialog = new SubtitleFileOpenErrorDialog(path, exception); errorDialog.Show(); bool toOpenAgain = errorDialog.WaitForResponse(); if (toOpenAgain) Open(); } }