Browse Source

Fixed code completion problems when one referenced assembly has references to other assemblies.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@170 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 21 years ago
parent
commit
a7a4fe10c9
  1. 50
      src/AddIns/Misc/SubversionAddIn/Project/SubversionAddIn.csproj
  2. 6
      src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj
  3. 2
      src/Main/Base/Project/Src/Dom/Implementations/DefaultClass.cs
  4. 1
      src/Main/Base/Project/Src/Dom/Implementations/DefaultCompilationUnit.cs
  5. 3
      src/Main/Base/Project/Src/Gui/Pads/ClassBrowser/Nodes/ReferenceFolderNode.cs
  6. 123
      src/Main/Base/Project/Src/Services/ParserService/DefaultProjectContent.cs
  7. 117
      src/Main/Base/Project/Src/Services/ParserService/ParseProjectContent.cs
  8. 13
      src/Main/Base/Project/Src/Services/ParserService/ParserService.cs
  9. 111
      src/Main/Base/Project/Src/Services/ParserService/ProjectContentRegistry.cs
  10. 60
      src/Main/Base/Project/Src/Services/ParserService/ReflectionProjectContent.cs
  11. 1
      src/Main/Base/Project/Src/Services/ProjectService/ProjectService.cs
  12. 82
      src/SharpDevelop.sln

50
src/AddIns/Misc/SubversionAddIn/Project/SubversionAddIn.csproj

@ -7,6 +7,8 @@ @@ -7,6 +7,8 @@
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{17F4D7E0-6933-4C2E-8714-FD7E98D625D5}</ProjectGuid>
<PostBuildEvent>..\..\..\..\src\AddIns\Misc\SubversionAddIn\Project\PostBuildEvent.bat</PostBuildEvent>
<ProductVersion>8.0.50215</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>True</DebugSymbols>
@ -43,7 +45,9 @@ @@ -43,7 +45,9 @@
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<Compile Include="Src\SvnClient.cs" />
<Compile Include="Src\InOperationDialog.cs" />
<Compile Include="Src\InOperationDialog.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Src\AddInOptions.cs" />
<Compile Include="Configuration\AssemblyInfo.cs" />
<EmbeddedResource Include="Resources\ClientCertDialog.xfrm" />
@ -56,24 +60,46 @@ @@ -56,24 +60,46 @@
<EmbeddedResource Include="Resources\SslServerTrustDialog.xfrm" />
<EmbeddedResource Include="Resources\SubversionOptionsPanel.xfrm" />
<Compile Include="Src\Commands\Checkout\CheckoutCommand.cs" />
<Compile Include="Src\Commands\Checkout\CheckoutDialog.cs" />
<Compile Include="Src\Commands\Checkout\CheckoutDialog.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Src\Commands\Commit\CommitCommand.cs" />
<Compile Include="Src\Commands\Commit\CommitDialog.cs" />
<Compile Include="Src\Commands\Commit\CommitDialog.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Src\Commands\Export\ExportCommand.cs" />
<Compile Include="Src\Commands\Export\ExportDialog.cs" />
<Compile Include="Src\Commands\Export\ExportDialog.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Src\Commands\AutostartCommands.cs" />
<Compile Include="Src\Commands\ProjectBrowserCommands.cs" />
<Compile Include="Src\Gui\AuthentificationDialogs\ClientCertDialog.cs" />
<Compile Include="Src\Gui\AuthentificationDialogs\ClientCertPassphraseDialog.cs" />
<Compile Include="Src\Gui\AuthentificationDialogs\LoginDialog.cs" />
<Compile Include="Src\Gui\AuthentificationDialogs\SslServerTrustDialog.cs" />
<Compile Include="Src\Gui\HistoryViewDisplayBinding\DiffPanel.cs" />
<Compile Include="Src\Gui\AuthentificationDialogs\ClientCertDialog.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Src\Gui\AuthentificationDialogs\ClientCertPassphraseDialog.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Src\Gui\AuthentificationDialogs\LoginDialog.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Src\Gui\AuthentificationDialogs\SslServerTrustDialog.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Src\Gui\HistoryViewDisplayBinding\DiffPanel.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Src\Gui\HistoryViewDisplayBinding\HistoryView.cs" />
<Compile Include="Src\Gui\HistoryViewDisplayBinding\HistoryViewDisplayBinding.cs" />
<Compile Include="Src\Gui\HistoryViewDisplayBinding\HistoryViewPanel.cs" />
<Compile Include="Src\Gui\HistoryViewDisplayBinding\InfoPanel.cs" />
<Compile Include="Src\Gui\HistoryViewDisplayBinding\HistoryViewPanel.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Src\Gui\HistoryViewDisplayBinding\InfoPanel.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Src\Gui\ProjectBrowserVisitor\SvnProjectBrowserVisitor.cs" />
<Compile Include="Src\Gui\SubversionOptionsPanel.cs" />
<Compile Include="Src\Gui\SubversionOptionsPanel.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Src\Gui\ProjectBrowserVisitor\OverlayIconManager.cs" />
<None Include="PostBuildEvent.bat" />
</ItemGroup>

