Skip to content

Commit 39afce9

Browse files
committed
2 parents 1a23b2e + 3b760cb commit 39afce9

File tree

85 files changed

+2568
-808
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+2568
-808
lines changed

Installer Build Script.iss

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ Filename: "{dotnet4064}\RegAsm.exe"; Parameters: "/codebase {#AddinDLL}"; Workin
5252
Filename: "{dotnet4032}\RegAsm.exe"; Parameters: "/u {#AddinDLL}"; WorkingDir: "{app}"; StatusMsg: "Unregistering Controls..."; Flags: runascurrentuser runminimized; Check: Is32BitOfficeInstalled
5353
Filename: "{dotnet4064}\RegAsm.exe"; Parameters: "/u {#AddinDLL}"; WorkingDir: "{app}"; StatusMsg: "Unregistering Controls..."; Flags: runascurrentuser runminimized; Check: Is64BitOfficeInstalled
5454

55+
[UninstallDelete]
56+
Type: filesandordirs; Name: "{localappdata}\{#AppName}"
57+
5558
[CustomMessages]
5659
; TODO add additional languages here.
5760
English.NETFramework40NotInstalled=Microsoft .NET Framework 4.0 installation was not detected.

RetailCoder.VBE/App.cs

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
using System.IO;
1+
using System.Collections.Generic;
2+
using System.IO;
3+
using System.Reflection;
24
using Infralution.Localization.Wpf;
35
using NLog;
6+
using NLog.Fluent;
47
using Rubberduck.Common;
58
using Rubberduck.Parsing;
69
using Rubberduck.Parsing.Symbols;
@@ -145,6 +148,7 @@ private void UpdateLoggingLevel()
145148
public void Startup()
146149
{
147150
EnsureLogFolderPathExists();
151+
LogRubberduckSart();
148152
LoadConfig();
149153
CheckForLegacyIndenterSettings();
150154
_appMenus.Initialize();
@@ -223,6 +227,21 @@ private void CheckForLegacyIndenterSettings()
223227
}
224228
}
225229

