|
|
|
|
@ -1,13 +1,15 @@
@@ -1,13 +1,15 @@
|
|
|
|
|
/* |
|
|
|
|
* Created by SharpDevelop. |
|
|
|
|
* User: Daniel Grunwald |
|
|
|
|
* Date: 25.11.2005 |
|
|
|
|
* Time: 18:56 |
|
|
|
|
*/ |
|
|
|
|
// <file>
|
|
|
|
|
// <copyright see="prj:///doc/copyright.txt">2002-2005 AlphaSierraPapa</copyright>
|
|
|
|
|
// <license see="prj:///doc/license.txt">GNU General Public License</license>
|
|
|
|
|
// <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/>
|
|
|
|
|
// <version>$Revision$</version>
|
|
|
|
|
// </file>
|
|
|
|
|
|
|
|
|
|
using System; |
|
|
|
|
using System.Collections.Generic; |
|
|
|
|
using System.IO; |
|
|
|
|
using System.Xml; |
|
|
|
|
using System.Text; |
|
|
|
|
|
|
|
|
|
namespace ICSharpCode.Core |
|
|
|
|
{ |
|
|
|
|
@ -17,6 +19,7 @@ namespace ICSharpCode.Core
@@ -17,6 +19,7 @@ namespace ICSharpCode.Core
|
|
|
|
|
public class CoreStartup |
|
|
|
|
{ |
|
|
|
|
List<string> addInFiles = new List<string>(); |
|
|
|
|
List<string> disabledAddIns = new List<string>(); |
|
|
|
|
string propertiesName; |
|
|
|
|
string configDirectory; |
|
|
|
|
string dataDirectory; |
|
|
|
|
@ -79,9 +82,62 @@ namespace ICSharpCode.Core
@@ -79,9 +82,62 @@ namespace ICSharpCode.Core
|
|
|
|
|
addInFiles.AddRange(FileUtility.SearchDirectory(addInDir, "*.addin")); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void LoadAddInConfiguration(string configurationFile) |
|
|
|
|
{ |
|
|
|
|
LoadAddInConfiguration(configurationFile, addInFiles, disabledAddIns); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Loads a configuration file.
|
|
|
|
|
/// The 'file' from XML elements in the form "<AddIn file='full path to .addin file'>" will
|
|
|
|
|
/// be added to <paramref name="addInFiles"/>, the 'addin' element from
|
|
|
|
|
/// "<Disable addin='addin identity'>" will be added to <paramref name="disabledAddIns"/>,
|
|
|
|
|
/// all other XML elements are ignored.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public static void LoadAddInConfiguration(string configurationFile, List<string> addInFiles, List<string> disabledAddIns) |
|
|
|
|
{ |
|
|
|
|
using (XmlTextReader reader = new XmlTextReader(configurationFile)) { |
|
|
|
|
while (reader.Read()) { |
|
|
|
|
if (reader.NodeType == XmlNodeType.Element) { |
|
|
|
|
if (reader.Name == "AddIn") { |
|
|
|
|
string fileName = reader.GetAttribute("file"); |
|
|
|
|
if (fileName != null && fileName.Length > 0) { |
|
|
|
|
addInFiles.Add(fileName); |
|
|
|
|
} |
|
|
|
|
} else if (reader.Name == "Disable") { |
|
|
|
|
string addIn = reader.GetAttribute("addin"); |
|
|
|
|
if (addIn != null && addIn.Length > 0) { |
|
|
|
|
disabledAddIns.Add(addIn); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static void SaveAddInConfiguration(string configurationFile, List<string> addInFiles, List<string> disabledAddIns) |
|
|
|
|
{ |
|
|
|
|
using (XmlTextWriter writer = new XmlTextWriter(configurationFile, Encoding.UTF8)) { |
|
|
|
|
writer.Formatting = Formatting.Indented; |
|
|
|
|
writer.WriteStartDocument(); |
|
|
|
|
writer.WriteStartElement("AddInConfiguration"); |
|
|
|
|
foreach (string file in addInFiles) { |
|
|
|
|
writer.WriteStartElement("AddIn"); |
|
|
|
|
writer.WriteAttributeString("file", file); |
|
|
|
|
writer.WriteEndElement(); |
|
|
|
|
} |
|
|
|
|
foreach (string name in disabledAddIns) { |
|
|
|
|
writer.WriteStartElement("Disable"); |
|
|
|
|
writer.WriteAttributeString("addin", name); |
|
|
|
|
writer.WriteEndElement(); |
|
|
|
|
} |
|
|
|
|
writer.WriteEndDocument(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void RunInitialization() |
|
|
|
|
{ |
|
|
|
|
LoggingService.Info("Loading AddInTree..."); |
|
|
|
|
AddInTree.Load(addInFiles); |
|
|
|
|
|
|
|
|
|
// run workspace autostart commands
|
|
|
|
|
|