6
src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj

@ -181,7 +181,7 @@ @@ -181,7 +181,7 @@
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Src\Gui\Dialogs\CommonAboutDialog.cs">
<SubType>UserControl</SubType>
<SubType>Form</SubType>
</Compile>
<Compile Include="Src\Gui\Dialogs\DirtyFilesDialog.cs" />
<Compile Include="Src\Gui\Dialogs\FolderDialog.cs" />
@ -200,7 +200,7 @@ @@ -200,7 +200,7 @@
<SubType>Form</SubType>
</Compile>
<Compile Include="Src\Gui\Dialogs\TreeViewOptions.cs">
<SubType>Form</SubType>
<SubType>Component</SubType>
</Compile>
<Compile Include="Src\Gui\Dialogs\ViewGPLDialog.cs">
<SubType>Form</SubType>
@ -667,6 +667,8 @@ @@ -667,6 +667,8 @@
<Compile Include="Src\Services\RefactoringService\RefactoringService.cs" />
<Compile Include="Src\Services\RefactoringService\Reference.cs" />
<Compile Include="Src\Services\ProjectService\ParseableFileContentEnumerator.cs" />
<Compile Include="Src\Services\ParserService\ParseProjectContent.cs" />
<Compile Include="Src\Services\ParserService\ReflectionProjectContent.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\Libraries\DockPanel_Src\WinFormsUI\WinFormsUI.csproj">

2
src/Main/Base/Project/Src/Dom/Implementations/DefaultClass.cs

