Browse Source

Update to NDoc 1.3.1-v11 from http://jonas.lagerblad.com/blog/?p=4 (unofficial version that works with .NET 2.0)

Now NDoc can be started with the command "Project > Build documentation with NDoc".

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@869 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 20 years ago
parent
commit
65777d486d
  1. 63
      AddIns/ICSharpCode.SharpDevelop.addin
  2. 51
      src/AddIns/Misc/NAntAddIn/Project/NAnt.addin
  3. 139
      src/Main/Base/Project/Src/Commands/ProjectMenuCommands.cs
  4. 10
      src/Main/Base/Project/Src/Project/AbstractProject.cs
  5. 4
      src/Main/Base/Project/Src/Project/IProject.cs
  6. 3
      src/Main/Base/Project/Src/TextEditor/Commands/ProjectCommands.cs
  7. 28
      src/Main/Core/Project/Src/AddInTree/AddIn/ExtensionPath.cs
  8. 38
      src/Main/Core/Test/AddInTreeTests/AddInTreeLoadingTests.cs
  9. 5
      src/Main/Core/Test/ICSharpCode.Core.Tests.csproj
  10. BIN
      src/Main/StartUp/Project/Resources/StringResources.resources
  11. 2
      src/SharpDevelop.Tests.sln
  12. 2
      src/Tools/Tools.build

63
AddIns/ICSharpCode.SharpDevelop.addin

