Skip to content

Commit 14f1513

Browse files
authored
Merge pull request #3516 from IvenBach/next
2 parents d9ac266 + 0b26a8d commit 14f1513

File tree

8 files changed

+44
-13
lines changed

8 files changed

+44
-13
lines changed

Rubberduck.VBEEditor/SafeComWrappers/Office.Core/CommandBarButton.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public event EventHandler<CommandBarButtonClickEventArgs> Click
3333
((Microsoft.Office.Core.CommandBarButton)Target).Click += Target_Click;
3434
}
3535
_clickHandler += value;
36-
System.Diagnostics.Debug.WriteLine("Added handler for: {0} '{1}' (tag: {2}, hashcode:{3})", Parent.Name, Target.Caption, Tag, Target.GetHashCode());
36+
System.Diagnostics.Debug.WriteLine($"Added handler for: {Parent.Name} '{Target.Caption}' (tag: {Tag}, hashcode:{Target.GetHashCode()})");
3737
}
3838
remove
3939
{
@@ -49,7 +49,7 @@ public event EventHandler<CommandBarButtonClickEventArgs> Click
4949
{
5050
// he's gone, dave.
5151
}
52-
System.Diagnostics.Debug.WriteLine("Removed handler for: {0} '{1}' (tag: {2}, hashcode:{3})", Parent.GetType().Name, Target.Caption, Tag, Target.GetHashCode());
52+
System.Diagnostics.Debug.WriteLine($"Removed handler for: {Parent.GetType().Name} '{Target.Caption}' (tag: {Tag}, hashcode:{Target.GetHashCode()})");
5353
}
5454
}
5555

@@ -64,7 +64,7 @@ private void Target_Click(Microsoft.Office.Core.CommandBarButton ctrl, ref bool
6464
System.Diagnostics.Debug.Assert(handler.GetInvocationList().Length == 1, "Multicast delegate is registered more than once.");
6565

6666
//note: event is fired for every parent the command exists under. not sure why.
67-
System.Diagnostics.Debug.WriteLine("Executing handler for: {0} '{1}' (tag: {2}, hashcode:{3})", Parent.GetType().Name, Target.Caption, Tag, Target.GetHashCode());
67+
System.Diagnostics.Debug.WriteLine($"Executing handler for: {Parent.GetType().Name} '{Target.Caption}' (tag: {Tag}, hashcode:{Target.GetHashCode()})");
6868

6969
var button = new CommandBarButton(ctrl);
7070
var args = new CommandBarButtonClickEventArgs(button);

Rubberduck.VBEEditor/SafeComWrappers/VB6/Reference.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public int Minor
3232

3333
public string Version
3434
{
35-
get { return string.Format("{0}.{1}", Major, Minor); }
35+
get { return string.Format($"{Major}.{Minor}"); }
3636
}
3737

3838
public string Description

Rubberduck.VBEEditor/SafeComWrappers/VB6/VBProjects.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,10 @@ public IVBProject Add(ProjectType type)
3838

3939
public void Remove(IVBProject project)
4040
{
41-
if (IsWrappingNullReference) return;
41+
if (IsWrappingNullReference)
42+
{
43+
return;
44+
}
4245
Target.Remove((VB.VBProject)project.Target);
4346
}
4447

Rubberduck.VBEEditor/SafeComWrappers/VBA/LinkedWindows.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,21 @@ public LinkedWindows(VB.LinkedWindows linkedWindows)
2222

2323
public void Remove(IWindow window)
2424
{
25-
if (IsWrappingNullReference) return;
25+
if (IsWrappingNullReference)
26+
{
27+
return;
28+
}
29+
2630
Target.Remove(((Window)window).Target);
2731
}
2832

2933
public void Add(IWindow window)
3034
{
31-
if (IsWrappingNullReference) return;
35+
if (IsWrappingNullReference)
36+
{
37+
return;
38+
}
39+
3240
Target.Add(((Window)window).Target);
3341
}
3442

Rubberduck.VBEEditor/SafeComWrappers/VBA/Property.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,10 @@ public object GetIndexedValue(object index1, object index2 = null, object index3
4040

4141
public void SetIndexedValue(object value, object index1, object index2 = null, object index3 = null, object index4 = null)
4242
{
43-
if (!IsWrappingNullReference) Target.set_IndexedValue(index1, index2, index3, index4, value);
43+
if (!IsWrappingNullReference)
44+
{
45+
Target.set_IndexedValue(index1, index2, index3, index4, value);
46+
}
4447
}
4548

4649
/// <summary>

Rubberduck.VBEEditor/SafeComWrappers/VBA/Reference.cs

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public int Minor
3232

3333
public string Version
3434
{
35-
get { return string.Format("{0}.{1}", Major, Minor); }
35+
get { return string.Format($"{Major}.{Minor}"); }
3636
}
3737

3838
public string Description
@@ -42,7 +42,18 @@ public string Description
4242

4343
public string FullPath
4444
{
45-
get { return IsBroken ? string.Empty : Target.FullPath; }
45+
get
46+
{
47+
try
48+
{
49+
return IsBroken ? string.Empty : Target.FullPath;
50+
}
51+
catch (System.Runtime.InteropServices.COMException)
52+
{
53+
54+
return string.Empty;
55+
}
56+
}
4657
}
4758

4859
public bool IsBuiltIn
@@ -92,4 +103,4 @@ public override int GetHashCode()
92103
return IsBroken ? 0 : HashCode.Compute(Type, Name, Guid, FullPath, Major, Minor);
93104
}
94105
}
95-
}
106+
}

Rubberduck.VBEEditor/SafeComWrappers/VBA/VBE.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,10 @@ public IWindow ActiveMDIChild()
285285
public bool HostSupportsUnitTests()
286286
{
287287
var host = Path.GetFileName(System.Windows.Forms.Application.ExecutablePath).ToUpperInvariant();
288-
if (HostAppMap.ContainsKey(host)) return true;
288+
if (HostAppMap.ContainsKey(host))
289+
{
290+
return true;
291+
}
289292
//Guessing the above will work like 99.9999% of the time for supported applications.
290293

291294
var project = ActiveVBProject;

Rubberduck.VBEEditor/SafeComWrappers/VBA/VBProjects.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,10 @@ public IVBProject Add(ProjectType type)
4343

4444
public void Remove(IVBProject project)
4545
{
46-
if (IsWrappingNullReference) return;
46+
if (IsWrappingNullReference)
47+
{
48+
return;
49+
}
4750
Target.Remove((VB.VBProject) project.Target);
4851
}
4952

0 commit comments

Comments
 (0)