mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-10-26 23:12:38 +02:00
Added check for another non subtitle file
This commit is contained in:
parent
7d5a059f84
commit
f9dc21b9a0
@ -1225,6 +1225,7 @@ Continue?</SubtitleAppendPrompt>
|
||||
<ErrorLoadRar>This file seems to be a compressed .rar file. Subtitle Edit cannot open compressed files.</ErrorLoadRar>
|
||||
<ErrorLoadZip>This file seems to be a compressed .zip file. Subtitle Edit cannot open compressed files.</ErrorLoadZip>
|
||||
<ErrorLoadPng>This file seems to be a PNG image file. Subtitle Edit cannot open PNG files.</ErrorLoadPng>
|
||||
<ErrorLoadSrr>This file seems to be a ReScene .srr file - not a subtitle file.</ErrorLoadSrr>
|
||||
</Main>
|
||||
<MatroskaSubtitleChooser>
|
||||
<Title>Choose subtitle from Matroska file</Title>
|
||||
|
@ -115,6 +115,20 @@ namespace Nikse.SubtitleEdit.Core
|
||||
}
|
||||
}
|
||||
|
||||
public static bool IsSrr(string fileName)
|
||||
{
|
||||
using (var fs = new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
|
||||
{
|
||||
var buffer = new byte[3];
|
||||
var count = fs.Read(buffer, 0, buffer.Length);
|
||||
if (count != buffer.Length)
|
||||
return false;
|
||||
return buffer[0] == 0x69
|
||||
&& buffer[1] == 0x69
|
||||
&& buffer[2] == 0x69;
|
||||
}
|
||||
}
|
||||
|
||||
public static bool IsBluRaySup(string fileName)
|
||||
{
|
||||
using (var fs = new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
|
||||
|
@ -2824,6 +2824,16 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
return;
|
||||
}
|
||||
|
||||
// check for .srr file
|
||||
if (format == null && fi.Length > 100 && ext == ".srr" && FileUtil.IsSrr(fileName))
|
||||
{
|
||||
if (string.IsNullOrEmpty(_language.ErrorLoadSrr))
|
||||
MessageBox.Show("This file seems to be a ReScene .srr file - not a subtitle file.");
|
||||
else
|
||||
MessageBox.Show(_language.ErrorLoadSrr);
|
||||
return;
|
||||
}
|
||||
|
||||
if (format == null && fi.Length < 100 * 1000000 && TransportStreamParser.IsDvbSup(fileName))
|
||||
{
|
||||
ImportSubtitleFromDvbSupFile(fileName);
|
||||
|
@ -1133,6 +1133,7 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
ErrorLoadRar = "This file seems to be a compressed .rar file. Subtitle Edit cannot open compressed files.",
|
||||
ErrorLoadZip = "This file seems to be a compressed .zip file. Subtitle Edit cannot open compressed files.",
|
||||
ErrorLoadPng = "This file seems to be a PNG image file. Subtitle Edit cannot open PNG files.",
|
||||
ErrorLoadSrr = "This file seems to be a ReScene .srr file - not a subtitle file.",
|
||||
|
||||
Menu = new LanguageStructure.Main.MainMenu
|
||||
{
|
||||
|
@ -2624,6 +2624,9 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
case "Main/ErrorLoadPng":
|
||||
language.Main.ErrorLoadPng = reader.Value;
|
||||
break;
|
||||
case "Main/ErrorLoadSrr":
|
||||
language.Main.ErrorLoadSrr = reader.Value;
|
||||
break;
|
||||
case "Main/Menu/File/Title":
|
||||
language.Main.Menu.File.Title = reader.Value;
|
||||
break;
|
||||
|
@ -1018,6 +1018,7 @@
|
||||
public string ErrorLoadRar { get; set; }
|
||||
public string ErrorLoadZip { get; set; }
|
||||
public string ErrorLoadPng { get; set; }
|
||||
public string ErrorLoadSrr { get; set; }
|
||||
|
||||
public class MainMenu
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user