@ -63,12 +63,14 @@ namespace ICSharpCode.SharpDevelop.Dom @@ -63,12 +63,14 @@ namespace ICSharpCode.SharpDevelop.Dom
}
public ICompilationUnit CompilationUnit {
[System.Diagnostics.DebuggerStepThrough]
get {
return compilationUnit;
}
}
public IProjectContent ProjectContent {
[System.Diagnostics.DebuggerStepThrough]
get {
return CompilationUnit.ProjectContent;
}

1
src/Main/Base/Project/Src/Dom/Implementations/DefaultCompilationUnit.cs

@ -37,6 +37,7 @@ namespace ICSharpCode.SharpDevelop.Dom @@ -37,6 +37,7 @@ namespace ICSharpCode.SharpDevelop.Dom
}
public IProjectContent ProjectContent {
[System.Diagnostics.DebuggerStepThrough]
get {
return projectContent;
}

3
src/Main/Base/Project/Src/Gui/Pads/ClassBrowser/Nodes/ReferenceFolderNode.cs

@ -96,6 +96,9 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -96,6 +96,9 @@ namespace ICSharpCode.SharpDevelop.Gui
protected override string StripRootNamespace(string directory)
{
string rootNamespace = item.Include;
int pos = rootNamespace.IndexOf(',');
if (pos > 0)
rootNamespace = rootNamespace.Substring(0, pos);
if (directory.ToLower().StartsWith(rootNamespace.ToLower())) {
directory = directory.Substring(rootNamespace.Length);
}

123
src/Main/Base/Project/Src/Services/ParserService/DefaultProjectContent.cs

@ -28,7 +28,7 @@ namespace ICSharpCode.Core @@ -28,7 +28,7 @@ namespace ICSharpCode.Core
List<Dictionary<string, IClass>> classLists = new List<Dictionary<string, IClass>>();
Hashtable namespaces = new Hashtable();
XmlDoc xmlDoc = new XmlDoc();
protected XmlDoc xmlDoc = new XmlDoc();
public List<Dictionary<string, IClass>> ClassLists {
get {
@ -112,7 +112,7 @@ namespace ICSharpCode.Core @@ -112,7 +112,7 @@ namespace ICSharpCode.Core
return null;
}
static string LookupLocalizedXmlDoc(string fileName)
protected static string LookupLocalizedXmlDoc(string fileName)
{
string xmlFileName = Path.ChangeExtension(fileName, ".xml");
string localizedXmlDocFile = FileUtility.Combine(System.IO.Path.GetDirectoryName(fileName), Thread.CurrentThread.CurrentUICulture.TwoLetterISOLanguageName, System.IO.Path.GetFileName(xmlFileName));
@ -125,124 +125,9 @@ namespace ICSharpCode.Core @@ -125,124 +125,9 @@ namespace ICSharpCode.Core
return null;
}
public static IProjectContent Create(Assembly assembly)
{
DefaultProjectContent newProjectContent = new DefaultProjectContent();
if (typeof(object).Assembly != assembly) {
newProjectContent.referencedContents.Add(ProjectContentRegistry.GetMscorlibContent());
}
ICompilationUnit assemblyCompilationUnit = new DefaultCompilationUnit(newProjectContent);
foreach (Type type in assembly.GetTypes()) {
if (!type.FullName.StartsWith("<") && type.IsPublic) {
newProjectContent.AddClassToNamespaceListInternal(new ReflectionClass(assemblyCompilationUnit, type, null));
}
}
string fileName = LookupLocalizedXmlDoc(assembly.Location);
// Not found -> look in runtime directory.
if (fileName == null) {
string runtimeDirectory = System.Runtime.InteropServices.RuntimeEnvironment.GetRuntimeDirectory();
fileName = LookupLocalizedXmlDoc(Path.Combine(runtimeDirectory, Path.GetFileName(assembly.Location)));
}
if (fileName != null) {
newProjectContent.xmlDoc = XmlDoc.Load(fileName);
}
return newProjectContent;
}
internal static IProjectContent CreateUninitalized(IProject project)
{
DefaultProjectContent newProjectContent = new DefaultProjectContent();
newProjectContent.project = project;
newProjectContent.language = project.LanguageProperties;
newProjectContent.referencedContents.Add(ProjectContentRegistry.GetMscorlibContent());
newProjectContent.initializing = true;
return newProjectContent;
}
public static IProjectContent Create(IProject project)
{
IProjectContent newProjectContent = CreateUninitalized(project);
if (newProjectContent is DefaultProjectContent) {
((DefaultProjectContent)newProjectContent).Initialize1();
((DefaultProjectContent)newProjectContent).Initialize2();
}
return newProjectContent;
}
IProject project;
bool initializing;
internal void Initialize1()
{
ProjectItem[] items = project.Items.ToArray();
ProjectService.ReferenceAdded += OnReferenceAdded;
foreach (ProjectItem item in items) {
if (!initializing) return; // abort initialization
switch (item.ItemType) {
case ItemType.Reference:
case ItemType.ProjectReference:
AddReference(item as ReferenceProjectItem);
break;
}
}
}
delegate void AddReferenceDelegate(ReferenceProjectItem reference);
void AddReference(ReferenceProjectItem reference)
{
try {
IProjectContent referencedContent = ProjectContentRegistry.GetProjectContentForReference(reference);
if (referencedContent != null) {
referencedContents.Add(referencedContent);
}
} catch (Exception e) {
MessageService.ShowError(e);
}
}
void OnReferenceAdded(object sender, ProjectReferenceEventArgs e)
{
if (e.Project != project) return;
new AddReferenceDelegate(AddReference).BeginInvoke(e.ReferenceProjectItem, null, null);
}
internal int GetInitializationWorkAmount()
{
return project.Items.Count;
}
internal void Initialize2()
{
if (!initializing) return;
int progressStart = StatusBarService.ProgressMonitor.WorkDone;
ParseableFileContentEnumerator enumerator = new ParseableFileContentEnumerator(project);
try {
StatusBarService.ProgressMonitor.TaskName = "Parsing " + project.Name + "...";
while (enumerator.MoveNext()) {
int i = enumerator.Index;
if ((i % 5) == 2)
StatusBarService.ProgressMonitor.WorkDone = progressStart + i;
ParserService.ParseFile(this, enumerator.CurrentFileName, enumerator.CurrentFileContent, true, false);
if (!initializing) return;
}
} finally {
initializing = false;
StatusBarService.ProgressMonitor.WorkDone = progressStart + enumerator.ItemCount;
enumerator.Dispose();
}
}
public void Dispose()
public virtual void Dispose()
{
xmlDoc.Dispose();
ProjectService.ReferenceAdded -= OnReferenceAdded;
initializing = false;
}
public Hashtable AddClassToNamespaceList(IClass addClass)
@ -252,7 +137,7 @@ namespace ICSharpCode.Core @@ -252,7 +137,7 @@ namespace ICSharpCode.Core
}
}
Hashtable AddClassToNamespaceListInternal(IClass addClass)
protected Hashtable AddClassToNamespaceListInternal(IClass addClass)
{
foreach (Dictionary<string, IClass> classes in ClassLists) {
classes[addClass.FullyQualifiedName] = addClass;

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

@ -0,0 +1,117 @@ @@ -0,0 +1,117 @@
using System;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Project;
using ICSharpCode.SharpDevelop.Dom;
namespace ICSharpCode.Core
{
public class ParseProjectContent : DefaultProjectContent
{
internal static ParseProjectContent CreateUninitalized(IProject project)
{
ParseProjectContent newProjectContent = new ParseProjectContent();
newProjectContent.project = project;
newProjectContent.Language = project.LanguageProperties;
newProjectContent.ReferencedContents.Add(ProjectContentRegistry.GetMscorlibContent());
newProjectContent.initializing = true;
return newProjectContent;
}
public static ParseProjectContent Create(IProject project)
{
ParseProjectContent newProjectContent = CreateUninitalized(project);
newProjectContent.Initialize1();
newProjectContent.Initialize2();
return newProjectContent;
}
IProject project;
bool initializing;
public override string ToString()
{
return string.Format("[{0}: {1}]", GetType().Name, project.Name);
}
internal void Initialize1()
{
ProjectItem[] items = project.Items.ToArray();
ProjectService.ReferenceAdded += OnReferenceAdded;
foreach (ProjectItem item in items) {
if (!initializing) return; // abort initialization
switch (item.ItemType) {
case ItemType.Reference:
case ItemType.ProjectReference:
AddReference(item as ReferenceProjectItem);
break;
}
}
}
delegate void AddReferenceDelegate(ReferenceProjectItem reference);
void AddReference(ReferenceProjectItem reference)
{
try {
IProjectContent referencedContent = ProjectContentRegistry.GetProjectContentForReference(reference);
if (referencedContent != null) {
ReferencedContents.Add(referencedContent);
}
if (referencedContent is ReflectionProjectContent) {
((ReflectionProjectContent)referencedContent).InitializeReferences();
}
} catch (Exception e) {
MessageService.ShowError(e);
}
}
void OnReferenceAdded(object sender, ProjectReferenceEventArgs e)
{
if (e.Project != project) return;
new AddReferenceDelegate(AddReference).BeginInvoke(e.ReferenceProjectItem, null, null);
}
internal int GetInitializationWorkAmount()
{
return project.Items.Count;
}
internal void Initialize2()
{
if (!initializing) return;
int progressStart = StatusBarService.ProgressMonitor.WorkDone;
ParseableFileContentEnumerator enumerator = new ParseableFileContentEnumerator(project);
try {
StatusBarService.ProgressMonitor.TaskName = "Parsing " + project.Name + "...";
foreach (IProjectContent referencedContent in ReferencedContents) {
if (referencedContent is ReflectionProjectContent) {
((ReflectionProjectContent)referencedContent).InitializeReferences();
}
}
while (enumerator.MoveNext()) {
int i = enumerator.Index;
if ((i % 5) == 2)
StatusBarService.ProgressMonitor.WorkDone = progressStart + i;
ParserService.ParseFile(this, enumerator.CurrentFileName, enumerator.CurrentFileContent, true, false);
if (!initializing) return;
}
} finally {
initializing = false;
StatusBarService.ProgressMonitor.WorkDone = progressStart + enumerator.ItemCount;
enumerator.Dispose();
}
}
public override void Dispose()
{
ProjectService.ReferenceAdded -= OnReferenceAdded;
initializing = false;
base.Dispose();
}
}
}

13
src/Main/Base/Project/Src/Services/ParserService/ParserService.cs

@ -37,6 +37,7 @@ namespace ICSharpCode.Core @@ -37,6 +37,7 @@ namespace ICSharpCode.Core
static Dictionary<string, ParseInformation> parsings = new Dictionary<string, ParseInformation>();
public static IProjectContent CurrentProjectContent {
[DebuggerStepThrough]
get {
if (forcedContent != null) return forcedContent;
@ -121,23 +122,21 @@ namespace ICSharpCode.Core @@ -121,23 +122,21 @@ namespace ICSharpCode.Core
static void LoadSolutionProjectsInternal()
{
List<DefaultProjectContent> createdContents = new List<DefaultProjectContent>();
List<ParseProjectContent> createdContents = new List<ParseProjectContent>();
foreach (IProject project in ProjectService.OpenSolution.Projects) {
try {
IProjectContent newContent = DefaultProjectContent.CreateUninitalized(project);
ParseProjectContent newContent = ParseProjectContent.CreateUninitalized(project);
lock (projectContents) {
projectContents[project] = newContent;
}
if (newContent is DefaultProjectContent) {
createdContents.Add((DefaultProjectContent)newContent);
}
createdContents.Add(newContent);
} catch (Exception e) {
Console.WriteLine("Error while retrieving project contents from {0}:", project);
ICSharpCode.Core.MessageService.ShowError(e);
}
}
int workAmount = 0;
foreach (DefaultProjectContent newContent in createdContents) {
foreach (ParseProjectContent newContent in createdContents) {
if (abortLoadSolutionProjectsThread) return;
try {
newContent.Initialize1();
@ -148,7 +147,7 @@ namespace ICSharpCode.Core @@ -148,7 +147,7 @@ namespace ICSharpCode.Core
}
}
StatusBarService.ProgressMonitor.BeginTask("Parsing...", workAmount);
foreach (DefaultProjectContent newContent in createdContents) {
foreach (ParseProjectContent newContent in createdContents) {
if (abortLoadSolutionProjectsThread) return;
try {
newContent.Initialize2();

111
src/Main/Base/Project/Src/Services/ParserService/ProjectContentRegistry.cs

@ -5,13 +5,6 @@ using System.Collections; @@ -5,13 +5,6 @@ using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters;
using System.Runtime.Serialization.Formatters.Binary;
using System.Security;
using System.Security.Permissions;
using System.Security.Policy;
using System.Xml;
using System.Text;
@ -22,14 +15,17 @@ using ICSharpCode.SharpDevelop.Dom; @@ -22,14 +15,17 @@ using ICSharpCode.SharpDevelop.Dom;
namespace ICSharpCode.Core
{
public class ProjectContentRegistry
public static class ProjectContentRegistry
{
static Dictionary<string, IProjectContent> contents = new Dictionary<string, IProjectContent>(StringComparer.InvariantCultureIgnoreCase);
static IProjectContent mscorlibContent;
public static IProjectContent GetMscorlibContent()
{
if (mscorlibContent != null) return mscorlibContent;
lock (contents) {
if (contents.ContainsKey("mscorlib")) {
mscorlibContent = contents["mscorlib"];
return contents["mscorlib"];
}
#if DEBUG
@ -37,15 +33,31 @@ namespace ICSharpCode.Core @@ -37,15 +33,31 @@ namespace ICSharpCode.Core
int time = Environment.TickCount;
#endif
contents["mscorlib"] = DefaultProjectContent.Create(typeof(object).Assembly);
mscorlibContent = new ReflectionProjectContent(typeof(object).Assembly);
contents["mscorlib"] = mscorlibContent;
#if DEBUG
Console.WriteLine("mscorlib loaded in {0} ms", Environment.TickCount - time);
#endif
return contents["mscorlib"];
return mscorlibContent;
}
}
public static IProjectContent GetExistingProjectContent(AssemblyName assembly)
{
lock (contents) {
if (contents.ContainsKey(assembly.FullName)) {
return contents[assembly.FullName];
}
if (contents.ContainsKey(assembly.Name)) {
return contents[assembly.Name];
}
return null;
}
}
static string lookupDirectory;
public static IProjectContent GetProjectContentForReference(ReferenceProjectItem item)
{
if (item is ProjectReferenceProjectItem) {
@ -67,27 +79,50 @@ namespace ICSharpCode.Core @@ -67,27 +79,50 @@ namespace ICSharpCode.Core
StatusBarService.ProgressMonitor.BeginTask("Loading " + shortName + "...", 100);
#if DEBUG
int time = Environment.TickCount;
string how = "??";
#endif
Assembly assembly = null;
Assembly assembly = GetDefaultAssembly(shortName);
try {
assembly = Assembly.ReflectionOnlyLoadFrom(item.FileName);
if (assembly != null) {
contents[item.FileName] = DefaultProjectContent.Create(assembly);
return contents[item.FileName];
contents[item.Include] = new ReflectionProjectContent(assembly);
#if DEBUG
how = "typeof";
#endif
return contents[item.Include];
}
lookupDirectory = Path.GetDirectoryName(item.FileName);
AppDomain.CurrentDomain.ReflectionOnlyAssemblyResolve += AssemblyResolve;
try {
assembly = Assembly.ReflectionOnlyLoadFrom(item.FileName);
if (assembly != null) {
contents[item.FileName] = new ReflectionProjectContent(assembly);
#if DEBUG
how = "ReflectionOnly";
#endif
return contents[item.FileName];
}
} finally {
AppDomain.CurrentDomain.ReflectionOnlyAssemblyResolve -= AssemblyResolve;
lookupDirectory = null;
}
} catch (Exception) {
} catch (FileNotFoundException) {
try {
assembly = LoadGACAssembly(item.Include, true);
if (assembly != null) {
contents[item.Include] = DefaultProjectContent.Create(assembly);
contents[item.Include] = new ReflectionProjectContent(assembly);
#if DEBUG
how = "PartialName";
#endif
return contents[item.Include];
}
} catch (Exception e) {
Console.WriteLine("Can't load assembly '{0}' : " + e.Message, item.Include);
}
} catch (BadImageFormatException) {
Console.WriteLine("BadImageFormat: " + shortName);
} finally {
#if DEBUG
Console.WriteLine("Loaded {0} in {1}ms", item.Include, Environment.TickCount - time);
Console.WriteLine("Loaded {0} with {2} in {1}ms", item.Include, Environment.TickCount - time, how);
#endif
StatusBarService.ProgressMonitor.Done();
}
@ -95,6 +130,48 @@ namespace ICSharpCode.Core @@ -95,6 +130,48 @@ namespace ICSharpCode.Core
return null;
}
static Assembly GetDefaultAssembly(string shortName)
{
// GAC Assemblies take some time because first the non-GAC try
// has to fail.
// Therefore, the most assemblies already used by SharpDevelop
// are used directly.
switch (shortName) {
case "System": // System != mscorlib !!!
return typeof(Uri).Assembly;
case "System.Design":
return typeof(System.ComponentModel.Design.DesignSurface).Assembly;
case "System.DirectoryServices":
return typeof(System.DirectoryServices.AuthenticationTypes).Assembly;
case "System.Drawing":
return typeof(System.Drawing.Color).Assembly;
case "System.Web.Services":
return typeof(System.Web.Services.WebService).Assembly;
case "System.Windows.Forms":
return typeof(System.Windows.Forms.Control).Assembly;
case "System.XML":
return typeof(XmlReader).Assembly;
default:
return null;
}
}
static Assembly AssemblyResolve(object sender, ResolveEventArgs e)
{
string shortName = e.Name;
int pos = shortName.IndexOf(',');
if (pos > 0)
shortName = shortName.Substring(0, pos);
string path = Path.Combine(lookupDirectory, shortName);
if (File.Exists(path + ".dll"))
return Assembly.ReflectionOnlyLoadFrom(path + ".dll");
if (File.Exists(path + ".exe"))
return Assembly.ReflectionOnlyLoadFrom(path + ".exe");
if (File.Exists(path))
return Assembly.ReflectionOnlyLoadFrom(path);
return null;
}
public static Assembly LoadGACAssembly(string partialName, bool reflectionOnly)
{
#pragma warning disable 618

60
src/Main/Base/Project/Src/Services/ParserService/ReflectionProjectContent.cs

@ -0,0 +1,60 @@ @@ -0,0 +1,60 @@
using System;
using System.IO;
using System.Threading;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using ICSharpCode.SharpDevelop.Project;
using ICSharpCode.SharpDevelop.Dom;
namespace ICSharpCode.Core
{
public class ReflectionProjectContent : DefaultProjectContent
{
Assembly assembly;
public ReflectionProjectContent(Assembly assembly)
{
this.assembly = assembly;
ICompilationUnit assemblyCompilationUnit = new DefaultCompilationUnit(this);
foreach (Type type in assembly.GetTypes()) {
if (!type.FullName.StartsWith("<") && type.IsPublic) {
AddClassToNamespaceListInternal(new ReflectionClass(assemblyCompilationUnit, type, null));
}
}
string fileName = LookupLocalizedXmlDoc(assembly.Location);
// Not found -> look in runtime directory.
if (fileName == null) {
string runtimeDirectory = System.Runtime.InteropServices.RuntimeEnvironment.GetRuntimeDirectory();
fileName = LookupLocalizedXmlDoc(Path.Combine(runtimeDirectory, Path.GetFileName(assembly.Location)));
}
if (fileName != null) {
xmlDoc = XmlDoc.Load(fileName);
}
}
bool initialized = false;
public void InitializeReferences()
{
if (initialized) return;
initialized = true;
foreach (AssemblyName name in assembly.GetReferencedAssemblies()) {
IProjectContent content = ProjectContentRegistry.GetExistingProjectContent(name);
if (content != null) {
ReferencedContents.Add(content);
}
}
}
public override string ToString()
{
return string.Format("[{0}: {1}]", GetType().Name, assembly.FullName);
}
}
}

1
src/Main/Base/Project/Src/Services/ProjectService/ProjectService.cs

@ -17,6 +17,7 @@ namespace ICSharpCode.SharpDevelop.Project @@ -17,6 +17,7 @@ namespace ICSharpCode.SharpDevelop.Project
}
public static IProject CurrentProject {
[System.Diagnostics.DebuggerStepThrough]
get {
return currentProject;
}

82
src/SharpDevelop.sln

@ -1,35 +1,5 @@ @@ -1,35 +1,5 @@
Microsoft Visual Studio Solution File, Format Version 9.00
# SharpDevelop 2.0.0.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Main", "Main", "{5A3EBEBA-0560-41C1-966B-23F7D03A5486}"
ProjectSection(SolutionItems) = postProject
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.SharpDevelop.Tests", "Main\Base\Test\ICSharpCode.SharpDevelop.Tests.csproj", "{4980B743-B32F-4aba-AABD-45E2CAD3568D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.SharpDevelop", "Main\Base\Project\ICSharpCode.SharpDevelop.csproj", "{2748AD25-9C63-4E12-877B-4DCE96FBED54}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.Core", "Main\Core\Project\ICSharpCode.Core.csproj", "{35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StartUp", "Main\StartUp\Project\StartUp.csproj", "{1152B71B-3C05-4598-B20D-823B5D40559E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.Core.Tests", "Main\Core\Test\ICSharpCode.Core.Tests.csproj", "{AD6FAA08-D6F5-4DBA-AF85-F4DA9F40C3B5}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Libraries", "Libraries", "{9421EDF4-9769-4BE9-B5A6-C87DE221D73C}"
ProjectSection(SolutionItems) = postProject
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nunit.framework.dll", "Tools\NUnit\src\NUnitFramework\framework\nunit.framework.dll.csproj", "{83DD7E12-A705-4DBA-9D71-09C8973D9382}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nunit.core.dll", "Tools\NUnit\src\NUnitFramework\core\nunit.core.dll.csproj", "{EBD43A7F-AFCA-4281-BB53-5CDD91F966A3}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WinFormsUI", "Libraries\DockPanel_Src\WinFormsUI\WinFormsUI.csproj", "{D3C782BA-178E-4235-A3BA-8C11DEBB6BEE}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.TextEditor", "Libraries\ICSharpCode.TextEditor\Project\ICSharpCode.TextEditor.csproj", "{2D18BE89-D210-49EB-A9DD-2246FBB3DF6D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NRefactory", "Libraries\NRefactory\Project\NRefactory.csproj", "{3A9AE6AA-BC07-4A2F-972C-581E3AE2F195}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nunit.extensions.dll", "Tools\NUnit\src\NUnitFramework\extensions\nunit.extensions.dll.csproj", "{98B10E98-003C-45A0-9587-119142E39986}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "AddIns", "AddIns", "{14A277EE-7DF1-4529-B639-7D1EF334C1C5}"
ProjectSection(SolutionItems) = postProject
EndProjectSection
@ -78,6 +48,36 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StartPage", "AddIns\Misc\St @@ -78,6 +48,36 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StartPage", "AddIns\Misc\St
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AddinScout", "AddIns\Misc\AddinScout\Project\AddinScout.csproj", "{4B8F0F98-8BE1-402B-AA8B-C8D548577B38}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Libraries", "Libraries", "{9421EDF4-9769-4BE9-B5A6-C87DE221D73C}"
ProjectSection(SolutionItems) = postProject
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nunit.framework.dll", "Tools\NUnit\src\NUnitFramework\framework\nunit.framework.dll.csproj", "{83DD7E12-A705-4DBA-9D71-09C8973D9382}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nunit.core.dll", "Tools\NUnit\src\NUnitFramework\core\nunit.core.dll.csproj", "{EBD43A7F-AFCA-4281-BB53-5CDD91F966A3}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WinFormsUI", "Libraries\DockPanel_Src\WinFormsUI\WinFormsUI.csproj", "{D3C782BA-178E-4235-A3BA-8C11DEBB6BEE}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.TextEditor", "Libraries\ICSharpCode.TextEditor\Project\ICSharpCode.TextEditor.csproj", "{2D18BE89-D210-49EB-A9DD-2246FBB3DF6D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NRefactory", "Libraries\NRefactory\Project\NRefactory.csproj", "{3A9AE6AA-BC07-4A2F-972C-581E3AE2F195}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nunit.extensions.dll", "Tools\NUnit\src\NUnitFramework\extensions\nunit.extensions.dll.csproj", "{98B10E98-003C-45A0-9587-119142E39986}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Main", "Main", "{5A3EBEBA-0560-41C1-966B-23F7D03A5486}"
ProjectSection(SolutionItems) = postProject
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.SharpDevelop.Tests", "Main\Base\Test\ICSharpCode.SharpDevelop.Tests.csproj", "{4980B743-B32F-4aba-AABD-45E2CAD3568D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.SharpDevelop", "Main\Base\Project\ICSharpCode.SharpDevelop.csproj", "{2748AD25-9C63-4E12-877B-4DCE96FBED54}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.Core", "Main\Core\Project\ICSharpCode.Core.csproj", "{35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StartUp", "Main\StartUp\Project\StartUp.csproj", "{1152B71B-3C05-4598-B20D-823B5D40559E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.Core.Tests", "Main\Core\Test\ICSharpCode.Core.Tests.csproj", "{AD6FAA08-D6F5-4DBA-AF85-F4DA9F40C3B5}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -159,17 +159,6 @@ Global @@ -159,17 +159,6 @@ Global
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{AD6FAA08-D6F5-4DBA-AF85-F4DA9F40C3B5} = {5A3EBEBA-0560-41C1-966B-23F7D03A5486}
{1152B71B-3C05-4598-B20D-823B5D40559E} = {5A3EBEBA-0560-41C1-966B-23F7D03A5486}
{35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} = {5A3EBEBA-0560-41C1-966B-23F7D03A5486}
{2748AD25-9C63-4E12-877B-4DCE96FBED54} = {5A3EBEBA-0560-41C1-966B-23F7D03A5486}
{4980B743-B32F-4aba-AABD-45E2CAD3568D} = {5A3EBEBA-0560-41C1-966B-23F7D03A5486}
{98B10E98-003C-45A0-9587-119142E39986} = {9421EDF4-9769-4BE9-B5A6-C87DE221D73C}
{3A9AE6AA-BC07-4A2F-972C-581E3AE2F195} = {9421EDF4-9769-4BE9-B5A6-C87DE221D73C}
{2D18BE89-D210-49EB-A9DD-2246FBB3DF6D} = {9421EDF4-9769-4BE9-B5A6-C87DE221D73C}
{D3C782BA-178E-4235-A3BA-8C11DEBB6BEE} = {9421EDF4-9769-4BE9-B5A6-C87DE221D73C}
{EBD43A7F-AFCA-4281-BB53-5CDD91F966A3} = {9421EDF4-9769-4BE9-B5A6-C87DE221D73C}
{83DD7E12-A705-4DBA-9D71-09C8973D9382} = {9421EDF4-9769-4BE9-B5A6-C87DE221D73C}
{CE5B42B7-6E8C-4385-9E97-F4023FC16BF2} = {14A277EE-7DF1-4529-B639-7D1EF334C1C5}
{FEB825FA-4AD8-425D-8E4A-B5A18EE1B81C} = {14A277EE-7DF1-4529-B639-7D1EF334C1C5}
{4EA396ED-64AD-4AD0-A67A-AB363F3E0C79} = {14A277EE-7DF1-4529-B639-7D1EF334C1C5}
@ -188,5 +177,16 @@ Global @@ -188,5 +177,16 @@ Global
{B08385CD-F0CC-488C-B4F4-EEB34B6D2688} = {6604365C-C702-4C10-9BA8-637F1E3D4D0D}
{1D18D788-F7EE-4585-A23B-34DC8EC63CB8} = {6604365C-C702-4C10-9BA8-637F1E3D4D0D}
{EC06F96A-AEEC-49D6-B03D-AB87C6EB674C} = {6604365C-C702-4C10-9BA8-637F1E3D4D0D}
{98B10E98-003C-45A0-9587-119142E39986} = {9421EDF4-9769-4BE9-B5A6-C87DE221D73C}
{3A9AE6AA-BC07-4A2F-972C-581E3AE2F195} = {9421EDF4-9769-4BE9-B5A6-C87DE221D73C}
{2D18BE89-D210-49EB-A9DD-2246FBB3DF6D} = {9421EDF4-9769-4BE9-B5A6-C87DE221D73C}
{D3C782BA-178E-4235-A3BA-8C11DEBB6BEE} = {9421EDF4-9769-4BE9-B5A6-C87DE221D73C}
{EBD43A7F-AFCA-4281-BB53-5CDD91F966A3} = {9421EDF4-9769-4BE9-B5A6-C87DE221D73C}
{83DD7E12-A705-4DBA-9D71-09C8973D9382} = {9421EDF4-9769-4BE9-B5A6-C87DE221D73C}
{AD6FAA08-D6F5-4DBA-AF85-F4DA9F40C3B5} = {5A3EBEBA-0560-41C1-966B-23F7D03A5486}
{1152B71B-3C05-4598-B20D-823B5D40559E} = {5A3EBEBA-0560-41C1-966B-23F7D03A5486}
{35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} = {5A3EBEBA-0560-41C1-966B-23F7D03A5486}
{2748AD25-9C63-4E12-877B-4DCE96FBED54} = {5A3EBEBA-0560-41C1-966B-23F7D03A5486}
{4980B743-B32F-4aba-AABD-45E2CAD3568D} = {5A3EBEBA-0560-41C1-966B-23F7D03A5486}
EndGlobalSection
EndGlobal

Loading…
Cancel
Save