mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-26 13:12:39 +01:00
Fixed some bugs in command line subtitle conversion (also tested on Linux)
git-svn-id: https://subtitleedit.googlecode.com/svn/trunk@905 99eadd0c-20b8-1223-b5c4-2a2b2df33de2
This commit is contained in:
parent
12941e3af2
commit
7899c1968f
@ -197,7 +197,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
|
||||
public Main()
|
||||
{
|
||||
try
|
||||
//try
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
@ -351,16 +351,17 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
|
||||
FixLargeFonts();
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
Cursor = Cursors.Default;
|
||||
MessageBox.Show(exception.Message + Environment.NewLine + exception.StackTrace);
|
||||
}
|
||||
//catch (Exception exception)
|
||||
//{
|
||||
// Cursor = Cursors.Default;
|
||||
// MessageBox.Show(exception.Message + Environment.NewLine + exception.StackTrace);
|
||||
//}
|
||||
}
|
||||
|
||||
private void BatchConvert(string[] args) // E.g.: /convert *.txt SubRip
|
||||
{
|
||||
const int ATTACH_PARENT_PROCESS = -1;
|
||||
if (!Utilities.IsRunningOnMac() && !Utilities.IsRunningOnLinux())
|
||||
AttachConsole(ATTACH_PARENT_PROCESS);
|
||||
|
||||
Console.WriteLine();
|
||||
@ -382,10 +383,10 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
|
||||
string inputDirectory = Directory.GetCurrentDirectory();
|
||||
int indexOfDirectorySeparatorChar = pattern.LastIndexOf(Path.DirectorySeparatorChar.ToString());
|
||||
if (indexOfDirectorySeparatorChar > 0)
|
||||
if (indexOfDirectorySeparatorChar > 0 && indexOfDirectorySeparatorChar < pattern.Length)
|
||||
{
|
||||
pattern = pattern.Substring(indexOfDirectorySeparatorChar);
|
||||
inputDirectory = pattern.Substring(0, indexOfDirectorySeparatorChar -1);
|
||||
pattern = pattern.Substring(indexOfDirectorySeparatorChar+1);
|
||||
inputDirectory = args[2].Substring(0, indexOfDirectorySeparatorChar);
|
||||
}
|
||||
|
||||
int count = 0;
|
||||
|
@ -92,7 +92,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
||||
public List<string> GetClasses(Subtitle subtitle)
|
||||
{
|
||||
var list = new List<string>();
|
||||
if (subtitle.Header.ToLower().StartsWith("<style"))
|
||||
if (!string.IsNullOrEmpty(subtitle.Header) && subtitle.Header.ToLower().StartsWith("<style"))
|
||||
{
|
||||
foreach (string line in subtitle.Header.Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries))
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user