@ -284,15 +284,7 @@ @@ -284,15 +284,7 @@
label = "${res:ProjectComponent.ContextMenu.AddReference}"
class = "ICSharpCode.SharpDevelop.Project.Commands.AddReferenceToProject"/>
<MenuItem id = "AddSeparator" type = "Separator"/>
<MenuItem id = "SetAsStartupProject"
label = "${res:ProjectComponent.ContextMenu.SetAsStartupProject}"
class = "ICSharpCode.SharpDevelop.Project.Commands.SetAsStartupProject"/>
<Condition name="IsProcessRunning" isprocessrunning="False" isdebugging="False" action="Disable">
<MenuItem id = "Run"
label = "${res:ProjectComponent.ContextMenu.RunProject}"
icon = "Icons.16x16.RunProgramIcon"
class = "ICSharpCode.SharpDevelop.Project.Commands.RunProject"/>
</Condition>
<Include id = "ProjectActions" path="/SharpDevelop/Pads/ProjectBrowser/ContextMenu/ProjectActions"/>
<MenuItem id = "Separator2" type = "Separator"/>
<MenuItem id = "Cut"
label = "${res:XML.MainMenu.EditMenu.Cut}"
@ -320,6 +312,24 @@ @@ -320,6 +312,24 @@
class = "ICSharpCode.SharpDevelop.Project.Commands.ShowPropertiesForNode"/>
</Path>
<Path name="/SharpDevelop/Pads/ProjectBrowser/ContextMenu/ProjectActions">
<Condition name="IsProcessRunning" isprocessrunning="False" isdebugging="False" action="Disable">
<MenuItem id = "Run"
label = "${res:ProjectComponent.ContextMenu.RunProject}"
icon = "Icons.16x16.RunProgramIcon"
class = "ICSharpCode.SharpDevelop.Project.Commands.RunProject"/>
</Condition>
<MenuItem id = "SetAsStartupProject"
label = "${res:ProjectComponent.ContextMenu.SetAsStartupProject}"
class = "ICSharpCode.SharpDevelop.Project.Commands.SetAsStartupProject"/>
<MenuItem id = "ExportToHtml"
label = "${res:ProjectComponent.ContextMenu.HtmlExport}"
class = "ICSharpCode.SharpDevelop.Project.Commands.ExportProjectToHtml"/>
<MenuItem id = "GenerateDocumentation"
label = "${res:ProjectComponent.ContextMenu.GenerateDocumentation}"
class = "ICSharpCode.SharpDevelop.Project.Commands.GenerateProjectDocumentation"/>
</Path>
<Path name = "/SharpDevelop/Pads/ProjectBrowser/ContextMenu/ReferenceFolderNode">
<MenuItem id = "AddReference"
label = "${res:ProjectComponent.ContextMenu.AddReference}"
@ -1151,16 +1161,11 @@ @@ -1151,16 +1161,11 @@
</MenuItem> <!-- end VIEW menu -->
<Condition name = "ProjectActive" activeproject="*">
<MenuItem id = "Project" label = "${res:XML.MainMenu.ProjectMenu}" type="Menu">
<MenuItem id = "Project" label = "${res:XML.MainMenu.ProjectMenu}" type="Menu">
<MenuItem id = "AddReference"
label = "${res:ProjectComponent.ContextMenu.AddReference}"
class = "ICSharpCode.SharpDevelop.Project.Commands.AddReferenceToProject"/>
<MenuItem id = "SetAsStartupProject"
label = "${res:ProjectComponent.ContextMenu.SetAsStartupProject}"
class = "ICSharpCode.SharpDevelop.Project.Commands.SetAsStartupProject"/>
<MenuItem id = "ExportToHtml"
label = "${res:ProjectComponent.ContextMenu.HtmlExport}"
class = "ICSharpCode.SharpDevelop.DefaultEditor.Commands.ExportProjectToHtml"/>
<Include id = "ProjectActions" path="/SharpDevelop/Pads/ProjectBrowser/ContextMenu/ProjectActions"/>
<MenuItem id = "Separator2" type = "Separator" />
<MenuItem id = "Options"
label = "${res:XML.MainMenu.ProjectMenu.Options}"
@ -1399,28 +1404,28 @@ @@ -1399,28 +1404,28 @@
<MenuItem id = "Web" label = "${res:XML.MainMenu.HelpMenu.WebMenu}" type="Menu">
<MenuItem id = "SharpDevelop" label = "SharpDevelop" type="Menu">
<MenuItem id = "Downloads" label = "Downloads" icon = "Icons.16x16.WebSearchIcon" link = "http://www.sharpdevelop.net/OpenSource/SD/Download/" />
<MenuItem id = "Forum" label = "Community Forums" icon = "Icons.16x16.WebSearchIcon" link = "http://www.sharpdevelop.net/OpenSource/SD/Forum/" />
<MenuItem id = "Forum" label = "Community Forums" icon = "Icons.16x16.WebSearchIcon" link = "http://community.sharpdevelop.net/forums/" />
<MenuItem id = "Announcement" label = "Announcement List" icon = "Icons.16x16.WebSearchIcon" link = "http://www.sharpdevelop.net/OpenSource/SD/AnnouncementList.aspx" />
<MenuItem id = "Mail" label = "Send Us a Mail" icon = "Icons.16x16.WebSearchIcon" link = "http://www.sharpdevelop.net/OpenSource/SD/ContactUs.asp" />
</MenuItem>
<MenuItem id = "C#" label = "C#" type="Menu">
<MenuItem id = "cshrp.net" label = "cshrp.net" icon = "Icons.16x16.WebSearchIcon" link = "http://www.cshrp.net/" />
<MenuItem id = "C# Help" label = "C# Help" icon = "Icons.16x16.WebSearchIcon" link = "http://www.csharphelp.com" />
<MenuItem id = "CodeProject" label = "CodeProject" icon = "Icons.16x16.WebSearchIcon" link = "http://www.codeproject.com" />
<MenuItem id = "C# Corner" label = "C# Corner" icon = "Icons.16x16.WebSearchIcon" link = "http://www.c-sharpcorner.com" />
<MenuItem id = "GotDotNet" label = "GotDotNet" icon = "Icons.16x16.WebSearchIcon" link = "http://www.gotdotnet.com/" />
</MenuItem>
<MenuItem id = "IntegratedProjects" label = "Integrated Projects" type="Menu">
<MenuItem id = "DockManager Control" label = "DockPanel Suite" icon = "Icons.16x16.WebSearchIcon" link = "http://www.freewebs.com/weifenluo/DockManager.htm" />
<MenuItem id = "NUnit" label = "NUnit" icon = "Icons.16x16.WebSearchIcon" link = "http://www.nunit.org/" />
<MenuItem id = "NProf" label = "NProf" icon = "Icons.16x16.WebSearchIcon" link = "http://nprof.sourceforge.net/Site/SiteHomeNews.html" />
<MenuItem id = "WiX" label = "WiX" icon = "Icons.16x16.WebSearchIcon" link = "http://sourceforge.net/projects/wix/" />
<MenuItem id = "NAnt" label = "NAnt" icon = "Icons.16x16.WebSearchIcon" link = "http://nant.sourceforge.net/" />
<MenuItem id = "DockManager Control" label = "DockPanel Suite" icon = "Icons.16x16.WebSearchIcon" link = "http://sourceforge.net/projects/dockpanelsuite/" />
<MenuItem id = "NUnit" label = "NUnit" icon = "PadIcons.NUnitTest" link = "http://www.nunit.org/" />
<MenuItem id = "MbUnit" label = "MbUnit" icon = "PadIcons.MbUnitTest" link = "http://www.mbunit.org/" />
<!--<MenuItem id = "WiX" label = "WiX" icon = "Icons.16x16.WebSearchIcon" link = "http://sourceforge.net/projects/wix/" />-->
<MenuItem id = "NAnt" label = "NAnt" icon = "NAntAddIn.Icons.16x16.NAntPad" link = "http://nant.sourceforge.net/" />
<MenuItem id = "NDoc" label = "NDoc" icon = "Icons.16x16.WebSearchIcon" link = "http://ndoc.sourceforge.net/" />
<MenuItem id = "#ZipLib" label = "#ZipLib" icon = "Icons.16x16.WebSearchIcon" link = "http://www.sharpdevelop.net/OpenSource/SharpZipLib/Default.aspx" />
<MenuItem id = "#ZipLib" label = "#ZipLib" icon = "Icons.16x16.WebSearchIcon" link = "http://www.sharpdevelop.net/OpenSource/SharpZipLib/" />
</MenuItem>
<MenuItem id = "NETPlatforms" label = ".NET Platforms" type="Menu">
<MenuItem id = "MSNET" label = "MS .NET" icon = "Icons.16x16.WebSearchIcon" link = "http://msdn.microsoft.com/net" />
<MenuItem id = "Mono" label = "Mono Project" icon = "Icons.16x16.WebSearchIcon" link = "http://www.go-mono.com" />
<MenuItem id = "Mono" label = "Mono Project" icon = "Icons.16x16.WebSearchIcon" link = "http://www.mono-project.com/" />
<MenuItem id = "DotGNU" label = "DotGNU" icon = "Icons.16x16.WebSearchIcon" link = "http://www.dotgnu.org" />
</MenuItem>
</MenuItem>
@ -1445,14 +1450,6 @@ @@ -1445,14 +1450,6 @@
<Class id ="XmlFormatter" class = "ICSharpCode.SharpDevelop.DefaultEditor.XmlFormattingStrategy"/>
</Path>
<Path name = "/SharpDevelop/Pads/ProjectBrowser/ContextMenu/ProjectNode">
<MenuItem id = "ExportToHtml"
insertafter = "AddSeparator"
insertbefore = "Separator2"
label = "${res:ProjectComponent.ContextMenu.HtmlExport}"
class = "ICSharpCode.SharpDevelop.DefaultEditor.Commands.ExportProjectToHtml"/>
</Path>
<Path name = "/SharpDevelop/Workbench/DisplayBindings">
<DisplayBinding id = "Text"
insertafter = "Browser"