230+
private void LogRubberduckSart()
231+
{
232+
var version = GetType().Assembly.GetName().Version.ToString();
233+
GlobalDiagnosticsContext.Set("RubberduckVersion", version);
234+
var headers = new List<string>
235+
{
236+
string.Format("Rubberduck version {0} loading:", version),
237+
string.Format("\tOperating System: {0} {1}", Environment.OSVersion.VersionString, Environment.Is64BitOperatingSystem ? "x64" : "x86"),
238+
string.Format("\tHost Product: {0} {1}", Application.ProductName, Environment.Is64BitProcess ? "x64" : "x86"),
239+
string.Format("\tHost Version: {0}", Application.ProductVersion),
240+
string.Format("\tHost Executable: {0}", Path.GetFileName(Application.ExecutablePath)),
241+
};
242+
Logger.Log(LogLevel.Info, string.Join(Environment.NewLine, headers));
243+
}
244+
226245
private bool _disposed;
227246
public void Dispose()
228247
{

RetailCoder.VBE/Inspections/Concrete/Inspector.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ private void UpdateInspectionSeverity(Configuration config)
4343
{
4444
foreach (var setting in config.UserSettings.CodeInspectionSettings.CodeInspections)
4545
{
46-
if (inspection.Description == setting.Description)
46+
if (inspection.Name == setting.Name)
4747
{
4848
inspection.Severity = setting.Severity;
4949
}

RetailCoder.VBE/Inspections/UnassignedVariableUsageInspection.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,9 @@ public override IEnumerable<InspectionResultBase> GetInspectionResults()
3030
&& !declaration.IsSelfAssigned
3131
&& !declaration.References.Any(reference => reference.IsAssignment));
3232

33-
var lenFunction = BuiltInDeclarations.SingleOrDefault(s => s.Scope == "VBE7.DLL;VBA.Strings.Len");
34-
var lenbFunction = BuiltInDeclarations.SingleOrDefault(s => s.Scope == "VBE7.DLL;VBA.Strings.LenB");
33+
//The parameter scoping was apparently incorrect before - need to filter for the actual function.
34+
var lenFunction = BuiltInDeclarations.SingleOrDefault(s => s.DeclarationType == DeclarationType.Function && s.Scope.Equals("VBE7.DLL;VBA.Strings.Len"));
35+
var lenbFunction = BuiltInDeclarations.SingleOrDefault(s => s.DeclarationType == DeclarationType.Function && s.Scope.Equals("VBE7.DLL;VBA.Strings.Len"));
3536

3637
return from issue in declarations
3738
where issue.References.Any()

RetailCoder.VBE/NLog.dll.nlog

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,13 @@
77
xsi:type="File"
88
name="file"
99
fileName="${specialfolder:folder=ApplicationData}/Rubberduck/Logs/RubberduckLog.txt"
10-
layout="${longdate};${uppercase:${level}};${logger};${message};${exception:format=tostring}"
10+
layout="${longdate};${uppercase:${level}}-${gdc:item=RubberduckVersion};${logger};${message};${exception:format=tostring}"
1111
archiveFileName="${specialfolder:folder=ApplicationData}/Rubberduck/Logs/archives/RubberduckLog.{#}.txt"
1212
archiveAboveSize="5242880"
1313
archiveNumbering="Sequence"
1414
concurrentWrites="true"
15+
archiveEvery="Day"
16+
deleteOldFileOnStartup="true"
1517
keepFileOpen="false"
1618
encoding="UTF-8"/>
1719
<target

RetailCoder.VBE/Root/RubberduckModule.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,13 +187,14 @@ private void ApplyConfigurationConvention(IEnumerable<Assembly> assemblies)
187187
.BindAllInterfaces()
188188
.Configure(binding => binding.InSingletonScope()));
189189

190-
Bind<IPersistable<SerializableDeclarationTree>>().To<XmlPersistableDeclarations>().InCallScope();
190+
Bind<IPersistable<SerializableProject>>().To<XmlPersistableDeclarations>().InCallScope();
191191

192192
Bind<IPersistanceService<CodeInspectionSettings>>().To<XmlPersistanceService<CodeInspectionSettings>>().InCallScope();
193193
Bind<IPersistanceService<GeneralSettings>>().To<XmlPersistanceService<GeneralSettings>>().InCallScope();
194194
Bind<IPersistanceService<HotkeySettings>>().To<XmlPersistanceService<HotkeySettings>>().InCallScope();
195195
Bind<IPersistanceService<ToDoListSettings>>().To<XmlPersistanceService<ToDoListSettings>>().InCallScope();
196196
Bind<IPersistanceService<UnitTestSettings>>().To<XmlPersistanceService<UnitTestSettings>>().InCallScope();
197+
Bind<IPersistanceService<WindowSettings>>().To<XmlPersistanceService<WindowSettings>>().InCallScope();
197198
Bind<IPersistanceService<IndenterSettings>>().To<XmlPersistanceService<IndenterSettings>>().InCallScope();
198199
Bind<IFilePersistanceService<SourceControlSettings>>().To<XmlPersistanceService<SourceControlSettings>>().InCallScope();
199200

@@ -205,6 +206,7 @@ private void ApplyConfigurationConvention(IEnumerable<Assembly> assemblies)
205206
Bind<IHotkeySettings>().To<HotkeySettings>().InCallScope();
206207
Bind<IToDoListSettings>().To<ToDoListSettings>().InCallScope();
207208
Bind<IUnitTestSettings>().To<UnitTestSettings>().InCallScope();
209+
Bind<IWindowSettings>().To<WindowSettings>().InCallScope();
208210
Bind<IIndenterSettings>().To<IndenterSettings>().InCallScope();
209211
Bind<ISourceControlSettings>().To<SourceControlSettings>().InCallScope();
210212
}

RetailCoder.VBE/Rubberduck.csproj

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -445,6 +445,8 @@
445445
<Compile Include="Settings\ToDoListConfigProvider.cs" />
446446
<Compile Include="Settings\UnitTestConfigProvider.cs" />
447447
<Compile Include="Settings\WhitelistedIdentifierSetting.cs" />
448+
<Compile Include="Settings\WindowConfigProvider.cs" />
449+
<Compile Include="Settings\WindowSettings.cs" />
448450
<Compile Include="UI\About\AboutControl.xaml.cs">
449451
<DependentUpon>AboutControl.xaml</DependentUpon>
450452
</Compile>
@@ -843,6 +845,10 @@
843845
<Compile Include="UI\IdentifierReferences\ListItemActionEventArgs.cs" />
844846
<Compile Include="UI\ParserErrors\ParserErrorsPresenter.cs" />
845847
<Compile Include="Refactorings\ExtractMethod\ExtractMethodModel.cs" />
848+
<Compile Include="UI\Settings\WindowSettings.xaml.cs">
849+
<DependentUpon>WindowSettings.xaml</DependentUpon>
850+
</Compile>
851+
<Compile Include="UI\Settings\WindowSettingsViewModel.cs" />
846852
<Compile Include="UI\SimpleListControl.cs">
847853
<SubType>UserControl</SubType>
848854
</Compile>
@@ -1483,6 +1489,10 @@
14831489
<SubType>Designer</SubType>
14841490
<Generator>MSBuild:Compile</Generator>
14851491
</Page>
1492+
<Page Include="UI\Settings\WindowSettings.xaml">
1493+
<SubType>Designer</SubType>
1494+
<Generator>MSBuild:Compile</Generator>
1495+
</Page>
14861496
<Page Include="UI\SourceControl\BranchesView.xaml">
14871497
<SubType>Designer</SubType>
14881498
<Generator>MSBuild:Compile</Generator>

