|
From: <fr...@us...> - 2010-04-13 20:00:56
|
Revision: 3525
http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=3525&view=rev
Author: framug
Date: 2010-04-13 20:00:45 +0000 (Tue, 13 Apr 2010)
Log Message:
-----------
Simple indentation 2 chars.
Modified Paths:
--------------
trunk/plugins/MultiShortcut/DLLFix/Program.cs
trunk/plugins/MultiShortcut/MultiShortcut/Config.cs
trunk/plugins/MultiShortcut/MultiShortcut/LocalizeStrings.cs
trunk/plugins/MultiShortcut/MultiShortcut/LocalizedCategory.cs
trunk/plugins/MultiShortcut/MultiShortcut/LocalizedDisplayName.cs
trunk/plugins/MultiShortcut/MultiShortcut/XmlConfig.cs
trunk/plugins/MultiShortcut/TestServer/Program.cs
Modified: trunk/plugins/MultiShortcut/DLLFix/Program.cs
===================================================================
--- trunk/plugins/MultiShortcut/DLLFix/Program.cs 2010-04-12 21:24:03 UTC (rev 3524)
+++ trunk/plugins/MultiShortcut/DLLFix/Program.cs 2010-04-13 20:00:45 UTC (rev 3525)
@@ -8,14 +8,14 @@
namespace DLLFix
{
- class Program
+ class Program
+ {
+ const int fixStart = 11290;
+
+ static void Main(string[] args)
{
- const int fixStart = 11290;
- static void Main(string[] args)
- {
-
- byte[] search_bytes = new byte[]
+ byte[] search_bytes = new byte[]
{
// R u n t i m e C
0x52, 0x75, 0x6E, 0x74, 0x69, 0x6D, 0x65, 0x43,
@@ -31,80 +31,80 @@
0x63, 0x75, 0x74
};
- byte fileCounter = 0;
+ byte fileCounter = 0;
- string myPath = System.Reflection.Assembly.GetExecutingAssembly().Location;
- myPath = myPath.Substring(0, myPath.LastIndexOf('\\'));
+ string myPath = System.Reflection.Assembly.GetExecutingAssembly().Location;
+ myPath = myPath.Substring(0, myPath.LastIndexOf('\\'));
- string[] files = Directory.GetFiles(myPath, "*.dll");
+ string[] files = Directory.GetFiles(myPath, "*.dll");
- Console.WriteLine("*******************************************************");
- Console.WriteLine("** **");
- Console.WriteLine("** MultiShortcut DLL fix (.net metadata changer) **");
- Console.WriteLine("** **");
- Console.WriteLine("*******************************************************");
- Console.WriteLine("");
- Console.WriteLine("1.) Patching files...\n");
- // Parse all MP plugins DLL
- foreach (string s in files)
+ Console.WriteLine("*******************************************************");
+ Console.WriteLine("** **");
+ Console.WriteLine("** MultiShortcut DLL fix (.net metadata changer) **");
+ Console.WriteLine("** **");
+ Console.WriteLine("*******************************************************");
+ Console.WriteLine("");
+ Console.WriteLine("1.) Patching files...\n");
+ // Parse all MP plugins DLL
+ foreach (string s in files)
+ {
+ using (Stream st = new FileStream(s, FileMode.Open, FileAccess.ReadWrite))
+ {
+ int offset = 0;
+ long file_pos = 0;
+ int bytes_read = 0;
+ byte[] buffer = new byte[65536];
+
+ bool match = false;
+
+ // Loop for each 64 KB buffer length until EOF or, found what searched
+ while ((bytes_read = st.Read(buffer, offset, buffer.Length - offset)) > 0 && !match)
+ {
+ // Loop for each searched bytes : 43 bytes length step, in this case.
+ for (int i = 0; i < bytes_read + offset - search_bytes.Length; i++)
{
- using (Stream st = new FileStream(s, FileMode.Open, FileAccess.ReadWrite))
+ match = true;
+
+ // Loop inside 43 bytes until differ.
+ for (int j = 0; j < search_bytes.Length; j++)
+ {
+ if (search_bytes[j] != buffer[i + j])
{
- int offset = 0;
- long file_pos = 0;
- int bytes_read = 0;
- byte[] buffer = new byte[65536];
+ match = false;
+ break;
+ }
+ }
- bool match = false;
+ // We found "RuntimeCompatibilityAttributeMultiShortcut" inside the DLL code.
+ // Then, it's most likely a MultiShortcut DLL.
+ if (match)
+ {
+ // Replace value number in the dll code then, ability to have duplicate plugins.
+ st.Seek(file_pos + i - offset + search_bytes.Length, SeekOrigin.Begin);
+ byte[] replaceBuffer = new byte[] { (Byte)(48 + (fileCounter > 9 ? ((int)fileCounter / 10) : 0)), (Byte)(48 + ((int)fileCounter % 10)) };
+ string Sreplaced = Encoding.ASCII.GetString(replaceBuffer);
+ st.Write(replaceBuffer, 0, replaceBuffer.Length);
+ Console.WriteLine(" - PATCHED: {0} with {1} value.", s.Substring(s.LastIndexOf('\\') + 1), Sreplaced);
+ fileCounter++;
+ break;
+ }
+ }
- // Loop for each 64 KB buffer length until EOF or, found what searched
- while ((bytes_read = st.Read(buffer, offset, buffer.Length - offset)) > 0 && !match)
- {
- // Loop for each searched bytes : 43 bytes length step, in this case.
- for (int i = 0; i < bytes_read + offset - search_bytes.Length; i++)
- {
- match = true;
+ file_pos = st.Position;
- // Loop inside 43 bytes until differ.
- for (int j = 0; j < search_bytes.Length; j++)
- {
- if (search_bytes[j] != buffer[i + j])
- {
- match = false;
- break;
- }
- }
-
- // We found "RuntimeCompatibilityAttributeMultiShortcut" inside the DLL code.
- // Then, it's most likely a MultiShortcut DLL.
- if (match)
- {
- // Replace value number in the dll code then, ability to have duplicate plugins.
- st.Seek(file_pos + i - offset + search_bytes.Length, SeekOrigin.Begin);
- byte[] replaceBuffer = new byte[] { (Byte)(48 + (fileCounter > 9 ? ((int)fileCounter / 10) : 0)), (Byte)(48 + ((int)fileCounter % 10)) };
- string Sreplaced = Encoding.ASCII.GetString(replaceBuffer);
- st.Write(replaceBuffer, 0, replaceBuffer.Length);
- Console.WriteLine(" - PATCHED: {0} with {1} value.", s.Substring(s.LastIndexOf('\\') + 1), Sreplaced);
- fileCounter++;
- break;
- }
- }
-
- file_pos = st.Position;
-
- offset = search_bytes.Length;
- // recopy the end of the buffer
- for (int i = 0; i < offset; i++)
- {
- buffer[i] = buffer[buffer.Length - offset + i];
- }
- }
- }
+ offset = search_bytes.Length;
+ // recopy the end of the buffer
+ for (int i = 0; i < offset; i++)
+ {
+ buffer[i] = buffer[buffer.Length - offset + i];
}
+ }
+ }
+ }
- Console.WriteLine("\n2.) Done.");
- Console.WriteLine("\n3.) Press Enter to close...");
- Console.ReadKey();
- }
+ Console.WriteLine("\n2.) Done.");
+ Console.WriteLine("\n3.) Press Enter to close...");
+ Console.ReadKey();
}
+ }
}
Modified: trunk/plugins/MultiShortcut/MultiShortcut/Config.cs
===================================================================
--- trunk/plugins/MultiShortcut/MultiShortcut/Config.cs 2010-04-12 21:24:03 UTC (rev 3524)
+++ trunk/plugins/MultiShortcut/MultiShortcut/Config.cs 2010-04-13 20:00:45 UTC (rev 3525)
@@ -8,16 +8,16 @@
namespace MediaPortal.MultiShortcut
{
- public partial class Config : Form
+ public partial class Config : Form
+ {
+ public Config()
{
- public Config()
- {
- InitializeComponent();
- }
+ InitializeComponent();
+ }
- public void SetPropertyGrid(object o)
- {
- propertyGrid1.SelectedObject = o;
- }
+ public void SetPropertyGrid(object o)
+ {
+ propertyGrid1.SelectedObject = o;
}
+ }
}
\ No newline at end of file
Modified: trunk/plugins/MultiShortcut/MultiShortcut/LocalizeStrings.cs
===================================================================
--- trunk/plugins/MultiShortcut/MultiShortcut/LocalizeStrings.cs 2010-04-12 21:24:03 UTC (rev 3524)
+++ trunk/plugins/MultiShortcut/MultiShortcut/LocalizeStrings.cs 2010-04-13 20:00:45 UTC (rev 3525)
@@ -41,7 +41,8 @@
/// <summary>
/// Enumerations of all Configuration Messages
/// </summary>
- public enum LocalizedMessages {
+ public enum LocalizedMessages
+ {
/// <summary>
/// Program
/// </summary>
@@ -146,7 +147,7 @@
/// </summary>
msgbox7 = 31
-}
+ }
/// <summary>
/// This class will hold all text used in the application
@@ -174,7 +175,7 @@
/// </summary>
static public void Dispose()
{
- if(_stringProvider != null)
+ if (_stringProvider != null)
_stringProvider.Dispose();
}
#endregion
@@ -194,14 +195,14 @@
bool isPrefixEnabled = true;
using (MediaPortal.Profile.Settings reader = new MediaPortal.Profile.Settings(MediaPortal.Configuration.Config.GetFile(MediaPortal.Configuration.Config.Dir.Config, "MediaPortal.xml")))
- isPrefixEnabled = reader.GetValueAsBool("general", "myprefix", true);
+ isPrefixEnabled = reader.GetValueAsBool("general", "myprefix", true);
string directory = MediaPortal.Configuration.Config.GetSubFolder(MediaPortal.Configuration.Config.Dir.Language, "MultiShortcut");
string cultureName = null;
if (language != null)
cultureName = GetCultureName(language);
- Log.Info("MultiShortcut: Loading localised Strings - Path: {0} Culture: {1} Language: {2} Prefix: {3}", directory, cultureName, language, isPrefixEnabled);
+ Log.Info("MultiShortcut: Loading localised Strings - Path: {0} Culture: {1} Language: {2} Prefix: {3}", directory, cultureName, language, isPrefixEnabled);
_stringProvider = new LocalisationProvider(directory, cultureName, isPrefixEnabled);
@@ -360,10 +361,10 @@
sortedLanguages.Add(culture.EnglishName, culture.EnglishName);
_languages = new string[sortedLanguages.Count];
-
+
for (int i = 0; i < sortedLanguages.Count; i++)
{
- _languages[i] = (string) sortedLanguages.GetByIndex(i);
+ _languages[i] = (string)sortedLanguages.GetByIndex(i);
}
}
Modified: trunk/plugins/MultiShortcut/MultiShortcut/LocalizedCategory.cs
===================================================================
--- trunk/plugins/MultiShortcut/MultiShortcut/LocalizedCategory.cs 2010-04-12 21:24:03 UTC (rev 3524)
+++ trunk/plugins/MultiShortcut/MultiShortcut/LocalizedCategory.cs 2010-04-13 20:00:45 UTC (rev 3525)
@@ -26,17 +26,17 @@
namespace MediaPortal.MultiShortcut
{
- class LocalizedCategory : CategoryAttribute
+ class LocalizedCategory : CategoryAttribute
+ {
+ public LocalizedCategory(string Category)
+ :
+ base(Category) { }
+
+ protected override string GetLocalizedString(string Category)
{
- public LocalizedCategory(string Category)
- :
- base(Category) { }
-
- protected override string GetLocalizedString(string Category)
- {
- string categoryname = base.Category;
- LocalizeStrings.LocalizeLabel(ref categoryname);
- return categoryname;
- }
+ string categoryname = base.Category;
+ LocalizeStrings.LocalizeLabel(ref categoryname);
+ return categoryname;
}
+ }
}
Modified: trunk/plugins/MultiShortcut/MultiShortcut/LocalizedDisplayName.cs
===================================================================
--- trunk/plugins/MultiShortcut/MultiShortcut/LocalizedDisplayName.cs 2010-04-12 21:24:03 UTC (rev 3524)
+++ trunk/plugins/MultiShortcut/MultiShortcut/LocalizedDisplayName.cs 2010-04-13 20:00:45 UTC (rev 3525)
@@ -26,20 +26,20 @@
namespace MediaPortal.MultiShortcut
{
- class LocalizedDisplayName : DisplayNameAttribute
+ class LocalizedDisplayName : DisplayNameAttribute
+ {
+ public LocalizedDisplayName(string DisplayName)
+ :
+ base(DisplayName) { }
+
+ public override string DisplayName
{
- public LocalizedDisplayName(string DisplayName)
- :
- base(DisplayName) { }
-
- public override string DisplayName
- {
- get
- {
- string displayname = base.DisplayName;
- LocalizeStrings.LocalizeLabel(ref displayname);
- return displayname;
- }
- }
+ get
+ {
+ string displayname = base.DisplayName;
+ LocalizeStrings.LocalizeLabel(ref displayname);
+ return displayname;
+ }
}
+ }
}
Modified: trunk/plugins/MultiShortcut/MultiShortcut/XmlConfig.cs
===================================================================
--- trunk/plugins/MultiShortcut/MultiShortcut/XmlConfig.cs 2010-04-12 21:24:03 UTC (rev 3524)
+++ trunk/plugins/MultiShortcut/MultiShortcut/XmlConfig.cs 2010-04-13 20:00:45 UTC (rev 3525)
@@ -63,258 +63,258 @@
namespace MediaPortal.MultiShortcut
{
- class XmlConfig
- {
+ class XmlConfig
+ {
-#region <<DECLARATION>>
- XmlDocument configxml = new XmlDocument();
-#endregion
+ #region <<DECLARATION>>
+ XmlDocument configxml = new XmlDocument();
+ #endregion
-#region <<public>>
+ #region <<public>>
- // Recover install MediaPortal path
- public string PathInstalMP()
- {
- string path = MediaPortal.Configuration.Config.GetFolder(MediaPortal.Configuration.Config.Dir.Config);
- return path;
- }
+ // Recover install MediaPortal path
+ public string PathInstalMP()
+ {
+ string path = MediaPortal.Configuration.Config.GetFolder(MediaPortal.Configuration.Config.Dir.Config);
+ return path;
+ }
- // Build entire filename of config file
- public string EntireFilenameConfig(string FileName)
- {
- string entirefilename = PathInstalMP() + @"\" + FileName + ".xml";
- return entirefilename;
- }
+ // Build entire filename of config file
+ public string EntireFilenameConfig(string FileName)
+ {
+ string entirefilename = PathInstalMP() + @"\" + FileName + ".xml";
+ return entirefilename;
+ }
- // Called with bool type
- public void WriteXmlConfig(string FileName, string Section, string Entry, bool Value)
- {
- string value = "";
- // Change true by "yes" and false by "no" for xml MediaPortal compatibility
- if (Value)
- {
- value = "yes";
- }
- else
- {
- value = "no";
- }
+ // Called with bool type
+ public void WriteXmlConfig(string FileName, string Section, string Entry, bool Value)
+ {
+ string value = "";
+ // Change true by "yes" and false by "no" for xml MediaPortal compatibility
+ if (Value)
+ {
+ value = "yes";
+ }
+ else
+ {
+ value = "no";
+ }
- WriteXmlConfig(FileName, Section, Entry, value);
- }
+ WriteXmlConfig(FileName, Section, Entry, value);
+ }
- // Called with decimal type
- public void WriteXmlConfig(string FileName, string Section, string Entry, decimal Value)
- {
- string value = Value.ToString();
+ // Called with decimal type
+ public void WriteXmlConfig(string FileName, string Section, string Entry, decimal Value)
+ {
+ string value = Value.ToString();
- WriteXmlConfig(FileName, Section, Entry, value);
- }
+ WriteXmlConfig(FileName, Section, Entry, value);
+ }
- // Write a config file with XmlDocument
- public void WriteXmlConfig(string FileName, string Section, string Entry, string Value)
- {
- // Create file if doesn't exist
- if (!File.Exists(EntireFilenameConfig(FileName)))
- {
- CreateXmlConfig(FileName);
- }
+ // Write a config file with XmlDocument
+ public void WriteXmlConfig(string FileName, string Section, string Entry, string Value)
+ {
+ // Create file if doesn't exist
+ if (!File.Exists(EntireFilenameConfig(FileName)))
+ {
+ CreateXmlConfig(FileName);
+ }
- //Open xml document
- configxml.Load(EntireFilenameConfig(FileName));
- //Recover profile node
- XmlElement profile = configxml.DocumentElement;
- //Create section if doesn't exist
- String XPath = @"/profile/section[@name='" + Section + "']";
- XmlNodeList ListSection = configxml.SelectNodes(XPath);
- if (ListSection.Count < 1)
- {
- CreateSection(Section);
- }
- //Posit on section node
- XmlNode section = profile.SelectSingleNode("section[@name='" + Section + "']");
+ //Open xml document
+ configxml.Load(EntireFilenameConfig(FileName));
+ //Recover profile node
+ XmlElement profile = configxml.DocumentElement;
+ //Create section if doesn't exist
+ String XPath = @"/profile/section[@name='" + Section + "']";
+ XmlNodeList ListSection = configxml.SelectNodes(XPath);
+ if (ListSection.Count < 1)
+ {
+ CreateSection(Section);
+ }
+ //Posit on section node
+ XmlNode section = profile.SelectSingleNode("section[@name='" + Section + "']");
- //Create Entry if doesn't exist
- XPath = @"/profile/section[@name='" + Section + "']/entry[@name='" + Entry + "']";
- XmlNodeList ListEntry = configxml.SelectNodes(XPath);
- if (ListEntry.Count < 1)
- {
- CreateEntry(Section, Entry);
- }
- //Posit on entry node
- XmlNode entry = section.SelectSingleNode("entry[@name='" + Entry + "']");
+ //Create Entry if doesn't exist
+ XPath = @"/profile/section[@name='" + Section + "']/entry[@name='" + Entry + "']";
+ XmlNodeList ListEntry = configxml.SelectNodes(XPath);
+ if (ListEntry.Count < 1)
+ {
+ CreateEntry(Section, Entry);
+ }
+ //Posit on entry node
+ XmlNode entry = section.SelectSingleNode("entry[@name='" + Entry + "']");
- //Store entry value
- entry.InnerText = Value;
+ //Store entry value
+ entry.InnerText = Value;
- //Save xml config file
- configxml.Save(EntireFilenameConfig(FileName));
- }
+ //Save xml config file
+ configxml.Save(EntireFilenameConfig(FileName));
+ }
- // Remove an Entry
- public void RemoveEntry(string FileName, string Section, string Entry)
- {
- // Return if xml file doesn't exist
- if (!File.Exists(EntireFilenameConfig(FileName)))
- {
- return;
- }
+ // Remove an Entry
+ public void RemoveEntry(string FileName, string Section, string Entry)
+ {
+ // Return if xml file doesn't exist
+ if (!File.Exists(EntireFilenameConfig(FileName)))
+ {
+ return;
+ }
- //Open xml document
- configxml.Load(EntireFilenameConfig(FileName));
- //Recover profile node
- XmlElement profile = configxml.DocumentElement;
+ //Open xml document
+ configxml.Load(EntireFilenameConfig(FileName));
+ //Recover profile node
+ XmlElement profile = configxml.DocumentElement;
- //Posit on value
- String XPath = @"/profile/section[@name='" + Section + "']/entry[@name='" + Entry + "']";
- XmlNodeList ListEntry = configxml.SelectNodes(XPath);
+ //Posit on value
+ String XPath = @"/profile/section[@name='" + Section + "']/entry[@name='" + Entry + "']";
+ XmlNodeList ListEntry = configxml.SelectNodes(XPath);
- // If value exist, remove it otherwise, return
- if (ListEntry.Count > 0)
- {
- //Posit on section node
- XmlNode section = profile.SelectSingleNode("section[@name='" + Section + "']");
- //Posit on entry node
- XmlNode entry = section.SelectSingleNode("entry[@name='" + Entry + "']");
- //Remove the entry node for section
- section.RemoveChild(entry);
- //Save xml config file
- configxml.Save(EntireFilenameConfig(FileName));
- }
- return;
- }
+ // If value exist, remove it otherwise, return
+ if (ListEntry.Count > 0)
+ {
+ //Posit on section node
+ XmlNode section = profile.SelectSingleNode("section[@name='" + Section + "']");
+ //Posit on entry node
+ XmlNode entry = section.SelectSingleNode("entry[@name='" + Entry + "']");
+ //Remove the entry node for section
+ section.RemoveChild(entry);
+ //Save xml config file
+ configxml.Save(EntireFilenameConfig(FileName));
+ }
+ return;
+ }
- // Called with bool type
- public bool ReadXmlConfig(string FileName, string Section, string Entry, bool Value)
- {
- // Change true by "yes" and false by "no" for xml MediaPortal compatibility
- string value = Value.ToString();
- if (Value)
- {
- value = "yes";
- }
- else
- {
- value = "no";
- }
+ // Called with bool type
+ public bool ReadXmlConfig(string FileName, string Section, string Entry, bool Value)
+ {
+ // Change true by "yes" and false by "no" for xml MediaPortal compatibility
+ string value = Value.ToString();
+ if (Value)
+ {
+ value = "yes";
+ }
+ else
+ {
+ value = "no";
+ }
- string result = ReadXmlConfig(FileName, Section, Entry, value);
+ string result = ReadXmlConfig(FileName, Section, Entry, value);
- // Change "yes" by true and "no" by false for xml MediaPortal compatibility
- if (result == "yes")
- {
- Value = true;
- }
- else
- {
- Value = false;
- }
+ // Change "yes" by true and "no" by false for xml MediaPortal compatibility
+ if (result == "yes")
+ {
+ Value = true;
+ }
+ else
+ {
+ Value = false;
+ }
- return Value;
- }
+ return Value;
+ }
- // Called with int type
- public int ReadXmlConfig(string FileName, string Section, string Entry, int Value)
- {
- string value = Value.ToString();
+ // Called with int type
+ public int ReadXmlConfig(string FileName, string Section, string Entry, int Value)
+ {
+ string value = Value.ToString();
- string result = ReadXmlConfig(FileName, Section, Entry, value);
+ string result = ReadXmlConfig(FileName, Section, Entry, value);
- Value = Convert.ToInt32(result);
+ Value = Convert.ToInt32(result);
- return Value;
- }
+ return Value;
+ }
- // Read xml config file with XmlDocument
- public string ReadXmlConfig(string FileName, string Section, string Entry, string Value)
- {
- // Default value if xml file doesn't exist
- if (!File.Exists(EntireFilenameConfig(FileName)))
- {
- return Value;
- }
+ // Read xml config file with XmlDocument
+ public string ReadXmlConfig(string FileName, string Section, string Entry, string Value)
+ {
+ // Default value if xml file doesn't exist
+ if (!File.Exists(EntireFilenameConfig(FileName)))
+ {
+ return Value;
+ }
- //Open xml document
- configxml.Load(EntireFilenameConfig(FileName));
- //Recover profile node
- XmlElement profile = configxml.DocumentElement;
+ //Open xml document
+ configxml.Load(EntireFilenameConfig(FileName));
+ //Recover profile node
+ XmlElement profile = configxml.DocumentElement;
- //Posit on value
- String XPath = @"/profile/section[@name='" + Section + "']/entry[@name='" + Entry + "']";
- XmlNodeList ListEntry = configxml.SelectNodes(XPath);
+ //Posit on value
+ String XPath = @"/profile/section[@name='" + Section + "']/entry[@name='" + Entry + "']";
+ XmlNodeList ListEntry = configxml.SelectNodes(XPath);
- // If value exist, return it otherwise, return default value
- if (ListEntry.Count > 0)
- {
- //Posit on section node
- XmlNode section = profile.SelectSingleNode("section[@name='" + Section + "']");
- //Posit on entry node
- XmlNode entry = section.SelectSingleNode("entry[@name='" + Entry + "']");
- //Recover value with entry data
- Value = entry.InnerText;
- }
+ // If value exist, return it otherwise, return default value
+ if (ListEntry.Count > 0)
+ {
+ //Posit on section node
+ XmlNode section = profile.SelectSingleNode("section[@name='" + Section + "']");
+ //Posit on entry node
+ XmlNode entry = section.SelectSingleNode("entry[@name='" + Entry + "']");
+ //Recover value with entry data
+ Value = entry.InnerText;
+ }
- return Value;
- }
+ return Value;
+ }
-#endregion
+ #endregion
-#region <<private>>
+ #region <<private>>
- // Create xml config file with profile node
- private void CreateXmlConfig(string FileName)
- {
- XmlDocument configxml = new XmlDocument();
- //Declaration of XML document type (utf-8, same as MediaPortal)
- XmlDeclaration declaration = configxml.CreateXmlDeclaration("1.0", "utf-8", "");
- //Add declaration to document
- configxml.AppendChild(declaration);
- //Create profile node
- XmlNode profile = configxml.CreateNode(System.Xml.XmlNodeType.Element, "profile", "");
- //Add node to document
- configxml.AppendChild(profile);
+ // Create xml config file with profile node
+ private void CreateXmlConfig(string FileName)
+ {
+ XmlDocument configxml = new XmlDocument();
+ //Declaration of XML document type (utf-8, same as MediaPortal)
+ XmlDeclaration declaration = configxml.CreateXmlDeclaration("1.0", "utf-8", "");
+ //Add declaration to document
+ configxml.AppendChild(declaration);
+ //Create profile node
+ XmlNode profile = configxml.CreateNode(System.Xml.XmlNodeType.Element, "profile", "");
+ //Add node to document
+ configxml.AppendChild(profile);
- //Save xml config file
- configxml.Save(EntireFilenameConfig(FileName));
- }
+ //Save xml config file
+ configxml.Save(EntireFilenameConfig(FileName));
+ }
- // create section node
- private void CreateSection(string Section)
- {
- //Recover profile node
- XmlElement profile = configxml.DocumentElement;
- //Create new section node
- XmlNode section = configxml.CreateElement("section");
- //Add "name" attribute to section node
- XmlAttribute name = configxml.CreateAttribute("name");
- //value is section name
- name.Value = Section;
- //Add value to section
- section.Attributes.Append(name);
- //Add section to document
- profile.AppendChild(section);
- }
+ // create section node
+ private void CreateSection(string Section)
+ {
+ //Recover profile node
+ XmlElement profile = configxml.DocumentElement;
+ //Create new section node
+ XmlNode section = configxml.CreateElement("section");
+ //Add "name" attribute to section node
+ XmlAttribute name = configxml.CreateAttribute("name");
+ //value is section name
+ name.Value = Section;
+ //Add value to section
+ section.Attributes.Append(name);
+ //Add section to document
+ profile.AppendChild(section);
+ }
- // create entry node
- private void CreateEntry(string Section, string Entry)
- {
- //Recover profile node
- XmlElement profile = configxml.DocumentElement;
- //Posit on section node
- XmlNode section = profile.SelectSingleNode("section[@name='" + Section + "']");
- //Create new node for entry
- XmlNode entry = configxml.CreateElement("entry");
- //Add "name" attribute to entry node
- XmlAttribute name = configxml.CreateAttribute("name");
- //value is entry name
- name.Value = Entry;
- //Add value to entry
- entry.Attributes.Append(name);
- //Add entry to document
- section.AppendChild(entry);
- }
+ // create entry node
+ private void CreateEntry(string Section, string Entry)
+ {
+ //Recover profile node
+ XmlElement profile = configxml.DocumentElement;
+ //Posit on section node
+ XmlNode section = profile.SelectSingleNode("section[@name='" + Section + "']");
+ //Create new node for entry
+ XmlNode entry = configxml.CreateElement("entry");
+ //Add "name" attribute to entry node
+ XmlAttribute name = configxml.CreateAttribute("name");
+ //value is entry name
+ name.Value = Entry;
+ //Add value to entry
+ entry.Attributes.Append(name);
+ //Add entry to document
+ section.AppendChild(entry);
+ }
-#endregion
+ #endregion
- } // end of class
+ } // end of class
} // end of namespace
Modified: trunk/plugins/MultiShortcut/TestServer/Program.cs
===================================================================
--- trunk/plugins/MultiShortcut/TestServer/Program.cs 2010-04-12 21:24:03 UTC (rev 3524)
+++ trunk/plugins/MultiShortcut/TestServer/Program.cs 2010-04-13 20:00:45 UTC (rev 3525)
@@ -10,15 +10,15 @@
namespace TestServer
{
- class Program
+ class Program
+ {
+ static void Main(string[] args)
{
- static void Main(string[] args)
- {
- MultiShortcut ms = new MultiShortcut();
- MultiShortcut ms2 = new MultiShortcut();
- //ms.RunProgram(@"c:\windows\notepad.exe", String.Empty);
+ MultiShortcut ms = new MultiShortcut();
+ MultiShortcut ms2 = new MultiShortcut();
+ //ms.RunProgram(@"c:\windows\notepad.exe", String.Empty);
- Console.ReadKey();
- }
+ Console.ReadKey();
}
+ }
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|