51
src/AddIns/Misc/NAntAddIn/Project/NAnt.addin

@ -22,11 +22,11 @@ @@ -22,11 +22,11 @@
</Path>
<!-- Menu options -->
<Path name = "/SharpDevelop/Workbench/MainMenu/Project">
<Path name = "/SharpDevelop/Pads/ProjectBrowser/ContextMenu/ProjectActions">
<MenuItem id = "NAnt"
label = "&amp;NAnt"
insertbefore = "Separator2"
type="Menu">
icon="NAntAddIn.Icons.16x16.NAntPad"
type="Menu">
<ComplexCondition action="Disable">
<And>
<Condition name="SolutionOpen"/>
@ -63,50 +63,7 @@ @@ -63,50 +63,7 @@
</ComplexCondition>
</MenuItem>
</Path>
<!-- Context menu options -->
<Path name = "/SharpDevelop/Pads/ProjectBrowser/ContextMenu/ProjectNode">
<MenuItem id = "NAnt"
label = "&amp;NAnt"
insertafter = "Properties"
type="Menu">
<ComplexCondition action="Disable">
<And>
<Condition name="SolutionOpen"/>
<Not>
<Condition name="IsNAntRunning"/>
</Not>
</And>
<MenuItem id = "RunNAnt"
icon = "NAntAddIn.Icons.16x16.RunNAnt"
label = "${res:ICSharpCode.NAntAddIn.RunDefaultTargetMenuLabel}"
description = "Runs a NAnt on the build file contained in a SharpDevelop project."
class = "ICSharpCode.NAntAddIn.Commands.RunNAntCommand"
/>
<MenuItem id = "RunNAntCleanTarget"
icon = "NAntAddIn.Icons.16x16.RunNAntClean"
insertafter = "RunNAnt"
label = "${res:ICSharpCode.NAntAddIn.RunCleanTargetMenuLabel}"
description = "Runs the clean target on the build file."
class = "ICSharpCode.NAntAddIn.Commands.RunNAntCleanTargetCommand"
/>
</ComplexCondition>
<ComplexCondition action="Disable">
<And>
<Condition name="SolutionOpen"/>
<Condition name="IsNAntRunning"/>
</And>
<MenuItem id = "StopNAnt"
icon = "NAntAddIn.Icons.16x16.StopNAnt"
insertafter = "RunNAntCleanTarget"
label = "${res:ICSharpCode.NAntAddIn.StopNAntMenuLabel}"
description = "Stops the currently running build."
class = "ICSharpCode.NAntAddIn.Commands.StopNAntCommand"
/>
</ComplexCondition>
</MenuItem>
</Path>
<!-- Project browser icons -->
<Path name = "/Workspace/Icons">
<Icon id = "NAntBuildFileIcon"