RetailCoder.VBE/Settings/ConfigurationLoader.cs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,18 @@ public class ConfigurationLoader : IGeneralConfigService
3232
private readonly IConfigProvider<CodeInspectionSettings> _inspectionProvider;
3333
private readonly IConfigProvider<UnitTestSettings> _unitTestProvider;
3434
private readonly IConfigProvider<IndenterSettings> _indenterProvider;
35+
private readonly IConfigProvider<WindowSettings> _windowProvider;
3536

3637
public ConfigurationLoader(IConfigProvider<GeneralSettings> generalProvider, IConfigProvider<HotkeySettings> hotkeyProvider, IConfigProvider<ToDoListSettings> todoProvider,
37-
IConfigProvider<CodeInspectionSettings> inspectionProvider, IConfigProvider<UnitTestSettings> unitTestProvider, IConfigProvider<IndenterSettings> indenterProvider)
38+
IConfigProvider<CodeInspectionSettings> inspectionProvider, IConfigProvider<UnitTestSettings> unitTestProvider, IConfigProvider<IndenterSettings> indenterProvider, IConfigProvider<WindowSettings> windowProvider)
3839
{
3940
_generalProvider = generalProvider;
4041
_hotkeyProvider = hotkeyProvider;
4142
_todoProvider = todoProvider;
4243
_inspectionProvider = inspectionProvider;
4344
_unitTestProvider = unitTestProvider;
4445
_indenterProvider = indenterProvider;
46+
_windowProvider = windowProvider;
4547
}
4648

4749
/// <summary>
@@ -58,7 +60,8 @@ public virtual Configuration LoadConfiguration()
5860
_todoProvider.Create(),
5961
_inspectionProvider.Create(),
6062
_unitTestProvider.Create(),
61-
_indenterProvider.Create()
63+
_indenterProvider.Create(),
64+
_windowProvider.Create()
6265
)
6366
};
6467
return config;
@@ -75,7 +78,8 @@ public Configuration GetDefaultConfiguration()
7578
_todoProvider.CreateDefaults(),
7679
_inspectionProvider.CreateDefaults(),
7780
_unitTestProvider.CreateDefaults(),
78-
_indenterProvider.CreateDefaults()
81+
_indenterProvider.CreateDefaults(),
82+
_windowProvider.CreateDefaults()
7983
)
8084
};
8185
}
@@ -93,6 +97,7 @@ public void SaveConfiguration(Configuration toSerialize)
9397
_inspectionProvider.Save(toSerialize.UserSettings.CodeInspectionSettings);
9498
_unitTestProvider.Save(toSerialize.UserSettings.UnitTestSettings);
9599
_indenterProvider.Save(toSerialize.UserSettings.IndenterSettings);
100+
_windowProvider.Save(toSerialize.UserSettings.WindowSettings);
96101

97102
OnSettingsChanged(new ConfigurationChangedEventArgs(inspectOnReparse, langChanged, !oldInspectionSettings.SequenceEqual(newInspectionSettings)));
98103
}

RetailCoder.VBE/Settings/UserSettings.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,23 @@ public class UserSettings
1212
public CodeInspectionSettings CodeInspectionSettings { get; set; }
1313
public UnitTestSettings UnitTestSettings { get; set; }
1414
public IndenterSettings IndenterSettings { get; set; }
15+
public WindowSettings WindowSettings { get; set; }
1516

1617
public UserSettings(GeneralSettings generalSettings,
1718
HotkeySettings hotkeySettings,
1819
ToDoListSettings todoSettings,
1920
CodeInspectionSettings codeInspectionSettings,
2021
UnitTestSettings unitTestSettings,
21-
IndenterSettings indenterSettings)
22+
IndenterSettings indenterSettings,
23+
WindowSettings windowSettings)
2224
{
2325
GeneralSettings = generalSettings;
2426
HotkeySettings = hotkeySettings;
2527
ToDoListSettings = todoSettings;
2628
CodeInspectionSettings = codeInspectionSettings;
2729
UnitTestSettings = unitTestSettings;
2830
IndenterSettings = indenterSettings;
31+
WindowSettings = windowSettings;
2932
}
3033
}
3134
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
using Rubberduck.SettingsProvider;
2+
3+
namespace Rubberduck.Settings
4+
{
5+
public class WindowConfigProvider : IConfigProvider<WindowSettings>
6+
{
7+
private readonly IPersistanceService<WindowSettings> _persister;
8+
9+
public WindowConfigProvider(IPersistanceService<WindowSettings> persister)
10+
{
11+
_persister = persister;
12+
}
13+
14+
public WindowSettings Create()
15+
{
16+
var prototype = new WindowSettings();
17+
return _persister.Load(prototype) ?? prototype;
18+
}
19+
20+
public WindowSettings CreateDefaults()
21+
{
22+
return new WindowSettings();
23+
}
24+
25+
public void Save(WindowSettings settings)
26+
{
27+
_persister.Save(settings);
28+
}
29+
}
30+
}

0 commit comments

Comments
 (0)