mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-22 03:02:35 +01:00
parent
c2f03d2762
commit
01bea6dc86
@ -1542,6 +1542,7 @@ To use an API key, go to "Options -> Settings -> Tools" to enter your Goog
|
||||
<LoadedEmptyOrShort>Loaded empty or very short subtitle {0}</LoadedEmptyOrShort>
|
||||
<FileIsEmptyOrShort>File is empty or very short!</FileIsEmptyOrShort>
|
||||
<FileNotFound>File not found: {0}</FileNotFound>
|
||||
<FileLocked>Unable to open file as it is in use by another program: {0}</FileLocked>
|
||||
<SavedSubtitleX>Saved subtitle {0}</SavedSubtitleX>
|
||||
<SavedOriginalSubtitleX>Saved original subtitle {0}</SavedOriginalSubtitleX>
|
||||
<FileOnDiskModified>File on disk modified</FileOnDiskModified>
|
||||
|
@ -609,5 +609,22 @@ namespace Nikse.SubtitleEdit.Core.Common
|
||||
return validator.IsValid;
|
||||
}
|
||||
}
|
||||
|
||||
public static bool IsFileLocked(string fileName)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var stream = new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.None))
|
||||
{
|
||||
stream.Close();
|
||||
}
|
||||
}
|
||||
catch (IOException)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2756,6 +2756,12 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
return;
|
||||
}
|
||||
|
||||
if (FileUtil.IsFileLocked(fileName))
|
||||
{
|
||||
MessageBox.Show(string.Format(_language.FileLocked, fileName));
|
||||
return;
|
||||
}
|
||||
|
||||
_lastAutoSave = DateTime.UtcNow.Ticks;
|
||||
bool videoFileLoaded = false;
|
||||
_formatManuallyChanged = false;
|
||||
|
@ -1447,6 +1447,7 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
LoadedEmptyOrShort = "Loaded empty or very short subtitle {0}",
|
||||
FileIsEmptyOrShort = "File is empty or very short!",
|
||||
FileNotFound = "File not found: {0}",
|
||||
FileLocked = "Unable to open file as it is in use by another program: {0}",
|
||||
SavedSubtitleX = "Saved subtitle {0}",
|
||||
SavedOriginalSubtitleX = "Saved original subtitle {0}",
|
||||
FileOnDiskModified = "File on disk modified",
|
||||
|
@ -3190,6 +3190,9 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
case "Main/FileNotFound":
|
||||
language.Main.FileNotFound = reader.Value;
|
||||
break;
|
||||
case "Main/FileLocked":
|
||||
language.Main.FileLocked = reader.Value;
|
||||
break;
|
||||
case "Main/SavedSubtitleX":
|
||||
language.Main.SavedSubtitleX = reader.Value;
|
||||
break;
|
||||
|
@ -1307,6 +1307,7 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
public string LoadedEmptyOrShort { get; set; }
|
||||
public string FileIsEmptyOrShort { get; set; }
|
||||
public string FileNotFound { get; set; }
|
||||
public string FileLocked { get; set; }
|
||||
public string SavedSubtitleX { get; set; }
|
||||
public string SavedOriginalSubtitleX { get; set; }
|
||||
public string FileOnDiskModified { get; set; }
|
||||
|
Loading…
Reference in New Issue
Block a user