Fixed drag and dropping of timecode files

Originally committed to SVN as r134.
This commit is contained in:
Rodrigo Braz Monteiro 2006-02-23 23:04:41 +00:00
parent 81efd4082f
commit 9f361dca17
2 changed files with 16 additions and 0 deletions

View File

@ -303,6 +303,11 @@ void AssFile::LoadTXT (wxString _filename,wxString encoding) {
// Reads line
wxString value = file.ReadLineFromFile();
// Check if this isn't a timecodes file
if (value.Left(10) == _T("# timecode")) {
throw _T("File is a timecode file, cannot load as subtitles.");
}
// Read comment data
isComment = false;
if (comment != _T("") && value.Left(comment.Length()) == comment) {

View File

@ -62,6 +62,7 @@
#include "drop.h"
#include "hotkeys.h"
#include "utils.h"
#include "text_file_reader.h"
/////////////////////////
@ -489,6 +490,16 @@ void FrameMain::LoadSubtitles (wxString filename,wxString charset) {
if (isFile) {
wxFileName fileCheck(filename);
if (!fileCheck.FileExists()) throw _T("File does not exist.");
// Make sure that file isn't actually a timecode file
TextFileReader testSubs(filename);
if (testSubs.HasMoreLines()) {
wxString cur = testSubs.ReadLineFromFile();
if (cur.Left(10) == _T("# timecode")) {
LoadVFR(filename);
return;
}
}
}
// Proceed into loading