Defect 20/21 - applied logic from Hawk's patches, so SE runs better on Linux :)

git-svn-id: https://subtitleedit.googlecode.com/svn/trunk@387 99eadd0c-20b8-1223-b5c4-2a2b2df33de2
This commit is contained in:
niksedk 2011-04-08 13:21:37 +00:00
parent 47cca73209
commit fb24594c5c
4 changed files with 31 additions and 8 deletions

View File

@ -1,5 +1,4 @@

using System;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
@ -1248,9 +1247,17 @@ namespace Nikse.SubtitleEdit.Forms
Process process = new Process();
process.StartInfo = new ProcessStartInfo(Configuration.TesseractFolder + "tesseract.exe");
process.StartInfo.UseShellExecute = true;
process.StartInfo.Arguments = "\"" + tempTiffFileName + "\" \"" + tempTextFileName + "\" -l " + language;
process.StartInfo.WorkingDirectory = (Configuration.TesseractFolder);
process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
if (Utilities.IsRunningOnLinux())
{
process.StartInfo.FileName = "tesseract";
process.StartInfo.UseShellExecute = false;
}
process.Start();
process.WaitForExit(5000);
@ -1535,9 +1542,9 @@ namespace Nikse.SubtitleEdit.Forms
foreach (var culture in System.Globalization.CultureInfo.GetCultures(System.Globalization.CultureTypes.NeutralCultures))
{
string tesseractName = culture.ThreeLetterISOLanguageName;
if (culture.LCID == 0x4 && !File.Exists(dir + "\\" + tesseractName + ".traineddata"))
if (culture.LCID == 0x4 && !File.Exists(dir + Path.PathSeparator + tesseractName + ".traineddata"))
tesseractName = "chi_sim";
string trainDataFileName = dir + "\\" + tesseractName + ".traineddata";
string trainDataFileName = dir + Path.PathSeparator + tesseractName + ".traineddata";
if (!list.Contains(culture.ThreeLetterISOLanguageName) && File.Exists(trainDataFileName))
{
list.Add(culture.ThreeLetterISOLanguageName);

View File

@ -186,10 +186,17 @@ namespace Nikse.SubtitleEdit.Logic.OCR
}
// Load NHunspell spellchecker
_hunspell = new Hunspell(dictionary + ".aff", dictionary + ".dic");
IsDictionaryLoaded = true;
_spellCheckDictionaryName = dictionary;
DictionaryCulture = culture;
try
{
_hunspell = new Hunspell(dictionary + ".aff", dictionary + ".dic");
IsDictionaryLoaded = true;
_spellCheckDictionaryName = dictionary;
DictionaryCulture = culture;
}
catch
{
IsDictionaryLoaded = false;
}
}
public string SpellCheckDictionaryName

View File

@ -1031,6 +1031,12 @@ namespace Nikse.SubtitleEdit.Logic
return Type.GetType("Mono.Runtime") != null;
}
public static bool IsRunningOnLinux()
{
int p = (int)Environment.OSVersion.Platform;
return (p == 4 || p == 6 || p == 128);
}
public static void ShowHelp(string parameter)
{
string helpFile = Configuration.Settings.Language.General.HelpFile;

View File

@ -401,6 +401,9 @@ namespace Nikse.SubtitleEdit.Logic.VideoPlayers
public static string GetVlcPath(string fileName)
{
if (Utilities.IsRunningOnLinux())
return null;
string path;
path = Path.Combine(Configuration.BaseDirectory, @"VLC\" + fileName);