Skip to content

Commit

Permalink
Closes #4097
Browse files Browse the repository at this point in the history
  • Loading branch information
mansellan committed Jun 16, 2018
1 parent c5bb40f commit 1addfae
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 20 deletions.
2 changes: 1 addition & 1 deletion Rubberduck.Parsing/Rewriter/MemberAttributesRewriter.cs
Expand Up @@ -39,7 +39,7 @@ public override void Rewrite()
return;
}

var file = vbeKind == VBEKind.Embedded
var file = vbeKind == VBEKind.Hosted
? _exporter.Export(component)
: component.GetFileName(1);

Expand Down
19 changes: 11 additions & 8 deletions Rubberduck.Parsing/VBA/AttributeParser.cs
Expand Up @@ -37,7 +37,7 @@ public AttributeParser(IModuleExporter exporter, Func<IVBAPreprocessor> preproce
cancellationToken.ThrowIfCancellationRequested();
var component = _projectsProvider.Component(module);

var path = component.VBE.Kind == VBEKind.Embedded
var path = component.VBE.Kind == VBEKind.Hosted
? _exporter.Export(component)
: component.GetFileName(1);

Expand All @@ -57,15 +57,18 @@ public AttributeParser(IModuleExporter exporter, Func<IVBAPreprocessor> preproce
code = File.ReadAllText(path, Encoding.Default); //The VBE exports encoded in the current ANSI codepage from the windows settings.
}

try
if (component.VBE.Kind == VBEKind.Hosted)
{
File.Delete(path);
try
{
File.Delete(path);
}
catch
{
// Meh.
}
}
catch
{
// Meh.
}


cancellationToken.ThrowIfCancellationRequested();

var type = module.ComponentType == ComponentType.StandardModule
Expand Down
18 changes: 8 additions & 10 deletions Rubberduck.VBEEditor/SafeComWrappers/VB/Enums/VBEKind.cs
@@ -1,17 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Rubberduck.VBEditor.SafeComWrappers
namespace Rubberduck.VBEditor.SafeComWrappers
{
public enum VBEKind
{
/// <summary>Embedded VB editor (Visual Basic for Applications).</summary>
Embedded,
/// <summary>
/// Hosted VB editor (Visual Basic for Applications).
/// </summary>
Hosted,

/// <summary>Standalone VB editor (Visual Basic).</summary>
/// <summary>
/// Standalone VB editor (Visual Basic).
/// </summary>
Standalone
}
}
2 changes: 1 addition & 1 deletion Rubberduck.VBEditor.VBA/SafeComWrappers/VB/VBE.cs
Expand Up @@ -19,7 +19,7 @@ public VBE(VB.VBE target, bool rewrapping = false)
{
}

public VBEKind Kind => VBEKind.Embedded;
public VBEKind Kind => VBEKind.Hosted;
public object HardReference => Target;

public string Version => IsWrappingNullReference ? string.Empty : Target.Version;
Expand Down

0 comments on commit 1addfae

Please sign in to comment.