Browse Source

Lookup XmlDoc for XNA references.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/2.1@2611 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 19 years ago
parent
commit
c8f31d4b3a
  1. 37
      src/Main/Base/Project/Src/Services/ParserService/DomHostCallback.cs
  2. 29
      src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/ProjectContent/ReflectionProjectContent.cs
  3. 8
      src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/XmlDoc.cs

37
src/Main/Base/Project/Src/Services/ParserService/DomHostCallback.cs

@ -6,6 +6,8 @@
// </file> // </file>
using System; using System;
using System.IO;
using Microsoft.Win32;
using ICSharpCode.Core; using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Dom; using ICSharpCode.SharpDevelop.Dom;
using ICSharpCode.SharpDevelop.Gui; using ICSharpCode.SharpDevelop.Gui;
@ -45,6 +47,13 @@ namespace ICSharpCode.SharpDevelop
}; };
HostCallback.InitializeCodeGeneratorOptions = AmbienceService.InitializeCodeGeneratorOptions; HostCallback.InitializeCodeGeneratorOptions = AmbienceService.InitializeCodeGeneratorOptions;
string dir = WinFXReferenceDirectory;
if (!string.IsNullOrEmpty(dir))
XmlDoc.XmlDocLookupDirectories.Add(dir);
dir = XNAReferenceDirectory;
if (!string.IsNullOrEmpty(dir))
XmlDoc.XmlDocLookupDirectories.Add(dir);
} }
static void ShowAssemblyLoadError(string fileName, string include, string message) static void ShowAssemblyLoadError(string fileName, string include, string message)
@ -57,5 +66,33 @@ namespace ICSharpCode.SharpDevelop
) + "\r\n" + message + "\r\n" ) + "\r\n" + message + "\r\n"
); );
} }
static string WinFXReferenceDirectory {
get {
RegistryKey k = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.0\Setup\Windows Communication Foundation");
if (k == null)
return null;
object o = k.GetValue("ReferenceInstallPath");
k.Close();
if (o == null)
return null;
else
return o.ToString();
}
}
static string XNAReferenceDirectory {
get {
RegistryKey k = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\XNA\Game Studio Express\v1.0");
if (k == null)
return null;
object o = k.GetValue("InstallPath");
k.Close();
if (o == null)
return null;
else
return Path.Combine(o.ToString(), @"References\Windows\x86");
}
}
} }
} }

29
src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/ProjectContent/ReflectionProjectContent.cs

@ -9,7 +9,6 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Reflection; using System.Reflection;
using Microsoft.Win32;
using ICSharpCode.SharpDevelop.Dom.ReflectionLayer; using ICSharpCode.SharpDevelop.Dom.ReflectionLayer;
@ -116,16 +115,12 @@ namespace ICSharpCode.SharpDevelop.Dom
} }
string fileName = LookupLocalizedXmlDoc(assemblyLocation); string fileName = LookupLocalizedXmlDoc(assemblyLocation);
// Not found -> look in runtime directory.
if (fileName == null) { if (fileName == null) {
string runtimeDirectory = System.Runtime.InteropServices.RuntimeEnvironment.GetRuntimeDirectory(); // Not found -> look in other directories:
fileName = LookupLocalizedXmlDoc(Path.Combine(runtimeDirectory, Path.GetFileName(assemblyLocation))); foreach (string testDirectory in XmlDoc.XmlDocLookupDirectories) {
} fileName = LookupLocalizedXmlDoc(Path.Combine(testDirectory, Path.GetFileName(assemblyLocation)));
if (fileName == null) { if (fileName != null)
// still not found -> look in WinFX reference directory break;
string referenceDirectory = WinFXReferenceDirectory;
if (!string.IsNullOrEmpty(referenceDirectory)) {
fileName = LookupLocalizedXmlDoc(Path.Combine(referenceDirectory, Path.GetFileName(assemblyLocation)));
} }
} }
@ -134,20 +129,6 @@ namespace ICSharpCode.SharpDevelop.Dom
} }
} }
static string WinFXReferenceDirectory {
get {
RegistryKey k = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.0\Setup\Windows Communication Foundation");
if (k == null)
return null;
object o = k.GetValue("ReferenceInstallPath");
k.Close();
if (o == null)
return null;
else
return o.ToString();
}
}
public void InitializeSpecialClasses() public void InitializeSpecialClasses()
{ {
if (GetClassInternal(VoidClass.VoidName, 0, Language) != null) { if (GetClassInternal(VoidClass.VoidName, 0, Language) != null) {

8
src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/XmlDoc.cs

@ -18,6 +18,14 @@ namespace ICSharpCode.SharpDevelop.Dom
/// </summary> /// </summary>
public sealed class XmlDoc : IDisposable public sealed class XmlDoc : IDisposable
{ {
static readonly List<string> xmlDocLookupDirectories = new List<string>(
new string[] { System.Runtime.InteropServices.RuntimeEnvironment.GetRuntimeDirectory() }
);
public static IList<string> XmlDocLookupDirectories {
get { return xmlDocLookupDirectories; }
}
struct IndexEntry : IComparable<IndexEntry> struct IndexEntry : IComparable<IndexEntry>
{ {
public int HashCode; public int HashCode;

Loading…
Cancel
Save