Browse Source

Merge branch 'master' of github.com:icsharpcode/SharpDevelop

pull/23/head
PeterForstmeier 15 years ago
parent
commit
380f1ae28d
  1. 2
      .gitignore
  2. 3
      src/AddIns/Analysis/CodeQuality/TreeMaps/TreeMaps.csproj
  3. 27
      src/AddIns/BackendBindings/Boo/BooBinding/Project/Src/BooProject.cs
  4. 2
      src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Templates/WPFApplication.xpt
  5. 18
      src/AddIns/BackendBindings/VBNetBinding/Project/Src/Project/VBNetProject.cs
  6. 74
      src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/CodeEditorView.cs
  7. BIN
      src/AddIns/Misc/PackageManagement/Packages/AvalonEdit.Sample/AvalonEdit.Sample.4.1.0.8000.nupkg
  8. 14
      src/AddIns/Misc/PackageManagement/Packages/AvalonEdit.Sample/AvalonEdit.Sample.nuspec
  9. 0
      src/AddIns/Misc/PackageManagement/Packages/AvalonEdit.Sample/Content/Samples/AvalonEdit/BraceFoldingStrategy.cs.pp
  10. 0
      src/AddIns/Misc/PackageManagement/Packages/AvalonEdit.Sample/Content/Samples/AvalonEdit/ColorizeAvalonEdit.cs.pp
  11. 0
      src/AddIns/Misc/PackageManagement/Packages/AvalonEdit.Sample/Content/Samples/AvalonEdit/CustomHighlighting.xshd
  12. 0
      src/AddIns/Misc/PackageManagement/Packages/AvalonEdit.Sample/Content/Samples/AvalonEdit/ImageElementGenerator.cs.pp
  13. 0
      src/AddIns/Misc/PackageManagement/Packages/AvalonEdit.Sample/Content/Samples/AvalonEdit/MyCompletionData.cs.pp
  14. 0
      src/AddIns/Misc/PackageManagement/Packages/AvalonEdit.Sample/Content/Samples/AvalonEdit/Window1.xaml.cs.pp
  15. 3
      src/AddIns/Misc/PackageManagement/Packages/AvalonEdit.Sample/Content/Samples/AvalonEdit/Window1.xaml.pp
  16. 0
      src/AddIns/Misc/PackageManagement/Packages/AvalonEdit.Sample/Content/Samples/AvalonEdit/article.html
  17. 0
      src/AddIns/Misc/PackageManagement/Packages/AvalonEdit.Sample/Content/Samples/AvalonEdit/document.html
  18. 0
      src/AddIns/Misc/PackageManagement/Packages/AvalonEdit.Sample/Content/Samples/AvalonEdit/rendering.html
  19. BIN
      src/AddIns/Misc/PackageManagement/Packages/AvalonEdit/AvalonEdit.4.0.0.7070.nupkg
  20. BIN
      src/AddIns/Misc/PackageManagement/Packages/AvalonEdit/AvalonEdit.4.1.0.8000.nupkg
  21. BIN
      src/AddIns/Misc/PackageManagement/Packages/AvalonEdit/AvalonEdit.4.1.0.8000.symbols.nupkg
  22. 35
      src/AddIns/Misc/PackageManagement/Packages/AvalonEdit/AvalonEdit.nuspec
  23. BIN
      src/AddIns/Misc/PackageManagement/Packages/AvalonEdit/lib/Net35/ICSharpCode.AvalonEdit.dll
  24. BIN
      src/AddIns/Misc/PackageManagement/Packages/AvalonEdit/lib/Net40/ICSharpCode.AvalonEdit.dll
  25. BIN
      src/AddIns/Misc/PackageManagement/Packages/NuGet.exe
  26. 25
      src/AddIns/Misc/PackageManagement/Packages/buildpackages.cmd
  27. 2
      src/AddIns/Misc/TextTemplating/Project/Resources/TextTemplating.xshd
  28. 12
      src/AddIns/Misc/TextTemplating/Project/Src/ITextTemplatingEnvironment.cs
  29. 12
      src/AddIns/Misc/TextTemplating/Project/Src/ITextTemplatingPathResolver.cs
  30. 12
      src/AddIns/Misc/TextTemplating/Project/Src/ITextTemplatingStringParser.cs
  31. 13
      src/AddIns/Misc/TextTemplating/Project/Src/ITextTemplatingVariables.cs
  32. 21
      src/AddIns/Misc/TextTemplating/Project/Src/TextTemplatingAssemblyResolver.cs
  33. 6
      src/AddIns/Misc/TextTemplating/Project/Src/TextTemplatingCustomTool.cs
  34. 27
      src/AddIns/Misc/TextTemplating/Project/Src/TextTemplatingDirectoryVariable.cs
  35. 15
      src/AddIns/Misc/TextTemplating/Project/Src/TextTemplatingEnvironment.cs
  36. 33
      src/AddIns/Misc/TextTemplating/Project/Src/TextTemplatingHost.cs
  37. 57
      src/AddIns/Misc/TextTemplating/Project/Src/TextTemplatingHostContext.cs
  38. 32
      src/AddIns/Misc/TextTemplating/Project/Src/TextTemplatingPathResolver.cs
  39. 15
      src/AddIns/Misc/TextTemplating/Project/Src/TextTemplatingServiceProvider.cs
  40. 16
      src/AddIns/Misc/TextTemplating/Project/Src/TextTemplatingStringParser.cs
  41. 75
      src/AddIns/Misc/TextTemplating/Project/Src/TextTemplatingVariableLocation.cs
  42. 92
      src/AddIns/Misc/TextTemplating/Project/Src/TextTemplatingVariables.cs
  43. 73
      src/AddIns/Misc/TextTemplating/Project/Src/TextTemplatingVariablesStringBuilder.cs
  44. 13
      src/AddIns/Misc/TextTemplating/Project/TextTemplating.csproj
  45. 2
      src/AddIns/Misc/TextTemplating/Test/Helpers/FakeAssemblyParserService.cs
  46. 25
      src/AddIns/Misc/TextTemplating/Test/Helpers/FakeServiceProvider.cs
  47. 29
      src/AddIns/Misc/TextTemplating/Test/Helpers/FakeTextTemplatingEnvironment.cs
  48. 28
      src/AddIns/Misc/TextTemplating/Test/Helpers/FakeTextTemplatingPathResolver.cs
  49. 26
      src/AddIns/Misc/TextTemplating/Test/Helpers/FakeTextTemplatingStringParser.cs
  50. 35
      src/AddIns/Misc/TextTemplating/Test/Helpers/FakeTextTemplatingVariables.cs
  51. 23
      src/AddIns/Misc/TextTemplating/Test/Helpers/TestableTextTemplatingHost.cs
  52. 30
      src/AddIns/Misc/TextTemplating/Test/Src/TextTemplatingAssemblyResolverTests.cs
  53. 62
      src/AddIns/Misc/TextTemplating/Test/Src/TextTemplatingHostTests.cs
  54. 57
      src/AddIns/Misc/TextTemplating/Test/Src/TextTemplatingPathResolverTests.cs
  55. 30
      src/AddIns/Misc/TextTemplating/Test/Src/TextTemplatingServiceProviderTests.cs
  56. 78
      src/AddIns/Misc/TextTemplating/Test/Src/TextTemplatingVariableLocationTests.cs
  57. 241
      src/AddIns/Misc/TextTemplating/Test/Src/TextTemplatingVariablesTests.cs
  58. 9
      src/AddIns/Misc/TextTemplating/Test/TextTemplating.Tests.csproj
  59. 1
      src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Folding/FoldingSection.cs
  60. 21
      src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Rendering/TextView.cs
  61. 11
      src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/WebProjectOptions/WebProjectOptionsPanel.xaml.cs
  62. 6
      src/Main/Base/Project/Src/Gui/Dialogs/ReferenceDialog/GacReferencePanel.cs
  63. 23
      src/Main/Base/Project/Src/Project/AbstractProject.cs
  64. 18
      src/Main/Base/Project/Src/Project/MSBuildBasedProject.cs
  65. 83
      src/Main/Base/Project/Src/Project/MSBuildInternals.cs
  66. 33
      src/Main/Base/Project/Src/Services/ParserService/ParseProjectContent.cs
  67. 37
      src/Main/Base/Project/Src/Services/WebProjectService/WebProjectService.cs

2
.gitignore vendored

@ -18,3 +18,5 @@ bin/ @@ -18,3 +18,5 @@ bin/
/src/Main/StartUp/Project/SharpDevelop.exe.config
/src/Main/GlobalAssemblyInfo.cs
/src/AddIns/Misc/UsageDataCollector/UsageDataCollector.AddIn/AnalyticsMonitor.AppProperties.cs
/src/AddIns/Misc/PackageManagement/Packages/AvalonEdit/lib

3
src/AddIns/Analysis/CodeQuality/TreeMaps/TreeMaps.csproj

@ -28,18 +28,17 @@ @@ -28,18 +28,17 @@
<AllowUnsafeBlocks>False</AllowUnsafeBlocks>
<NoStdLib>False</NoStdLib>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<OutputPath>..\..\..\..\..\AddIns\Analysis\CodeQualityAnalysis\</OutputPath>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>Full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\..\..\..\AddIns\Analysis\CodeQualityAnalysis\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugSymbols>false</DebugSymbols>
<Optimize>true</Optimize>
<OutputPath>.\bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">

27
src/AddIns/BackendBindings/Boo/BooBinding/Project/Src/BooProject.cs

