Skip to content

Commit

Permalink
Clean up the botched merge
Browse files Browse the repository at this point in the history
  • Loading branch information
bclothier committed Mar 14, 2018
1 parent 8575191 commit b6cc24e
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 28 deletions.
3 changes: 0 additions & 3 deletions Rubberduck.Core/Rubberduck.Core.csproj
Expand Up @@ -475,9 +475,6 @@
<Compile Include="UnitTesting\IFakes.cs" />
<Compile Include="UnitTesting\ReturnTypeConverter.cs" />
<Compile Include="UnitTesting\PermissiveObjectComparer.cs" />
<Compile Include="VBERuntime\RegistryWrapper.cs" />
<Compile Include="VBERuntime\IVBESettings.cs" />
<Compile Include="VBERuntime\VBESettings.cs" />
<Compile Include="VersionCheck\IVersionCheck.cs" />
<Compile Include="UI\Command\MenuItems\CommandBars\AppCommandBarBase.cs" />
<Compile Include="UI\Command\MenuItems\CommandBars\ContextSelectionLabelMenuItem.cs" />
Expand Down
3 changes: 1 addition & 2 deletions Rubberduck.Core/UI/Settings/SettingsForm.cs
@@ -1,10 +1,9 @@
using System.Windows.Forms;
using Rubberduck.Settings;
using Rubberduck.Common;
using Rubberduck.VBERuntime;
using Rubberduck.VBEditor.VBERuntime.Settings;
using System.Collections.Generic;
using System;
using System.Collections.ObjectModel;

namespace Rubberduck.UI.Settings
{
Expand Down
@@ -1,6 +1,6 @@
using Microsoft.Win32;
using Microsoft.Win32;

namespace Rubberduck.VBERuntime
namespace Rubberduck.VBEditor.Utility
{
public interface IRegistryWrapper
{
Expand Down
@@ -1,8 +1,8 @@
namespace Rubberduck.VBERuntime
namespace Rubberduck.VBEditor.VBERuntime.Settings
{
public interface IVBESettings
{
VBESettings.DllVersion Version { get; }
DllVersion Version { get; }
bool CompileOnDemand { get; set; }
bool BackGroundCompile { get; set; }
}
Expand Down
@@ -1,36 +1,30 @@
using System;
using Microsoft.Win32;
using Rubberduck.VBEditor.SafeComWrappers.Abstract;
using Rubberduck.VBEditor.Utility;

namespace Rubberduck.VBERuntime
namespace Rubberduck.VBEditor.VBERuntime.Settings
{
public class VBESettings : IVBESettings
{
private const string Vbe7SettingPath = @"HKEY_CURRENT_USER\Software\Microsoft\VBA\7.0\Common";
private const string Vbe6SettingPath = @"HKEY_CURRENT_USER\Software\Microsoft\VBA\6.0\Common";

public enum DllVersion
{
Unknown,
Vbe6,
Vbe7
}

private readonly IRegistryWrapper _registry;
private readonly string _activeRegistryRootPath;
private readonly string[] _registryRootPaths = {Vbe7SettingPath, Vbe6SettingPath};
private readonly string[] _registryRootPaths = { Vbe7SettingPath, Vbe6SettingPath };

public VBESettings(IVBE vbe, IRegistryWrapper registry)
{
try
{
switch (int.Parse(vbe.Version.Split('.')[0]))
switch (VBEDllVersion.GetCurrentVersion(vbe))
{
case 6:
case DllVersion.Vbe6:
Version = DllVersion.Vbe6;
_activeRegistryRootPath = Vbe6SettingPath;
break;
case 7:
case DllVersion.Vbe7:
Version = DllVersion.Vbe7;
_activeRegistryRootPath = Vbe7SettingPath;
break;
Expand Down Expand Up @@ -83,7 +77,7 @@ private void WriteAllRegistryPaths(string keyName, bool value)
private bool? DWordToBooleanConverter(string path, string keyName)
{
return !(_registry.GetValue(path, keyName, DWordFalseValue) is int result)
? (bool?) null
? (bool?)null
: Convert.ToBoolean(result);
}

Expand Down
2 changes: 1 addition & 1 deletion RubberduckTests/Settings/GeneralSettingsTests.cs
Expand Up @@ -7,7 +7,7 @@
using Rubberduck.Common;
using Moq;
using Rubberduck.UI;
using Rubberduck.VBERuntime;
using Rubberduck.VBEditor.VBERuntime.Settings;
using System;

namespace RubberduckTests.Settings
Expand Down
12 changes: 7 additions & 5 deletions RubberduckTests/VBE/VBESettingsTests.cs
@@ -1,7 +1,9 @@
using Microsoft.Win32;
using Moq;
using NUnit.Framework;
using Rubberduck.VBERuntime;
using Rubberduck.VBEditor.Utility;
using Rubberduck.VBEditor.VBERuntime;
using Rubberduck.VBEditor.VBERuntime.Settings;
using RubberduckTests.Mocks;

namespace RubberduckTests.VBE
Expand Down Expand Up @@ -29,7 +31,7 @@ public void DllVersion_MustBe6()
vbe.SetupGet(s => s.Version).Returns("6.00");
var settings = new VBESettings(vbe.Object, registry.Object);

Assert.AreEqual(VBESettings.DllVersion.Vbe6, settings.Version);
Assert.AreEqual(DllVersion.Vbe6, settings.Version);
}

[Category("VBE")]
Expand All @@ -42,7 +44,7 @@ public void DllVersion_MustBe7()
vbe.SetupGet(s => s.Version).Returns("7.00");
var settings = new VBESettings(vbe.Object, registry.Object);

Assert.AreEqual(VBESettings.DllVersion.Vbe7, settings.Version);
Assert.AreEqual(DllVersion.Vbe7, settings.Version);
}

[Category("VBE")]
Expand All @@ -55,7 +57,7 @@ public void DllVersion_IsBogus()
vbe.SetupGet(s => s.Version).Returns("foo");
var settings = new VBESettings(vbe.Object, registry.Object);

Assert.AreEqual(VBESettings.DllVersion.Unknown, settings.Version);
Assert.AreEqual(DllVersion.Unknown, settings.Version);
}

[Category("VBE")]
Expand All @@ -68,7 +70,7 @@ public void DllVersion_IsNull()
vbe.SetupGet(s => s.Version).Returns((string)null);
var settings = new VBESettings(vbe.Object, registry.Object);

Assert.IsTrue(settings.Version == VBESettings.DllVersion.Unknown);
Assert.IsTrue(settings.Version == DllVersion.Unknown);
}

[Category("VBE")]
Expand Down

0 comments on commit b6cc24e

Please sign in to comment.