Browse Source

Applied patch by Christian Hornung: Forms designer resource loading

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@1129 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 20 years ago
parent
commit
ae64d1e72e
  1. 22
      src/AddIns/DisplayBindings/FormsDesigner/Project/Src/Services/DesignerResourceService.cs

22
src/AddIns/DisplayBindings/FormsDesigner/Project/Src/Services/DesignerResourceService.cs

@ -257,9 +257,25 @@ namespace ICSharpCode.FormsDesigner.Services @@ -257,9 +257,25 @@ namespace ICSharpCode.FormsDesigner.Services
resourceFileName = new StringBuilder(Path.GetTempPath());
}
resourceFileName.Append(Path.DirectorySeparatorChar);
string sourceFileName = Path.GetFileNameWithoutExtension(this.FileName);
if (sourceFileName != null && sourceFileName.ToLowerInvariant().EndsWith(".designer")) {
sourceFileName = sourceFileName.Substring(0, sourceFileName.Length - 9);
string sourceFileName = null;
if (project != null && this.FileName != null) {
// Try to find the source file name by using the project dependencies first.
FileProjectItem sourceItem = project.Items.Find(delegate(ProjectItem item) {
FileProjectItem fpi = item as FileProjectItem;
return fpi != null && fpi.FileName != null && FileUtility.IsEqualFileName(fpi.FileName, this.FileName);
}) as FileProjectItem;
if (sourceItem != null && sourceItem.DependentUpon != null && sourceItem.DependentUpon.Length > 0) {
sourceFileName = Path.GetFileNameWithoutExtension(sourceItem.DependentUpon);
}
}
if (sourceFileName == null) {
// If the source file name cannot be found using the project dependencies,
// assume the resource file name to be equal to the current source file name.
// Remove the ".Designer" part if present.
sourceFileName = Path.GetFileNameWithoutExtension(this.FileName);
if (sourceFileName != null && sourceFileName.ToLowerInvariant().EndsWith(".designer")) {
sourceFileName = sourceFileName.Substring(0, sourceFileName.Length - 9);
}
}
resourceFileName.Append(sourceFileName);

Loading…
Cancel
Save