@ -2,8 +2,11 @@ @@ -2,8 +2,11 @@
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Threading;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Dom;
@ -80,7 +83,6 @@ namespace Grunwald.BooBinding @@ -80,7 +83,6 @@ namespace Grunwald.BooBinding
}
internal static IProjectContent BooCompilerPC;
internal static IProjectContent BooUsefulPC;
protected override ParseProjectContent CreateProjectContent()
{
@ -88,17 +90,8 @@ namespace Grunwald.BooBinding @@ -88,17 +90,8 @@ namespace Grunwald.BooBinding
ReferenceProjectItem booCompilerItem = new ReferenceProjectItem(this, typeof(Boo.Lang.Compiler.AbstractAstAttribute).Assembly.Location);
BooCompilerPC = AssemblyParserService.GetProjectContentForReference(booCompilerItem);
}
if (BooUsefulPC == null) {
ReferenceProjectItem booUsefulItem = new ReferenceProjectItem(this, typeof(Boo.Lang.Useful.Attributes.SingletonAttribute).Assembly.Location);
BooUsefulPC = AssemblyParserService.GetRegistryForReference(booUsefulItem).GetProjectContentForReference("Boo.Lang.Useful", booUsefulItem.Include);
}
ParseProjectContent pc = base.CreateProjectContent();
ReferenceProjectItem systemItem = new ReferenceProjectItem(this, "System");
pc.AddReferencedContent(AssemblyParserService.GetProjectContentForReference(systemItem));
ReferenceProjectItem booLangItem = new ReferenceProjectItem(this, typeof(Boo.Lang.Builtins).Assembly.Location);
pc.AddReferencedContent(AssemblyParserService.GetProjectContentForReference(booLangItem));
ReferenceProjectItem booExtensionsItem = new ReferenceProjectItem(this, typeof(Boo.Lang.Extensions.PropertyAttribute).Assembly.Location);
pc.AddReferencedContent(AssemblyParserService.GetProjectContentForReference(booExtensionsItem));
pc.DefaultImports = new DefaultUsing(pc);
pc.DefaultImports.Usings.Add("Boo.Lang");
pc.DefaultImports.Usings.Add("Boo.Lang.Builtins");
@ -106,6 +99,18 @@ namespace Grunwald.BooBinding @@ -106,6 +99,18 @@ namespace Grunwald.BooBinding
return pc;
}
public override IEnumerable<ReferenceProjectItem> ResolveAssemblyReferences(CancellationToken cancellationToken)
{
ReferenceProjectItem[] additionalReferences = {
new ReferenceProjectItem(this, "System")
};
ReferenceProjectItem[] booReferences = {
new ReferenceProjectItem(this, "Boo.Lang") { FileName = typeof(Boo.Lang.Builtins).Assembly.Location },
new ReferenceProjectItem(this, "Boo.Extensions") { FileName = typeof(Boo.Lang.Extensions.PropertyAttribute).Assembly.Location }
};
return MSBuildInternals.ResolveAssemblyReferences(this, additionalReferences).Concat(booReferences);
}
public override IAmbience GetAmbience()
{
return new BooAmbience();

2
src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Templates/WPFApplication.xpt

@ -28,7 +28,7 @@ @@ -28,7 +28,7 @@
<PropertyGroup configuration="Release" escapeValue="false">
<OutputType>WinExe</OutputType>
<MainFile>Application.rb</MainFile>
<StartArguments>--disable-gems Application.py</StartArguments>
<StartArguments>--disable-gems Application.rb</StartArguments>
<StartWorkingDirectory>.\</StartWorkingDirectory>
<StartAction>Program</StartAction>
<StartProgram>${addinpath:ICSharpCode.RubyBinding}\ir.exe</StartProgram>

18
src/AddIns/BackendBindings/VBNetBinding/Project/Src/Project/VBNetProject.cs

@ -2,9 +2,10 @@ @@ -2,9 +2,10 @@
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.ComponentModel;
using System.Linq;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Dom;
@ -67,14 +68,19 @@ namespace ICSharpCode.VBNetBinding @@ -67,14 +68,19 @@ namespace ICSharpCode.VBNetBinding
protected override ParseProjectContent CreateProjectContent()
{
ParseProjectContent pc = base.CreateProjectContent();
ReferenceProjectItem vbRef = new ReferenceProjectItem(this, "Microsoft.VisualBasic");
if (vbRef != null) {
pc.AddReferencedContent(AssemblyParserService.GetProjectContentForReference(vbRef));
}
MyNamespaceBuilder.BuildNamespace(this, pc);
return pc;
}
public override IEnumerable<ReferenceProjectItem> ResolveAssemblyReferences(CancellationToken cancellationToken)
{
ReferenceProjectItem[] additionalItems = {
new ReferenceProjectItem(this, "mscorlib"),
new ReferenceProjectItem(this, "Microsoft.VisualBasic"),
};
return MSBuildInternals.ResolveAssemblyReferences(this, additionalItems);
}
void InitVB()
{
reparseReferencesSensitiveProperties.Add("TargetFrameworkVersion");

74
src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/CodeEditorView.cs

@ -8,27 +8,27 @@ using System.ComponentModel.Design; @@ -8,27 +8,27 @@ using System.ComponentModel.Design;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Threading;
using ICSharpCode.AvalonEdit.AddIn.Options;
using ICSharpCode.AvalonEdit.AddIn.Snippets;
using ICSharpCode.AvalonEdit.Document;
using ICSharpCode.AvalonEdit.Editing;
using ICSharpCode.AvalonEdit.Folding;
using ICSharpCode.AvalonEdit.Highlighting;
using ICSharpCode.AvalonEdit.Rendering;
using ICSharpCode.NRefactory;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Dom;
using ICSharpCode.SharpDevelop.Editor;
using ICSharpCode.SharpDevelop.Editor.AvalonEdit;
using ICSharpCode.SharpDevelop.Editor.Commands;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.SharpDevelop.Refactoring;
using Ast = ICSharpCode.NRefactory.Ast;
namespace ICSharpCode.AvalonEdit.AddIn
{
@ -233,7 +233,7 @@ namespace ICSharpCode.AvalonEdit.AddIn @@ -233,7 +233,7 @@ namespace ICSharpCode.AvalonEdit.AddIn
{
Debug.Assert(sender == this);
ToolTipRequestEventArgs args = new ToolTipRequestEventArgs(this.Adapter);
var pos = GetPositionFromPoint(e.GetPosition(this));
var pos = this.TextArea.TextView.GetPositionFloor(e.GetPosition(this.TextArea.TextView) + this.TextArea.TextView.ScrollOffset);
args.InDocument = pos.HasValue;
if (pos.HasValue) {
args.LogicalPosition = AvalonEditDocumentAdapter.ToLocation(pos.Value);
@ -244,11 +244,11 @@ namespace ICSharpCode.AvalonEdit.AddIn @@ -244,11 +244,11 @@ namespace ICSharpCode.AvalonEdit.AddIn
FoldingManager foldings = this.Adapter.GetService(typeof(FoldingManager)) as FoldingManager;
if (foldings != null) {
var foldingsAtOffset = foldings.GetFoldingsContaining(offset);
var foldingsAtOffset = foldings.GetFoldingsAt(offset);
FoldingSection collapsedSection = foldingsAtOffset.FirstOrDefault(section => section.IsFolded);
if (collapsedSection != null) {
args.SetToolTip(collapsedSection.TooltipText);
args.SetToolTip(GetTooltipTextForCollapsedSection(collapsedSection));
}
}
@ -396,6 +396,68 @@ namespace ICSharpCode.AvalonEdit.AddIn @@ -396,6 +396,68 @@ namespace ICSharpCode.AvalonEdit.AddIn
{
popup = null;
}
#region GetTooltipTextForCollapsedSection
string GetTooltipTextForCollapsedSection(FoldingSection foldingSection)
{
// This fixes SD-1394:
// Each line is checked for leading indentation whitespaces. If
// a line has the same or more indentation than the first line,
// it is reduced. If a line is less indented than the first line
// the indentation is removed completely.
//
// See the following example:
// line 1
// line 2
// line 3
// line 4
//
// is reduced to:
// line 1
// line 2
// line 3
// line 4
const int maxLineCount = 15;
TextDocument document = this.Document;
int startOffset = foldingSection.StartOffset;
int endOffset = foldingSection.EndOffset;
DocumentLine startLine = document.GetLineByOffset(startOffset);
DocumentLine endLine = document.GetLineByOffset(endOffset);
StringBuilder builder = new StringBuilder();
DocumentLine current = startLine;
ISegment startIndent = TextUtilities.GetLeadingWhitespace(document, startLine);
int lineCount = 0;
while (current != endLine.NextLine && lineCount < maxLineCount) {
ISegment currentIndent = TextUtilities.GetLeadingWhitespace(document, current);
if (current == startLine && current == endLine)
builder.Append(document.GetText(startOffset, endOffset - startOffset));
else if (current == startLine) {
if (current.EndOffset - startOffset > 0)
builder.AppendLine(document.GetText(startOffset, current.EndOffset - startOffset).TrimStart());
} else if (current == endLine) {
if (startIndent.Length <= currentIndent.Length)
builder.Append(document.GetText(current.Offset + startIndent.Length, endOffset - current.Offset - startIndent.Length));
else
builder.Append(document.GetText(current.Offset + currentIndent.Length, endOffset - current.Offset - currentIndent.Length));
} else {
if (startIndent.Length <= currentIndent.Length)
builder.AppendLine(document.GetText(current.Offset + startIndent.Length, current.Length - startIndent.Length));
else
builder.AppendLine(document.GetText(current.Offset + currentIndent.Length, current.Length - currentIndent.Length));
}
current = current.NextLine;
lineCount++;
}
return builder.ToString();
}
#endregion
#endregion
#region Ctrl+Click Go To Definition

BIN
src/AddIns/Misc/PackageManagement/Packages/AvalonEdit.Sample/AvalonEdit.Sample.4.0.0.7070.nupkg → src/AddIns/Misc/PackageManagement/Packages/AvalonEdit.Sample/AvalonEdit.Sample.4.1.0.8000.nupkg

Binary file not shown.

14
src/AddIns/Misc/PackageManagement/Packages/AvalonEdit.Sample/AvalonEdit.Sample.nuspec

@ -2,18 +2,26 @@ @@ -2,18 +2,26 @@
<package xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<metadata xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<id>AvalonEdit.Sample</id>
<version>4.0.0.7070</version>
<version>4.1.0.8000</version>
<authors>Daniel Grunwald</authors>
<owners>SharpDevelop</owners>
<licenseUrl>http://www.opensource.org/licenses/mit-license.php</licenseUrl>
<projectUrl>http://www.avalonedit.net</projectUrl>
<iconUrl>http://community.sharpdevelop.net/blogs/mattward/SharpDevelop.png</iconUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>Sample code for AvalonEdit the WPF-based text editor used in SharpDevelop 4.0.</description>
<description>Sample code for AvalonEdit the WPF-based text editor used in SharpDevelop 4.0.
Modify your App.xaml file so the StartupUri points to the AvalonEdit Sample window:
StartupUri="/Samples/AvalonEdit/Window1.xaml"</description>
<summary>Sample code for AvalonEdit the WPF-based text editor used in SharpDevelop 4.0.</summary>
<language>en-US</language>
<dependencies>
<dependency id="AvalonEdit" version="4.0.0.7070" />
<dependency id="AvalonEdit" version="4.1.0.8000" />
</dependencies>
<frameworkAssemblies>
<frameworkAssembly assemblyName="System.Windows.Forms" />
<frameworkAssembly assemblyName="WindowsFormsIntegration" />
</frameworkAssemblies>
<tags>WPF Text Editor SharpDevelop AvalonEdit</tags>
</metadata>
</package>

0
src/AddIns/Misc/PackageManagement/Packages/AvalonEdit.Sample/Content/AvalonEdit.Sample/BraceFoldingStrategy.cs.pp → src/AddIns/Misc/PackageManagement/Packages/AvalonEdit.Sample/Content/Samples/AvalonEdit/BraceFoldingStrategy.cs.pp

0
src/AddIns/Misc/PackageManagement/Packages/AvalonEdit.Sample/Content/AvalonEdit.Sample/ColorizeAvalonEdit.cs.pp → src/AddIns/Misc/PackageManagement/Packages/AvalonEdit.Sample/Content/Samples/AvalonEdit/ColorizeAvalonEdit.cs.pp

0
src/AddIns/Misc/PackageManagement/Packages/AvalonEdit.Sample/Content/AvalonEdit.Sample/CustomHighlighting.xshd → src/AddIns/Misc/PackageManagement/Packages/AvalonEdit.Sample/Content/Samples/AvalonEdit/CustomHighlighting.xshd

0
src/AddIns/Misc/PackageManagement/Packages/AvalonEdit.Sample/Content/AvalonEdit.Sample/ImageElementGenerator.cs.pp → src/AddIns/Misc/PackageManagement/Packages/AvalonEdit.Sample/Content/Samples/AvalonEdit/ImageElementGenerator.cs.pp

0
src/AddIns/Misc/PackageManagement/Packages/AvalonEdit.Sample/Content/AvalonEdit.Sample/MyCompletionData.cs.pp → src/AddIns/Misc/PackageManagement/Packages/AvalonEdit.Sample/Content/Samples/AvalonEdit/MyCompletionData.cs.pp

0
src/AddIns/Misc/PackageManagement/Packages/AvalonEdit.Sample/Content/AvalonEdit.Sample/Window1.xaml.cs.pp → src/AddIns/Misc/PackageManagement/Packages/AvalonEdit.Sample/Content/Samples/AvalonEdit/Window1.xaml.cs.pp

3
src/AddIns/Misc/PackageManagement/Packages/AvalonEdit.Sample/Content/AvalonEdit.Sample/Window1.xaml.pp → src/AddIns/Misc/PackageManagement/Packages/AvalonEdit.Sample/Content/Samples/AvalonEdit/Window1.xaml.pp

@ -21,7 +21,8 @@ @@ -21,7 +21,8 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:avalonEdit="http://icsharpcode.net/sharpdevelop/avalonedit"
xmlns:forms="clr-namespace:System.Windows.Forms;assembly=System.Windows.Forms"
xmlns:forms="clr-namespace:System.Windows.Forms;assembly=System.Windows.Forms"
TextOptions.TextFormattingMode="Display"
Title="AvalonEdit.Sample" Height="500" Width="700"
>
<DockPanel>

0
src/AddIns/Misc/PackageManagement/Packages/AvalonEdit.Sample/Content/AvalonEdit.Sample/article.html → src/AddIns/Misc/PackageManagement/Packages/AvalonEdit.Sample/Content/Samples/AvalonEdit/article.html

0
src/AddIns/Misc/PackageManagement/Packages/AvalonEdit.Sample/Content/AvalonEdit.Sample/document.html → src/AddIns/Misc/PackageManagement/Packages/AvalonEdit.Sample/Content/Samples/AvalonEdit/document.html

0
src/AddIns/Misc/PackageManagement/Packages/AvalonEdit.Sample/Content/AvalonEdit.Sample/rendering.html → src/AddIns/Misc/PackageManagement/Packages/AvalonEdit.Sample/Content/Samples/AvalonEdit/rendering.html

BIN
src/AddIns/Misc/PackageManagement/Packages/AvalonEdit/AvalonEdit.4.0.0.7070.nupkg

Binary file not shown.

BIN
src/AddIns/Misc/PackageManagement/Packages/AvalonEdit/AvalonEdit.4.1.0.8000.nupkg

Binary file not shown.

BIN
src/AddIns/Misc/PackageManagement/Packages/AvalonEdit/AvalonEdit.4.1.0.8000.symbols.nupkg

Binary file not shown.

35
src/AddIns/Misc/PackageManagement/Packages/AvalonEdit/AvalonEdit.nuspec

@ -1,18 +1,25 @@ @@ -1,18 +1,25 @@
<?xml version="1.0"?>
<package xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<metadata xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<id>AvalonEdit</id>
<version>4.0.0.7070</version>
<authors>Daniel Grunwald</authors>
<owners>SharpDevelop</owners>
<licenseUrl>http://www.opensource.org/licenses/lgpl-2.1.php</licenseUrl>
<projectUrl>http://www.avalonedit.net</projectUrl>
<iconUrl>http://community.sharpdevelop.net/blogs/mattward/SharpDevelop.png</iconUrl>
<requireLicenseAcceptance>true</requireLicenseAcceptance>
<description>AvalonEdit is the WPF-based text editor used in SharpDevelop 4.0.
There are two builds of AvalonEdit included in this package. One that targets .NET 4.0 and
one that targets .NET 3.5.</description>
<summary>AvalonEdit is the WPF-based text editor used in SharpDevelop 4.0.</summary>
<language>en-US</language>
<metadata xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<id>AvalonEdit</id>
<version>4.1.0.8000</version>
<authors>Daniel Grunwald</authors>
<owners>SharpDevelop</owners>
<licenseUrl>http://www.opensource.org/licenses/lgpl-2.1.php</licenseUrl>
<projectUrl>http://www.avalonedit.net</projectUrl>
<iconUrl>http://community.sharpdevelop.net/blogs/mattward/SharpDevelop.png</iconUrl>
<requireLicenseAcceptance>true</requireLicenseAcceptance>
<description>AvalonEdit is the WPF-based text editor used in SharpDevelop. There are two builds of AvalonEdit included in this package. One that targets .NET 4.0 and one that targets .NET 3.5.</description>
<summary>AvalonEdit is the WPF-based text editor used in SharpDevelop</summary>
<releaseNotes>Improved WPF text rendering performance.
Region tooltips added.
C# syntax highlighting: Do not colorize punctuation.</releaseNotes>
<language>en-US</language>
<tags>WPF Text Editor SharpDevelop AvalonEdit</tags>
</metadata>
<files>
<file src="lib\Net35\*.*" target="lib\Net35" />
<file src="lib\Net40\*.*" target="lib\Net40" />
<file src="..\..\..\..\..\Libraries\AvalonEdit\ICSharpCode.AvalonEdit\**\*.cs" target="src" />
</files>
</package>

BIN
src/AddIns/Misc/PackageManagement/Packages/AvalonEdit/lib/Net35/ICSharpCode.AvalonEdit.dll

Binary file not shown.

BIN
src/AddIns/Misc/PackageManagement/Packages/AvalonEdit/lib/Net40/ICSharpCode.AvalonEdit.dll

Binary file not shown.

BIN
src/AddIns/Misc/PackageManagement/Packages/NuGet.exe

Binary file not shown.

25
src/AddIns/Misc/PackageManagement/Packages/buildpackages.cmd

@ -1,4 +1,21 @@ @@ -1,4 +1,21 @@
nuget.exe pack AvalonEdit\AvalonEdit.nuspec -b AvalonEdit -o AvalonEdit
nuget.exe pack AvalonEdit.Sample\AvalonEdit.Sample.nuspec -b AvalonEdit.Sample -o AvalonEdit.Sample
nuget.exe pack ICSharpCode.TextEditor\ICSharpCode.TextEditor.nuspec -b ICSharpCode.TextEditor -o ICSharpCode.TextEditor
nuget.exe pack ICSharpCode.TextEditor.Sample\ICSharpCode.TextEditor.Sample.nuspec -b ICSharpCode.TextEditor.Sample -o ICSharpCode.TextEditor.Sample
@ECHO OFF
SETLOCAL
SET msbuild=%windir%\microsoft.net\framework\v4.0.30319\msbuild
SET project=..\..\..\..\Libraries\AvalonEdit\ICSharpCode.AvalonEdit\ICSharpCode.AvalonEdit.csproj
SET buildoptions=/t:Rebuild /p:Configuration=Release /p:DebugType=PdbOnly
@ECHO ON
:Clean debug build
%msbuild% /m %project% /t:Clean /p:Configuration=Debug /p:OutputPath=%~dp0\AvalonEdit\lib\Net40
:BUILD .NET 4.0 version
%msbuild% /m %project% %buildoptions% /p:OutputPath=%~dp0\AvalonEdit\lib\Net40
:BUILD .NET 3.5 version
%msbuild% /m %project% %buildoptions% "/p:DefineConstants=TRACE" "/p:TargetFrameworkVersion=v3.5" /p:OutputPath=%~dp0\AvalonEdit\lib\Net35
nuget.exe pack AvalonEdit\AvalonEdit.nuspec -Symbols -BasePath AvalonEdit -OutputDirectory AvalonEdit
nuget.exe pack AvalonEdit.Sample\AvalonEdit.Sample.nuspec -BasePath AvalonEdit.Sample -OutputDirectory AvalonEdit.Sample
@ECHO OFF
ENDLOCAL

2
src/AddIns/Misc/TextTemplating/Project/Resources/TextTemplating.xshd

@ -51,7 +51,7 @@ @@ -51,7 +51,7 @@
</RuleSet>
<RuleSet name="DirectiveBlock">
<RuleSet name="DirectiveBlock" ignoreCase="true">
<Keywords color="DirectiveKeywords">
<Word>template</Word>
<Word>parameter</Word>

12
src/AddIns/Misc/TextTemplating/Project/Src/ITextTemplatingEnvironment.cs

@ -0,0 +1,12 @@ @@ -0,0 +1,12 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
namespace ICSharpCode.TextTemplating
{
public interface ITextTemplatingEnvironment
{
string ExpandEnvironmentVariables(string name);
}
}

12
src/AddIns/Misc/TextTemplating/Project/Src/ITextTemplatingPathResolver.cs

@ -0,0 +1,12 @@ @@ -0,0 +1,12 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
namespace ICSharpCode.TextTemplating
{
public interface ITextTemplatingPathResolver
{
string ResolvePath(string path);
}
}

12
src/AddIns/Misc/TextTemplating/Project/Src/ITextTemplatingStringParser.cs

@ -0,0 +1,12 @@ @@ -0,0 +1,12 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
namespace ICSharpCode.TextTemplating
{
public interface ITextTemplatingStringParser
{
string GetValue(string propertyName);
}
}

13
src/AddIns/Misc/TextTemplating/Project/Src/ITextTemplatingVariables.cs

@ -0,0 +1,13 @@ @@ -0,0 +1,13 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
namespace ICSharpCode.TextTemplating
{
public interface ITextTemplatingVariables
{
string ExpandVariables(string name);
string GetValue(string name);
}
}

21
src/AddIns/Misc/TextTemplating/Project/Src/TextTemplatingAssemblyResolver.cs

@ -2,6 +2,7 @@ @@ -2,6 +2,7 @@
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.IO;
using ICSharpCode.SharpDevelop.Project;
namespace ICSharpCode.TextTemplating
@ -10,22 +11,33 @@ namespace ICSharpCode.TextTemplating @@ -10,22 +11,33 @@ namespace ICSharpCode.TextTemplating
{
IProject project;
IAssemblyParserService assemblyParserService;
ITextTemplatingPathResolver pathResolver;
public TextTemplatingAssemblyResolver(
IProject project,
IAssemblyParserService assemblyParserService)
IAssemblyParserService assemblyParserService,
ITextTemplatingPathResolver pathResolver)
{
this.project = project;
this.assemblyParserService = assemblyParserService;
this.pathResolver = pathResolver;
}
public TextTemplatingAssemblyResolver(IProject project)
: this(project, new TextTemplatingAssemblyParserService())
: this(
project,
new TextTemplatingAssemblyParserService(),
new TextTemplatingPathResolver())
{
}
public string Resolve(string assemblyReference)
{
assemblyReference = ResolvePath(assemblyReference);
if (Path.IsPathRooted(assemblyReference)) {
return assemblyReference;
}
string resolvedAssemblyFileName = ResolveAssemblyFromProject(assemblyReference);
if (resolvedAssemblyFileName == null) {
resolvedAssemblyFileName = ResolveAssemblyFromGac(assemblyReference);
@ -36,6 +48,11 @@ namespace ICSharpCode.TextTemplating @@ -36,6 +48,11 @@ namespace ICSharpCode.TextTemplating
return assemblyReference;
}
string ResolvePath(string assemblyReference)
{
return pathResolver.ResolvePath(assemblyReference);
}
string ResolveAssemblyFromProject(string assemblyReference)
{
foreach (ReferenceProjectItem refProjectItem in project.GetItemsOfType(ItemType.Reference)) {

6
src/AddIns/Misc/TextTemplating/Project/Src/TextTemplatingCustomTool.cs

@ -16,8 +16,10 @@ namespace ICSharpCode.TextTemplating @@ -16,8 +16,10 @@ namespace ICSharpCode.TextTemplating
var appDomainFactory = new TextTemplatingAppDomainFactory();
string applicationBase = GetAssemblyBaseLocation();
var assemblyResolver = new TextTemplatingAssemblyResolver(project);
var host = new TextTemplatingHost(appDomainFactory, assemblyResolver, applicationBase);
return host;
var textTemplatingVariables = new TextTemplatingVariables();
var serviceProvider = new TextTemplatingServiceProvider();
var context = new TextTemplatingHostContext(project);
return new TextTemplatingHost(context, applicationBase);
}
string GetAssemblyBaseLocation()

27
src/AddIns/Misc/TextTemplating/Project/Src/TextTemplatingDirectoryVariable.cs

@ -0,0 +1,27 @@ @@ -0,0 +1,27 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.Linq;
namespace ICSharpCode.TextTemplating
{
public static class TextTemplatingDirectoryVariable
{
public static bool IsDirectoryVariable(string name)
{
return name.EndsWith("Dir", StringComparison.OrdinalIgnoreCase);
}
public static string AppendTrailingSlashIfMissing(string variableValue)
{
if (!String.IsNullOrEmpty(variableValue)) {
if (variableValue.Last() == '\\') {
return variableValue;
}
return variableValue + "\\";
}
return String.Empty;
}
}
}

15
src/AddIns/Misc/TextTemplating/Project/Src/TextTemplatingEnvironment.cs

@ -0,0 +1,15 @@ @@ -0,0 +1,15 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
namespace ICSharpCode.TextTemplating
{
public class TextTemplatingEnvironment : ITextTemplatingEnvironment
{
public string ExpandEnvironmentVariables(string name)
{
return Environment.ExpandEnvironmentVariables(name);
}
}
}

33
src/AddIns/Misc/TextTemplating/Project/Src/TextTemplatingHost.cs

@ -6,20 +6,15 @@ using Mono.TextTemplating; @@ -6,20 +6,15 @@ using Mono.TextTemplating;
namespace ICSharpCode.TextTemplating
{
public class TextTemplatingHost : TemplateGenerator, ITextTemplatingHost
public class TextTemplatingHost : TemplateGenerator, ITextTemplatingHost, IServiceProvider
{
ITextTemplatingAppDomainFactory appDomainFactory;
ITextTemplatingAppDomain templatingAppDomain;
ITextTemplatingAssemblyResolver assemblyResolver;
TextTemplatingHostContext context;
string applicationBase;
public TextTemplatingHost(
ITextTemplatingAppDomainFactory appDomainFactory,
ITextTemplatingAssemblyResolver assemblyResolver,
string applicationBase)
public TextTemplatingHost(TextTemplatingHostContext context, string applicationBase)
{
this.appDomainFactory = appDomainFactory;
this.assemblyResolver = assemblyResolver;
this.context = context;
this.applicationBase = applicationBase;
}
@ -41,12 +36,28 @@ namespace ICSharpCode.TextTemplating @@ -41,12 +36,28 @@ namespace ICSharpCode.TextTemplating
void CreateAppDomain()
{
templatingAppDomain = appDomainFactory.CreateTextTemplatingAppDomain(applicationBase);
templatingAppDomain = context.CreateTextTemplatingAppDomain(applicationBase);
}
protected override string ResolveAssemblyReference(string assemblyReference)
{
return assemblyResolver.Resolve(assemblyReference);
return context.ResolveAssemblyReference(assemblyReference);
}
protected override string ResolvePath(string path)
{
path = ExpandPath(path);
return base.ResolvePath(path);
}
string ExpandPath(string path)
{
return context.ExpandTemplateVariables(path);
}
object IServiceProvider.GetService(Type serviceType)
{
return context.GetService(serviceType);
}
}
}

57
src/AddIns/Misc/TextTemplating/Project/Src/TextTemplatingHostContext.cs

@ -0,0 +1,57 @@ @@ -0,0 +1,57 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using ICSharpCode.SharpDevelop.Project;
namespace ICSharpCode.TextTemplating
{
public class TextTemplatingHostContext
{
ITextTemplatingAppDomainFactory appDomainFactory;
ITextTemplatingAssemblyResolver assemblyResolver;
ITextTemplatingVariables templatingVariables;
IServiceProvider serviceProvider;
public TextTemplatingHostContext(IProject project)
: this(
new TextTemplatingAppDomainFactory(),
new TextTemplatingAssemblyResolver(project),
new TextTemplatingVariables(),
new TextTemplatingServiceProvider())
{
}
public TextTemplatingHostContext(
ITextTemplatingAppDomainFactory appDomainFactory,
ITextTemplatingAssemblyResolver assemblyResolver,
ITextTemplatingVariables templatingVariables,
IServiceProvider serviceProvider)
{
this.appDomainFactory = appDomainFactory;
this.assemblyResolver = assemblyResolver;
this.templatingVariables = templatingVariables;
this.serviceProvider = serviceProvider;
}
public object GetService(Type serviceType)
{
return serviceProvider.GetService(serviceType);
}
public string ExpandTemplateVariables(string name)
{
return templatingVariables.ExpandVariables(name);
}
public ITextTemplatingAppDomain CreateTextTemplatingAppDomain(string applicationBase)
{
return appDomainFactory.CreateTextTemplatingAppDomain(applicationBase);
}
public string ResolveAssemblyReference(string assemblyReference)
{
return assemblyResolver.Resolve(assemblyReference);
}
}
}

32
src/AddIns/Misc/TextTemplating/Project/Src/TextTemplatingPathResolver.cs

@ -0,0 +1,32 @@ @@ -0,0 +1,32 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
namespace ICSharpCode.TextTemplating
{
public class TextTemplatingPathResolver : ITextTemplatingPathResolver
{
ITextTemplatingVariables templatingVariables;
ITextTemplatingEnvironment environment;
public TextTemplatingPathResolver()
: this(new TextTemplatingVariables(), new TextTemplatingEnvironment())
{
}
public TextTemplatingPathResolver(
ITextTemplatingVariables templatingVariables,
ITextTemplatingEnvironment environment)
{
this.templatingVariables = templatingVariables;
this.environment = environment;
}
public string ResolvePath(string path)
{
path = environment.ExpandEnvironmentVariables(path);
return templatingVariables.ExpandVariables(path);
}
}
}

15
src/AddIns/Misc/TextTemplating/Project/Src/TextTemplatingServiceProvider.cs

@ -0,0 +1,15 @@ @@ -0,0 +1,15 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
namespace ICSharpCode.TextTemplating
{
public class TextTemplatingServiceProvider : IServiceProvider
{
public object GetService(Type serviceType)
{
return serviceType.Assembly.CreateInstance(serviceType.FullName);
}
}
}

16
src/AddIns/Misc/TextTemplating/Project/Src/TextTemplatingStringParser.cs

@ -0,0 +1,16 @@ @@ -0,0 +1,16 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using ICSharpCode.Core;
namespace ICSharpCode.TextTemplating
{
public class TextTemplatingStringParser : ITextTemplatingStringParser
{
public string GetValue(string propertyName)
{
return StringParser.GetValue(propertyName);
}
}
}

75
src/AddIns/Misc/TextTemplating/Project/Src/TextTemplatingVariableLocation.cs

@ -0,0 +1,75 @@ @@ -0,0 +1,75 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
namespace ICSharpCode.TextTemplating
{
public class TextTemplatingVariableLocation
{
public TextTemplatingVariableLocation()
: this(String.Empty, 0, 0)
{
}
public TextTemplatingVariableLocation(
string variableName,
int index,
int length)
{
this.VariableName = variableName;
this.Index = index;
this.Length = length;
}
public static TextTemplatingVariableLocation CreateFromString(
string text,
int unexpandedVariableStartIndex,
int unexpandedVariableEndIndex)
{
int variableNameStart = unexpandedVariableStartIndex + 2;
int unexpandedLength = unexpandedVariableEndIndex - unexpandedVariableStartIndex + 1;
string variableName = text.Substring(variableNameStart, unexpandedVariableEndIndex - variableNameStart);
return new TextTemplatingVariableLocation(variableName, unexpandedVariableStartIndex, unexpandedLength);
}
public string VariableName { get; set; }
public int Index { get; set; }
public int Length { get; set; }
public override bool Equals(object obj)
{
var rhs = obj as TextTemplatingVariableLocation;
if (rhs != null) {
return (VariableName == rhs.VariableName) &&
(Index == rhs.Index) &&
(Length == rhs.Length);
}
return false;
}
public override int GetHashCode()
{
return base.GetHashCode();
}
public override string ToString()
{
return String.Format(
"VariableName: {0}, Index: {1}, Length: {2}",
VariableName, Index, Length);
}
public static TextTemplatingVariableLocation FindVariable(string text, int startSearchIndex)
{
int start = text.IndexOf("$(", startSearchIndex);
if (start >= 0) {
int end = text.IndexOf(")", start);
if (end >= 0) {
return CreateFromString(text, start, end);
}
}
return null;
}
}
}

92
src/AddIns/Misc/TextTemplating/Project/Src/TextTemplatingVariables.cs

@ -0,0 +1,92 @@ @@ -0,0 +1,92 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ICSharpCode.TextTemplating
{
public class TextTemplatingVariables : ITextTemplatingVariables
{
ITextTemplatingStringParser stringParser;
public TextTemplatingVariables()
: this(new TextTemplatingStringParser())
{
}
public TextTemplatingVariables(
ITextTemplatingStringParser stringParser)
{
this.stringParser = stringParser;
}
public string ExpandVariables(string name)
{
var variablesBuilder = new TextTemplatingVariablesStringBuilder(name, this);
foreach (TextTemplatingVariableLocation variableLocation in GetVariables(name)) {
variablesBuilder.AppendTextBeforeVariable(variableLocation);
variablesBuilder.AppendVariable(variableLocation);
}
variablesBuilder.AppendRemaining();
return variablesBuilder.ToString();
}
public IEnumerable<TextTemplatingVariableLocation> GetVariables(string text)
{
if (String.IsNullOrEmpty(text)) {
yield break;
}
int currentIndex = 0;
while (true) {
TextTemplatingVariableLocation variableLocation =
FindVariable(text, currentIndex);
if (variableLocation != null) {
currentIndex = variableLocation.Index + variableLocation.Length;
yield return variableLocation;
} else {
yield break;
}
}
}
TextTemplatingVariableLocation FindVariable(string text, int startIndex)
{
return TextTemplatingVariableLocation.FindVariable(text, startIndex);
}
public string GetValue(string name)
{
if (name == null) {
return String.Empty;
}
string variableValue = stringParser.GetValue(name);
if (IsDirectoryVariable(name)) {
return AppendTrailingSlashIfMissing(variableValue);
}
return GetEmptyStringIfNull(variableValue);
}
bool IsDirectoryVariable(string name)
{
return TextTemplatingDirectoryVariable.IsDirectoryVariable(name);
}
string AppendTrailingSlashIfMissing(string variableValue)
{
return TextTemplatingDirectoryVariable.AppendTrailingSlashIfMissing(variableValue);
}
string GetEmptyStringIfNull(string variableValue)
{
if (variableValue != null) {
return variableValue;
}
return String.Empty;
}
}
}

73
src/AddIns/Misc/TextTemplating/Project/Src/TextTemplatingVariablesStringBuilder.cs

@ -0,0 +1,73 @@ @@ -0,0 +1,73 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.Text;
namespace ICSharpCode.TextTemplating
{
public class TextTemplatingVariablesStringBuilder
{
StringBuilder variablesBuilder = new StringBuilder();
string unexpandedVariablesString;
ITextTemplatingVariables templatingVariables;
int currentIndex;
public TextTemplatingVariablesStringBuilder(
string unexpandedVariablesString,
ITextTemplatingVariables templatingVariables)
{
this.unexpandedVariablesString = unexpandedVariablesString;
this.templatingVariables = templatingVariables;
}
public void Append(string text)
{
variablesBuilder.Append(text);
}
public override string ToString()
{
return variablesBuilder.ToString();
}
public void AppendVariable(TextTemplatingVariableLocation variableLocation)
{
AppendVariableText(variableLocation);
UpdateCurrentIndex(variableLocation);
}
public void AppendTextBeforeVariable(TextTemplatingVariableLocation variableLocation)
{
string textBeforeVariable = unexpandedVariablesString.Substring(currentIndex, variableLocation.Index);
variablesBuilder.Append(textBeforeVariable);
}
void AppendVariableText(TextTemplatingVariableLocation variableLocation)
{
string variableValue = GetVariableValue(variableLocation);
variablesBuilder.Append(variableValue);
}
void UpdateCurrentIndex(TextTemplatingVariableLocation variableLocation)
{
currentIndex = variableLocation.Index + variableLocation.Length;
}
string GetVariableValue(TextTemplatingVariableLocation variableLocation)
{
return templatingVariables.GetValue(variableLocation.VariableName);
}
public void AppendRemaining()
{
string textNotAppended = GetTextNotAppended();
variablesBuilder.Append(textNotAppended);
}
string GetTextNotAppended()
{
return unexpandedVariablesString.Substring(currentIndex);
}
}
}

13
src/AddIns/Misc/TextTemplating/Project/TextTemplating.csproj

@ -57,9 +57,13 @@ @@ -57,9 +57,13 @@
<Compile Include="Src\ITextTemplatingAppDomainFactory.cs" />
<Compile Include="Src\ITextTemplatingAssemblyResolver.cs" />
<Compile Include="Src\ITextTemplatingCustomToolContext.cs" />
<Compile Include="Src\ITextTemplatingEnvironment.cs" />
<Compile Include="Src\ITextTemplatingFilePreprocessor.cs" />
<Compile Include="Src\ITextTemplatingHost.cs" />
<Compile Include="Src\ITextTemplatingFileGenerator.cs" />
<Compile Include="Src\ITextTemplatingPathResolver.cs" />
<Compile Include="Src\ITextTemplatingStringParser.cs" />
<Compile Include="Src\ITextTemplatingVariables.cs" />
<Compile Include="Src\NamespaceHint.cs" />
<Compile Include="Src\TemplatingHostProcessTemplateError.cs" />
<Compile Include="Src\TextTemplatingAppDomain.cs" />
@ -68,6 +72,8 @@ @@ -68,6 +72,8 @@
<Compile Include="Src\TextTemplatingAssemblyResolver.cs" />
<Compile Include="Src\TextTemplatingCustomTool.cs" />
<Compile Include="Src\TextTemplatingCustomToolContext.cs" />
<Compile Include="Src\TextTemplatingDirectoryVariable.cs" />
<Compile Include="Src\TextTemplatingEnvironment.cs" />
<Compile Include="Src\TextTemplatingFileGenerator.cs" />
<Compile Include="Src\TextTemplatingFileGeneratorCustomTool.cs" />
<Compile Include="Configuration\AssemblyInfo.cs" />
@ -75,7 +81,14 @@ @@ -75,7 +81,14 @@
<Compile Include="Src\TextTemplatingFilePreprocessorCustomTool.cs" />
<Compile Include="Src\TextTemplatingFileProcessor.cs" />
<Compile Include="Src\TextTemplatingHost.cs" />
<Compile Include="Src\TextTemplatingHostContext.cs" />
<Compile Include="Src\TextTemplatingPathResolver.cs" />
<Compile Include="Src\TextTemplatingReflectionProjectContent.cs" />
<Compile Include="Src\TextTemplatingServiceProvider.cs" />
<Compile Include="Src\TextTemplatingStringParser.cs" />
<Compile Include="Src\TextTemplatingVariableLocation.cs" />
<Compile Include="Src\TextTemplatingVariables.cs" />
<Compile Include="Src\TextTemplatingVariablesStringBuilder.cs" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Resources\TextTemplating.xshd" />

2
src/AddIns/Misc/TextTemplating/Test/Helpers/FakeAssemblyParserService.cs

@ -11,9 +11,11 @@ namespace TextTemplating.Tests.Helpers @@ -11,9 +11,11 @@ namespace TextTemplating.Tests.Helpers
{
public FakeReflectionProjectContent FakeReflectionProjectContent = new FakeReflectionProjectContent();
public ReferenceProjectItem ItemPassedToGetReflectionProjectContentForReference;
public bool IsGetReflectionProjectContentForReferenceCalled;
public IReflectionProjectContent GetReflectionProjectContentForReference(ReferenceProjectItem item)
{
IsGetReflectionProjectContentForReferenceCalled = true;
ItemPassedToGetReflectionProjectContentForReference = item;
return FakeReflectionProjectContent;
}

25
src/AddIns/Misc/TextTemplating/Test/Helpers/FakeServiceProvider.cs

@ -0,0 +1,25 @@ @@ -0,0 +1,25 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.Collections.Generic;
namespace TextTemplating.Tests.Helpers
{
public class FakeServiceProvider : IServiceProvider
{
public Dictionary<Type, object> Services = new Dictionary<Type, object>();
public void AddService(Type serviceType, object service)
{
Services.Add(serviceType, service);
}
public object GetService(Type serviceType)
{
object service = null;
Services.TryGetValue(serviceType, out service);
return service;
}
}
}

29
src/AddIns/Misc/TextTemplating/Test/Helpers/FakeTextTemplatingEnvironment.cs

@ -0,0 +1,29 @@ @@ -0,0 +1,29 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.Collections.Generic;
using ICSharpCode.TextTemplating;
namespace TextTemplating.Tests.Helpers
{
public class FakeTextTemplatingEnvironment : ITextTemplatingEnvironment
{
public Dictionary<string, string> Variables = new Dictionary<string, string>();
public string ExpandEnvironmentVariables(string name)
{
string value = null;
if (Variables.TryGetValue(name, out value)) {
return value;
}
return name;
}
public void AddVariable(string name, string value)
{
name = "%" + name + "%";
Variables.Add(name, value);
}
}
}

28
src/AddIns/Misc/TextTemplating/Test/Helpers/FakeTextTemplatingPathResolver.cs

@ -0,0 +1,28 @@ @@ -0,0 +1,28 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.Collections.Generic;
using ICSharpCode.TextTemplating;
namespace TextTemplating.Tests.Helpers
{
public class FakeTextTemplatingPathResolver : ITextTemplatingPathResolver
{
public Dictionary<string, string> Paths = new Dictionary<string, string>();
public string ResolvePath(string path)
{
string resolvedPath = null;
if (Paths.TryGetValue(path, out resolvedPath)) {
return resolvedPath;
}
return path;
}
public void AddPath(string path, string resolvedPath)
{
Paths.Add(path, resolvedPath);
}
}
}

26
src/AddIns/Misc/TextTemplating/Test/Helpers/FakeTextTemplatingStringParser.cs

@ -0,0 +1,26 @@ @@ -0,0 +1,26 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.Collections.Generic;
using ICSharpCode.TextTemplating;
namespace TextTemplating.Tests.Helpers
{
public class FakeTextTemplatingStringParser : ITextTemplatingStringParser
{
public Dictionary<string, string> Properties = new Dictionary<string, string>();
public string GetValue(string propertyName)
{
string propertyValue = null;
Properties.TryGetValue(propertyName, out propertyValue);
return propertyValue;
}
public void AddProperty(string name, string value)
{
Properties.Add(name, value);
}
}
}

35
src/AddIns/Misc/TextTemplating/Test/Helpers/FakeTextTemplatingVariables.cs

@ -0,0 +1,35 @@ @@ -0,0 +1,35 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.Collections.Generic;
using ICSharpCode.TextTemplating;
namespace TextTemplating.Tests.Helpers
{
public class FakeTextTemplatingVariables : ITextTemplatingVariables
{
public Dictionary<string, string> Variables = new Dictionary<string, string>();
public void AddVariable(string name, string value)
{
name = "$(" + name + ")";
Variables.Add(name, value);
}
public string ExpandVariables(string name)
{
foreach (KeyValuePair<string, string> variable in Variables) {
name = name.Replace(variable.Key, variable.Value);
}
return name;
}
public string GetValue(string name)
{
string variableValue = null;
Variables.TryGetValue(name, out variableValue);
return variableValue;
}
}
}

23
src/AddIns/Misc/TextTemplating/Test/Helpers/TestableTextTemplatingHost.cs

@ -10,11 +10,16 @@ namespace TextTemplating.Tests.Helpers @@ -10,11 +10,16 @@ namespace TextTemplating.Tests.Helpers
{
public FakeTextTemplatingAppDomainFactory FakeTextTemplatingAppDomainFactory;
public FakeTextTemplatingAssemblyResolver FakeTextTemplatingAssemblyResolver;
public FakeTextTemplatingVariables FakeTextTemplatingVariables;
public FakeServiceProvider FakeServiceProvider;
public TextTemplatingHostContext HostContext;
public TestableTextTemplatingHost(string applicationBase)
: this(
new FakeTextTemplatingAppDomainFactory(),
new FakeTextTemplatingAssemblyResolver(),
new FakeTextTemplatingVariables(),
new FakeServiceProvider(),
applicationBase)
{
}
@ -22,16 +27,32 @@ namespace TextTemplating.Tests.Helpers @@ -22,16 +27,32 @@ namespace TextTemplating.Tests.Helpers
public TestableTextTemplatingHost(
FakeTextTemplatingAppDomainFactory appDomainFactory,
FakeTextTemplatingAssemblyResolver assemblyResolver,
FakeTextTemplatingVariables textTemplatingVariables,
FakeServiceProvider fakeServiceProvider,
string applicationBase)
: base(appDomainFactory, assemblyResolver, applicationBase)
: this(
new TextTemplatingHostContext(appDomainFactory, assemblyResolver, textTemplatingVariables, fakeServiceProvider),
applicationBase)
{
FakeTextTemplatingAppDomainFactory = appDomainFactory;
FakeTextTemplatingAssemblyResolver = assemblyResolver;
FakeTextTemplatingVariables = textTemplatingVariables;
FakeServiceProvider = fakeServiceProvider;
}
public TestableTextTemplatingHost(TextTemplatingHostContext context, string applicationBase)
: base(context, applicationBase)
{
}
public string CallResolveAssemblyReference(string assemblyReference)
{
return base.ResolveAssemblyReference(assemblyReference);
}
public string CallResolvePath(string path)
{
return base.ResolvePath(path);
}
}
}

30
src/AddIns/Misc/TextTemplating/Test/Src/TextTemplatingAssemblyResolverTests.cs

@ -16,12 +16,14 @@ namespace TextTemplating.Tests @@ -16,12 +16,14 @@ namespace TextTemplating.Tests
TextTemplatingAssemblyResolver resolver;
IProject project;
FakeAssemblyParserService fakeAssemblyParserService;
FakeTextTemplatingPathResolver fakePathResolver;
void CreateResolver()
{
project = ProjectHelper.CreateProject();
fakeAssemblyParserService = new FakeAssemblyParserService();
resolver = new TextTemplatingAssemblyResolver(project, fakeAssemblyParserService);
fakePathResolver = new FakeTextTemplatingPathResolver();
resolver = new TextTemplatingAssemblyResolver(project, fakeAssemblyParserService, fakePathResolver);
}
ReferenceProjectItem AddReferenceToProject(string referenceName)
@ -146,5 +148,31 @@ namespace TextTemplating.Tests @@ -146,5 +148,31 @@ namespace TextTemplating.Tests
Assert.AreEqual("System.Data", result);
}
[Test]
public void Resolve_AssemblyReferenceHasTemplateVariable_ReturnsExpandedAssemblyReferenceFileName()
{
CreateResolver();
string path = @"$(SolutionDir)lib\Test.dll";
string expectedPath = @"d:\projects\MyProject\lib\Test.dll";
fakePathResolver.AddPath(path, expectedPath);
string resolvedPath = resolver.Resolve(path);
Assert.AreEqual(expectedPath, resolvedPath);
}
[Test]
public void Resolve_AssemblyReferenceHasTemplateVariable_AssemblyParserServiceIsNotUsed()
{
CreateResolver();
string path = @"$(SolutionDir)lib\Test.dll";
string expectedPath = @"d:\projects\MyProject\lib\Test.dll";
fakePathResolver.AddPath(path, expectedPath);
string result = resolver.Resolve(path);
Assert.IsFalse(fakeAssemblyParserService.IsGetReflectionProjectContentForReferenceCalled);
}
}
}

62
src/AddIns/Misc/TextTemplating/Test/Src/TextTemplatingHostTests.cs

@ -13,9 +13,11 @@ namespace TextTemplating.Tests @@ -13,9 +13,11 @@ namespace TextTemplating.Tests
public class TextTemplatingHostTests
{
TestableTextTemplatingHost host;
FakeTextTemplatingAppDomainFactory textTemplatingAppDomainFactory;
FakeTextTemplatingAppDomain textTemplatingAppDomain;
FakeTextTemplatingAssemblyResolver assemblyResolver;
FakeTextTemplatingAppDomainFactory fakeTextTemplatingAppDomainFactory;
FakeTextTemplatingAppDomain fakeTextTemplatingAppDomain;
FakeTextTemplatingAssemblyResolver fakeAssemblyResolver;
FakeTextTemplatingVariables fakeTextTemplatingVariables;
FakeServiceProvider fakeServiceProvider;
void CreateHost()
{
@ -25,9 +27,16 @@ namespace TextTemplating.Tests @@ -25,9 +27,16 @@ namespace TextTemplating.Tests
void CreateHost(string applicationBase)
{
host = new TestableTextTemplatingHost(applicationBase);
textTemplatingAppDomainFactory = host.FakeTextTemplatingAppDomainFactory;
textTemplatingAppDomain = textTemplatingAppDomainFactory.FakeTextTemplatingAppDomain;
assemblyResolver = host.FakeTextTemplatingAssemblyResolver;
fakeTextTemplatingAppDomainFactory = host.FakeTextTemplatingAppDomainFactory;
fakeTextTemplatingAppDomain = fakeTextTemplatingAppDomainFactory.FakeTextTemplatingAppDomain;
fakeAssemblyResolver = host.FakeTextTemplatingAssemblyResolver;
fakeTextTemplatingVariables = host.FakeTextTemplatingVariables;
fakeServiceProvider = host.FakeServiceProvider;
}
void AddTemplateVariableValue(string variableName, string variableValue)
{
fakeTextTemplatingVariables.AddVariable(variableName, variableValue);
}
[Test]
@ -35,7 +44,7 @@ namespace TextTemplating.Tests @@ -35,7 +44,7 @@ namespace TextTemplating.Tests
{
CreateHost();
AppDomain expectedAppDomain = AppDomain.CreateDomain("TextTemplatingHostTests");
textTemplatingAppDomain.AppDomain = expectedAppDomain;
fakeTextTemplatingAppDomain.AppDomain = expectedAppDomain;
AppDomain actualAppDomain = host.ProvideTemplatingAppDomain("test");
@ -49,7 +58,7 @@ namespace TextTemplating.Tests @@ -49,7 +58,7 @@ namespace TextTemplating.Tests
host.ProvideTemplatingAppDomain("test");
host.Dispose();
Assert.IsTrue(textTemplatingAppDomain.IsDisposeCalled);
Assert.IsTrue(fakeTextTemplatingAppDomain.IsDisposeCalled);
}
[Test]
@ -66,7 +75,7 @@ namespace TextTemplating.Tests @@ -66,7 +75,7 @@ namespace TextTemplating.Tests
host.ProvideTemplatingAppDomain("test");
host.ProvideTemplatingAppDomain("test");
Assert.AreEqual(1, textTemplatingAppDomainFactory.CreateTextTemplatingAppDomainCallCount);
Assert.AreEqual(1, fakeTextTemplatingAppDomainFactory.CreateTextTemplatingAppDomainCallCount);
}
[Test]
@ -76,10 +85,10 @@ namespace TextTemplating.Tests @@ -76,10 +85,10 @@ namespace TextTemplating.Tests
host.ProvideTemplatingAppDomain("test");
host.Dispose();
textTemplatingAppDomain.IsDisposeCalled = false;
fakeTextTemplatingAppDomain.IsDisposeCalled = false;
host.Dispose();
Assert.IsFalse(textTemplatingAppDomain.IsDisposeCalled);
Assert.IsFalse(fakeTextTemplatingAppDomain.IsDisposeCalled);
}
[Test]
@ -89,7 +98,7 @@ namespace TextTemplating.Tests @@ -89,7 +98,7 @@ namespace TextTemplating.Tests
CreateHost(applicationBase);
host.ProvideTemplatingAppDomain("test");
string actualApplicationBase = textTemplatingAppDomainFactory.ApplicationBasePassedToCreateTextTemplatingAppDomain;
string actualApplicationBase = fakeTextTemplatingAppDomainFactory.ApplicationBasePassedToCreateTextTemplatingAppDomain;
Assert.AreEqual(applicationBase, actualApplicationBase);
}
@ -99,17 +108,40 @@ namespace TextTemplating.Tests @@ -99,17 +108,40 @@ namespace TextTemplating.Tests
CreateHost();
host.CallResolveAssemblyReference("MyReference");
Assert.AreEqual("MyReference", assemblyResolver.AssembyReferencePassedToResolve);
Assert.AreEqual("MyReference", fakeAssemblyResolver.AssembyReferencePassedToResolve);
}
[Test]
public void ResolveAssemblyReference_PassedMyAssemblyReference_ReturnFileNameReturnedFromAssemblyResolverResolveMethod()
public void ResolveAssemblyReference_PassedMyAssemblyReference_ReturnsFileNameReturnedFromAssemblyResolverResolveMethod()
{
CreateHost();
assemblyResolver.ResolveReturnValue = @"d:\projects\references\MyReference.dll";
fakeAssemblyResolver.ResolveReturnValue = @"d:\projects\references\MyReference.dll";
string result = host.CallResolveAssemblyReference("MyReference");
Assert.AreEqual(@"d:\projects\references\MyReference.dll", result);
}
[Test]
public void ResolvePath_PathContainsSolutionDirProperty_SolutionDirExpanded()
{
CreateHost();
AddTemplateVariableValue("SolutionDir", @"d:\projects\MySolution\");
string path = host.CallResolvePath("$(SolutionDir)");
Assert.AreEqual(@"d:\projects\MySolution\", path);
}
[Test]
public void GetService_HostPassedFakeServiceProvider_ReturnsServiceFromFakeServiceProvider()
{
CreateHost();
var expectedService = new StringWriter();
fakeServiceProvider.AddService(typeof(StringWriter), expectedService);
var hostServiceProvider = host as IServiceProvider;
StringWriter service = hostServiceProvider.GetService(typeof(StringWriter)) as StringWriter;
Assert.AreEqual(expectedService, service);
}
}
}

57
src/AddIns/Misc/TextTemplating/Test/Src/TextTemplatingPathResolverTests.cs

@ -0,0 +1,57 @@ @@ -0,0 +1,57 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using ICSharpCode.TextTemplating;
using NUnit.Framework;
using TextTemplating.Tests.Helpers;
namespace TextTemplating.Tests
{
[TestFixture]
public class TextTemplatingPathResolverTests
{
TextTemplatingPathResolver pathResolver;
FakeTextTemplatingVariables fakeTemplatingVariables;
FakeTextTemplatingEnvironment fakeEnvironment;
void CreatePathResolver()
{
fakeTemplatingVariables = new FakeTextTemplatingVariables();
fakeEnvironment = new FakeTextTemplatingEnvironment();
pathResolver = new TextTemplatingPathResolver(fakeTemplatingVariables, fakeEnvironment);
}
void AddEnvironmentVariable(string name, string value)
{
fakeEnvironment.AddVariable(name, value);
}
void AddTemplateVariable(string name, string value)
{
fakeTemplatingVariables.AddVariable(name, value);
}
[Test]
public void ResolvePath_EnvironmentVariableInPath_ReturnsPathWithEnvironmentVariableExpanded()
{
CreatePathResolver();
AddEnvironmentVariable("windir", @"c:\windows");
string path = pathResolver.ResolvePath("%windir%");
Assert.AreEqual(@"c:\windows", path);
}
[Test]
public void ResolvePath_TemplateVariableInPath_ReturnsPathWithTemplateVariableExpanded()
{
CreatePathResolver();
AddTemplateVariable("SolutionDir", @"d:\projects\MyApp\");
string path = pathResolver.ResolvePath("$(SolutionDir)");
Assert.AreEqual(@"d:\projects\MyApp\", path);
}
}
}

30
src/AddIns/Misc/TextTemplating/Test/Src/TextTemplatingServiceProviderTests.cs

@ -0,0 +1,30 @@ @@ -0,0 +1,30 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using ICSharpCode.TextTemplating;
using NUnit.Framework;
using TextTemplating.Tests.Helpers;
namespace TextTemplating.Tests
{
[TestFixture]
public class TextTemplatingServiceProviderTests
{
TextTemplatingServiceProvider serviceProvider;
void CreateServiceProvider()
{
serviceProvider = new TextTemplatingServiceProvider();
}
[Test]
public void GetService_TypeOfFakeServiceProvider_ReturnsNewFakeServiceProvider()
{
CreateServiceProvider();
FakeServiceProvider service = serviceProvider.GetService(typeof(FakeServiceProvider)) as FakeServiceProvider;
Assert.IsNotNull(service);
}
}
}

78
src/AddIns/Misc/TextTemplating/Test/Src/TextTemplatingVariableLocationTests.cs

@ -0,0 +1,78 @@ @@ -0,0 +1,78 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using ICSharpCode.TextTemplating;
using NUnit.Framework;
namespace TextTemplating.Tests
{
[TestFixture]
public class TextTemplatingVariableLocationTests
{
TextTemplatingVariableLocation lhs;
TextTemplatingVariableLocation rhs;
void CreateVariableLocationsToCompare()
{
lhs = new TextTemplatingVariableLocation();
rhs = new TextTemplatingVariableLocation();
}
[Test]
public void Equals_AllPropertiesSame_ReturnsTrue()
{
CreateVariableLocationsToCompare();
bool result = lhs.Equals(rhs);
Assert.IsTrue(result);
}
[Test]
public void Equals_VariableNamesAreDifferent_ReturnsFalse()
{
CreateVariableLocationsToCompare();
lhs.VariableName = "A";
rhs.VariableName = "B";
bool result = lhs.Equals(rhs);
Assert.IsFalse(result);
}
[Test]
public void Equals_NullPassed_ReturnsFalse()
{
CreateVariableLocationsToCompare();
bool result = lhs.Equals(null);
Assert.IsFalse(result);
}
[Test]
public void Equals_IndexesAreDifferent_ReturnsFalse()
{
CreateVariableLocationsToCompare();
lhs.Index = 1;
rhs.Index = 3;
bool result = lhs.Equals(rhs);
Assert.IsFalse(result);
}
[Test]
public void Equals_LengthsAreDifferent_ReturnsFalse()
{
CreateVariableLocationsToCompare();
lhs.Length = 1;
rhs.Length = 3;
bool result = lhs.Equals(rhs);
Assert.IsFalse(result);
}
}
}

241
src/AddIns/Misc/TextTemplating/Test/Src/TextTemplatingVariablesTests.cs

@ -0,0 +1,241 @@ @@ -0,0 +1,241 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.Collections.Generic;
using System.Linq;
using ICSharpCode.TextTemplating;
using NUnit.Framework;
using TextTemplating.Tests.Helpers;
namespace TextTemplating.Tests
{
[TestFixture]
public class TextTemplatingVariablesTests
{
TextTemplatingVariables variables;
FakeTextTemplatingStringParser fakeStringParser;
void CreateTextTemplatingVariables()
{
fakeStringParser = new FakeTextTemplatingStringParser();
variables = new TextTemplatingVariables(fakeStringParser);
}
void AddProperty(string name, string value)
{
fakeStringParser.AddProperty(name, value);
}
[Test]
public void ExpandVariables_SolutionDirProperty_SolutionDirPropertyIsExpanded()
{
CreateTextTemplatingVariables();
AddProperty("SolutionDir", @"d:\projects\MyProject\");
string result = variables.ExpandVariables(@"$(SolutionDir)bin\Debug\Test.dll");
string expectedResult = @"d:\projects\MyProject\bin\Debug\Test.dll";
Assert.AreEqual(expectedResult, result);
}
[Test]
public void ExpandVariables_ProjectDirProperty_ProjectDirPropertyIsExpanded()
{
CreateTextTemplatingVariables();
AddProperty("ProjectDir", @"d:\projects\MyProject\");
string result = variables.ExpandVariables(@"$(ProjectDir)bin\Debug\Test.dll");
string expectedResult = @"d:\projects\MyProject\bin\Debug\Test.dll";
Assert.AreEqual(expectedResult, result);
}
[Test]
public void GetVariableLocations_SolutionDirProperty_ReturnsSolutionDirVariable()
{
CreateTextTemplatingVariables();
TextTemplatingVariableLocation location = variables.GetVariables("$(SolutionDir)").First();
var expectedLocation = new TextTemplatingVariableLocation() {
VariableName = "SolutionDir",
Index = 0,
Length = 14
};
Assert.AreEqual(expectedLocation, location);
}
[Test]
public void GetVariableLocations_NullPassed_ReturnsNoVariables()
{
CreateTextTemplatingVariables();
List<TextTemplatingVariableLocation> locations =
variables.GetVariables(null).ToList();
Assert.AreEqual(0, locations.Count);
}
[Test]
public void GetVariableLocations_EmptyStringPassed_ReturnsNoVariables()
{
CreateTextTemplatingVariables();
List<TextTemplatingVariableLocation> locations =
variables.GetVariables(String.Empty).ToList();
Assert.AreEqual(0, locations.Count);
}
[Test]
public void GetVariableLocations_TextHasNoVariables_ReturnsNoVariables()
{
CreateTextTemplatingVariables();
List<TextTemplatingVariableLocation> locations =
variables.GetVariables("No Variables").ToList();
Assert.AreEqual(0, locations.Count);
}
[Test]
public void GetVariableLocations_TextHasVariableStartButNoEnd_ReturnsNoVariables()
{
CreateTextTemplatingVariables();
List<TextTemplatingVariableLocation> locations =
variables.GetVariables("$(No Variables").ToList();
Assert.AreEqual(0, locations.Count);
}
[Test]
public void GetVariableLocations_TwoProperties_ReturnsTwoVariables()
{
CreateTextTemplatingVariables();
List<TextTemplatingVariableLocation> locations =
variables.GetVariables("$(SolutionDir)$(ProjectDir)").ToList();
var expectedLocation1 = new TextTemplatingVariableLocation() {
VariableName = "SolutionDir",
Index = 0,
Length = 14
};
var expectedLocation2 = new TextTemplatingVariableLocation() {
VariableName = "ProjectDir",
Index = 14,
Length = 13
};
var expectedLocations = new TextTemplatingVariableLocation[] {
expectedLocation1,
expectedLocation2
};
CollectionAssert.AreEqual(expectedLocations, locations);
}
[Test]
public void GetValue_ProjectDirProperty_ReturnsProjectDir()
{
CreateTextTemplatingVariables();
AddProperty("ProjectDir", @"d:\projects\MyProject\");
string variableValue = variables.GetValue("ProjectDir");
string expectedVariableValue = @"d:\projects\MyProject\";
Assert.AreEqual(expectedVariableValue, variableValue);
}
[Test]
public void GetValue_ProjectDirPropertyHasNoTrailingSlash_ReturnsProjectDirWithTrailingSlash()
{
CreateTextTemplatingVariables();
AddProperty("ProjectDir", @"d:\projects\MyProject");
string variableValue = variables.GetValue("ProjectDir");
string expectedVariableValue = @"d:\projects\MyProject\";
Assert.AreEqual(expectedVariableValue, variableValue);
}
[Test]
public void GetValue_PropertyReturnsEmptyStringAsValue_ReturnsEmptyString()
{
CreateTextTemplatingVariables();
AddProperty("ProjectDir", String.Empty);
string variableValue = variables.GetValue("ProjectDir");
Assert.AreEqual(String.Empty, variableValue);
}
[Test]
public void GetValue_PropertyReturnsNullAsValue_ReturnsEmptyString()
{
CreateTextTemplatingVariables();
AddProperty("Test", null);
string variableValue = variables.GetValue("Test");
Assert.AreEqual(String.Empty, variableValue);
}
[Test]
public void GetValue_NonDirectoryPropertyReturnsNonEmptyStringAsValue_DoesNotAppendTrailingSlash()
{
CreateTextTemplatingVariables();
AddProperty("Test", "abc");
string variableValue = variables.GetValue("Test");
Assert.AreEqual("abc", variableValue);
}
[Test]
public void GetValue_SolutionDirPropertyWithoutTrailingSlash_ReturnsExpandedSolutionDirWithTrailingSlash()
{
CreateTextTemplatingVariables();
AddProperty("SolutionDir", @"d:\projects\MySolution");
string variableValue = variables.GetValue("SolutionDir");
string expectedVariableValue = @"d:\projects\MySolution\";
Assert.AreEqual(expectedVariableValue, variableValue);
}
[Test]
public void GetValue_SolutionDirPropertyInLowerCaseWithoutTrailingSlash_ReturnsExpandedSolutionDirWithTrailingSlash()
{
CreateTextTemplatingVariables();
AddProperty("solutiondir", @"d:\projects\MySolution");
string variableValue = variables.GetValue("solutiondir");
string expectedVariableValue = @"d:\projects\MySolution\";
Assert.AreEqual(expectedVariableValue, variableValue);
}
[Test]
public void GetValue_NullPassed_ReturnsEmptyString()
{
CreateTextTemplatingVariables();
string variableValue = variables.GetValue(null);
Assert.AreEqual(String.Empty, variableValue);
}
[Test]
public void ExpandVariables_ProjectDirPropertyHasNoTrailingSlash_ProjectDirPropertyIsExpandedWithTrailingSlash()
{
CreateTextTemplatingVariables();
AddProperty("ProjectDir", @"d:\projects\MyProject");
string result = variables.ExpandVariables(@"$(ProjectDir)bin\Debug\Test.dll");
string expectedResult = @"d:\projects\MyProject\bin\Debug\Test.dll";
Assert.AreEqual(expectedResult, result);
}
}
}

9
src/AddIns/Misc/TextTemplating/Test/TextTemplating.Tests.csproj

@ -57,13 +57,18 @@ @@ -57,13 +57,18 @@
<Compile Include="Configuration\AssemblyInfo.cs" />
<Compile Include="Helpers\FakeAssemblyParserService.cs" />
<Compile Include="Helpers\FakeReflectionProjectContent.cs" />
<Compile Include="Helpers\FakeServiceProvider.cs" />
<Compile Include="Helpers\FakeTextTemplatingAppDomain.cs" />
<Compile Include="Helpers\FakeTextTemplatingAppDomainFactory.cs" />
<Compile Include="Helpers\FakeTextTemplatingAssemblyResolver.cs" />
<Compile Include="Helpers\FakeTextTemplatingCustomToolContext.cs" />
<Compile Include="Helpers\FakeTextTemplatingEnvironment.cs" />
<Compile Include="Helpers\FakeTextTemplatingFilePreprocessor.cs" />
<Compile Include="Helpers\FakeTextTemplatingHost.cs" />
<Compile Include="Helpers\FakeTextTemplatingFileGenerator.cs" />
<Compile Include="Helpers\FakeTextTemplatingPathResolver.cs" />
<Compile Include="Helpers\FakeTextTemplatingStringParser.cs" />
<Compile Include="Helpers\FakeTextTemplatingVariables.cs" />
<Compile Include="Helpers\ProjectHelper.cs" />
<Compile Include="Helpers\TestableFileProjectItem.cs" />
<Compile Include="Helpers\TestableProject.cs" />
@ -77,8 +82,12 @@ @@ -77,8 +82,12 @@
<Compile Include="Src\TextTemplatingFileGeneratorTests.cs" />
<Compile Include="Src\TextTemplatingFilePreprocessorCustomToolTests.cs" />
<Compile Include="Src\TextTemplatingHostTests.cs" />
<Compile Include="Src\TextTemplatingPathResolverTests.cs" />
<Compile Include="Src\TextTemplatingPreprocessorTests.cs" />
<Compile Include="Src\TextTemplatingReflectionProjectContentTests.cs" />
<Compile Include="Src\TextTemplatingServiceProviderTests.cs" />
<Compile Include="Src\TextTemplatingVariableLocationTests.cs" />
<Compile Include="Src\TextTemplatingVariablesTests.cs" />
</ItemGroup>
<ItemGroup>
<Folder Include="Configuration" />

1
src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Folding/FoldingSection.cs

@ -84,6 +84,7 @@ namespace ICSharpCode.AvalonEdit.Folding @@ -84,6 +84,7 @@ namespace ICSharpCode.AvalonEdit.Folding
/// <summary>
/// Gets the content of the collapsed lines as tooltip text.
/// </summary>
[Obsolete]
public string TooltipText {
get {
// This fixes SD-1394:

21
src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Rendering/TextView.cs

@ -1612,6 +1612,7 @@ namespace ICSharpCode.AvalonEdit.Rendering @@ -1612,6 +1612,7 @@ namespace ICSharpCode.AvalonEdit.Rendering
/// <summary>
/// Gets the text view position from the specified visual position.
/// If the position is within a character, it is rounded to the next character boundary.
/// </summary>
/// <param name="visualPosition">The position in WPF device-independent pixels relative
/// to the top left corner of the document.</param>
@ -1628,6 +1629,26 @@ namespace ICSharpCode.AvalonEdit.Rendering @@ -1628,6 +1629,26 @@ namespace ICSharpCode.AvalonEdit.Rendering
int documentOffset = line.GetRelativeOffset(visualColumn) + line.FirstDocumentLine.Offset;
return new TextViewPosition(document.GetLocation(documentOffset), visualColumn);
}
/// <summary>
/// Gets the text view position from the specified visual position.
/// If the position is inside a character, the position in front of the character is returned.
/// </summary>
/// <param name="visualPosition">The position in WPF device-independent pixels relative
/// to the top left corner of the document.</param>
/// <returns>The logical position, or null if the position is outside the document.</returns>
public TextViewPosition? GetPositionFloor(Point visualPosition)
{
VerifyAccess();
if (this.Document == null)
throw ThrowUtil.NoDocumentAssigned();
VisualLine line = GetVisualLineFromVisualTop(visualPosition.Y);
if (line == null)
return null;
int visualColumn = line.GetVisualColumnFloor(visualPosition);
int documentOffset = line.GetRelativeOffset(visualColumn) + line.FirstDocumentLine.Offset;
return new TextViewPosition(document.GetLocation(documentOffset), visualColumn);
}
#endregion
#region Service Provider

11
src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/WebProjectOptions/WebProjectOptionsPanel.xaml.cs

@ -45,10 +45,8 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels @@ -45,10 +45,8 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels
}
break;
case WebServer.IIS:
if (WebProjectService.IISVersion == IISVersion.IIS5 ||
WebProjectService.IISVersion == IISVersion.IIS6 ||
WebProjectService.IISVersion == IISVersion.IIS7 ||
WebProjectService.IISVersion == IISVersion.IIS_Future) {
if (WebProjectService.IISVersion != IISVersion.IISExpress &&
WebProjectService.IISVersion != IISVersion.None) {
UseLocalIIS.IsChecked = true;
ProjectUrl.Text = CurrentProjectDebugData.ProjectUrl ?? string.Empty;
@ -134,9 +132,8 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels @@ -134,9 +132,8 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels
WebProjectDebugData data = new WebProjectDebugData();
data.WebServer = WebServer.IIS;
data.Port = string.Empty;
bool isIISInstalled = WebProjectService.IISVersion == IISVersion.IIS5 ||
WebProjectService.IISVersion == IISVersion.IIS6 ||
WebProjectService.IISVersion == IISVersion.IIS7;
bool isIISInstalled = WebProjectService.IISVersion != IISVersion.IISExpress &&
WebProjectService.IISVersion != IISVersion.None;
if (!isIISInstalled) {
StatusLabel.Text = ResourceService.GetString("ICSharpCode.WepProjectOptionsPanel.IISNotFound");

6
src/Main/Base/Project/Src/Gui/Dialogs/ReferenceDialog/GacReferencePanel.cs

@ -378,8 +378,7 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -378,8 +378,7 @@ namespace ICSharpCode.SharpDevelop.Gui
}
});
string mscorlibPath;
MSBuildInternals.ResolveAssemblyReferences(project, referenceItems.ToArray(), out mscorlibPath);
MSBuildInternals.ResolveAssemblyReferences(project, referenceItems.ToArray(), resolveOnlyAdditionalReferences: true, logErrorsToOutputPad: false);
WorkbenchSingleton.SafeThreadAsyncCall(
delegate {
@ -423,8 +422,7 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -423,8 +422,7 @@ namespace ICSharpCode.SharpDevelop.Gui
}
});
string mscorlibPath;
MSBuildInternals.ResolveAssemblyReferences(project, referenceItems.ToArray(), out mscorlibPath);
MSBuildInternals.ResolveAssemblyReferences(project, referenceItems.ToArray(), resolveOnlyAdditionalReferences: true, logErrorsToOutputPad: false);
foreach (ReferenceProjectItem rpi in referenceItems) {
if (string.IsNullOrEmpty(rpi.Redist)) continue;
if (!redistNameToRequiredFramework.ContainsKey(rpi.Redist)) {

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

@ -7,7 +7,7 @@ using System.Collections.ObjectModel; @@ -7,7 +7,7 @@ using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Threading;
using System.Xml.Linq;
using ICSharpCode.Core;
@ -525,6 +525,27 @@ namespace ICSharpCode.SharpDevelop.Project @@ -525,6 +525,27 @@ namespace ICSharpCode.SharpDevelop.Project
{
}
public virtual IEnumerable<ReferenceProjectItem> ResolveAssemblyReferences(CancellationToken cancellationToken)
{
ResolveAssemblyReferences();
List<ReferenceProjectItem> referenceItems = new List<ReferenceProjectItem>();
bool mscorlib = false;
foreach (ProjectItem item in this.Items) {
cancellationToken.ThrowIfCancellationRequested();
if (ItemType.ReferenceItemTypes.Contains(item.ItemType)) {
ReferenceProjectItem reference = item as ReferenceProjectItem;
if (reference != null) {
referenceItems.Add(reference);
mscorlib |= "mscorlib".Equals(reference.Include, StringComparison.OrdinalIgnoreCase);
}
}
}
if (!mscorlib) {
referenceItems.Add(new ReferenceProjectItem(this, "mscorlib") { FileName = typeof(object).Module.FullyQualifiedName });
}
return referenceItems;
}
public virtual void StartBuild(ProjectBuildOptions options, IBuildFeedbackSink feedbackSink)
{
feedbackSink.ReportError(new BuildError { ErrorText = "Building project " + Name + " is not supported.", IsWarning = true });

18
src/Main/Base/Project/Src/Project/MSBuildBasedProject.cs

@ -8,6 +8,7 @@ using System.ComponentModel; @@ -8,6 +8,7 @@ using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Threading;
using System.Xml;
using System.Xml.Linq;
using ICSharpCode.Core;
@ -137,21 +138,14 @@ namespace ICSharpCode.SharpDevelop.Project @@ -137,21 +138,14 @@ namespace ICSharpCode.SharpDevelop.Project
}
}
volatile string mscorlibPath;
/// <summary>
/// Gets the path to mscorlib.
/// This property is set only after ResolveAssemblyReferences() is called.
/// </summary>
public string MscorlibPath {
get { return mscorlibPath; }
public override void ResolveAssemblyReferences()
{
MSBuildInternals.ResolveAssemblyReferences(this);
}
public override void ResolveAssemblyReferences()
public override IEnumerable<ReferenceProjectItem> ResolveAssemblyReferences(CancellationToken cancellationToken)
{
string mscorlib;
MSBuildInternals.ResolveAssemblyReferences(this, null, out mscorlib);
this.mscorlibPath = mscorlib;
return MSBuildInternals.ResolveAssemblyReferences(this);
}
#region CreateProjectItem

83
src/Main/Base/Project/Src/Project/MSBuildInternals.cs

@ -162,7 +162,10 @@ namespace ICSharpCode.SharpDevelop.Project @@ -162,7 +162,10 @@ namespace ICSharpCode.SharpDevelop.Project
/// <param name="baseProject">The base project.</param>
/// <param name="referenceReplacements">A different set of references to use instead of those in the project.
/// Used by the GacReferencePanel.</param>
internal static void ResolveAssemblyReferences(MSBuildBasedProject baseProject, ReferenceProjectItem[] referenceReplacements, out string mscorlibPath)
public static IList<ReferenceProjectItem> ResolveAssemblyReferences(
MSBuildBasedProject baseProject,
ReferenceProjectItem[] additionalReferences = null, bool resolveOnlyAdditionalReferences = false,
bool logErrorsToOutputPad = true)
{
ProjectInstance project = baseProject.CreateProjectInstance();
project.SetProperty("BuildingProject", "false");
@ -173,30 +176,35 @@ namespace ICSharpCode.SharpDevelop.Project @@ -173,30 +176,35 @@ namespace ICSharpCode.SharpDevelop.Project
select item
).ToList();
ReferenceProjectItem[] referenceProjectItems;
List<ReferenceProjectItem> referenceProjectItems;
if (referenceReplacements == null) {
// Remove the "Private" meta data.
// This is necessary to detect the default value for "Private"
if (resolveOnlyAdditionalReferences) {
// Remove existing references from project
foreach (ProjectItemInstance reference in references) {
reference.RemoveMetadata("Private");
project.RemoveItem(reference);
}
referenceProjectItems = baseProject.Items.OfType<ReferenceProjectItem>().ToArray();
references.Clear();
referenceProjectItems = new List<ReferenceProjectItem>();
} else {
// Remove the "Private" meta data.
// This is necessary to detect the default value for "Private"
foreach (ProjectItemInstance reference in references) {
project.RemoveItem(reference);
reference.RemoveMetadata("Private");
}
foreach (ReferenceProjectItem item in referenceReplacements) {
project.AddItem("Reference", item.Include);
referenceProjectItems = baseProject.Items.OfType<ReferenceProjectItem>().ToList();
}
if (additionalReferences != null) {
referenceProjectItems.AddRange(additionalReferences);
foreach (ReferenceProjectItem item in additionalReferences) {
references.Add(project.AddItem("Reference", item.Include));
}
referenceProjectItems = referenceReplacements;
}
string[] targets = { "ResolveAssemblyReferences" };
BuildRequestData requestData = new BuildRequestData(project, targets, new HostServices());
List<ILogger> loggers = new List<ILogger>();
if (referenceReplacements == null)
if (logErrorsToOutputPad)
loggers.Add(new SimpleErrorLogger());
lock (SolutionProjectCollectionLock) {
BuildParameters parameters = new BuildParameters(baseProject.MSBuildProjectCollection);
@ -209,32 +217,37 @@ namespace ICSharpCode.SharpDevelop.Project @@ -209,32 +217,37 @@ namespace ICSharpCode.SharpDevelop.Project
LoggingService.Debug("Build for ResolveAssemblyReferences finished: " + result.OverallResult);
}
var referenceDict = new Dictionary<string, ReferenceProjectItem>();
foreach (ReferenceProjectItem item in referenceProjectItems) {
// references could be duplicate, so we cannot use referenceDict.Add or reference.ToDictionary
referenceDict[item.Include] = item;
}
IEnumerable<ProjectItemInstance> resolvedAssemblyProjectItems = project.GetItems("_ResolveAssemblyReferenceResolvedFiles");
mscorlibPath = null;
foreach (ProjectItemInstance item in project.GetItems("_ResolveAssemblyReferenceResolvedFiles")) {
DomAssemblyName assemblyName = new DomAssemblyName(item.GetMetadataValue("FusionName"));
string fullPath = FileUtility.GetAbsolutePath(baseProject.Directory, item.GetMetadataValue("Identity"));
string originalInclude = item.GetMetadataValue("OriginalItemSpec");
ReferenceProjectItem reference;
if (referenceDict.TryGetValue(originalInclude, out reference)) {
reference.AssemblyName = new Dom.DomAssemblyName(item.GetMetadataValue("FusionName"));
reference.FileName = fullPath;
reference.Redist = item.GetMetadataValue("Redist");
LoggingService.Debug("Got information about " + originalInclude + "; fullpath=" + fullPath);
reference.DefaultCopyLocalValue = bool.Parse(item.GetMetadataValue("CopyLocal"));
} else if (string.Equals(assemblyName.ShortName, "mscorlib", StringComparison.OrdinalIgnoreCase)) {
LoggingService.Debug("Got information for mscorlib: " + fullPath);
mscorlibPath = fullPath;
var query =
from msbuildItem in resolvedAssemblyProjectItems
let originalInclude = msbuildItem.GetMetadataValue("OriginalItemSpec")
join item in referenceProjectItems on originalInclude equals item.Include into referenceItems
select new {
OriginalInclude = originalInclude,
AssemblyName = new DomAssemblyName(msbuildItem.GetMetadataValue("FusionName")),
FullPath = FileUtility.GetAbsolutePath(baseProject.Directory, msbuildItem.GetMetadataValue("Identity")),
Redist = msbuildItem.GetMetadataValue("Redist"),
CopyLocal = bool.Parse(msbuildItem.GetMetadataValue("CopyLocal")),
ReferenceItems = referenceItems
};
List<ReferenceProjectItem> resolvedAssemblies = new List<ReferenceProjectItem>();
foreach (var assembly in query) {
LoggingService.Debug("Got information about " + assembly.OriginalInclude + "; fullpath=" + assembly.FullPath);
foreach (var referenceItem in assembly.ReferenceItems) {
referenceItem.AssemblyName = assembly.AssemblyName;
referenceItem.FileName = assembly.FullPath;
referenceItem.Redist = assembly.Redist;
referenceItem.DefaultCopyLocalValue = assembly.CopyLocal;
}
ReferenceProjectItem firstItem = assembly.ReferenceItems.FirstOrDefault();
if (firstItem != null) {
resolvedAssemblies.Add(firstItem);
} else {
LoggingService.Warn("Unknown item " + originalInclude);
resolvedAssemblies.Add(new ReferenceProjectItem(baseProject, assembly.OriginalInclude) { FileName = assembly.FullPath });
}
}
return resolvedAssemblies;
}
sealed class SimpleErrorLogger : ILogger

33
src/Main/Base/Project/Src/Services/ParserService/ParseProjectContent.cs

@ -57,27 +57,23 @@ namespace ICSharpCode.SharpDevelop @@ -57,27 +57,23 @@ namespace ICSharpCode.SharpDevelop
UpdateDefaultImports(items);
// TODO: Translate me
// progressMonitor.TaskName = "Resolving references for " + project.Name + "...";
project.ResolveAssemblyReferences();
MSBuildBasedProject msbuildProject = project as MSBuildBasedProject;
if (msbuildProject != null) {
string mscorlib = msbuildProject.MscorlibPath;
if (string.IsNullOrEmpty(mscorlib)) {
AddReferencedContent(AssemblyParserService.DefaultProjectContentRegistry.Mscorlib);
} else {
AddReferencedContent(AssemblyParserService.DefaultProjectContentRegistry.GetProjectContentForReference("mscorlib", mscorlib));
AbstractProject abstractProject = project as AbstractProject;
if (abstractProject != null) {
foreach (var reference in abstractProject.ResolveAssemblyReferences(progressMonitor.CancellationToken)) {
if (!initializing) return; // abort initialization
AddReference(reference, false, progressMonitor.CancellationToken);
}
} else {
project.ResolveAssemblyReferences();
AddReferencedContent(AssemblyParserService.DefaultProjectContentRegistry.Mscorlib);
}
foreach (ProjectItem item in items) {
if (!initializing) return; // abort initialization
progressMonitor.CancellationToken.ThrowIfCancellationRequested();
if (ItemType.ReferenceItemTypes.Contains(item.ItemType)) {
ReferenceProjectItem reference = item as ReferenceProjectItem;
if (reference != null) {
// TODO: Translate me
// progressMonitor.TaskName = "Loading " + reference.ShortName + "...";
AddReference(reference, false, progressMonitor.CancellationToken);
foreach (ProjectItem item in items) {
if (!initializing) return; // abort initialization
progressMonitor.CancellationToken.ThrowIfCancellationRequested();
if (ItemType.ReferenceItemTypes.Contains(item.ItemType)) {
ReferenceProjectItem reference = item as ReferenceProjectItem;
if (reference != null) {
AddReference(reference, false, progressMonitor.CancellationToken);
}
}
}
}
@ -116,6 +112,7 @@ namespace ICSharpCode.SharpDevelop @@ -116,6 +112,7 @@ namespace ICSharpCode.SharpDevelop
void AddReference(ReferenceProjectItem reference, bool updateInterDependencies, CancellationToken cancellationToken)
{
try {
cancellationToken.ThrowIfCancellationRequested();
AddReferencedContent(AssemblyParserService.GetProjectContentForReference(reference));
if (updateInterDependencies) {
UpdateReferenceInterDependencies();

37
src/Main/Base/Project/Src/Services/WebProjectService/WebProjectService.cs

@ -7,6 +7,7 @@ using System.IO; @@ -7,6 +7,7 @@ using System.IO;
using System.Reflection;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Dom;
using Microsoft.Win32;
namespace ICSharpCode.SharpDevelop.Project
@ -14,11 +15,12 @@ namespace ICSharpCode.SharpDevelop.Project @@ -14,11 +15,12 @@ namespace ICSharpCode.SharpDevelop.Project
public enum IISVersion
{
None = 0,
IISExpress,
IIS5 = 5,
IIS6,
IIS7,
IISExpress,
IIS_Future
IIS8,
IIS_Future = 100
}
public enum WebServer
@ -49,7 +51,7 @@ namespace ICSharpCode.SharpDevelop.Project @@ -49,7 +51,7 @@ namespace ICSharpCode.SharpDevelop.Project
/// <summary>
/// Gets &quot;iisexpress&quot; string.
/// </summary>
public const string IIS_EXPRESS_PROCESS_NAME = "iisexpress";
public const string IIS_EXPRESS_PROCESS_NAME = "iisexpress";
/// <summary>
/// Gets &quot;aspnet_wp&quot; string.
@ -193,8 +195,9 @@ namespace ICSharpCode.SharpDevelop.Project @@ -193,8 +195,9 @@ namespace ICSharpCode.SharpDevelop.Project
public static string CreateVirtualDirectory(string virtualDirectoryName, string physicalDirectoryPath)
{
try {
string iisNotFoundError = ResourceService.GetString("ICSharpCode.WepProjectOptionsPanel.IISNotFound");
if (!IsIISInstalled)
return ResourceService.GetString("ICSharpCode.WepProjectOptionsPanel.IISNotFound");
return iisNotFoundError;
string error;
@ -208,20 +211,26 @@ namespace ICSharpCode.SharpDevelop.Project @@ -208,20 +211,26 @@ namespace ICSharpCode.SharpDevelop.Project
virtualDirectoryName,
out error);
break;
case IISVersion.None:
return iisNotFoundError;
default:
// TODO: find a better way to create IIS 7 applications without Microsoft.Web.Administration.ServerManager
// TODO: find a better way to create IIS applications without Microsoft.Web.Administration.ServerManager
string name = "/" + virtualDirectoryName;
// load from GAC - IIS7 is installed
Assembly webAdministrationAssembly;
// load from GAC
Assembly webAdministrationAssembly = null;
try {
// iis 7
webAdministrationAssembly = Assembly.Load("Microsoft.Web.Administration, Version=7.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35");
}
catch {
// iis express
webAdministrationAssembly = Assembly.Load("Microsoft.Web.Administration, Version=7.9.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35");
// iis installed
foreach(var assembly in GacInterop.GetAssemblyList()) {
if (assembly.FullName.Contains("Microsoft.Web.Administration")) {
webAdministrationAssembly = Assembly.Load(assembly.FullName);
break;
}
}
} catch {
return iisNotFoundError;
}
if (webAdministrationAssembly == null)
return iisNotFoundError;
// use dynamic because classic reflection is way TOO ugly
dynamic manager = webAdministrationAssembly.CreateInstance("Microsoft.Web.Administration.ServerManager");

Loading…
Cancel
Save