diff options
Diffstat (limited to 'win/C#/Functions')
-rw-r--r-- | win/C#/Functions/AppcastReader.cs | 4 | ||||
-rw-r--r-- | win/C#/Functions/GrowlCommunicator.cs | 18 | ||||
-rw-r--r-- | win/C#/Functions/Main.cs | 441 | ||||
-rw-r--r-- | win/C#/Functions/PresetLoader.cs | 25 | ||||
-rw-r--r-- | win/C#/Functions/QueryGenerator.cs | 56 | ||||
-rw-r--r-- | win/C#/Functions/QueryParser.cs | 158 | ||||
-rw-r--r-- | win/C#/Functions/Scan.cs | 27 | ||||
-rw-r--r-- | win/C#/Functions/System.cs | 4 |
8 files changed, 400 insertions, 333 deletions
diff --git a/win/C#/Functions/AppcastReader.cs b/win/C#/Functions/AppcastReader.cs index 7248ffa78..e6bd64b08 100644 --- a/win/C#/Functions/AppcastReader.cs +++ b/win/C#/Functions/AppcastReader.cs @@ -54,7 +54,9 @@ namespace Handbrake.Functions Match verShort = Regex.Match(result, @"sparkle:shortVersionString=""(([svn]*)([0-9.\s]*))\""");
this.Build = ver.ToString().Replace("sparkle:version=", string.Empty).Replace("\"", string.Empty);
- this.Version = verShort.ToString().Replace("sparkle:shortVersionString=", string.Empty).Replace("\"", string.Empty);
+ this.Version = verShort.ToString().Replace("sparkle:shortVersionString=", string.Empty).Replace("\"",
+ string.
+ Empty);
this.DownloadFile = nodeItem["windows"].InnerText;
this.DescriptionUrl = new Uri(nodeItem["sparkle:releaseNotesLink"].InnerText);
}
diff --git a/win/C#/Functions/GrowlCommunicator.cs b/win/C#/Functions/GrowlCommunicator.cs index 04450eefc..5bb5efa70 100644 --- a/win/C#/Functions/GrowlCommunicator.cs +++ b/win/C#/Functions/GrowlCommunicator.cs @@ -6,10 +6,7 @@ namespace Handbrake.Functions
{
using System;
- using System.Collections.Generic;
- using System.Text;
using Growl.Connector;
- using Growl.CoreLibrary;
/// <summary>
/// Provides all functionality for communicating with Growl for Windows.
@@ -35,7 +32,8 @@ namespace Handbrake.Functions /// <summary>
/// Notification shown upon completion of encoding
/// </summary>
- private static NotificationType encodeOrQueueCompleted = new NotificationType("EncodeOrQueue", "HandBrake Status");
+ private static NotificationType encodeOrQueueCompleted = new NotificationType("EncodeOrQueue",
+ "HandBrake Status");
/// <summary>
/// Checks to see if Growl is currently running on the local machine.
@@ -60,7 +58,7 @@ namespace Handbrake.Functions public static void Register()
{
Initialize();
- growl.Register(application, new NotificationType[] { encodeOrQueueCompleted });
+ growl.Register(application, new[] {encodeOrQueueCompleted});
}
/// <summary>
@@ -75,7 +73,8 @@ namespace Handbrake.Functions /// </param>
public static void Notify(string title, string text)
{
- Notification notification = new Notification(application.Name, encodeOrQueueCompleted.Name, String.Empty, title, text);
+ Notification notification = new Notification(application.Name, encodeOrQueueCompleted.Name, String.Empty,
+ title, text);
growl.Notify(notification);
}
@@ -89,9 +88,10 @@ namespace Handbrake.Functions /// <param name="imageUrl">The notification image as a url</param>
public static void Notify(NotificationType notificationType, string title, string text, string imageUrl)
{
- Notification notification = new Notification(application.Name, notificationType.Name, String.Empty, title, text)
+ Notification notification = new Notification(application.Name, notificationType.Name, String.Empty, title,
+ text)
{
- Icon = imageUrl
+ Icon = imageUrl
};
growl.Notify(notification);
@@ -116,4 +116,4 @@ namespace Handbrake.Functions }
}
}
-}
+}
\ No newline at end of file diff --git a/win/C#/Functions/Main.cs b/win/C#/Functions/Main.cs index 96550706a..758abdcc0 100644 --- a/win/C#/Functions/Main.cs +++ b/win/C#/Functions/Main.cs @@ -16,6 +16,7 @@ namespace Handbrake.Functions using System.Xml.Serialization;
using EncodeQueue;
using Model;
+ using Parsing;
/// <summary>
/// Useful functions which various screens can use.
@@ -25,7 +26,7 @@ namespace Handbrake.Functions /// <summary>
/// The XML Serializer
/// </summary>
- private static readonly XmlSerializer Ser = new XmlSerializer(typeof(List<Job>));
+ private static readonly XmlSerializer Ser = new XmlSerializer(typeof (List<Job>));
/// <summary>
/// Calculate the duration of the selected title and chapters
@@ -42,7 +43,7 @@ namespace Handbrake.Functions /// <returns>
/// The calculated duration.
/// </returns>
- public static TimeSpan CalculateDuration(int chapterStart, int chapterEnd, Parsing.Title selectedTitle)
+ public static TimeSpan CalculateDuration(int chapterStart, int chapterEnd, Title selectedTitle)
{
TimeSpan duration = TimeSpan.FromSeconds(0.0);
chapterStart++;
@@ -65,12 +66,12 @@ namespace Handbrake.Functions /// <returns>
/// The longest title.
/// </returns>
- public static Parsing.Title SelectLongestTitle(Parsing.DVD source)
+ public static Title SelectLongestTitle(DVD source)
{
TimeSpan longestDurationFound = TimeSpan.FromSeconds(0.0);
- Parsing.Title returnTitle = null;
+ Title returnTitle = null;
- foreach (Parsing.Title item in source.Titles)
+ foreach (Title item in source.Titles)
{
if (item.Duration > longestDurationFound)
{
@@ -105,8 +106,8 @@ namespace Handbrake.Functions int n = dataChpt.Rows.Add();
dataChpt.Rows[n].Cells[0].Value = i + 1;
dataChpt.Rows[n].Cells[1].Value = "Chapter " + (i + 1);
- dataChpt.Rows[n].Cells[0].ValueType = typeof(int);
- dataChpt.Rows[n].Cells[1].ValueType = typeof(string);
+ dataChpt.Rows[n].Cells[0].ValueType = typeof (int);
+ dataChpt.Rows[n].Cells[1].ValueType = typeof (string);
i++;
}
@@ -151,7 +152,7 @@ namespace Handbrake.Functions foreach (DataGridViewRow item in dataChpt.Rows)
{
string name;
- chapterMap.TryGetValue((int)item.Cells[0].Value, out name);
+ chapterMap.TryGetValue((int) item.Cells[0].Value, out name);
item.Cells[1].Value = name ?? "Chapter " + item.Cells[0].Value;
}
@@ -192,7 +193,9 @@ namespace Handbrake.Functions if (Properties.Settings.Default.autoNameFormat != string.Empty)
{
destinationFilename = Properties.Settings.Default.autoNameFormat;
- destinationFilename = destinationFilename.Replace("{source}", sourceName).Replace("{title}", dvdTitle).Replace("{chapters}", combinedChapterTag);
+ destinationFilename =
+ destinationFilename.Replace("{source}", sourceName).Replace("{title}", dvdTitle).Replace(
+ "{chapters}", combinedChapterTag);
}
else
destinationFilename = sourceName + "_T" + dvdTitle + "_C" + combinedChapterTag;
@@ -200,7 +203,8 @@ namespace Handbrake.Functions // Add the appropriate file extension
if (mainWindow.drop_format.SelectedIndex == 0)
{
- if (Properties.Settings.Default.useM4v || mainWindow.Check_ChapterMarkers.Checked || mainWindow.AudioSettings.RequiresM4V() || mainWindow.Subtitles.RequiresM4V())
+ if (Properties.Settings.Default.useM4v || mainWindow.Check_ChapterMarkers.Checked ||
+ mainWindow.AudioSettings.RequiresM4V() || mainWindow.Subtitles.RequiresM4V())
destinationFilename += ".m4v";
else
destinationFilename += ".mp4";
@@ -213,7 +217,8 @@ namespace Handbrake.Functions if (!mainWindow.text_destination.Text.Contains(Path.DirectorySeparatorChar.ToString()))
{
// If there is an auto name path, use it...
- if (Properties.Settings.Default.autoNamePath.Trim() != string.Empty && Properties.Settings.Default.autoNamePath.Trim() != "Click 'Browse' to set the default location")
+ if (Properties.Settings.Default.autoNamePath.Trim() != string.Empty &&
+ Properties.Settings.Default.autoNamePath.Trim() != "Click 'Browse' to set the default location")
autoNamePath = Path.Combine(Properties.Settings.Default.autoNamePath, destinationFilename);
else // ...otherwise, output to the source directory
autoNamePath = null;
@@ -221,10 +226,12 @@ namespace Handbrake.Functions else // Otherwise, use the path that is already there.
{
// Use the path and change the file extension to match the previous destination
- autoNamePath = Path.Combine(Path.GetDirectoryName(mainWindow.text_destination.Text), destinationFilename);
+ autoNamePath = Path.Combine(Path.GetDirectoryName(mainWindow.text_destination.Text),
+ destinationFilename);
if (Path.HasExtension(mainWindow.text_destination.Text))
- autoNamePath = Path.ChangeExtension(autoNamePath, Path.GetExtension(mainWindow.text_destination.Text));
+ autoNamePath = Path.ChangeExtension(autoNamePath,
+ Path.GetExtension(mainWindow.text_destination.Text));
}
}
@@ -250,9 +257,9 @@ namespace Handbrake.Functions Process cliProcess = new Process();
ProcessStartInfo handBrakeCli = new ProcessStartInfo("HandBrakeCLI.exe", " -u -v0")
{
- UseShellExecute = false,
- RedirectStandardError = true,
- RedirectStandardOutput = true,
+ UseShellExecute = false,
+ RedirectStandardError = true,
+ RedirectStandardOutput = true,
CreateNoWindow = true
};
cliProcess.StartInfo = handBrakeCli;
@@ -272,7 +279,8 @@ namespace Handbrake.Functions if (m.Success)
{
- string data = line.Replace("(", string.Empty).Replace(")", string.Empty).Replace("HandBrake ", string.Empty);
+ string data = line.Replace("(", string.Empty).Replace(")", string.Empty).Replace("HandBrake ",
+ string.Empty);
string[] arr = data.Split(' ');
Properties.Settings.Default.hb_build = int.Parse(arr[1]);
@@ -314,7 +322,8 @@ namespace Handbrake.Functions {
try
{
- string tempPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), @"HandBrake\hb_queue_recovery.xml");
+ string tempPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
+ @"HandBrake\hb_queue_recovery.xml");
if (File.Exists(tempPath))
{
using (FileStream strm = new FileStream(tempPath, FileMode.Open, FileAccess.Read))
@@ -354,7 +363,8 @@ namespace Handbrake.Functions {
hbProcesses = Process.GetProcessesByName("HandBrakeCLI");
duration = DateTime.Now - startTime;
- if (duration.Seconds > 5 && hbProcesses.Length == 0) // Make sure we don't wait forever if the process doesn't start
+ if (duration.Seconds > 5 && hbProcesses.Length == 0)
+ // Make sure we don't wait forever if the process doesn't start
return -1;
}
@@ -394,7 +404,8 @@ namespace Handbrake.Functions FileInfo[] logFiles = info.GetFiles("*.txt");
foreach (FileInfo file in logFiles)
{
- if (!file.Name.Contains("last_scan_log") && !file.Name.Contains("last_encode_log") && !file.Name.Contains("tmp_appReadable_log.txt"))
+ if (!file.Name.Contains("last_scan_log") && !file.Name.Contains("last_encode_log") &&
+ !file.Name.Contains("tmp_appReadable_log.txt"))
File.Delete(file.FullName);
}
}
@@ -415,7 +426,8 @@ namespace Handbrake.Functions {
if (file.LastWriteTime < DateTime.Now.AddDays(-30))
{
- if (!file.Name.Contains("last_scan_log") && !file.Name.Contains("last_encode_log") && !file.Name.Contains("tmp_appReadable_log.txt"))
+ if (!file.Name.Contains("last_scan_log") && !file.Name.Contains("last_encode_log") &&
+ !file.Name.Contains("tmp_appReadable_log.txt"))
File.Delete(file.FullName);
}
}
@@ -464,7 +476,7 @@ namespace Handbrake.Functions UpdateCheckInformation info =
new UpdateCheckInformation
{
- NewVersionAvailable = false,
+ NewVersionAvailable = false,
BuildInformation = null
};
callback(new UpdateCheckResult(debug, info));
@@ -479,14 +491,18 @@ namespace Handbrake.Functions UpdateCheckInformation info2 =
new UpdateCheckInformation
{
- NewVersionAvailable = latest > current,
+ NewVersionAvailable = latest > current,
BuildInformation = reader
};
callback(new UpdateCheckResult(debug, info2));
}
catch (Exception exc)
{
- callback(new UpdateCheckResult(debug, new UpdateCheckInformation{Error = exc}));
+ callback(new UpdateCheckResult(debug,
+ new UpdateCheckInformation
+ {
+ Error = exc
+ }));
}
}));
}
@@ -502,7 +518,7 @@ namespace Handbrake.Functions /// </returns>
public static UpdateCheckInformation EndCheckForUpdates(IAsyncResult result)
{
- UpdateCheckResult checkResult = (UpdateCheckResult)result;
+ UpdateCheckResult checkResult = (UpdateCheckResult) result;
return checkResult.Result;
}
@@ -514,191 +530,191 @@ namespace Handbrake.Functions {
IDictionary<string, string> languageMap = new Dictionary<string, string>
{
- {"Any", "und"},
- {"Afar", "aar"},
- {"Abkhazian", "abk"},
- {"Afrikaans", "afr"},
- {"Akan", "aka"},
- {"Albanian", "sqi"},
- {"Amharic", "amh"},
- {"Arabic", "ara"},
- {"Aragonese", "arg"},
- {"Armenian", "hye"},
- {"Assamese", "asm"},
- {"Avaric", "ava"},
- {"Avestan", "ave"},
- {"Aymara", "aym"},
- {"Azerbaijani", "aze"},
- {"Bashkir", "bak"},
- {"Bambara", "bam"},
- {"Basque", "eus"},
- {"Belarusian", "bel"},
- {"Bengali", "ben"},
- {"Bihari", "bih"},
- {"Bislama", "bis"},
- {"Bosnian", "bos"},
- {"Breton", "bre"},
- {"Bulgarian", "bul"},
- {"Burmese", "mya"},
- {"Catalan", "cat"},
- {"Chamorro", "cha"},
- {"Chechen", "che"},
- {"Chinese", "zho"},
- {"Church Slavic", "chu"},
- {"Chuvash", "chv"},
- {"Cornish", "cor"},
- {"Corsican", "cos"},
- {"Cree", "cre"},
- {"Czech", "ces"},
- {"Dansk", "dan"},
- {"Divehi", "div"},
- {"Nederlands", "nld"},
- {"Dzongkha", "dzo"},
- {"English", "eng"},
- {"Esperanto", "epo"},
- {"Estonian", "est"},
- {"Ewe", "ewe"},
- {"Faroese", "fao"},
- {"Fijian", "fij"},
- {"Suomi", "fin"},
- {"Francais", "fra"},
- {"Western Frisian", "fry"},
- {"Fulah", "ful"},
- {"Georgian", "kat"},
- {"Deutsch", "deu"},
- {"Gaelic (Scots)", "gla"},
- {"Irish", "gle"},
- {"Galician", "glg"},
- {"Manx", "glv"},
- {"Greek Modern", "ell"},
- {"Guarani", "grn"},
- {"Gujarati", "guj"},
- {"Haitian", "hat"},
- {"Hausa", "hau"},
- {"Hebrew", "heb"},
- {"Herero", "her"},
- {"Hindi", "hin"},
- {"Hiri Motu", "hmo"},
- {"Magyar", "hun"},
- {"Igbo", "ibo"},
- {"Islenska", "isl"},
- {"Ido", "ido"},
- {"Sichuan Yi", "iii"},
- {"Inuktitut", "iku"},
- {"Interlingue", "ile"},
- {"Interlingua", "ina"},
- {"Indonesian", "ind"},
- {"Inupiaq", "ipk"},
- {"Italiano", "ita"},
- {"Javanese", "jav"},
- {"Japanese", "jpn"},
- {"Kalaallisut", "kal"},
- {"Kannada", "kan"},
- {"Kashmiri", "kas"},
- {"Kanuri", "kau"},
- {"Kazakh", "kaz"},
- {"Central Khmer", "khm"},
- {"Kikuyu", "kik"},
- {"Kinyarwanda", "kin"},
- {"Kirghiz", "kir"},
- {"Komi", "kom"},
- {"Kongo", "kon"},
- {"Korean", "kor"},
- {"Kuanyama", "kua"},
- {"Kurdish", "kur"},
- {"Lao", "lao"},
- {"Latin", "lat"},
- {"Latvian", "lav"},
- {"Limburgan", "lim"},
- {"Lingala", "lin"},
- {"Lithuanian", "lit"},
- {"Luxembourgish", "ltz"},
- {"Luba-Katanga", "lub"},
- {"Ganda", "lug"},
- {"Macedonian", "mkd"},
- {"Marshallese", "mah"},
- {"Malayalam", "mal"},
- {"Maori", "mri"},
- {"Marathi", "mar"},
- {"Malay", "msa"},
- {"Malagasy", "mlg"},
- {"Maltese", "mlt"},
- {"Moldavian", "mol"},
- {"Mongolian", "mon"},
- {"Nauru", "nau"},
- {"Navajo", "nav"},
- {"Ndebele, South", "nbl"},
- {"Ndebele, North", "nde"},
- {"Ndonga", "ndo"},
- {"Nepali", "nep"},
- {"Norwegian Nynorsk", "nno"},
- {"Norwegian Bokm�l", "nob"},
- {"Norsk", "nor"},
- {"Chichewa; Nyanja", "nya"},
- {"Occitan", "oci"},
- {"Ojibwa", "oji"},
- {"Oriya", "ori"},
- {"Oromo", "orm"},
- {"Ossetian", "oss"},
- {"Panjabi", "pan"},
- {"Persian", "fas"},
- {"Pali", "pli"},
- {"Polish", "pol"},
- {"Portugues", "por"},
- {"Pushto", "pus"},
- {"Quechua", "que"},
- {"Romansh", "roh"},
- {"Romanian", "ron"},
- {"Rundi", "run"},
- {"Russian", "rus"},
- {"Sango", "sag"},
- {"Sanskrit", "san"},
- {"Serbian", "srp"},
- {"Hrvatski", "hrv"},
- {"Sinhala", "sin"},
- {"Slovak", "slk"},
- {"Slovenian", "slv"},
- {"Northern Sami", "sme"},
- {"Samoan", "smo"},
- {"Shona", "sna"},
- {"Sindhi", "snd"},
- {"Somali", "som"},
- {"Sotho Southern", "sot"},
- {"Espanol", "spa"},
- {"Sardinian", "srd"},
- {"Swati", "ssw"},
- {"Sundanese", "sun"},
- {"Swahili", "swa"},
- {"Svenska", "swe"},
- {"Tahitian", "tah"},
- {"Tamil", "tam"},
- {"Tatar", "tat"},
- {"Telugu", "tel"},
- {"Tajik", "tgk"},
- {"Tagalog", "tgl"},
- {"Thai", "tha"},
- {"Tibetan", "bod"},
- {"Tigrinya", "tir"},
- {"Tonga", "ton"},
- {"Tswana", "tsn"},
- {"Tsonga", "tso"},
- {"Turkmen", "tuk"},
- {"Turkish", "tur"},
- {"Twi", "twi"},
- {"Uighur", "uig"},
- {"Ukrainian", "ukr"},
- {"Urdu", "urd"},
- {"Uzbek", "uzb"},
- {"Venda", "ven"},
- {"Vietnamese", "vie"},
- {"Volap�k", "vol"},
- {"Welsh", "cym"},
- {"Walloon", "wln"},
- {"Wolof", "wol"},
- {"Xhosa", "xho"},
- {"Yiddish", "yid"},
- {"Yoruba", "yor"},
- {"Zhuang", "zha"},
+ {"Any", "und"},
+ {"Afar", "aar"},
+ {"Abkhazian", "abk"},
+ {"Afrikaans", "afr"},
+ {"Akan", "aka"},
+ {"Albanian", "sqi"},
+ {"Amharic", "amh"},
+ {"Arabic", "ara"},
+ {"Aragonese", "arg"},
+ {"Armenian", "hye"},
+ {"Assamese", "asm"},
+ {"Avaric", "ava"},
+ {"Avestan", "ave"},
+ {"Aymara", "aym"},
+ {"Azerbaijani", "aze"},
+ {"Bashkir", "bak"},
+ {"Bambara", "bam"},
+ {"Basque", "eus"},
+ {"Belarusian", "bel"},
+ {"Bengali", "ben"},
+ {"Bihari", "bih"},
+ {"Bislama", "bis"},
+ {"Bosnian", "bos"},
+ {"Breton", "bre"},
+ {"Bulgarian", "bul"},
+ {"Burmese", "mya"},
+ {"Catalan", "cat"},
+ {"Chamorro", "cha"},
+ {"Chechen", "che"},
+ {"Chinese", "zho"},
+ {"Church Slavic", "chu"},
+ {"Chuvash", "chv"},
+ {"Cornish", "cor"},
+ {"Corsican", "cos"},
+ {"Cree", "cre"},
+ {"Czech", "ces"},
+ {"Dansk", "dan"},
+ {"Divehi", "div"},
+ {"Nederlands", "nld"},
+ {"Dzongkha", "dzo"},
+ {"English", "eng"},
+ {"Esperanto", "epo"},
+ {"Estonian", "est"},
+ {"Ewe", "ewe"},
+ {"Faroese", "fao"},
+ {"Fijian", "fij"},
+ {"Suomi", "fin"},
+ {"Francais", "fra"},
+ {"Western Frisian", "fry"},
+ {"Fulah", "ful"},
+ {"Georgian", "kat"},
+ {"Deutsch", "deu"},
+ {"Gaelic (Scots)", "gla"},
+ {"Irish", "gle"},
+ {"Galician", "glg"},
+ {"Manx", "glv"},
+ {"Greek Modern", "ell"},
+ {"Guarani", "grn"},
+ {"Gujarati", "guj"},
+ {"Haitian", "hat"},
+ {"Hausa", "hau"},
+ {"Hebrew", "heb"},
+ {"Herero", "her"},
+ {"Hindi", "hin"},
+ {"Hiri Motu", "hmo"},
+ {"Magyar", "hun"},
+ {"Igbo", "ibo"},
+ {"Islenska", "isl"},
+ {"Ido", "ido"},
+ {"Sichuan Yi", "iii"},
+ {"Inuktitut", "iku"},
+ {"Interlingue", "ile"},
+ {"Interlingua", "ina"},
+ {"Indonesian", "ind"},
+ {"Inupiaq", "ipk"},
+ {"Italiano", "ita"},
+ {"Javanese", "jav"},
+ {"Japanese", "jpn"},
+ {"Kalaallisut", "kal"},
+ {"Kannada", "kan"},
+ {"Kashmiri", "kas"},
+ {"Kanuri", "kau"},
+ {"Kazakh", "kaz"},
+ {"Central Khmer", "khm"},
+ {"Kikuyu", "kik"},
+ {"Kinyarwanda", "kin"},
+ {"Kirghiz", "kir"},
+ {"Komi", "kom"},
+ {"Kongo", "kon"},
+ {"Korean", "kor"},
+ {"Kuanyama", "kua"},
+ {"Kurdish", "kur"},
+ {"Lao", "lao"},
+ {"Latin", "lat"},
+ {"Latvian", "lav"},
+ {"Limburgan", "lim"},
+ {"Lingala", "lin"},
+ {"Lithuanian", "lit"},
+ {"Luxembourgish", "ltz"},
+ {"Luba-Katanga", "lub"},
+ {"Ganda", "lug"},
+ {"Macedonian", "mkd"},
+ {"Marshallese", "mah"},
+ {"Malayalam", "mal"},
+ {"Maori", "mri"},
+ {"Marathi", "mar"},
+ {"Malay", "msa"},
+ {"Malagasy", "mlg"},
+ {"Maltese", "mlt"},
+ {"Moldavian", "mol"},
+ {"Mongolian", "mon"},
+ {"Nauru", "nau"},
+ {"Navajo", "nav"},
+ {"Ndebele, South", "nbl"},
+ {"Ndebele, North", "nde"},
+ {"Ndonga", "ndo"},
+ {"Nepali", "nep"},
+ {"Norwegian Nynorsk", "nno"},
+ {"Norwegian Bokm�l", "nob"},
+ {"Norsk", "nor"},
+ {"Chichewa; Nyanja", "nya"},
+ {"Occitan", "oci"},
+ {"Ojibwa", "oji"},
+ {"Oriya", "ori"},
+ {"Oromo", "orm"},
+ {"Ossetian", "oss"},
+ {"Panjabi", "pan"},
+ {"Persian", "fas"},
+ {"Pali", "pli"},
+ {"Polish", "pol"},
+ {"Portugues", "por"},
+ {"Pushto", "pus"},
+ {"Quechua", "que"},
+ {"Romansh", "roh"},
+ {"Romanian", "ron"},
+ {"Rundi", "run"},
+ {"Russian", "rus"},
+ {"Sango", "sag"},
+ {"Sanskrit", "san"},
+ {"Serbian", "srp"},
+ {"Hrvatski", "hrv"},
+ {"Sinhala", "sin"},
+ {"Slovak", "slk"},
+ {"Slovenian", "slv"},
+ {"Northern Sami", "sme"},
+ {"Samoan", "smo"},
+ {"Shona", "sna"},
+ {"Sindhi", "snd"},
+ {"Somali", "som"},
+ {"Sotho Southern", "sot"},
+ {"Espanol", "spa"},
+ {"Sardinian", "srd"},
+ {"Swati", "ssw"},
+ {"Sundanese", "sun"},
+ {"Swahili", "swa"},
+ {"Svenska", "swe"},
+ {"Tahitian", "tah"},
+ {"Tamil", "tam"},
+ {"Tatar", "tat"},
+ {"Telugu", "tel"},
+ {"Tajik", "tgk"},
+ {"Tagalog", "tgl"},
+ {"Thai", "tha"},
+ {"Tibetan", "bod"},
+ {"Tigrinya", "tir"},
+ {"Tonga", "ton"},
+ {"Tswana", "tsn"},
+ {"Tsonga", "tso"},
+ {"Turkmen", "tuk"},
+ {"Turkish", "tur"},
+ {"Twi", "twi"},
+ {"Uighur", "uig"},
+ {"Ukrainian", "ukr"},
+ {"Urdu", "urd"},
+ {"Uzbek", "uzb"},
+ {"Venda", "ven"},
+ {"Vietnamese", "vie"},
+ {"Volap�k", "vol"},
+ {"Welsh", "cym"},
+ {"Walloon", "wln"},
+ {"Wolof", "wol"},
+ {"Xhosa", "xho"},
+ {"Yiddish", "yid"},
+ {"Yoruba", "yor"},
+ {"Zhuang", "zha"},
{"Zulu", "zul"}
};
return languageMap;
@@ -714,11 +730,12 @@ namespace Handbrake.Functions DriveInfo[] theCollectionOfDrives = DriveInfo.GetDrives();
foreach (DriveInfo curDrive in theCollectionOfDrives)
{
- if (curDrive.DriveType == DriveType.CDRom && curDrive.IsReady && File.Exists(curDrive.RootDirectory + "VIDEO_TS\\VIDEO_TS.IFO"))
+ if (curDrive.DriveType == DriveType.CDRom && curDrive.IsReady &&
+ File.Exists(curDrive.RootDirectory + "VIDEO_TS\\VIDEO_TS.IFO"))
{
drives.Add(new DriveInformation
{
- VolumeLabel = curDrive.VolumeLabel,
+ VolumeLabel = curDrive.VolumeLabel,
RootDirectory = curDrive.RootDirectory + "VIDEO_TS"
});
}
diff --git a/win/C#/Functions/PresetLoader.cs b/win/C#/Functions/PresetLoader.cs index a550bfa1d..95d09e5f5 100644 --- a/win/C#/Functions/PresetLoader.cs +++ b/win/C#/Functions/PresetLoader.cs @@ -33,6 +33,7 @@ namespace Handbrake.Functions public static void LoadPreset(frmMain mainWindow, QueryParser presetQuery, string name, bool pictureSettings)
{
#region Source
+
// Reset some vaules to stock first to prevent errors.
mainWindow.check_iPodAtom.CheckState = CheckState.Unchecked;
@@ -70,7 +71,9 @@ namespace Handbrake.Functions mainWindow.check_iPodAtom.CheckState = presetQuery.IpodAtom ? CheckState.Checked : CheckState.Unchecked;
- mainWindow.check_optimiseMP4.CheckState = presetQuery.OptimizeMP4 ? CheckState.Checked : CheckState.Unchecked;
+ mainWindow.check_optimiseMP4.CheckState = presetQuery.OptimizeMP4
+ ? CheckState.Checked
+ : CheckState.Unchecked;
mainWindow.check_largeFile.CheckState = presetQuery.LargeMP4 ? CheckState.Checked : CheckState.Unchecked;
@@ -79,6 +82,7 @@ namespace Handbrake.Functions #endregion
#region Picture
+
mainWindow.PictureSettings.check_autoCrop.Checked = true;
if (pictureSettings) // only Load picture settings if the perset requires it
{
@@ -102,7 +106,9 @@ namespace Handbrake.Functions mainWindow.PictureSettings.drp_anamorphic.SelectedIndex = presetQuery.AnamorphicMode;
// Keep Aspect Ration Anamorphic Setting.
- mainWindow.PictureSettings.check_KeepAR.CheckState = presetQuery.KeepDisplayAsect ? CheckState.Checked : CheckState.Unchecked;
+ mainWindow.PictureSettings.check_KeepAR.CheckState = presetQuery.KeepDisplayAsect
+ ? CheckState.Checked
+ : CheckState.Unchecked;
// Set the Width and height as Required.
if (presetQuery.Width != 0)
@@ -130,7 +136,9 @@ namespace Handbrake.Functions // Aspect Ratio for non anamorphic sources
if (presetQuery.AnamorphicMode == 0)
- mainWindow.PictureSettings.check_KeepAR.CheckState = presetQuery.Height == 0 ? CheckState.Checked : CheckState.Unchecked;
+ mainWindow.PictureSettings.check_KeepAR.CheckState = presetQuery.Height == 0
+ ? CheckState.Checked
+ : CheckState.Unchecked;
// Custom Anamorphic Controls
mainWindow.PictureSettings.updownDisplayWidth.Text = presetQuery.DisplayWidthValue.ToString();
@@ -141,15 +149,18 @@ namespace Handbrake.Functions #endregion
#region Filters
+
mainWindow.Filters.SetDecomb(presetQuery.Decomb);
mainWindow.Filters.SetDeInterlace(presetQuery.DeInterlace);
mainWindow.Filters.SetDeNoise(presetQuery.DeNoise);
mainWindow.Filters.SetDeTelecine(presetQuery.DeTelecine);
mainWindow.Filters.SetDeBlock(presetQuery.DeBlock);
mainWindow.Filters.SetGrayScale(presetQuery.Grayscale);
+
#endregion
#region Video
+
mainWindow.drp_videoEncoder.Text = presetQuery.VideoEncoder;
if (presetQuery.AverageVideoBitrate != null)
@@ -175,9 +186,9 @@ namespace Handbrake.Functions double x264Step = cqStep;
double presetValue = presetQuery.VideoQuality;
- double x = 51 / x264Step;
+ double x = 51/x264Step;
- double calculated = presetValue / x264Step;
+ double calculated = presetValue/x264Step;
calculated = x - calculated;
int.TryParse(calculated.ToString(), out value);
@@ -222,14 +233,18 @@ namespace Handbrake.Functions #endregion
#region Audio
+
mainWindow.AudioSettings.LoadTracks(presetQuery.AudioInformation);
+
#endregion
#region Other
+
mainWindow.x264Panel.X264Query = presetQuery.H264Query;
// Set the preset name
mainWindow.labelPreset.Text = "Output Settings (Preset: " + name + ")";
+
#endregion
}
}
diff --git a/win/C#/Functions/QueryGenerator.cs b/win/C#/Functions/QueryGenerator.cs index 592640f79..c1cadfd71 100644 --- a/win/C#/Functions/QueryGenerator.cs +++ b/win/C#/Functions/QueryGenerator.cs @@ -37,8 +37,9 @@ namespace Handbrake.Functions public static string GenerateCliQuery(frmMain mainWindow, int mode, int duration, string preview)
{
string query = string.Empty;
-
- if (!string.IsNullOrEmpty(mainWindow.sourcePath) && mainWindow.sourcePath.Trim() != "Select \"Source\" to continue")
+
+ if (!string.IsNullOrEmpty(mainWindow.sourcePath) &&
+ mainWindow.sourcePath.Trim() != "Select \"Source\" to continue")
query = " -i " + '"' + mainWindow.sourcePath + '"';
if (mainWindow.drp_dvdtitle.Text != string.Empty)
@@ -54,10 +55,13 @@ namespace Handbrake.Functions switch (mode)
{
case 0: // Chapters
- if (mainWindow.drop_chapterFinish.Text == mainWindow.drop_chapterStart.Text && mainWindow.drop_chapterStart.Text != string.Empty)
+ if (mainWindow.drop_chapterFinish.Text == mainWindow.drop_chapterStart.Text &&
+ mainWindow.drop_chapterStart.Text != string.Empty)
query += string.Format(" -c {0}", mainWindow.drop_chapterStart.Text);
- else if (mainWindow.drop_chapterStart.Text != string.Empty && mainWindow.drop_chapterFinish.Text != string.Empty)
- query += string.Format(" -c {0}-{1}", mainWindow.drop_chapterStart.Text, mainWindow.drop_chapterFinish.Text);
+ else if (mainWindow.drop_chapterStart.Text != string.Empty &&
+ mainWindow.drop_chapterFinish.Text != string.Empty)
+ query += string.Format(" -c {0}-{1}", mainWindow.drop_chapterStart.Text,
+ mainWindow.drop_chapterFinish.Text);
break;
case 1: // Seconds
int start, end;
@@ -65,14 +69,16 @@ namespace Handbrake.Functions int.TryParse(mainWindow.drop_chapterFinish.Text, out end);
int calculatedDuration = end - start;
- query += string.Format(" --start-at duration:{0} --stop-at duration:{1}", mainWindow.drop_chapterStart.Text, calculatedDuration);
+ query += string.Format(" --start-at duration:{0} --stop-at duration:{1}",
+ mainWindow.drop_chapterStart.Text, calculatedDuration);
break;
case 2: // Frames
int.TryParse(mainWindow.drop_chapterStart.Text, out start);
int.TryParse(mainWindow.drop_chapterFinish.Text, out end);
calculatedDuration = end - start;
- query += string.Format(" --start-at frame:{0} --stop-at frame:{1}", mainWindow.drop_chapterStart.Text, calculatedDuration);
+ query += string.Format(" --start-at frame:{0} --stop-at frame:{1}",
+ mainWindow.drop_chapterStart.Text, calculatedDuration);
break;
case 3: // Preview
query += " --previews " + Properties.Settings.Default.previewScanCount + " ";
@@ -80,7 +86,8 @@ namespace Handbrake.Functions query += " --stop-at duration:" + duration + " ";
if (mainWindow.text_destination.Text != string.Empty)
- query += string.Format(" -o \"{0}\" ", mainWindow.text_destination.Text.Replace(".m", "_sample.m"));
+ query += string.Format(" -o \"{0}\" ",
+ mainWindow.text_destination.Text.Replace(".m", "_sample.m"));
break;
default:
break;
@@ -103,6 +110,7 @@ namespace Handbrake.Functions string query = string.Empty;
#region Output Settings Box
+
query += " -f " + mainWindow.drop_format.Text.ToLower().Replace(" file", string.Empty);
// These are output settings features
@@ -114,6 +122,7 @@ namespace Handbrake.Functions if (mainWindow.check_optimiseMP4.Checked)
query += " -O ";
+
#endregion
#region Picture Settings Tab
@@ -122,7 +131,8 @@ namespace Handbrake.Functions if (mainWindow.PictureSettings.PresetMaximumResolution.Width == 0)
{
if (mainWindow.PictureSettings.text_width.Value != 0)
- if (mainWindow.PictureSettings.drp_anamorphic.SelectedIndex != 1) // Prevent usage for strict anamorphic
+ if (mainWindow.PictureSettings.drp_anamorphic.SelectedIndex != 1)
+ // Prevent usage for strict anamorphic
query += " -w " + mainWindow.PictureSettings.text_width.Text;
}
else
@@ -137,13 +147,16 @@ namespace Handbrake.Functions {
if (mainWindow.PictureSettings.text_height.Value != 0)
if (mainWindow.PictureSettings.text_height.Text != string.Empty)
- if (mainWindow.PictureSettings.drp_anamorphic.SelectedIndex == 0 || mainWindow.PictureSettings.drp_anamorphic.SelectedIndex == 3) // Prevent usage for strict anamorphic
+ if (mainWindow.PictureSettings.drp_anamorphic.SelectedIndex == 0 ||
+ mainWindow.PictureSettings.drp_anamorphic.SelectedIndex == 3)
+ // Prevent usage for strict anamorphic
query += " -l " + mainWindow.PictureSettings.text_height.Text;
}
else
{
if (mainWindow.PictureSettings.text_height.Value != 0)
- if (mainWindow.PictureSettings.drp_anamorphic.SelectedIndex == 0 || mainWindow.PictureSettings.drp_anamorphic.SelectedIndex == 3)
+ if (mainWindow.PictureSettings.drp_anamorphic.SelectedIndex == 0 ||
+ mainWindow.PictureSettings.drp_anamorphic.SelectedIndex == 3)
query += " -Y " + mainWindow.PictureSettings.text_height.Text;
}
@@ -193,10 +206,13 @@ namespace Handbrake.Functions query += " --keep-display-aspect ";
if (!mainWindow.PictureSettings.check_KeepAR.Checked)
- if (mainWindow.PictureSettings.updownParWidth.Text != string.Empty && mainWindow.PictureSettings.updownParHeight.Text != string.Empty)
- query += " --pixel-aspect " + mainWindow.PictureSettings.updownParWidth.Text + ":" + mainWindow.PictureSettings.updownParHeight.Text + " ";
+ if (mainWindow.PictureSettings.updownParWidth.Text != string.Empty &&
+ mainWindow.PictureSettings.updownParHeight.Text != string.Empty)
+ query += " --pixel-aspect " + mainWindow.PictureSettings.updownParWidth.Text + ":" +
+ mainWindow.PictureSettings.updownParHeight.Text + " ";
break;
}
+
#endregion
// Filters Panel
@@ -240,7 +256,7 @@ namespace Handbrake.Functions break;
case "H.264 (x264)":
CultureInfo culture = CultureInfo.CreateSpecificCulture("en-US");
- value = 51 - mainWindow.slider_videoQuality.Value * cqStep;
+ value = 51 - mainWindow.slider_videoQuality.Value*cqStep;
value = Math.Round(value, 2);
query += " -q " + value.ToString(culture);
break;
@@ -259,6 +275,7 @@ namespace Handbrake.Functions if (mainWindow.drp_videoFramerate.Text != "Same as source")
query += " -r " + mainWindow.drp_videoFramerate.Text;
+
#endregion
#region Audio Settings Tab
@@ -417,8 +434,8 @@ namespace Handbrake.Functions // This is for the queue. It allows different chapter name files for each title.
string[] destName = mainWindow.text_destination.Text.Split('\\');
string dest_name = destName[destName.Length - 1];
- dest_name = dest_name.Replace("\"", "");
- dest_name = dest_name.Replace(".mp4", "").Replace(".m4v", "").Replace(".mkv", "");
+ dest_name = dest_name.Replace("\"", string.Empty);
+ dest_name = dest_name.Replace(".mp4", string.Empty).Replace(".m4v", string.Empty).Replace(".mkv", string.Empty);
string sourceTitle = mainWindow.drp_dvdtitle.Text;
string[] titlesplit = sourceTitle.Split(' ');
@@ -440,12 +457,14 @@ namespace Handbrake.Functions else
query += " -m";
}
+
#endregion
// X264 Panel
query += " -x " + mainWindow.x264Panel.X264Query;
#region Processors / Other
+
string processors = Properties.Settings.Default.Processors;
if (processors != "Automatic")
query += " -C " + processors + " ";
@@ -454,6 +473,7 @@ namespace Handbrake.Functions if (Properties.Settings.Default.noDvdNav)
query += " --no-dvdnav";
+
#endregion
return query;
@@ -540,7 +560,9 @@ namespace Handbrake.Functions }
catch (Exception exc)
{
- MessageBox.Show("Unable to save Chapter Makrers file! \nChapter marker names will NOT be saved in your encode \n\n" + exc, "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
+ MessageBox.Show(
+ "Unable to save Chapter Makrers file! \nChapter marker names will NOT be saved in your encode \n\n" +
+ exc, "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return false;
}
}
diff --git a/win/C#/Functions/QueryParser.cs b/win/C#/Functions/QueryParser.cs index 216d114ac..9d5b9a9e5 100644 --- a/win/C#/Functions/QueryParser.cs +++ b/win/C#/Functions/QueryParser.cs @@ -4,15 +4,15 @@ Homepage: <http://handbrake.fr>.
It may be used under the terms of the GNU General Public License. */
-using System;
-using System.Globalization;
-using System.Text.RegularExpressions;
-using System.Windows.Forms;
-using System.Collections;
-using Handbrake.Model;
-
namespace Handbrake.Functions
{
+ using System;
+ using System.Collections;
+ using System.Globalization;
+ using System.Text.RegularExpressions;
+ using System.Windows.Forms;
+ using Model;
+
public class QueryParser
{
private static readonly CultureInfo Culture = new CultureInfo("en-US", false);
@@ -26,9 +26,9 @@ namespace Handbrake.Functions // Output Settings
public string Format { get; set; }
- public Boolean LargeMP4 { get; set; }
- public Boolean IpodAtom { get; set; }
- public Boolean OptimizeMP4 { get; set; }
+ public bool LargeMP4 { get; set; }
+ public bool IpodAtom { get; set; }
+ public bool OptimizeMP4 { get; set; }
// Picture Settings
public int Width { get; set; }
@@ -41,7 +41,7 @@ namespace Handbrake.Functions public string CropLeft { get; set; }
public string CropRight { get; set; }
public int AnamorphicMode { get; set; }
- public Boolean KeepDisplayAsect { get; set; }
+ public bool KeepDisplayAsect { get; set; }
public double DisplayWidthValue { get; set; }
public int PixelAspectWidth { get; set; }
public int PixelAspectHeight { get; set; }
@@ -56,9 +56,9 @@ namespace Handbrake.Functions // Video Settings
public string VideoEncoder { get; set; }
- public Boolean Grayscale { get; set; }
- public Boolean TwoPass { get; set; }
- public Boolean TurboFirstPass { get; set; }
+ public bool Grayscale { get; set; }
+ public bool TwoPass { get; set; }
+ public bool TurboFirstPass { get; set; }
public string VideoFramerate { get; set; }
public string AverageVideoBitrate { get; set; }
public string VideoTargetSize { get; set; }
@@ -67,23 +67,23 @@ namespace Handbrake.Functions // Audio Settings
public ArrayList AudioInformation { get; set; }
public string Subtitles { get; set; }
- public Boolean ForcedSubtitles { get; set; }
+ public bool ForcedSubtitles { get; set; }
// Chapter Markers
- public Boolean ChapterMarkers { get; set; }
+ public bool ChapterMarkers { get; set; }
// Other
public string H264Query { get; set; }
- public Boolean Verbose { get; set; }
+ public bool Verbose { get; set; }
// Preset Information
public int PresetBuildNumber { get; set; }
public string PresetDescription { get; set; }
public string PresetName { get; set; }
public string Type { get; set; }
- public Boolean UsesMaxPictureSettings { get; set; }
- public Boolean UsesPictureFilters { get; set; }
- public Boolean UsesPictureSettings { get; set; }
+ public bool UsesMaxPictureSettings { get; set; }
+ public bool UsesPictureFilters { get; set; }
+ public bool UsesPictureSettings { get; set; }
#endregion
@@ -93,23 +93,23 @@ namespace Handbrake.Functions /// </summary>
/// <param name="input">A ClI Query</param>
/// <returns>A Parsed Query</returns>
- public static QueryParser Parse(String input)
+ public static QueryParser Parse(string input)
{
var thisQuery = new QueryParser();
#region Regular Expressions
- //Source
+ // Source
Match title = Regex.Match(input, @"-t ([0-9]*)");
Match chapters = Regex.Match(input, @"-c ([0-9-]*)");
- //Output Settings
+ // Output Settings
Match format = Regex.Match(input, @"-f ([a-z0-9a-z0-9a-z0-9]*)");
Match grayscale = Regex.Match(input, @" -g");
Match largerMp4 = Regex.Match(input, @" -4");
Match ipodAtom = Regex.Match(input, @" -I");
- //Picture Settings Tab
+ // Picture Settings Tab
Match width = Regex.Match(input, @"-w ([0-9]*)");
Match height = Regex.Match(input, @"-l ([0-9]*)");
Match maxWidth = Regex.Match(input, @"-X ([0-9]*)");
@@ -134,7 +134,7 @@ namespace Handbrake.Functions Match detelecine = Regex.Match(input, @"--detelecine");
Match detelecineValue = Regex.Match(input, @" --detelecine=\""([a-zA-Z0-9.:]*)\""");
- //Video Settings Tab
+ // Video Settings Tab
Match videoEncoder = Regex.Match(input, @"-e ([a-zA-Z0-9]*)");
Match videoFramerate = Regex.Match(input, @"-r ([0-9.]*)");
Match videoBitrate = Regex.Match(input, @"-b ([0-9]*)");
@@ -144,13 +144,13 @@ namespace Handbrake.Functions Match turboFirstPass = Regex.Match(input, @" -T");
Match optimizeMP4 = Regex.Match(input, @" -O");
- //Audio Settings Tab
+ // Audio Settings Tab
Match noAudio = Regex.Match(input, @"-a none");
Match audioTracks = Regex.Match(input, @"-a ([0-9,]*)");
Match audioTrackMixes = Regex.Match(input, @"-6 ([0-9a-zA-Z,]*)");
Match audioEncoders = Regex.Match(input, @"-E ([a-zA-Z0-9+,]*)");
- Match audioBitrates = Regex.Match(input, @"-B ([0-9a-zA-Z,]*)"); // Auto = a-z
- Match audioSampleRates = Regex.Match(input, @"-R ([0-9a-zA-Z.,]*)"); // Auto = a-z
+ Match audioBitrates = Regex.Match(input, @"-B ([0-9a-zA-Z,]*)"); // Auto = a-z
+ Match audioSampleRates = Regex.Match(input, @"-R ([0-9a-zA-Z.,]*)"); // Auto = a-z
Match drcValues = Regex.Match(input, @"-D ([0-9.,]*)");
Match subtitles = Regex.Match(input, @"-s ([0-9a-zA-Z]*)");
@@ -161,10 +161,10 @@ namespace Handbrake.Functions Match chapterMarkers = Regex.Match(input, @" -m");
Match chapterMarkersFileMode = Regex.Match(input, @"--markers");
- //H264 Tab
+ // H264 Tab
Match x264 = Regex.Match(input, @"-x ([.,/a-zA-Z0-9=:-]*)");
- //Program Options
+ // Program Options
Match verbose = Regex.Match(input, @" -v");
#endregion
@@ -176,11 +176,11 @@ namespace Handbrake.Functions #region Source Tab
if (title.Success)
- thisQuery.DVDTitle = int.Parse(title.ToString().Replace("-t ", ""));
+ thisQuery.DVDTitle = int.Parse(title.ToString().Replace("-t ", string.Empty));
if (chapters.Success)
{
- string[] actTitles = chapters.ToString().Replace("-c ", "").Split('-');
+ string[] actTitles = chapters.ToString().Replace("-c ", string.Empty).Split('-');
thisQuery.DVDChapterStart = int.Parse(actTitles[0]);
if (actTitles.Length > 1)
{
@@ -190,12 +190,13 @@ namespace Handbrake.Functions if ((thisQuery.DVDChapterStart == 1) && (thisQuery.DVDChapterFinish == 0))
thisQuery.DVDChapterFinish = thisQuery.DVDChapterStart;
}
+
#endregion
#region Output Settings
if (format.Success)
- thisQuery.Format = format.ToString().Replace("-f ", "");
+ thisQuery.Format = format.ToString().Replace("-f ", string.Empty);
thisQuery.LargeMP4 = largerMp4.Success;
thisQuery.IpodAtom = ipodAtom.Success;
thisQuery.OptimizeMP4 = optimizeMP4.Success;
@@ -205,20 +206,20 @@ namespace Handbrake.Functions #region Picture Tab
if (width.Success)
- thisQuery.Width = int.Parse(width.Groups[0].Value.Replace("-w ", ""));
+ thisQuery.Width = int.Parse(width.Groups[0].Value.Replace("-w ", string.Empty));
if (height.Success)
- thisQuery.Height = int.Parse(height.Groups[0].Value.Replace("-l ", ""));
+ thisQuery.Height = int.Parse(height.Groups[0].Value.Replace("-l ", string.Empty));
if (maxWidth.Success)
- thisQuery.MaxWidth = int.Parse(maxWidth.Groups[0].Value.Replace("-X ", ""));
+ thisQuery.MaxWidth = int.Parse(maxWidth.Groups[0].Value.Replace("-X ", string.Empty));
if (maxHeight.Success)
- thisQuery.MaxHeight = int.Parse(maxHeight.Groups[0].Value.Replace("-Y ", ""));
+ thisQuery.MaxHeight = int.Parse(maxHeight.Groups[0].Value.Replace("-Y ", string.Empty));
if (crop.Success)
{
- thisQuery.CropValues = crop.ToString().Replace("--crop ", "");
+ thisQuery.CropValues = crop.ToString().Replace("--crop ", string.Empty);
string[] actCropValues = thisQuery.CropValues.Split(':');
thisQuery.CropTop = actCropValues[0];
thisQuery.CropBottom = actCropValues[1];
@@ -238,17 +239,17 @@ namespace Handbrake.Functions thisQuery.KeepDisplayAsect = keepDisplayAsect.Success;
if (displayWidth.Success)
- thisQuery.DisplayWidthValue = double.Parse(displayWidth.Groups[0].Value.Replace("--display-width ", ""));
+ thisQuery.DisplayWidthValue =
+ double.Parse(displayWidth.Groups[0].Value.Replace("--display-width ", string.Empty));
if (pixelAspect.Success)
- thisQuery.PixelAspectWidth = int.Parse(pixelAspect.Groups[1].Value.Replace("--pixel-aspect ", ""));
+ thisQuery.PixelAspectWidth = int.Parse(pixelAspect.Groups[1].Value.Replace("--pixel-aspect ", string.Empty));
- if (pixelAspect.Success && pixelAspect.Groups.Count >=3)
- thisQuery.PixelAspectHeight = int.Parse(pixelAspect.Groups[2].Value.Replace("--pixel-aspect ", ""));
+ if (pixelAspect.Success && pixelAspect.Groups.Count >= 3)
+ thisQuery.PixelAspectHeight = int.Parse(pixelAspect.Groups[2].Value.Replace("--pixel-aspect ", string.Empty));
if (modulus.Success)
- thisQuery.AnamorphicModulus = int.Parse(modulus.Groups[0].Value.Replace("--modulus ", ""));
-
+ thisQuery.AnamorphicModulus = int.Parse(modulus.Groups[0].Value.Replace("--modulus ", string.Empty));
#endregion
@@ -259,31 +260,33 @@ namespace Handbrake.Functions {
thisQuery.Decomb = "Default";
if (decombValue.Success)
- thisQuery.Decomb = decombValue.ToString().Replace("--decomb=", "").Replace("\"", "");
+ thisQuery.Decomb = decombValue.ToString().Replace("--decomb=", string.Empty).Replace("\"", string.Empty);
}
thisQuery.DeInterlace = "Off";
if (deinterlace.Success)
{
- thisQuery.DeInterlace = deinterlace.ToString().Replace("--deinterlace=", "").Replace("\"", "");
- thisQuery.DeInterlace = thisQuery.DeInterlace.Replace("fast", "Fast").Replace("slow", "Slow").Replace("slower", "Slower");
+ thisQuery.DeInterlace = deinterlace.ToString().Replace("--deinterlace=", string.Empty).Replace("\"", string.Empty);
+ thisQuery.DeInterlace =
+ thisQuery.DeInterlace.Replace("fast", "Fast").Replace("slow", "Slow").Replace("slower", "Slower");
thisQuery.DeInterlace = thisQuery.DeInterlace.Replace("slowest", "Slowest");
}
thisQuery.DeNoise = "Off";
if (denoise.Success)
{
- thisQuery.DeNoise = denoise.ToString().Replace("--denoise=", "").Replace("\"", "");
- thisQuery.DeNoise = thisQuery.DeNoise.Replace("weak", "Weak").Replace("medium", "Medium").Replace("strong", "Strong");
+ thisQuery.DeNoise = denoise.ToString().Replace("--denoise=", string.Empty).Replace("\"", string.Empty);
+ thisQuery.DeNoise =
+ thisQuery.DeNoise.Replace("weak", "Weak").Replace("medium", "Medium").Replace("strong", "Strong");
}
- string deblockValue = "";
+ string deblockValue = string.Empty;
thisQuery.DeBlock = 0;
if (deblock.Success)
- deblockValue = deblock.ToString().Replace("--deblock=", "");
+ deblockValue = deblock.ToString().Replace("--deblock=", string.Empty);
int dval = 0;
- if (deblockValue != "")
+ if (deblockValue != string.Empty)
int.TryParse(deblockValue, out dval);
thisQuery.DeBlock = dval;
@@ -292,14 +295,14 @@ namespace Handbrake.Functions {
thisQuery.DeTelecine = "Default";
if (detelecineValue.Success)
- thisQuery.DeTelecine = detelecineValue.ToString().Replace("--detelecine=", "").Replace("\"", "");
+ thisQuery.DeTelecine = detelecineValue.ToString().Replace("--detelecine=", string.Empty).Replace("\"", string.Empty);
}
#endregion
#region Video Settings Tab
- string videoEncoderConvertion = videoEncoder.ToString().Replace("-e ", "");
+ string videoEncoderConvertion = videoEncoder.ToString().Replace("-e ", string.Empty);
switch (videoEncoderConvertion)
{
case "ffmpeg":
@@ -316,31 +319,35 @@ namespace Handbrake.Functions break;
}
thisQuery.VideoEncoder = videoEncoderConvertion;
- thisQuery.VideoFramerate = videoFramerate.Success ? videoFramerate.ToString().Replace("-r ", "") : "Same as source";
+ thisQuery.VideoFramerate = videoFramerate.Success
+ ? videoFramerate.ToString().Replace("-r ", string.Empty)
+ : "Same as source";
thisQuery.Grayscale = grayscale.Success;
thisQuery.TwoPass = twoPass.Success;
thisQuery.TurboFirstPass = turboFirstPass.Success;
if (videoBitrate.Success)
- thisQuery.AverageVideoBitrate = videoBitrate.ToString().Replace("-b ", "");
+ thisQuery.AverageVideoBitrate = videoBitrate.ToString().Replace("-b ", string.Empty);
if (videoFilesize.Success)
- thisQuery.VideoTargetSize = videoFilesize.ToString().Replace("-S ", "");
+ thisQuery.VideoTargetSize = videoFilesize.ToString().Replace("-S ", string.Empty);
if (videoQuality.Success)
{
- float qConvert = float.Parse(videoQuality.ToString().Replace("-q ", ""), Culture);
+ float qConvert = float.Parse(videoQuality.ToString().Replace("-q ", string.Empty), Culture);
thisQuery.VideoQuality = qConvert;
- }
+ }
else
thisQuery.VideoQuality = -1;
+
#endregion
#region Audio Tab
+
// Find out how many tracks we need to add by checking how many encoders or audio tracks are selected.
int encoderCount = 0;
if (audioEncoders.Success)
{
- string[] audioDataCounters = audioEncoders.ToString().Replace("-E ", "").Split(',');
+ string[] audioDataCounters = audioEncoders.ToString().Replace("-E ", string.Empty).Split(',');
encoderCount = audioDataCounters.Length;
}
@@ -353,17 +360,17 @@ namespace Handbrake.Functions string[] trackDRCvalues = null;
if (audioTracks.Success)
- trackData = audioTracks.ToString().Replace("-a ", "").Split(',');
+ trackData = audioTracks.ToString().Replace("-a ", string.Empty).Split(',');
if (audioTrackMixes.Success)
- trackMixes = audioTrackMixes.ToString().Replace("-6 ", "").Split(',');
+ trackMixes = audioTrackMixes.ToString().Replace("-6 ", string.Empty).Split(',');
if (audioEncoders.Success)
- trackEncoders = audioEncoders.ToString().Replace("-E ", "").Split(',');
+ trackEncoders = audioEncoders.ToString().Replace("-E ", string.Empty).Split(',');
if (audioBitrates.Success)
- trackBitrates = audioBitrates.ToString().Replace("-B ", "").Split(',');
+ trackBitrates = audioBitrates.ToString().Replace("-B ", string.Empty).Split(',');
if (audioSampleRates.Success)
- trackSamplerates = audioSampleRates.ToString().Replace("-R ", "").Split(',');
+ trackSamplerates = audioSampleRates.ToString().Replace("-R ", string.Empty).Split(',');
if (drcValues.Success)
- trackDRCvalues = drcValues.ToString().Replace("-D ", "").Split(',');
+ trackDRCvalues = drcValues.ToString().Replace("-D ", string.Empty).Split(',');
// Create new Audio Track Classes and store them in the ArrayList
ArrayList allAudioTrackInfo = new ArrayList();
@@ -371,27 +378,27 @@ namespace Handbrake.Functions {
AudioTrack track = new AudioTrack();
if (trackData != null)
- if (trackData.Length >= (x + 1)) // Audio Track
+ if (trackData.Length >= (x + 1)) // Audio Track
track.Track = trackData[x].Trim();
if (trackMixes != null)
- if (trackMixes.Length >= (x + 1)) // Audio Mix
+ if (trackMixes.Length >= (x + 1)) // Audio Mix
track.MixDown = GetMixDown(trackMixes[x].Trim());
if (trackEncoders != null)
- if (trackEncoders.Length >= (x + 1)) // Audio Mix
+ if (trackEncoders.Length >= (x + 1)) // Audio Mix
track.Encoder = GetAudioEncoder(trackEncoders[x].Trim());
if (trackBitrates != null)
- if (trackBitrates.Length >= (x + 1)) // Audio Encoder
+ if (trackBitrates.Length >= (x + 1)) // Audio Encoder
track.Bitrate = trackBitrates[x].Trim() == "auto" ? "Auto" : trackBitrates[x].Trim();
if (trackSamplerates != null)
- if (trackSamplerates.Length >= (x + 1)) // Audio SampleRate
+ if (trackSamplerates.Length >= (x + 1)) // Audio SampleRate
track.SampleRate = trackSamplerates[x].Trim() == "0" ? "Auto" : trackSamplerates[x].Trim();
if (trackDRCvalues != null)
- if (trackDRCvalues.Length >= (x + 1)) // Audio DRC Values
+ if (trackDRCvalues.Length >= (x + 1)) // Audio DRC Values
track.DRC = trackDRCvalues[x].Trim();
allAudioTrackInfo.Add(track);
@@ -400,22 +407,25 @@ namespace Handbrake.Functions // Subtitle Stuff
if (subtitles.Success)
- thisQuery.Subtitles = subtitles.ToString().Replace("-s ", "");
+ thisQuery.Subtitles = subtitles.ToString().Replace("-s ", string.Empty);
else
thisQuery.Subtitles = subScan.Success ? "Autoselect" : "None";
thisQuery.ForcedSubtitles = forcedSubtitles.Success;
+
#endregion
#region Chapters Tab
+
if (chapterMarkersFileMode.Success || chapterMarkers.Success)
thisQuery.ChapterMarkers = true;
+
#endregion
#region H.264 and other
if (x264.Success)
- thisQuery.H264Query = x264.ToString().Replace("-x ", "");
+ thisQuery.H264Query = x264.ToString().Replace("-x ", string.Empty);
thisQuery.Verbose = verbose.Success;
diff --git a/win/C#/Functions/Scan.cs b/win/C#/Functions/Scan.cs index 124f2309b..78d158564 100644 --- a/win/C#/Functions/Scan.cs +++ b/win/C#/Functions/Scan.cs @@ -113,7 +113,8 @@ namespace Handbrake.Functions this.ScanStared(this, new EventArgs());
string handbrakeCLIPath = Path.Combine(Application.StartupPath, "HandBrakeCLI.exe");
- string logDir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\HandBrake\\logs";
+ string logDir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) +
+ "\\HandBrake\\logs";
string dvdInfoPath = Path.Combine(logDir, "last_scan_log.txt");
// Make we don't pick up a stale last_encode_log.txt (and that we have rights to the file)
@@ -125,18 +126,18 @@ namespace Handbrake.Functions dvdnav = " --no-dvdnav";
this.hbProc = new Process
- {
- StartInfo =
- {
- FileName = handbrakeCLIPath,
- Arguments =
- String.Format(@" -i ""{0}"" -t{1} {2} -v ", sourcePath, title, dvdnav),
- RedirectStandardOutput = true,
- RedirectStandardError = true,
- UseShellExecute = false,
- CreateNoWindow = true
- }
- };
+ {
+ StartInfo =
+ {
+ FileName = handbrakeCLIPath,
+ Arguments =
+ String.Format(@" -i ""{0}"" -t{1} {2} -v ", sourcePath, title, dvdnav),
+ RedirectStandardOutput = true,
+ RedirectStandardError = true,
+ UseShellExecute = false,
+ CreateNoWindow = true
+ }
+ };
this.hbProc.Start();
this.readData = new Parser(this.hbProc.StandardError.BaseStream);
diff --git a/win/C#/Functions/System.cs b/win/C#/Functions/System.cs index 1af1170a2..212579ebc 100644 --- a/win/C#/Functions/System.cs +++ b/win/C#/Functions/System.cs @@ -25,7 +25,7 @@ namespace Handbrake.Functions Win32.GlobalMemoryStatus(ref memStatus);
uint memoryInfo = memStatus.dwTotalPhys;
- memoryInfo = memoryInfo / 1024 / 1024;
+ memoryInfo = memoryInfo/1024/1024;
return memoryInfo;
}
@@ -54,4 +54,4 @@ namespace Handbrake.Functions get { return Screen.PrimaryScreen; }
}
}
-}
+}
\ No newline at end of file |