139
src/Main/Base/Project/Src/Commands/ProjectMenuCommands.cs

@ -41,102 +41,45 @@ namespace ICSharpCode.SharpDevelop.Project.Commands @@ -41,102 +41,45 @@ namespace ICSharpCode.SharpDevelop.Project.Commands
}
}
// public class GenerateProjectDocumentation : AbstractMenuCommand
// {
// public override void Run()
// {
// try {
//
//
// if (ProjectService.CurrentProject != null) {
// LanguageBindingService languageBindingService = (LanguageBindingService)ICSharpCode.Core.ServiceManager.Services.GetService(typeof(LanguageBindingService));
// ILanguageBinding csc = languageBindingService.GetBindingPerLanguageName(ProjectService.CurrentProject.ProjectType);
//
// string assembly = csc.GetCompiledOutputName(ProjectService.CurrentProject);
// string projectFile = Path.ChangeExtension(assembly, ".ndoc");
// if (!File.Exists(projectFile)) {
// StreamWriter sw = File.CreateText(projectFile);
// sw.WriteLine("<project>");
// sw.WriteLine(" <assemblies>");
// sw.WriteLine(" <assembly location=\""+ assembly +"\" documentation=\"" + Path.ChangeExtension(assembly, ".xml") + "\" />");
// sw.WriteLine(" </assemblies>");
// /*
// sw.WriteLine(" <documenters>");
// sw.WriteLine(" <documenter name=\"JavaDoc\">");
// sw.WriteLine(" <property name=\"Title\" value=\"NDoc\" />");
// sw.WriteLine(" <property name=\"OutputDirectory\" value=\".\\docs\\JavaDoc\" />");
// sw.WriteLine(" <property name=\"ShowMissingSummaries\" value=\"False\" />");
// sw.WriteLine(" <property name=\"ShowMissingRemarks\" value=\"False\" />");
// sw.WriteLine(" <property name=\"ShowMissingParams\" value=\"False\" />");
// sw.WriteLine(" <property name=\"ShowMissingReturns\" value=\"False\" />");
// sw.WriteLine(" <property name=\"ShowMissingValues\" value=\"False\" />");
// sw.WriteLine(" <property name=\"DocumentInternals\" value=\"False\" />");
// sw.WriteLine(" <property name=\"DocumentProtected\" value=\"True\" />");
// sw.WriteLine(" <property name=\"DocumentPrivates\" value=\"False\" />");
// sw.WriteLine(" <property name=\"DocumentEmptyNamespaces\" value=\"False\" />");
// sw.WriteLine(" <property name=\"IncludeAssemblyVersion\" value=\"False\" />");
// sw.WriteLine(" <property name=\"CopyrightText\" value=\"\" />");
// sw.WriteLine(" <property name=\"CopyrightHref\" value=\"\" />");
// sw.WriteLine(" </documenter>");
// sw.WriteLine(" <documenter name=\"MSDN\">");
// sw.WriteLine(" <property name=\"OutputDirectory\" value=\".\\docs\\MSDN\" />");
// sw.WriteLine(" <property name=\"HtmlHelpName\" value=\"NDoc\" />");
// sw.WriteLine(" <property name=\"HtmlHelpCompilerFilename\" value=\"C:\\Program Files\\HTML Help Workshop\\hhc.exe\" />");
// sw.WriteLine(" <property name=\"IncludeFavorites\" value=\"False\" />");
// sw.WriteLine(" <property name=\"Title\" value=\"An NDoc Documented Class Library\" />");
// sw.WriteLine(" <property name=\"SplitTOCs\" value=\"False\" />");
// sw.WriteLine(" <property name=\"DefaulTOC\" value=\"\" />");
// sw.WriteLine(" <property name=\"ShowVisualBasic\" value=\"True\" />");
// sw.WriteLine(" <property name=\"ShowMissingSummaries\" value=\"False\" />");
// sw.WriteLine(" <property name=\"ShowMissingRemarks\" value=\"False\" />");
// sw.WriteLine(" <property name=\"ShowMissingParams\" value=\"False\" />");
// sw.WriteLine(" <property name=\"ShowMissingValues\" value=\"False\" />");
// sw.WriteLine(" <property name=\"DocumentInternals\" value=\"False\" />");
// sw.WriteLine(" <property name=\"DocumentProtected\" value=\"True\" />");
// sw.WriteLine(" <property name=\"DocumentPrivates\" value=\"False\" />");
// sw.WriteLine(" <property name=\"DocumentEmptyNamespaces\" value=\"False\" />");
// sw.WriteLine(" <property name=\"IncludeAssemblyVersion\" value=\"False\" />");
// sw.WriteLine(" <property name=\"CopyrightText\" value=\"\" />");
// sw.WriteLine(" <property name=\"CopyrightHref\" value=\"\" />");
// sw.WriteLine(" </documenter>");
// sw.WriteLine(" <documenter name=\"XML\">");
// sw.WriteLine(" <property name=\"OutputFile\" value=\".\\docs\\doc.xml\" />");
// sw.WriteLine(" <property name=\"ShowMissingSummaries\" value=\"False\" />");
// sw.WriteLine(" <property name=\"ShowMissingRemarks\" value=\"False\" />");
// sw.WriteLine(" <property name=\"ShowMissingParams\" value=\"False\" />");
// sw.WriteLine(" <property name=\"ShowMissingReturns\" value=\"False\" />");
// sw.WriteLine(" <property name=\"ShowMissingValues\" value=\"False\" />");
// sw.WriteLine(" <property name=\"DocumentInternals\" value=\"False\" />");
// sw.WriteLine(" <property name=\"DocumentProtected\" value=\"True\" />");
// sw.WriteLine(" <property name=\"DocumentPrivates\" value=\"False\" />");
// sw.WriteLine(" <property name=\"DocumentEmptyNamespaces\" value=\"False\" />");
// sw.WriteLine(" <property name=\"IncludeAssemblyVersion\" value=\"False\" />");
// sw.WriteLine(" <property name=\"CopyrightText\" value=\"\" />");
// sw.WriteLine(" <property name=\"CopyrightHref\" value=\"\" />");
// sw.WriteLine(" </documenter>");
// sw.WriteLine(" </documenters>");*/
// sw.WriteLine(" </project>");
// sw.Close();
// }
//
// string command = FileUtility.SharpDevelopRootPath +
// Path.DirectorySeparatorChar + "bin" +
// Path.DirectorySeparatorChar + "ndoc" +
// Path.DirectorySeparatorChar + "NDocGui.exe";
// string args = '"' + projectFile + '"';
//
// ProcessStartInfo psi = new ProcessStartInfo(command, args);
// psi.WorkingDirectory = FileUtility.SharpDevelopRootPath +
// Path.DirectorySeparatorChar + "bin" +
// Path.DirectorySeparatorChar + "ndoc";
// psi.UseShellExecute = false;
// Process p = new Process();
// p.StartInfo = psi;
// p.Start();
// }
// } catch (Exception) {
// MessageBox.Show("You need to compile the project first.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand, MessageBoxDefaultButton.Button1);
// }
// }
// }
public class GenerateProjectDocumentation : AbstractMenuCommand
{
public override void Run()
{
IProject project = ProjectService.CurrentProject;
if (project == null) {
return;
}
string assembly = project.OutputAssemblyFullPath;
if (!File.Exists(assembly)) {
MessageService.ShowMessage("You need to compile the project.");
return;
}
string xmlDocFile = project.DocumentationFileName;
if (xmlDocFile == null) {
MessageService.ShowMessage("You need to edit the project build options to generate a xml documentation file.");
return;
}
if (!File.Exists(xmlDocFile)) {
MessageService.ShowMessage("The xml documentation file does not exist, you need to compile the project.");
return;
}
string nDocProjectFile = Path.ChangeExtension(assembly, ".ndoc");
if (!File.Exists(nDocProjectFile)) {
using (StreamWriter sw = File.CreateText(nDocProjectFile)) {
sw.WriteLine("<project>");
sw.WriteLine(" <assemblies>");
sw.WriteLine(" <assembly location=\""+ assembly +"\" documentation=\"" + xmlDocFile + "\" />");
sw.WriteLine(" </assemblies>");
sw.WriteLine("</project>");
}
}
string nDocDir = Path.Combine(FileUtility.ApplicationRootPath, "bin/Tools/NDoc");
ProcessStartInfo psi = new ProcessStartInfo(Path.Combine(nDocDir, "NDocGui.exe"), '"' + nDocProjectFile + '"');
psi.WorkingDirectory = nDocDir;
psi.UseShellExecute = false;
Process.Start(psi);
}
}
}

