Browse Source

Revert two forms designer files that shouldn't be committed...

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@976 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 20 years ago
parent
commit
7029bc66cf
  1. 8
      src/AddIns/DisplayBindings/FormsDesigner/Project/Src/Gui/CustomComponentsSideTab.cs
  2. 64
      src/AddIns/DisplayBindings/FormsDesigner/Project/Src/Services/TypeResolutionService.cs

8
src/AddIns/DisplayBindings/FormsDesigner/Project/Src/Gui/CustomComponentsSideTab.cs

@ -81,7 +81,7 @@ namespace ICSharpCode.FormsDesigner.Gui @@ -81,7 +81,7 @@ namespace ICSharpCode.FormsDesigner.Gui
{
string className;
IProjectContent assemblyLocation;
Assembly usedAssembly = null;
bool initialized;
public CustomComponentToolBoxItem(IClass c)
{
@ -93,12 +93,14 @@ namespace ICSharpCode.FormsDesigner.Gui @@ -93,12 +93,14 @@ namespace ICSharpCode.FormsDesigner.Gui
void Init()
{
if (initialized)
return;
initialized = true;
LoggingService.Debug("Initializing MyToolBoxItem: " + className);
if (assemblyLocation != null) {
Assembly asm = TypeResolutionService.LoadAssembly(assemblyLocation);
if (asm != null && usedAssembly != asm) {
if (asm != null) {
Initialize(asm.GetType(className));
usedAssembly = asm;
}
}
}

64
src/AddIns/DisplayBindings/FormsDesigner/Project/Src/Services/TypeResolutionService.cs

@ -26,9 +26,7 @@ namespace ICSharpCode.FormsDesigner.Services @@ -26,9 +26,7 @@ namespace ICSharpCode.FormsDesigner.Services
public class TypeResolutionService : ITypeResolutionService
{
readonly static List<Assembly> designerAssemblies = new List<Assembly>();
/// <summary>
/// string "filename:size" -> Assembly
/// </summary>
// hash of file content -> Assembly
readonly static Dictionary<string, Assembly> assemblyDict = new Dictionary<string, Assembly>();
/// <summary>
@ -139,8 +137,7 @@ namespace ICSharpCode.FormsDesigner.Services @@ -139,8 +137,7 @@ namespace ICSharpCode.FormsDesigner.Services
if (!File.Exists(fileName))
return null;
byte[] data = File.ReadAllBytes(fileName);
string hash = fileName + ":" + File.GetLastWriteTimeUtc(fileName);
string hash;
using (HashFunction hashFunction = new HashFunction()) {
hash = Convert.ToBase64String(hashFunction.ComputeHash(data));
}
@ -265,11 +262,18 @@ namespace ICSharpCode.FormsDesigner.Services @@ -265,11 +262,18 @@ namespace ICSharpCode.FormsDesigner.Services
return null;
}
try {
lock (designerAssemblies) {
foreach (Assembly asm in DesignerAssemblies) {
Type t = asm.GetType(name, false);
if (t != null) {
return t;
}
}
}
Type type = null;
int idx = name.IndexOf(",");
Type type = Type.GetType(name, false, ignoreCase);
if (idx < 0) {
if (type == null) {
IProjectContent pc = this.CallingProject;
if (pc != null) {
IClass foundClass = pc.GetClass(name);
@ -283,34 +287,26 @@ namespace ICSharpCode.FormsDesigner.Services @@ -283,34 +287,26 @@ namespace ICSharpCode.FormsDesigner.Services
}
// type lookup for typename, assembly, xyz style lookups
if (type == null && idx > 0) {
string[] splitName = name.Split(',');
string typeName = splitName[0];
string assemblyName = splitName[1].Substring(1);
Assembly assembly = null;
try {
assembly = Assembly.Load(assemblyName);
} catch (Exception e) {
LoggingService.Error(e);
}
if (assembly != null) {
lock (designerAssemblies) {
if (!designerAssemblies.Contains(assembly))
designerAssemblies.Add(assembly);
}
type = assembly.GetType(typeName, false, ignoreCase);
} else {
type = Type.GetType(typeName, false, ignoreCase);
}
}
if (type == null) {
lock (designerAssemblies) {
foreach (Assembly asm in DesignerAssemblies) {
Type t = asm.GetType(name, false);
if (t != null) {
return t;
int idx = name.IndexOf(",");
if (idx > 0) {
string[] splitName = name.Split(',');
string typeName = splitName[0];
string assemblyName = splitName[1].Substring(1);
Assembly assembly = null;
try {
assembly = Assembly.Load(assemblyName);
} catch (Exception e) {
LoggingService.Error(e);
}
if (assembly != null) {
lock (designerAssemblies) {
if (!designerAssemblies.Contains(assembly))
designerAssemblies.Add(assembly);
}
type = assembly.GetType(typeName, false, ignoreCase);
} else {
type = Type.GetType(typeName, false, ignoreCase);
}
}
}

Loading…
Cancel
Save