From: <an...@us...> - 2007-03-09 07:46:49
|
Revision: 169 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=169&view=rev Author: and-81 Date: 2007-03-08 23:46:47 -0800 (Thu, 08 Mar 2007) Log Message: ----------- Added Paths: ----------- trunk/plugins/ComSkipLauncher/ExternalProgram.Designer.cs trunk/plugins/ComSkipLauncher/ExternalProgram.cs trunk/plugins/ComSkipLauncher/ExternalProgram.resx Added: trunk/plugins/ComSkipLauncher/ExternalProgram.Designer.cs =================================================================== --- trunk/plugins/ComSkipLauncher/ExternalProgram.Designer.cs (rev 0) +++ trunk/plugins/ComSkipLauncher/ExternalProgram.Designer.cs 2007-03-09 07:46:47 UTC (rev 169) @@ -0,0 +1,184 @@ +namespace MediaPortal.Plugins +{ + partial class ExternalProgram + { + /// <summary> + /// Required designer variable. + /// </summary> + private System.ComponentModel.IContainer components = null; + + /// <summary> + /// Clean up any resources being used. + /// </summary> + /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// <summary> + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// </summary> + private void InitializeComponent() + { + this.textBoxProgram = new System.Windows.Forms.TextBox(); + this.labelProgram = new System.Windows.Forms.Label(); + this.buttonProgam = new System.Windows.Forms.Button(); + this.buttonOK = new System.Windows.Forms.Button(); + this.buttonCancel = new System.Windows.Forms.Button(); + this.labelParameters = new System.Windows.Forms.Label(); + this.textBoxParameters = new System.Windows.Forms.TextBox(); + this.openFileDialog = new System.Windows.Forms.OpenFileDialog(); + this.buttonParamQuestion = new System.Windows.Forms.Button(); + this.buttonTest = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // textBoxProgram + // + this.textBoxProgram.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.textBoxProgram.Location = new System.Drawing.Point(8, 24); + this.textBoxProgram.Name = "textBoxProgram"; + this.textBoxProgram.Size = new System.Drawing.Size(288, 20); + this.textBoxProgram.TabIndex = 1; + // + // labelProgram + // + this.labelProgram.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.labelProgram.Location = new System.Drawing.Point(8, 8); + this.labelProgram.Name = "labelProgram"; + this.labelProgram.Size = new System.Drawing.Size(288, 16); + this.labelProgram.TabIndex = 0; + this.labelProgram.Text = "Program:"; + this.labelProgram.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // buttonProgam + // + this.buttonProgam.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.buttonProgam.Location = new System.Drawing.Point(304, 24); + this.buttonProgam.Name = "buttonProgam"; + this.buttonProgam.Size = new System.Drawing.Size(24, 20); + this.buttonProgam.TabIndex = 2; + this.buttonProgam.Text = "..."; + this.buttonProgam.UseVisualStyleBackColor = true; + this.buttonProgam.Click += new System.EventHandler(this.buttonProgam_Click); + // + // buttonOK + // + this.buttonOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.buttonOK.Location = new System.Drawing.Point(208, 96); + this.buttonOK.Name = "buttonOK"; + this.buttonOK.Size = new System.Drawing.Size(56, 24); + this.buttonOK.TabIndex = 7; + this.buttonOK.Text = "OK"; + this.buttonOK.UseVisualStyleBackColor = true; + this.buttonOK.Click += new System.EventHandler(this.buttonOK_Click); + // + // buttonCancel + // + this.buttonCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.buttonCancel.Location = new System.Drawing.Point(272, 96); + this.buttonCancel.Name = "buttonCancel"; + this.buttonCancel.Size = new System.Drawing.Size(56, 24); + this.buttonCancel.TabIndex = 8; + this.buttonCancel.Text = "Cancel"; + this.buttonCancel.UseVisualStyleBackColor = true; + this.buttonCancel.Click += new System.EventHandler(this.buttonCancel_Click); + // + // labelParameters + // + this.labelParameters.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.labelParameters.Location = new System.Drawing.Point(8, 48); + this.labelParameters.Name = "labelParameters"; + this.labelParameters.Size = new System.Drawing.Size(288, 16); + this.labelParameters.TabIndex = 3; + this.labelParameters.Text = "Parameters:"; + this.labelParameters.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // textBoxParameters + // + this.textBoxParameters.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.textBoxParameters.Location = new System.Drawing.Point(8, 64); + this.textBoxParameters.Name = "textBoxParameters"; + this.textBoxParameters.Size = new System.Drawing.Size(288, 20); + this.textBoxParameters.TabIndex = 4; + // + // openFileDialog + // + this.openFileDialog.Filter = "All files|*.*"; + this.openFileDialog.Title = "Select Program Executable"; + // + // buttonParamQuestion + // + this.buttonParamQuestion.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.buttonParamQuestion.Location = new System.Drawing.Point(304, 64); + this.buttonParamQuestion.Name = "buttonParamQuestion"; + this.buttonParamQuestion.Size = new System.Drawing.Size(24, 20); + this.buttonParamQuestion.TabIndex = 5; + this.buttonParamQuestion.Text = "?"; + this.buttonParamQuestion.UseVisualStyleBackColor = true; + this.buttonParamQuestion.Click += new System.EventHandler(this.buttonParamQuestion_Click); + // + // buttonTest + // + this.buttonTest.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.buttonTest.Location = new System.Drawing.Point(8, 96); + this.buttonTest.Name = "buttonTest"; + this.buttonTest.Size = new System.Drawing.Size(56, 24); + this.buttonTest.TabIndex = 6; + this.buttonTest.Text = "Test"; + this.buttonTest.UseVisualStyleBackColor = true; + this.buttonTest.Click += new System.EventHandler(this.buttonTest_Click); + // + // ExternalProgram + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(336, 128); + this.Controls.Add(this.buttonTest); + this.Controls.Add(this.buttonParamQuestion); + this.Controls.Add(this.labelParameters); + this.Controls.Add(this.textBoxParameters); + this.Controls.Add(this.buttonCancel); + this.Controls.Add(this.buttonOK); + this.Controls.Add(this.buttonProgam); + this.Controls.Add(this.labelProgram); + this.Controls.Add(this.textBoxProgram); + this.MaximizeBox = false; + this.MinimizeBox = false; + this.MinimumSize = new System.Drawing.Size(352, 164); + this.Name = "ExternalProgram"; + this.ShowIcon = false; + this.ShowInTaskbar = false; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "ComSkip Program Details"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.TextBox textBoxProgram; + private System.Windows.Forms.Label labelProgram; + private System.Windows.Forms.Button buttonProgam; + private System.Windows.Forms.Button buttonOK; + private System.Windows.Forms.Button buttonCancel; + private System.Windows.Forms.Label labelParameters; + private System.Windows.Forms.TextBox textBoxParameters; + private System.Windows.Forms.OpenFileDialog openFileDialog; + private System.Windows.Forms.Button buttonParamQuestion; + private System.Windows.Forms.Button buttonTest; + } +} \ No newline at end of file Added: trunk/plugins/ComSkipLauncher/ExternalProgram.cs =================================================================== --- trunk/plugins/ComSkipLauncher/ExternalProgram.cs (rev 0) +++ trunk/plugins/ComSkipLauncher/ExternalProgram.cs 2007-03-09 07:46:47 UTC (rev 169) @@ -0,0 +1,113 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Diagnostics; +using System.Drawing; +using System.IO; +using System.Text; +using System.Windows.Forms; + +using MediaPortal.GUI.Library; + +namespace MediaPortal.Plugins +{ + + public partial class ExternalProgram : Form + { + + #region Constants + + const string ParametersMessage = +@"{0} = Recorded filename (includes path) +{1} = Recorded filename (w/o path) +{2} = Recorded filename (w/o path or extension) +{3} = Recorded file path +{4} = Current date +{5} = Current time"; + + #endregion Constants + + #region Properties + + public string Program + { + get { return textBoxProgram.Text; } + } + public string Parameters + { + get { return textBoxParameters.Text; } + } + + #endregion Properties + + #region Constructors + + public ExternalProgram(string program, string parameters) + { + InitializeComponent(); + + textBoxProgram.Text = program; + textBoxParameters.Text = parameters; + } + + #endregion Constructors + + private void buttonProgam_Click(object sender, EventArgs e) + { + if (openFileDialog.ShowDialog(this) == DialogResult.OK) + textBoxProgram.Text = openFileDialog.FileName; + } + + private void buttonOK_Click(object sender, EventArgs e) + { + if (textBoxProgram.Text.Trim().Length == 0) + { + MessageBox.Show(this, "You must specify a program to run", "Missing program name", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); + return; + } + + this.DialogResult = DialogResult.OK; + this.Close(); + } + + private void buttonCancel_Click(object sender, EventArgs e) + { + this.DialogResult = DialogResult.Cancel; + this.Close(); + } + + private void buttonParamQuestion_Click(object sender, EventArgs e) + { + MessageBox.Show(this, ParametersMessage, "Parameters", MessageBoxButtons.OK, MessageBoxIcon.Information); + } + + private void buttonTest_Click(object sender, EventArgs e) + { + if (textBoxProgram.Text.Trim().Length == 0) + { + MessageBox.Show(this, "You must specify a program to run", "Missing program name", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); + return; + } + + try + { + string parameters = ComSkipLauncher.ProcessParameters(textBoxParameters.Text, "test.file"); + + Process process = new Process(); + process.StartInfo.Arguments = parameters; + process.StartInfo.FileName = textBoxProgram.Text; + process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden; + process.StartInfo.WorkingDirectory = Path.GetDirectoryName(textBoxProgram.Text); + + process.Start(); + } + catch (Exception ex) + { + Log.Error("ComSkipLauncher: {0}", ex.Message); + } + } + + } + +} Added: trunk/plugins/ComSkipLauncher/ExternalProgram.resx =================================================================== --- trunk/plugins/ComSkipLauncher/ExternalProgram.resx (rev 0) +++ trunk/plugins/ComSkipLauncher/ExternalProgram.resx 2007-03-09 07:46:47 UTC (rev 169) @@ -0,0 +1,123 @@ +<?xml version="1.0" encoding="utf-8"?> +<root> + <!-- + Microsoft ResX Schema + + Version 2.0 + + The primary goals of this format is to allow a simple XML format + that is mostly human readable. The generation and parsing of the + various data types are done through the TypeConverter classes + associated with the data types. + + Example: + + ... ado.net/XML headers & schema ... + <resheader name="resmimetype">text/microsoft-resx</resheader> + <resheader name="version">2.0</resheader> + <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> + <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> + <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> + <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> + <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> + <value>[base64 mime encoded serialized .NET Framework object]</value> + </data> + <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> + <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> + <comment>This is a comment</comment> + </data> + + There are any number of "resheader" rows that contain simple + name/value pairs. + + Each data row contains a name, and value. The row also contains a + type or mimetype. Type corresponds to a .NET class that support + text/value conversion through the TypeConverter architecture. + Classes that don't support this are serialized and stored with the + mimetype set. + + The mimetype is used for serialized objects, and tells the + ResXResourceReader how to depersist the object. This is currently not + extensible. For a given mimetype the value must be set accordingly: + + Note - application/x-microsoft.net.object.binary.base64 is the format + that the ResXResourceWriter will generate, however the reader can + read any of the formats listed below. + + mimetype: application/x-microsoft.net.object.binary.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.soap.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Soap.SoapFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.bytearray.base64 + value : The object must be serialized into a byte array + : using a System.ComponentModel.TypeConverter + : and then encoded with base64 encoding. + --> + <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> + <xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> + <xsd:element name="root" msdata:IsDataSet="true"> + <xsd:complexType> + <xsd:choice maxOccurs="unbounded"> + <xsd:element name="metadata"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" /> + </xsd:sequence> + <xsd:attribute name="name" use="required" type="xsd:string" /> + <xsd:attribute name="type" type="xsd:string" /> + <xsd:attribute name="mimetype" type="xsd:string" /> + <xsd:attribute ref="xml:space" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="assembly"> + <xsd:complexType> + <xsd:attribute name="alias" type="xsd:string" /> + <xsd:attribute name="name" type="xsd:string" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="data"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> + <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> + <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> + <xsd:attribute ref="xml:space" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="resheader"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" /> + </xsd:complexType> + </xsd:element> + </xsd:choice> + </xsd:complexType> + </xsd:element> + </xsd:schema> + <resheader name="resmimetype"> + <value>text/microsoft-resx</value> + </resheader> + <resheader name="version"> + <value>2.0</value> + </resheader> + <resheader name="reader"> + <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <resheader name="writer"> + <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <metadata name="openFileDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> + <value>17, 17</value> + </metadata> +</root> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |