Skip to content

Commit fbc3345

Browse files
committed
Fix Application.Run call for CorelDraw host.
1 parent ed1f15e commit fbc3345

File tree

2 files changed

+16
-9
lines changed

2 files changed

+16
-9
lines changed

Rubberduck.VBEEditor/Application/CorelDRAWApp.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public CorelDRAWApp(IVBE vbe) : base(vbe, "CorelDRAW") { }
1515

1616
public override void Run(QualifiedMemberName qualifiedMemberName)
1717
{
18-
var projectName = qualifiedMemberName.QualifiedModuleName.ProjectId;
18+
var projectName = qualifiedMemberName.QualifiedModuleName.ProjectName;
1919
var memberName = qualifiedMemberName.QualifiedModuleName.ComponentName + "." + qualifiedMemberName.MemberName;
2020

2121
if (Application != null)

Rubberduck.VBEEditor/QualifiedModuleName.cs

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,22 @@ namespace Rubberduck.VBEditor
1010
/// </summary>
1111
public struct QualifiedModuleName
1212
{
13-
public static string GetProjectId(IVBProject project)
13+
public static Guid GetProjectId(IVBProject project)
1414
{
1515
if (project.IsWrappingNullReference)
1616
{
17-
return string.Empty;
17+
return Guid.Empty;
1818
}
1919

2020
if (string.IsNullOrEmpty(project.HelpFile))
2121
{
22-
project.HelpFile = project.GetHashCode().ToString();
22+
project.HelpFile = GetGuidFromHashCode(project.GetHashCode()).ToString();
2323
}
2424

25-
return project.HelpFile;
25+
return new Guid(project.HelpFile);
2626
}
2727

28-
public static string GetProjectId(IReference reference)
28+
public static Guid GetProjectId(IReference reference)
2929
{
3030
var projectName = reference.Name;
3131
return new QualifiedModuleName(projectName, reference.FullPath, projectName).ProjectId;
@@ -90,7 +90,7 @@ public QualifiedModuleName(string projectName, string projectPath, string compon
9090
_projectName = projectName;
9191
_projectDisplayName = null;
9292
_projectPath = projectPath;
93-
_projectId = string.Format("{0};{1}", _projectName, _projectPath).GetHashCode().ToString();
93+
_projectId = GetGuidFromHashCode(string.Format("{0};{1}", _projectName, _projectPath).GetHashCode());
9494
_componentName = componentName;
9595
_component = null;
9696
_componentType = ComponentType.ComComponent;
@@ -114,8 +114,8 @@ public QualifiedMemberName QualifyMemberName(string member)
114114
private readonly int _contentHashCode;
115115
public int ContentHashCode { get { return _contentHashCode; } }
116116

117-
private readonly string _projectId;
118-
public string ProjectId { get { return _projectId; } }
117+
private readonly Guid _projectId;
118+
public Guid ProjectId { get { return _projectId; } }
119119

120120
private readonly string _componentName;
121121
public string ComponentName { get { return _componentName ?? string.Empty; } }
@@ -209,5 +209,12 @@ public override bool Equals(object obj)
209209
{
210210
return !a.Equals(b);
211211
}
212+
213+
// Start all project IDs with the Rubberduck GUID as defined in AssemblyInfo.cs, add hashcode as last 12 bytes.
214+
private const string ProjectGuidFormat = "E07C841C-14B4-4890-83E9-{0}";
215+
public static Guid GetGuidFromHashCode(int hash)
216+
{
217+
return new Guid(string.Format(ProjectGuidFormat, hash.ToString("X12")));
218+
}
212219
}
213220
}

0 commit comments

Comments
 (0)