10
src/Main/Base/Project/Src/Project/AbstractProject.cs

@ -243,6 +243,16 @@ namespace ICSharpCode.SharpDevelop.Project @@ -243,6 +243,16 @@ namespace ICSharpCode.SharpDevelop.Project
}
}
[Browsable(false)]
public string DocumentationFileName {
get {
string file = GetProperty("DocumentationFile");
if (file == null || file.Length == 0)
return null;
return Path.Combine(Directory, file);
}
}
[Browsable(false)]
public string OutputAssemblyFullPath {
get {

4
src/Main/Base/Project/Src/Project/IProject.cs

@ -68,6 +68,10 @@ namespace ICSharpCode.SharpDevelop.Project @@ -68,6 +68,10 @@ namespace ICSharpCode.SharpDevelop.Project
get;
}
string DocumentationFileName {
get;
}
string OutputAssemblyFullPath {
get;
}

3
src/Main/Base/Project/Src/TextEditor/Commands/ProjectCommands.cs

@ -21,9 +21,8 @@ using ICSharpCode.Core; @@ -21,9 +21,8 @@ using ICSharpCode.Core;
using ICSharpCode.TextEditor.Document;
using ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.SharpDevelop.Project;
namespace ICSharpCode.SharpDevelop.DefaultEditor.Commands
namespace ICSharpCode.SharpDevelop.Project.Commands
{
public class ExportProjectToHtml : AbstractMenuCommand
{

28
src/Main/Core/Project/Src/AddInTree/AddIn/ExtensionPath.cs

@ -17,10 +17,9 @@ namespace ICSharpCode.Core @@ -17,10 +17,9 @@ namespace ICSharpCode.Core
/// </summary>
public class ExtensionPath
{
string name;
AddIn addIn;
List<Codon> codons = new List<Codon>();
Stack<ICondition> conditionStack = new Stack<ICondition>();
string name;
AddIn addIn;
List<Codon> codons = new List<Codon>();
public AddIn AddIn {
get {
@ -47,11 +46,12 @@ namespace ICSharpCode.Core @@ -47,11 +46,12 @@ namespace ICSharpCode.Core
public static void SetUp(ExtensionPath extensionPath, XmlTextReader reader, string endElement)
{
Stack<ICondition> conditionStack = new Stack<ICondition>();
while (reader.Read()) {
switch (reader.NodeType) {
case XmlNodeType.EndElement:
if (reader.LocalName == "Condition" || reader.LocalName == "ComplexCondition") {
extensionPath.conditionStack.Pop();
conditionStack.Pop();
} else if (reader.LocalName == endElement) {
return;
}
@ -60,21 +60,21 @@ namespace ICSharpCode.Core @@ -60,21 +60,21 @@ namespace ICSharpCode.Core
string elementName = reader.LocalName;
if (elementName == "Condition") {
ICondition newCondition = Condition.Read(reader);
extensionPath.conditionStack.Push(newCondition);
conditionStack.Push(newCondition);
} else if (elementName == "ComplexCondition") {
extensionPath.conditionStack.Push(Condition.ReadComplexCondition(reader));
conditionStack.Push(Condition.ReadComplexCondition(reader));
} else {
Codon newCodon = new Codon(extensionPath.AddIn, elementName, Properties.ReadFromAttributes(reader), extensionPath.conditionStack.ToArray());
Codon newCodon = new Codon(extensionPath.AddIn, elementName, Properties.ReadFromAttributes(reader), conditionStack.ToArray());
extensionPath.codons.Add(newCodon);
if (!reader.IsEmptyElement) {
ExtensionPath subPath = extensionPath.AddIn.GetExtensionPath(extensionPath.Name + "/" + newCodon.Id);
foreach (ICondition condition in extensionPath.conditionStack) {
subPath.conditionStack.Push(condition);
}
//foreach (ICondition condition in extensionPath.conditionStack) {
// subPath.conditionStack.Push(condition);
//}
SetUp(subPath, reader, elementName);
foreach (ICondition condition in extensionPath.conditionStack) {
subPath.conditionStack.Pop();
}
//foreach (ICondition condition in extensionPath.conditionStack) {
// subPath.conditionStack.Pop();
//}
}
}
break;

38
src/Main/Core/Test/AddInTreeTests/AddInTreeLoadingTests.cs

@ -40,7 +40,7 @@ namespace ICSharpCode.Core.Tests.AddInTreeTests.Tests @@ -40,7 +40,7 @@ namespace ICSharpCode.Core.Tests.AddInTreeTests.Tests
Assert.AreEqual(addIn.Properties["description"], "SharpDevelop core module");
Assert.AreEqual(addIn.Properties["version"], "1.0.0");
}
#endregion
#endregion
#region Runtime section tests
[Test]
@ -48,7 +48,7 @@ namespace ICSharpCode.Core.Tests.AddInTreeTests.Tests @@ -48,7 +48,7 @@ namespace ICSharpCode.Core.Tests.AddInTreeTests.Tests
{
string addInText = @"<AddIn><Runtime/></AddIn>";
AddIn addIn = AddIn.Load(new StringReader(addInText));
}
}
[Test]
public void TestEmtpyRuntimeSection2()
@ -164,13 +164,41 @@ namespace ICSharpCode.Core.Tests.AddInTreeTests.Tests @@ -164,13 +164,41 @@ namespace ICSharpCode.Core.Tests.AddInTreeTests.Tests
Assert.AreEqual("Sub2", addIn.Paths["/Path1/Path2"].Codons[0].Id);
}
[Test]
public void TestSubCodonsWithCondition()
{
string addInText = @"
<AddIn>
<Path name = '/Path1'>
<Condition name='Equal' string='a' equal='b'>
<Sub id='Path2'>
<Codon2 id='Sub2'/>
</Sub>
</Condition>
</Path>
</AddIn>";
AddIn addIn = AddIn.Load(new StringReader(addInText));
Assert.AreEqual(2, addIn.Paths.Count);
Assert.IsNotNull(addIn.Paths["/Path1"]);
Assert.AreEqual(1, addIn.Paths["/Path1"].Codons.Count);
Assert.AreEqual("Sub", addIn.Paths["/Path1"].Codons[0].Name);
Assert.AreEqual("Path2", addIn.Paths["/Path1"].Codons[0].Id);
Assert.AreEqual(1, addIn.Paths["/Path1"].Codons[0].Conditions.Length);
Assert.IsNotNull(addIn.Paths["/Path1/Path2"]);
Assert.AreEqual(1, addIn.Paths["/Path1/Path2"].Codons.Count);
Assert.AreEqual("Codon2", addIn.Paths["/Path1/Path2"].Codons[0].Name);
Assert.AreEqual("Sub2", addIn.Paths["/Path1/Path2"].Codons[0].Id);
Assert.AreEqual(0, addIn.Paths["/Path1/Path2"].Codons[0].Conditions.Length);
}
[Test]
public void TestSimpleCondition()
{
string addInText = @"
<AddIn>
<Path name = '/Path1'>
<Condition name='Equal' string='a' equal='b'>
<Condition name='Equal' string='a' equal='b'>
<Simple id ='Simple' attr='a' attr2='b'/>
</Condition>
</Path>
@ -202,8 +230,8 @@ namespace ICSharpCode.Core.Tests.AddInTreeTests.Tests @@ -202,8 +230,8 @@ namespace ICSharpCode.Core.Tests.AddInTreeTests.Tests
string addInText = @"
<AddIn>
<Path name = '/Path1'>
<Condition name='Equal' string='a' equal='b'>
<Condition name='StackedCondition' string='1' equal='2'>
<Condition name='Equal' string='a' equal='b'>
<Condition name='StackedCondition' string='1' equal='2'>
<Simple id ='Simple' attr='a' attr2='b'/>
</Condition>
<Simple id ='Simple2' attr='a' attr2='b'/>

5
src/Main/Core/Test/ICSharpCode.Core.Tests.csproj

@ -40,13 +40,12 @@ @@ -40,13 +40,12 @@
</ItemGroup>
<ItemGroup>
<Compile Include="AssemblyInfo.cs" />
<Compile Include="AddInTreeTests\AddInTreeLoadingTests.cs" />
<Compile Include="AddInTreeTests\ExtPathTests.cs" />
<Compile Include="TopologicalSortTest.cs" />
<Compile Include="StringParserTests.cs" />
<Compile Include="AddInTreeTests\AddInTreeLoadingTests.cs" />
<Compile Include="AddInTreeTests\ExtPathTests.cs" />
</ItemGroup>
<ItemGroup>
<Folder Include="AddInTreeTests\" />
<ProjectReference Include="..\Project\ICSharpCode.Core.csproj">
<Project>{35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}</Project>
<Name>ICSharpCode.Core</Name>

BIN
src/Main/StartUp/Project/Resources/StringResources.resources

Binary file not shown.

2
src/SharpDevelop.Tests.sln

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
Microsoft Visual Studio Solution File, Format Version 9.00
# SharpDevelop 2.0.0.838
# SharpDevelop 2.0.0.866
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "AddIns", "AddIns", "{14A277EE-7DF1-4529-B639-7D1EF334C1C5}"
ProjectSection(SolutionItems) = postProject
EndProjectSection

2
src/Tools/Tools.build

@ -13,8 +13,8 @@ @@ -13,8 +13,8 @@
</ItemGroup>
<Target Name="Build">
<!--
<Copy SourceFiles="@(NDocFiles)" DestinationFolder="..\..\bin\Tools\NDoc"/>
<!--
<Copy SourceFiles="@(WixFiles)" DestinationFolder="..\..\bin\Tools\Wix"/>
<Copy SourceFiles="@(WixCaFiles)" DestinationFolder="..\..\bin\Tools\Wix\ca"/>
<Copy SourceFiles="@(WixDocFiles)" DestinationFolder="..\..\bin\Tools\Wix\doc"/>

Loading…
Cancel
Save