Minor code cleanup/reorganization
Rob Mensching committed
Oct 19, 2018 at 02:57 UTC
7d302ba01db5b2a9e255cfade17b1c3d687fdee2
7 files changed
+19
-20
src/WixToolset.Core.WindowsInstaller/Decompiler.cs
+1
-1
@@ -1,6 +1,6 @@
1
// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
2
3
-namespace WixToolset
3
+namespace WixToolset.Core.WindowsInstaller
4
{
5
using System;
6
using System.Collections;
src/WixToolset.Core/CommandLine/ParseCommandLine.cs
+14
-8
@@ -25,11 +25,14 @@ namespace WixToolset.Core.CommandLine
25
this.ErrorArgument = errorArgument;
26
}
27
28
- public bool IsSwitch(string arg) => !String.IsNullOrEmpty(arg) && ('/' == arg[0] || '-' == arg[0]);
28
+ public bool IsSwitch(string arg)
29
+ {
30
+ return !String.IsNullOrEmpty(arg) && ('/' == arg[0] || '-' == arg[0]);
31
+ }
32
33
public void GetArgumentAsFilePathOrError(string argument, string fileType, IList<string> paths)
34
{
32
- foreach (var path in GetFiles(argument, fileType))
35
+ foreach (var path in this.GetFiles(argument, fileType))
36
{
37
paths.Add(path);
38
}
@@ -60,7 +63,7 @@ namespace WixToolset.Core.CommandLine
63
64
public string GetNextArgumentAsDirectoryOrError(string commandLineSwitch)
65
{
63
- if (this.TryGetNextNonSwitchArgumentOrError(out var arg) && TryGetDirectory(commandLineSwitch, this.Messaging, arg, out var directory))
66
+ if (this.TryGetNextNonSwitchArgumentOrError(out var arg) && this.TryGetDirectory(commandLineSwitch, this.Messaging, arg, out var directory))
67
{
68
return directory;
69
}
@@ -71,7 +74,7 @@ namespace WixToolset.Core.CommandLine
74
75
public bool GetNextArgumentAsDirectoryOrError(string commandLineSwitch, IList<string> directories)
76
{
74
- if (this.TryGetNextNonSwitchArgumentOrError(out var arg) && TryGetDirectory(commandLineSwitch, this.Messaging, arg, out var directory))
77
+ if (this.TryGetNextNonSwitchArgumentOrError(out var arg) && this.TryGetDirectory(commandLineSwitch, this.Messaging, arg, out var directory))
78
{
79
directories.Add(directory);
80
return true;
@@ -96,7 +99,7 @@ namespace WixToolset.Core.CommandLine
99
{
100
if (this.TryGetNextNonSwitchArgumentOrError(out var arg))
101
{
99
- foreach (var path in GetFiles(arg, fileType))
102
+ foreach (var path in this.GetFiles(arg, fileType))
103
{
104
paths.Add(path);
105
}
@@ -125,7 +128,10 @@ namespace WixToolset.Core.CommandLine
128
return result;
129
}
130
128
- private static bool IsValidArg(string arg) => !(String.IsNullOrEmpty(arg) || '/' == arg[0] || '-' == arg[0]);
131
+ private static bool IsValidArg(string arg)
132
+ {
133
+ return !(String.IsNullOrEmpty(arg) || '/' == arg[0] || '-' == arg[0]);
134
+ }
135
136
private static bool TryDequeue(Queue<string> q, out string arg)
137
{
@@ -194,8 +200,8 @@ namespace WixToolset.Core.CommandLine
200
}
201
202
// Convert alternate directory separators to the standard one.
197
- string filePath = searchPath.Replace(Path.AltDirectorySeparatorChar, Path.DirectorySeparatorChar);
198
- int lastSeparator = filePath.LastIndexOf(Path.DirectorySeparatorChar);
203
+ var filePath = searchPath.Replace(Path.AltDirectorySeparatorChar, Path.DirectorySeparatorChar);
204
+ var lastSeparator = filePath.LastIndexOf(Path.DirectorySeparatorChar);
205
var files = new string[0];
206
207
try
src/WixToolset.Core/Decompiler.cs
-7
@@ -3,7 +3,6 @@
3
namespace WixToolset.Core
4
{
5
using System;
6
- using WixToolset.Data;
6
using WixToolset.Extensibility;
7
using WixToolset.Extensibility.Data;
8
using WixToolset.Extensibility.Services;
@@ -18,12 +17,6 @@ namespace WixToolset.Core
17
this.ServiceProvider = serviceProvider;
18
}
19
21
- public OutputType DecompileType { get; set; }
22
-
23
- public string IntermediateFolder { get; set; }
24
-
25
- public string OutputPath { get; set; }
26
-
20
public IServiceProvider ServiceProvider { get; }
21
22
public BindResult Decompile(IDecompileContext context)
src/WixToolset.Core/ExtensibilityServices/FileTransfer.cs
renamed
+1
-1
@@ -1,6 +1,6 @@
1
// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
2
3
-namespace WixToolset.Core
3
+namespace WixToolset.Core.ExtensibilityServices
4
{
5
using WixToolset.Data;
6
using WixToolset.Extensibility.Data;
src/WixToolset.Core/ExtensibilityServices/TrackedFile.cs
renamed
+1
-1
@@ -1,6 +1,6 @@
1
// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
2
3
-namespace WixToolset.Core
3
+namespace WixToolset.Core.ExtensibilityServices
4
{
5
using WixToolset.Data;
6
using WixToolset.Extensibility.Data;
src/WixToolset.Core/ExtensibilityServices/Uuid.cs
renamed
+1
-1
@@ -1,6 +1,6 @@
1
// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
2
3
-namespace WixToolset
3
+namespace WixToolset.Core.ExtensibilityServices
4
{
5
using System;
6
using System.Net;
src/WixToolset.Core/WixToolsetServiceProvider.cs
+1
-1
@@ -92,7 +92,7 @@ namespace WixToolset.Core
92
public void AddService<T>(Func<IServiceProvider, Dictionary<Type, object>, T> creationFunction)
93
where T : class
94
{
95
- AddService(typeof(T), creationFunction);
95
+ this.AddService(typeof(T), creationFunction);
96
}
97
98
private static T AddSingleton<T>(Dictionary<Type, object> singletons, T service)