|
From: <mis...@us...> - 2007-03-18 22:09:27
|
Revision: 197
http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=197&view=rev
Author: misterd_sf
Date: 2007-03-18 11:10:10 -0700 (Sun, 18 Mar 2007)
Log Message:
-----------
Added additional error handling
Fixed bug with double entries in setup form
Modified Paths:
--------------
trunk/plugins/My MPlayer/MPlayer_ExtPlayer/ConfigurationForm.Designer.cs
trunk/plugins/My MPlayer/MPlayer_ExtPlayer/ConfigurationForm.cs
trunk/plugins/My MPlayer/MPlayer_ExtPlayer/ConfigurationManager.cs
trunk/plugins/My MPlayer/MPlayer_ExtPlayer/ExtensionSettings.cs
trunk/plugins/My MPlayer/MPlayer_ExtPlayer/MPlayer_ExtPlayer.cs
Modified: trunk/plugins/My MPlayer/MPlayer_ExtPlayer/ConfigurationForm.Designer.cs
===================================================================
--- trunk/plugins/My MPlayer/MPlayer_ExtPlayer/ConfigurationForm.Designer.cs 2007-03-18 10:30:53 UTC (rev 196)
+++ trunk/plugins/My MPlayer/MPlayer_ExtPlayer/ConfigurationForm.Designer.cs 2007-03-18 18:10:10 UTC (rev 197)
@@ -121,8 +121,6 @@
this.ftpArguments = new System.Windows.Forms.TextBox();
this.label12 = new System.Windows.Forms.Label();
this.cueArguments = new System.Windows.Forms.TextBox();
- this.audioCDArguments = new System.Windows.Forms.TextBox();
- this.label6 = new System.Windows.Forms.Label();
this.label11 = new System.Windows.Forms.Label();
this.svcdArguments = new System.Windows.Forms.TextBox();
this.label10 = new System.Windows.Forms.Label();
@@ -744,8 +742,6 @@
this.dvd_vcd_svcd_streams_Tab.Controls.Add(this.ftpArguments);
this.dvd_vcd_svcd_streams_Tab.Controls.Add(this.label12);
this.dvd_vcd_svcd_streams_Tab.Controls.Add(this.cueArguments);
- this.dvd_vcd_svcd_streams_Tab.Controls.Add(this.audioCDArguments);
- this.dvd_vcd_svcd_streams_Tab.Controls.Add(this.label6);
this.dvd_vcd_svcd_streams_Tab.Controls.Add(this.label11);
this.dvd_vcd_svcd_streams_Tab.Controls.Add(this.svcdArguments);
this.dvd_vcd_svcd_streams_Tab.Controls.Add(this.label10);
@@ -761,7 +757,7 @@
//
// label20
//
- this.label20.Location = new System.Drawing.Point(3, 326);
+ this.label20.Location = new System.Drawing.Point(3, 300);
this.label20.Name = "label20";
this.label20.Size = new System.Drawing.Size(117, 23);
this.label20.TabIndex = 50;
@@ -769,14 +765,14 @@
//
// unsvArguments
//
- this.unsvArguments.Location = new System.Drawing.Point(122, 323);
+ this.unsvArguments.Location = new System.Drawing.Point(122, 297);
this.unsvArguments.Name = "unsvArguments";
this.unsvArguments.Size = new System.Drawing.Size(256, 20);
this.unsvArguments.TabIndex = 51;
//
// label19
//
- this.label19.Location = new System.Drawing.Point(3, 300);
+ this.label19.Location = new System.Drawing.Point(3, 274);
this.label19.Name = "label19";
this.label19.Size = new System.Drawing.Size(117, 23);
this.label19.TabIndex = 48;
@@ -784,14 +780,14 @@
//
// udpArguments
//
- this.udpArguments.Location = new System.Drawing.Point(122, 297);
+ this.udpArguments.Location = new System.Drawing.Point(122, 271);
this.udpArguments.Name = "udpArguments";
this.udpArguments.Size = new System.Drawing.Size(256, 20);
this.udpArguments.TabIndex = 49;
//
// label18
//
- this.label18.Location = new System.Drawing.Point(3, 274);
+ this.label18.Location = new System.Drawing.Point(3, 248);
this.label18.Name = "label18";
this.label18.Size = new System.Drawing.Size(117, 23);
this.label18.TabIndex = 46;
@@ -799,14 +795,14 @@
//
// sdpArguments
//
- this.sdpArguments.Location = new System.Drawing.Point(122, 271);
+ this.sdpArguments.Location = new System.Drawing.Point(122, 245);
this.sdpArguments.Name = "sdpArguments";
this.sdpArguments.Size = new System.Drawing.Size(256, 20);
this.sdpArguments.TabIndex = 47;
//
// label17
//
- this.label17.Location = new System.Drawing.Point(3, 248);
+ this.label17.Location = new System.Drawing.Point(3, 222);
this.label17.Name = "label17";
this.label17.Size = new System.Drawing.Size(117, 23);
this.label17.TabIndex = 44;
@@ -814,14 +810,14 @@
//
// rtspArguments
//
- this.rtspArguments.Location = new System.Drawing.Point(122, 245);
+ this.rtspArguments.Location = new System.Drawing.Point(122, 219);
this.rtspArguments.Name = "rtspArguments";
this.rtspArguments.Size = new System.Drawing.Size(256, 20);
this.rtspArguments.TabIndex = 45;
//
// label16
//
- this.label16.Location = new System.Drawing.Point(3, 222);
+ this.label16.Location = new System.Drawing.Point(3, 196);
this.label16.Name = "label16";
this.label16.Size = new System.Drawing.Size(117, 23);
this.label16.TabIndex = 42;
@@ -829,14 +825,14 @@
//
// mpstArguments
//
- this.mpstArguments.Location = new System.Drawing.Point(122, 219);
+ this.mpstArguments.Location = new System.Drawing.Point(122, 193);
this.mpstArguments.Name = "mpstArguments";
this.mpstArguments.Size = new System.Drawing.Size(256, 20);
this.mpstArguments.TabIndex = 43;
//
// label15
//
- this.label15.Location = new System.Drawing.Point(3, 196);
+ this.label15.Location = new System.Drawing.Point(3, 170);
this.label15.Name = "label15";
this.label15.Size = new System.Drawing.Size(117, 23);
this.label15.TabIndex = 40;
@@ -844,14 +840,14 @@
//
// mmsArguments
//
- this.mmsArguments.Location = new System.Drawing.Point(122, 193);
+ this.mmsArguments.Location = new System.Drawing.Point(122, 167);
this.mmsArguments.Name = "mmsArguments";
this.mmsArguments.Size = new System.Drawing.Size(256, 20);
this.mmsArguments.TabIndex = 41;
//
// label14
//
- this.label14.Location = new System.Drawing.Point(3, 170);
+ this.label14.Location = new System.Drawing.Point(3, 144);
this.label14.Name = "label14";
this.label14.Size = new System.Drawing.Size(117, 23);
this.label14.TabIndex = 38;
@@ -859,14 +855,14 @@
//
// httpArguments
//
- this.httpArguments.Location = new System.Drawing.Point(122, 167);
+ this.httpArguments.Location = new System.Drawing.Point(122, 141);
this.httpArguments.Name = "httpArguments";
this.httpArguments.Size = new System.Drawing.Size(256, 20);
this.httpArguments.TabIndex = 39;
//
// label13
//
- this.label13.Location = new System.Drawing.Point(3, 144);
+ this.label13.Location = new System.Drawing.Point(3, 118);
this.label13.Name = "label13";
this.label13.Size = new System.Drawing.Size(117, 23);
this.label13.TabIndex = 36;
@@ -874,14 +870,14 @@
//
// ftpArguments
//
- this.ftpArguments.Location = new System.Drawing.Point(122, 141);
+ this.ftpArguments.Location = new System.Drawing.Point(122, 115);
this.ftpArguments.Name = "ftpArguments";
this.ftpArguments.Size = new System.Drawing.Size(256, 20);
this.ftpArguments.TabIndex = 37;
//
// label12
//
- this.label12.Location = new System.Drawing.Point(3, 118);
+ this.label12.Location = new System.Drawing.Point(3, 92);
this.label12.Name = "label12";
this.label12.Size = new System.Drawing.Size(117, 23);
this.label12.TabIndex = 34;
@@ -889,26 +885,11 @@
//
// cueArguments
//
- this.cueArguments.Location = new System.Drawing.Point(122, 115);
+ this.cueArguments.Location = new System.Drawing.Point(122, 89);
this.cueArguments.Name = "cueArguments";
this.cueArguments.Size = new System.Drawing.Size(256, 20);
this.cueArguments.TabIndex = 35;
//
- // audioCDArguments
- //
- this.audioCDArguments.Location = new System.Drawing.Point(122, 89);
- this.audioCDArguments.Name = "audioCDArguments";
- this.audioCDArguments.Size = new System.Drawing.Size(256, 20);
- this.audioCDArguments.TabIndex = 23;
- //
- // label6
- //
- this.label6.Location = new System.Drawing.Point(3, 92);
- this.label6.Name = "label6";
- this.label6.Size = new System.Drawing.Size(117, 23);
- this.label6.TabIndex = 22;
- this.label6.Text = "AudioCD Arguments:";
- //
// label11
//
this.label11.Location = new System.Drawing.Point(3, 66);
@@ -1031,8 +1012,6 @@
private System.Windows.Forms.Button videoDelete;
private System.Windows.Forms.Button videoAdd;
private System.Windows.Forms.ListBox videoExtList;
- private System.Windows.Forms.TextBox audioCDArguments;
- private System.Windows.Forms.Label label6;
private System.Windows.Forms.OpenFileDialog openFileDialog1;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.ComboBox noiseDenoise;
Modified: trunk/plugins/My MPlayer/MPlayer_ExtPlayer/ConfigurationForm.cs
===================================================================
--- trunk/plugins/My MPlayer/MPlayer_ExtPlayer/ConfigurationForm.cs 2007-03-18 10:30:53 UTC (rev 196)
+++ trunk/plugins/My MPlayer/MPlayer_ExtPlayer/ConfigurationForm.cs 2007-03-18 18:10:10 UTC (rev 197)
@@ -69,8 +69,8 @@
// Fetch available Audio Renderers
//
foreach (Filter audioRenderer in Filters.AudioRenderers) {
- if(audioRenderer.Name.StartsWith("DirectSound: ")){
- soundOutputDevice.Items.Add(audioRenderer.Name.Remove(0,13));
+ if (audioRenderer.Name.StartsWith("DirectSound: ")) {
+ soundOutputDevice.Items.Add(audioRenderer.Name.Remove(0, 13));
}
}
}
@@ -146,10 +146,10 @@
videoExtension.Text = String.Empty;
videoArgument.Text = String.Empty;
videoPlayerUse.Checked = false;
+ lastVideoSettings = null;
videoExtension.Enabled = false;
videoArgument.Enabled = false;
videoPlayerUse.Enabled = false;
- lastVideoSettings = null;
}
}
@@ -187,11 +187,16 @@
/// <param name="sender">Sender object</param>
/// <param name="e">Event Arguments</param>
private void videoExtension_Leave(object sender, EventArgs e) {
+ if (lastVideoSettings != null && (!videoExtension.Text.Equals(lastVideoSettings.Name))
+ && videoExtList.Items.Contains(videoExtension.Text)) {
+ MessageBox.Show(this, "Video Extension: " + videoExtension.Text + " already in the list", "MPlayer configuration", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ videoExtension.Focus();
+ return;
+ }
if (lastVideoSettings != null) {
lastVideoSettings.Name = videoExtension.Text;
videoExtList.Items[videoExtList.SelectedIndex] = lastVideoSettings;
}
-
}
/// <summary>
@@ -261,6 +266,12 @@
/// <param name="sender">Sender object</param>
/// <param name="e">Event Arguments</param>
private void audioExtension_Leave(object sender, EventArgs e) {
+ if (lastAudioSettings != null && (!audioExtension.Text.Equals(lastAudioSettings.Name))
+ && audioExtList.Items.Contains(audioExtension.Text)) {
+ MessageBox.Show(this, "Audio Extension: " + audioExtension.Text + " already in the list", "MPlayer configuration", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ audioExtension.Focus();
+ return;
+ }
if (lastAudioSettings != null) {
lastAudioSettings.Name = audioExtension.Text;
audioExtList.Items[audioExtList.SelectedIndex] = lastAudioSettings;
@@ -326,7 +337,6 @@
dvdArguments.Text = xmlreader.GetValueAsString("mplayer", "dvdArguments", String.Empty);
vcdArguments.Text = xmlreader.GetValueAsString("mplayer", "vcdArguments", String.Empty);
svcdArguments.Text = xmlreader.GetValueAsString("mplayer", "svcdArguments", String.Empty);
- audioCDArguments.Text = xmlreader.GetValueAsString("mplayer", "audioCDArguments", String.Empty);
cueArguments.Text = xmlreader.GetValueAsString("mplayer", "cueArguments", String.Empty);
ftpArguments.Text = xmlreader.GetValueAsString("mplayer", "ftpArguments", String.Empty);
httpArguments.Text = xmlreader.GetValueAsString("mplayer", "httpArguments", String.Empty);
@@ -338,7 +348,11 @@
unsvArguments.Text = xmlreader.GetValueAsString("mplayer", "unsvArguments", String.Empty);
mplayerPath.Text = xmlreader.GetValueAsString("mplayer", "mplayerPath", "C:\\Program Files\\MPlayer\\MPlayer.exe");
}
- loadXMLData();
+ try {
+ loadXMLData();
+ } catch (Exception e){
+ Log.Error(e);
+ }
}
@@ -369,7 +383,9 @@
settings.Arguments = nodeExtension.Attributes["arguments"].Value;
settings.ExtPlayerUse = Boolean.Parse(nodeExtension.Attributes["extPlayerUse"].Value);
settings.PlayMode = mode;
- workingList.Items.Add(settings);
+ if (!workingList.Items.Contains(settings.Name)) {
+ workingList.Items.Add(settings);
+ }
}
}
@@ -379,7 +395,7 @@
/// Stores the whole configuration
/// </summary>
private void saveConfiguration() {
- using (MediaPortal.Profile.Settings xmlWriter = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config,"MediaPortal.xml"))) {
+ using (MediaPortal.Profile.Settings xmlWriter = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) {
xmlWriter.SetValue("mplayer", "generalArguments", optionalArguments.Text);
xmlWriter.SetValueAsBool("mplayer", "rebuildIndex", rebuildIndex.Checked);
xmlWriter.SetValueAsBool("mplayer", "priorityBoost", priorityBoost.Checked);
@@ -395,9 +411,9 @@
xmlWriter.SetValue("mplayer", "aspectRatio", aspectRatio.SelectedIndex);
xmlWriter.SetValue("mplayer", "postProcessing", postProcessing.SelectedIndex);
xmlWriter.SetValue("mplayer", "audioChannels", audioChannels.SelectedIndex);
- if(cacheSize.Text.Equals(String.Empty)){
+ if (cacheSize.Text.Equals(String.Empty)) {
xmlWriter.SetValue("mplayer", "cacheSize", 0);
- }else{
+ } else {
xmlWriter.SetValue("mplayer", "cacheSize", cacheSize.Text);
}
xmlWriter.SetValue("mplayer", "noise", noiseDenoise.SelectedIndex);
@@ -405,7 +421,6 @@
xmlWriter.SetValue("mplayer", "dvdArguments", dvdArguments.Text);
xmlWriter.SetValue("mplayer", "vcdArguments", vcdArguments.Text);
xmlWriter.SetValue("mplayer", "svcdArguments", svcdArguments.Text);
- xmlWriter.SetValue("mplayer", "audioCDArguments", audioCDArguments.Text);
xmlWriter.SetValue("mplayer", "cueArguments", cueArguments.Text);
xmlWriter.SetValue("mplayer", "ftpArguments", ftpArguments.Text);
xmlWriter.SetValue("mplayer", "httpArguments", httpArguments.Text);
@@ -416,7 +431,11 @@
xmlWriter.SetValue("mplayer", "udpArguments", udpArguments.Text);
xmlWriter.SetValue("mplayer", "unsvArguments", unsvArguments.Text);
}
- saveXMLData();
+ try {
+ saveXMLData();
+ } catch (Exception e) {
+ Log.Error(e);
+ }
}
/// <summary>
Modified: trunk/plugins/My MPlayer/MPlayer_ExtPlayer/ConfigurationManager.cs
===================================================================
--- trunk/plugins/My MPlayer/MPlayer_ExtPlayer/ConfigurationManager.cs 2007-03-18 10:30:53 UTC (rev 196)
+++ trunk/plugins/My MPlayer/MPlayer_ExtPlayer/ConfigurationManager.cs 2007-03-18 18:10:10 UTC (rev 197)
@@ -474,7 +474,11 @@
videoArguments = xmlreader.GetValueAsString("mplayer", "videoArguments", String.Empty);
audioArguments = xmlreader.GetValueAsString("mplayer", "audioArguments", String.Empty);
}
- loadXMLData();
+ try {
+ loadXMLData();
+ } catch (Exception e) {
+ Log.Error(e);
+ }
m_supportedExtensions = new String[extensionSettingsExtPlayer.Count];
extensionSettingsExtPlayer.Keys.CopyTo(m_supportedExtensions, 0);
}
@@ -502,9 +506,11 @@
settings.Arguments = nodeExtension.Attributes["arguments"].Value;
settings.ExtPlayerUse = Boolean.Parse(nodeExtension.Attributes["extPlayerUse"].Value);
settings.PlayMode = mode;
- extensionSettings.Add(settings.Name, settings);
- if (settings.ExtPlayerUse) {
- extensionSettingsExtPlayer.Add(settings.Name, settings);
+ if (!extensionSettings.ContainsKey(settings.Name)) {
+ extensionSettings.Add(settings.Name, settings);
+ if (settings.ExtPlayerUse) {
+ extensionSettingsExtPlayer.Add(settings.Name, settings);
+ }
}
}
}
Modified: trunk/plugins/My MPlayer/MPlayer_ExtPlayer/ExtensionSettings.cs
===================================================================
--- trunk/plugins/My MPlayer/MPlayer_ExtPlayer/ExtensionSettings.cs 2007-03-18 10:30:53 UTC (rev 196)
+++ trunk/plugins/My MPlayer/MPlayer_ExtPlayer/ExtensionSettings.cs 2007-03-18 18:10:10 UTC (rev 197)
@@ -132,7 +132,7 @@
}
#endregion
- #region ToString-Method
+ #region Overrides
/// <summary>
/// Prints the extension name
/// </summary>
@@ -140,6 +140,27 @@
public override string ToString() {
return name;
}
+
+ /// <summary>
+ /// Compares a given string with the name
+ /// </summary>
+ /// <param name="obj">Object to compare</param>
+ /// <returns>true, if objects or by a given string the names are equal</returns>
+ public override bool Equals(object obj) {
+ String temp = obj as String;
+ if (temp == null) {
+ return base.Equals(obj);
+ }
+ return temp.Equals(name);
+ }
+
+ /// <summary>
+ /// Gets the standard hashcode. Overridden to avoid compiler warning
+ /// </summary>
+ /// <returns>Hashcode of the object</returns>
+ public override int GetHashCode() {
+ return base.GetHashCode();
+ }
#endregion
}
}
Modified: trunk/plugins/My MPlayer/MPlayer_ExtPlayer/MPlayer_ExtPlayer.cs
===================================================================
--- trunk/plugins/My MPlayer/MPlayer_ExtPlayer/MPlayer_ExtPlayer.cs 2007-03-18 10:30:53 UTC (rev 196)
+++ trunk/plugins/My MPlayer/MPlayer_ExtPlayer/MPlayer_ExtPlayer.cs 2007-03-18 18:10:10 UTC (rev 197)
@@ -494,16 +494,19 @@
Log.Info("MPlayer: Data received: " + e.Data);
if (result.StartsWith("ANS_TIME_POSITION=")) {
additionalTime = DateTime.Now;
- baseTime = Double.Parse(result.Substring(18).Replace(".",
- CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator));
+ Double.TryParse(result.Substring(18).Replace(".",
+ CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator),out baseTime);
} else if (result.StartsWith("ANS_PERCENT_POSITION=")) {
additionalTime = DateTime.Now;
- performSeekRelativePercentage(Int32.Parse(result.Substring(21)));
+ int tempValue;
+ Int32.TryParse(result.Substring(21), out tempValue);
+ performSeekRelativePercentage(tempValue);
} else if (result.StartsWith("ID_LENGTH")) {
- duration = Double.Parse(result.Substring(10).Replace(".",
- CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator));
+ Double.TryParse(result.Substring(10).Replace(".",
+ CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator), out duration);
} else if (result.StartsWith("ID_AUDIO_ID")) {
- int temp = Int32.Parse(result.Substring(12));
+ int temp;
+ Int32.TryParse(result.Substring(12), out temp);
if (!audioNames.ContainsKey(temp)) {
audioID.Add(numberOfAudioStreams, temp);
audioNames.Add(temp, Strings.Unknown);
@@ -512,11 +515,13 @@
} else if (result.StartsWith("ID_AID_")) {
String help = result.Substring(7);
int index = help.IndexOf('_');
- int temp = Int32.Parse(help.Substring(0, index));
+ int temp;
+ Int32.TryParse(help.Substring(0, index),out temp);
index = result.IndexOf('=');
audioNames[temp] = result.Substring(index + 1);
} else if (result.StartsWith("ID_SUBTITLE_ID")) {
- int temp = Int32.Parse(result.Substring(15));
+ int temp;
+ Int32.TryParse(result.Substring(15),out temp);
if (!subtitleNames.ContainsKey(temp)) {
subtitleID.Add(numberOfSubtitles, temp);
subtitleNames.Add(temp, Strings.Unknown);
@@ -525,7 +530,8 @@
} else if (result.StartsWith("ID_SID_")) {
String help = result.Substring(7);
int index = help.IndexOf('_');
- int temp = Int32.Parse(help.Substring(0, index));
+ int temp;
+ Int32.TryParse(help.Substring(0, index),out temp);
index = result.IndexOf('=');
subtitleNames[temp] = result.Substring(index + 1);
} else if (result.StartsWith("Exiting... (End of file)")) {
@@ -538,10 +544,10 @@
int pos = result.IndexOf("=> ");
String temp = result.Substring(pos + 3);
pos = temp.IndexOf('x');
- videoWith = Int32.Parse(temp.Substring(0, pos));
+ Int32.TryParse(temp.Substring(0, pos), out videoWith);
temp = temp.Substring(pos + 1);
pos = temp.IndexOf(' ');
- videoHeight = Int32.Parse(temp.Substring(0, pos));
+ Int32.TryParse(temp.Substring(0, pos),out videoHeight);
Log.Info("MPlayer: ASPECT: " + videoWith + "x" + videoHeight);
_needUpdate = true;
SetVideoWindow();
@@ -792,7 +798,7 @@
m_geometry.ScreenHeight = _renderHeight;
m_geometry.ARType = GUIGraphicsContext.ARType;
m_geometry.PixelRatio = GUIGraphicsContext.PixelRatio;
- // Use Method with crop settings, because without it doesn't work properly. There is a bug.
+
m_geometry.GetWindow(videoWith, videoHeight, out _sourceRectangle, out _videoRectangle);
_positionX += _videoRectangle.X;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|