Prevent directory drop with friendly msg

This commit is contained in:
ivandrofly 2015-06-03 23:01:00 +01:00
parent 571c38691e
commit 58d9b0ba63
5 changed files with 15 additions and 1 deletions

View File

@ -1281,6 +1281,7 @@ Continue?</SubtitleAppendPrompt>
<ErrorLoadBinaryZeroes>Sorry, this file contains only binary zeroes!
If you have edited this file with Subtitle Edit you might be alble to find a backup via the menu item File -&gt; Restore auto-backup...</ErrorLoadBinaryZeroes>
<ErrorDirectoryDropNotAllowed>Directory drop are not supported here.</ErrorDirectoryDropNotAllowed>
<NoSupportEncryptedVobSub>Encrypted VobSub content is not supported.</NoSupportEncryptedVobSub>
<NoSupportHereBluRaySup>Blu-ray sup files are not supported here.</NoSupportHereBluRaySup>
<NoSupportHereDvdSup>DVD sup files are not supported here.</NoSupportHereDvdSup>

View File

@ -9612,7 +9612,15 @@ namespace Nikse.SubtitleEdit.Forms
openFileDialog1.InitialDirectory = dirName;
var fi = new FileInfo(fileName);
string ext = Path.GetExtension(fileName).ToLower();
// Do not allow directory drop
bool isDirectory = (File.GetAttributes(fi.FullName) & FileAttributes.Directory) == FileAttributes.Directory;
if (isDirectory)
{
MessageBox.Show(_language.ErrorDirectoryDropNotAllowed, fi.Name, MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
string ext = Path.GetExtension(fileName).ToLowerInvariant();
if (ext == ".mkv")
{

View File

@ -1182,6 +1182,7 @@ namespace Nikse.SubtitleEdit.Logic
ErrorLoadSrr = "This file seems to be a ReScene .srr file - not a subtitle file.",
ErrorLoadTorrent = "This file seems to be a BitTorrent file - not a subtitle file.",
ErrorLoadBinaryZeroes = "Sorry, this file contains only binary zeroes!\r\n\r\nIf you have edited this file with Subtitle Edit you might be alble to find a backup via the menu item File -> Restore auto-backup...",
ErrorDirectoryDropNotAllowed = "Directory drop are not supported here.",
NoSupportEncryptedVobSub = "Encrypted VobSub content is not supported.",
NoSupportHereBluRaySup = "Blu-ray sup files are not supported here.",
NoSupportHereDvdSup = "DVD sup files are not supported here.",

View File

@ -2625,6 +2625,9 @@ namespace Nikse.SubtitleEdit.Logic
case "Main/ErrorLoadBinaryZeroes":
language.Main.ErrorLoadBinaryZeroes = reader.Value;
break;
case "Main/ErrorDirectoryDropNotAllowed":
language.Main.ErrorDirectoryDropNotAllowed = reader.Value;
break;
case "Main/NoSupportEncryptedVobSub":
language.Main.NoSupportEncryptedVobSub = reader.Value;
break;

View File

@ -1058,6 +1058,7 @@
public string ErrorLoadSrr { get; set; }
public string ErrorLoadTorrent { get; set; }
public string ErrorLoadBinaryZeroes { get; set; }
public string ErrorDirectoryDropNotAllowed { get; set; }
public string NoSupportEncryptedVobSub { get; set; }
public string NoSupportHereBluRaySup { get; set; }
public string NoSupportHereDvdSup { get; set; }