Major reduction in public surface area of WixToolset.Core
Rob Mensching committed
Aug 1, 2018 at 03:02 UTC
52005c7e6917f9866dd0b0de6993def16a72ed4b
38 files changed
+110
-220
src/WixToolset.Core/Bind/FileFacade.cs
+4
-4
@@ -21,13 +21,13 @@ namespace WixToolset.Core.Bind
21
this.WixFile = wixFile;
22
}
23
24
- public bool FromModule { get; private set; }
24
+ public bool FromModule { get; }
25
26
- public FileTuple File { get; private set; }
26
+ public FileTuple File { get; }
27
28
- public WixFileTuple WixFile { get; private set; }
28
+ public WixFileTuple WixFile { get; }
29
30
- public WixDeltaPatchFileTuple DeltaPatchFile { get; private set; }
30
+ public WixDeltaPatchFileTuple DeltaPatchFile { get; }
31
32
/// <summary>
33
/// Gets the set of MsiAssemblyName rows created for this file.
src/WixToolset.Core/BindContext.cs
+1
-1
@@ -8,7 +8,7 @@ namespace WixToolset.Core
8
using WixToolset.Extensibility;
9
using WixToolset.Extensibility.Data;
10
11
- public class BindContext : IBindContext
11
+ internal class BindContext : IBindContext
12
{
13
internal BindContext(IServiceProvider serviceProvider)
14
{
src/WixToolset.Core/Binder.cs
+2
-2
@@ -16,9 +16,9 @@ namespace WixToolset.Core
16
/// <summary>
17
/// Binder of the WiX toolset.
18
/// </summary>
19
- public sealed class Binder
19
+ internal class Binder
20
{
21
- public Binder(IServiceProvider serviceProvider)
21
+ internal Binder(IServiceProvider serviceProvider)
22
{
23
this.ServiceProvider = serviceProvider;
24
}
src/WixToolset.Core/CommandLine/BuildCommand.cs
+3
-2
@@ -317,6 +317,8 @@ namespace WixToolset.Core.CommandLine
317
318
private IEnumerable<Localization> LoadLocalizationFiles()
319
{
320
+ var localizer = new Localizer(this.ServiceProvider);
321
+
322
foreach (var loc in this.LocFiles)
323
{
324
var preprocessor = new Preprocessor(this.ServiceProvider);
@@ -331,8 +333,7 @@ namespace WixToolset.Core.CommandLine
333
continue;
334
}
335
334
- var localization = Localizer.ParseLocalizationFile(this.Messaging, document);
335
-
336
+ var localization = localizer.ParseLocalizationFile(document);
337
yield return localization;
338
}
339
}
src/WixToolset.Core/CommandLine/CommandLineResponseFile.cs
deleted
-132
@@ -1,132 +0,0 @@
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.CommandLine
4
-{
5
- using System;
6
- using System.Collections;
7
- using System.Collections.Generic;
8
- using System.IO;
9
- using System.Text;
10
- using System.Text.RegularExpressions;
11
-
12
- /// <summary>
13
- /// Common utilities for Wix command-line processing.
14
- /// </summary>
15
- public static class CommandLineResponseFile
16
- {
17
- /// <summary>
18
- /// Parses a response file.
19
- /// </summary>
20
- /// <param name="responseFile">The file to parse.</param>
21
- /// <returns>The array of arguments.</returns>
22
- public static string[] Parse(string responseFile)
23
- {
24
- string arguments;
25
-
26
- using (StreamReader reader = new StreamReader(responseFile))
27
- {
28
- arguments = reader.ReadToEnd();
29
- }
30
-
31
- return CommandLineResponseFile.ParseArgumentsToArray(arguments);
32
- }
33
-
34
- /// <summary>
35
- /// Parses an argument string into an argument array based on whitespace and quoting.
36
- /// </summary>
37
- /// <param name="arguments">Argument string.</param>
38
- /// <returns>Argument array.</returns>
39
- public static string[] ParseArgumentsToArray(string arguments)
40
- {
41
- // Scan and parse the arguments string, dividing up the arguments based on whitespace.
42
- // Unescaped quotes cause whitespace to be ignored, while the quotes themselves are removed.
43
- // Quotes may begin and end inside arguments; they don't necessarily just surround whole arguments.
44
- // Escaped quotes and escaped backslashes also need to be unescaped by this process.
45
-
46
- // Collects the final list of arguments to be returned.
47
- List<string> argsList = new List<string>();
48
-
49
- // True if we are inside an unescaped quote, meaning whitespace should be ignored.
50
- bool insideQuote = false;
51
-
52
- // Index of the start of the current argument substring; either the start of the argument
53
- // or the start of a quoted or unquoted sequence within it.
54
- int partStart = 0;
55
-
56
- // The current argument string being built; when completed it will be added to the list.
57
- StringBuilder arg = new StringBuilder();
58
-
59
- for (int i = 0; i <= arguments.Length; i++)
60
- {
61
- if (i == arguments.Length || (Char.IsWhiteSpace(arguments[i]) && !insideQuote))
62
- {
63
- // Reached a whitespace separator or the end of the string.
64
-
65
- // Finish building the current argument.
66
- arg.Append(arguments.Substring(partStart, i - partStart));
67
-
68
- // Skip over the whitespace character.
69
- partStart = i + 1;
70
-
71
- // Add the argument to the list if it's not empty.
72
- if (arg.Length > 0)
73
- {
74
- argsList.Add(CommandLineResponseFile.ExpandEnvVars(arg.ToString()));
75
- arg.Length = 0;
76
- }
77
- }
78
- else if (i > partStart && arguments[i - 1] == '\\')
79
- {
80
- // Check the character following an unprocessed backslash.
81
- // Unescape quotes, and backslashes followed by a quote.
82
- if (arguments[i] == '"' || (arguments[i] == '\\' && arguments.Length > i + 1 && arguments[i + 1] == '"'))
83
- {
84
- // Unescape the quote or backslash by skipping the preceeding backslash.
85
- arg.Append(arguments.Substring(partStart, i - 1 - partStart));
86
- arg.Append(arguments[i]);
87
- partStart = i + 1;
88
- }
89
- }
90
- else if (arguments[i] == '"')
91
- {
92
- // Add the quoted or unquoted section to the argument string.
93
- arg.Append(arguments.Substring(partStart, i - partStart));
94
-
95
- // And skip over the quote character.
96
- partStart = i + 1;
97
-
98
- insideQuote = !insideQuote;
99
- }
100
- }
101
-
102
- return argsList.ToArray();
103
- }
104
-
105
- static private string ExpandEnvVars(string arguments)
106
- {
107
- IDictionary id = Environment.GetEnvironmentVariables();
108
-
109
- Regex regex = new Regex("(?<=\\%)(?:[\\w\\.]+)(?=\\%)");
110
- MatchCollection matches = regex.Matches(arguments);
111
-
112
- string value = String.Empty;
113
- for (int i = 0; i <= (matches.Count - 1); i++)
114
- {
115
- try
116
- {
117
- string key = matches[i].Value;
118
- regex = new Regex(String.Concat("(?i)(?:\\%)(?:" , key , ")(?:\\%)"));
119
- value = id[key].ToString();
120
- arguments = regex.Replace(arguments, value);
121
- }
122
- catch (NullReferenceException)
123
- {
124
- // Collapse unresolved environment variables.
125
- arguments = regex.Replace(arguments, value);
126
- }
127
- }
128
-
129
- return arguments;
130
- }
131
- }
132
-}
src/WixToolset.Core/CompileContext.cs
+1
-1
@@ -9,7 +9,7 @@ namespace WixToolset.Core
9
using WixToolset.Extensibility;
10
using WixToolset.Extensibility.Data;
11
12
- public class CompileContext : ICompileContext
12
+ internal class CompileContext : ICompileContext
13
{
14
internal CompileContext(IServiceProvider serviceProvider)
15
{
src/WixToolset.Core/Compiler.cs
+2
-2
@@ -22,7 +22,7 @@ namespace WixToolset.Core
22
/// <summary>
23
/// Compiler of the WiX toolset.
24
/// </summary>
25
- public sealed class Compiler
25
+ internal class Compiler
26
{
27
public const string UpgradeDetectedProperty = "WIX_UPGRADE_DETECTED";
28
public const string UpgradePreventedCondition = "NOT WIX_UPGRADE_DETECTED";
@@ -69,7 +69,7 @@ namespace WixToolset.Core
69
Icon,
70
}
71
72
- public Compiler(IServiceProvider serviceProvider)
72
+ internal Compiler(IServiceProvider serviceProvider)
73
{
74
this.ServiceProvider = serviceProvider;
75
src/WixToolset.Core/CompilerCore.cs
+1
-1
@@ -39,7 +39,7 @@ namespace WixToolset.Core
39
/// <summary>
40
/// Core class for the compiler.
41
/// </summary>
42
- internal sealed class CompilerCore
42
+ internal class CompilerCore
43
{
44
internal static readonly XNamespace W3SchemaPrefix = "http://www.w3.org/";
45
internal static readonly XNamespace WixNamespace = "http://wixtoolset.org/schemas/v4/wxs";
src/WixToolset.Core/Converter.cs
+2
-2
@@ -15,7 +15,7 @@ namespace WixToolset.Core
15
/// <summary>
16
/// WiX source code converter.
17
/// </summary>
18
- public class Converter
18
+ internal class Converter
19
{
20
private const string XDocumentNewLine = "\n"; // XDocument normlizes "\r\n" to just "\n".
21
private static readonly XNamespace WixNamespace = "http://wixtoolset.org/schemas/v4/wxs";
@@ -65,7 +65,7 @@ namespace WixToolset.Core
65
/// <param name="indentationAmount">Indentation value to use when validating leading whitespace.</param>
66
/// <param name="errorsAsWarnings">Test errors to display as warnings.</param>
67
/// <param name="ignoreErrors">Test errors to ignore.</param>
68
- public Converter(IMessaging messaging, int indentationAmount, IEnumerable<string> errorsAsWarnings = null, IEnumerable<string> ignoreErrors = null)
68
+ internal Converter(IMessaging messaging, int indentationAmount, IEnumerable<string> errorsAsWarnings = null, IEnumerable<string> ignoreErrors = null)
69
{
70
this.ConvertElementMapping = new Dictionary<XName, Action<XElement>>()
71
{
src/WixToolset.Core/Harvester.cs
+1
-1
@@ -11,7 +11,7 @@ namespace WixToolset
11
/// <summary>
12
/// The WiX Toolset harvester.
13
/// </summary>
14
- public sealed class Harvester
14
+ public class Harvester
15
{
16
private HarvesterExtension harvesterExtension;
17
src/WixToolset.Core/HarvesterCore.cs
+1
-1
@@ -10,7 +10,7 @@ namespace WixToolset.Core
10
/// <summary>
11
/// The WiX Toolset harvester core.
12
/// </summary>
13
- public sealed class HarvesterCore : IHarvesterCore
13
+ public class HarvesterCore : IHarvesterCore
14
{
15
public IMessaging Messaging { get; set; }
16
src/WixToolset.Core/HeatCore.cs
+1
-1
@@ -7,7 +7,7 @@ namespace WixToolset.Core
7
/// <summary>
8
/// The WiX Toolset Harvester application core.
9
/// </summary>
10
- public sealed class HeatCore : IHeatCore
10
+ public class HeatCore : IHeatCore
11
{
12
private Harvester harvester;
13
private Mutator mutator;
src/WixToolset.Core/ILocalizer.cs
new
+27
@@ -0,0 +1,27 @@
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
4
+{
5
+ using System.Xml.Linq;
6
+ using WixToolset.Data;
7
+
8
+ /// <summary>
9
+ /// Parses localization files and localizes database values.
10
+ /// </summary>
11
+ public interface ILocalizer
12
+ {
13
+ /// <summary>
14
+ /// Loads a localization file from a path on disk.
15
+ /// </summary>
16
+ /// <param name="path">Path to localization file saved on disk.</param>
17
+ /// <returns>Returns the loaded localization file.</returns>
18
+ Localization ParseLocalizationFile(string path);
19
+
20
+ /// <summary>
21
+ /// Loads a localization file from memory.
22
+ /// </summary>
23
+ /// <param name="document">Document to parse as localization file.</param>
24
+ /// <returns>Returns the loaded localization file.</returns>
25
+ Localization ParseLocalizationFile(XDocument document);
26
+ }
27
+}
src/WixToolset.Core/Inscriber.cs
+2
-2
@@ -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
4
{
5
using System.IO;
6
using WixToolset.Data;
@@ -8,7 +8,7 @@ namespace WixToolset
8
/// <summary>
9
/// Converts a wixout representation of an MSM database into a ComponentGroup the form of WiX source.
10
/// </summary>
11
- public sealed class Inscriber
11
+ internal class Inscriber
12
{
13
/// <summary>
14
/// Gets or sets the temp files collection.
src/WixToolset.Core/Layout.cs
+2
-2
@@ -15,9 +15,9 @@ namespace WixToolset.Core
15
/// <summary>
16
/// Layout for the WiX toolset.
17
/// </summary>
18
- public sealed class Layout
18
+ internal class Layout
19
{
20
- public Layout(IServiceProvider serviceProvider)
20
+ internal Layout(IServiceProvider serviceProvider)
21
{
22
this.ServiceProvider = serviceProvider;
23
src/WixToolset.Core/LayoutContext.cs
+1
-1
@@ -7,7 +7,7 @@ namespace WixToolset.Core
7
using WixToolset.Extensibility;
8
using WixToolset.Extensibility.Data;
9
10
- public class LayoutContext : ILayoutContext
10
+ internal class LayoutContext : ILayoutContext
11
{
12
internal LayoutContext(IServiceProvider serviceProvider)
13
{
src/WixToolset.Core/Librarian.cs
+2
-2
@@ -15,9 +15,9 @@ namespace WixToolset.Core
15
/// <summary>
16
/// Core librarian tool.
17
/// </summary>
18
- public sealed class Librarian
18
+ internal class Librarian
19
{
20
- public Librarian(IServiceProvider serviceProvider)
20
+ internal Librarian(IServiceProvider serviceProvider)
21
{
22
this.ServiceProvider = serviceProvider;
23
src/WixToolset.Core/LibraryContext.cs
+2
-2
@@ -9,9 +9,9 @@ namespace WixToolset.Core
9
using WixToolset.Extensibility.Data;
10
using WixToolset.Extensibility.Services;
11
12
- public class LibraryContext : ILibraryContext
12
+ internal class LibraryContext : ILibraryContext
13
{
14
- public LibraryContext(IServiceProvider serviceProvider)
14
+ internal LibraryContext(IServiceProvider serviceProvider)
15
{
16
this.ServiceProvider = serviceProvider;
17
}
src/WixToolset.Core/Link/ConnectToFeature.cs
+2
-2
@@ -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.Link
3
+namespace WixToolset.Core.Link
4
{
5
using System.Collections.Generic;
6
using WixToolset.Data;
@@ -8,7 +8,7 @@ namespace WixToolset.Link
8
/// <summary>
9
/// Object that connects things (components/modules) to features.
10
/// </summary>
11
- public sealed class ConnectToFeature
11
+ internal class ConnectToFeature
12
{
13
/// <summary>
14
/// Creates a new connect to feature.
src/WixToolset.Core/Link/ConnectToFeatureCollection.cs
+2
-2
@@ -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.Link
3
+namespace WixToolset.Core.Link
4
{
5
using System;
6
using System.Collections;
@@ -8,7 +8,7 @@ namespace WixToolset.Link
8
/// <summary>
9
/// Hash collection of connect to feature objects.
10
/// </summary>
11
- public sealed class ConnectToFeatureCollection : ICollection
11
+ internal class ConnectToFeatureCollection : ICollection
12
{
13
private Hashtable collection;
14
src/WixToolset.Core/Link/ConnectToModule.cs
+2
-2
@@ -1,11 +1,11 @@
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.Link
3
+namespace WixToolset.Core.Link
4
{
5
/// <summary>
6
/// Object that connects things to modules.
7
/// </summary>
8
- public sealed class ConnectToModule
8
+ internal class ConnectToModule
9
{
10
private string childId;
11
private string module;
src/WixToolset.Core/Link/ConnectToModuleCollection.cs
+2
-2
@@ -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.Link
3
+namespace WixToolset.Core.Link
4
{
5
using System;
6
using System.Collections;
@@ -8,7 +8,7 @@ namespace WixToolset.Link
8
/// <summary>
9
/// Hash collection of connect to module objects.
10
/// </summary>
11
- public sealed class ConnectToModuleCollection : ICollection
11
+ internal class ConnectToModuleCollection : ICollection
12
{
13
private Hashtable collection;
14
src/WixToolset.Core/Link/ReportConflictingSymbolsCommand.cs
+2
-2
@@ -1,13 +1,13 @@
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.Link
3
+namespace WixToolset.Core.Link
4
{
5
using System.Collections.Generic;
6
using System.Linq;
7
using WixToolset.Data;
8
using WixToolset.Extensibility.Services;
9
10
- public class ReportConflictingSymbolsCommand
10
+ internal class ReportConflictingSymbolsCommand
11
{
12
public ReportConflictingSymbolsCommand(IMessaging messaging, IEnumerable<Symbol> possibleConflicts, IEnumerable<IntermediateSection> resolvedSections)
13
{
src/WixToolset.Core/Link/ResolveReferencesCommand.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.Link
3
+namespace WixToolset.Core.Link
4
{
5
using System;
6
using System.Collections.Generic;
src/WixToolset.Core/Link/WixGroupingOrdering.cs
+2
-2
@@ -16,7 +16,7 @@ namespace WixToolset.Core.Link
16
/// <summary>
17
/// Grouping and Ordering class of the WiX toolset.
18
/// </summary>
19
- internal sealed class WixGroupingOrdering
19
+ internal class WixGroupingOrdering
20
{
21
private IMessaging messageHandler;
22
private List<string> groupTypes;
@@ -679,7 +679,7 @@ namespace WixToolset.Core.Link
679
/// <summary>
680
/// Helper IComparer class to make ordering easier.
681
/// </summary>
682
- internal sealed class AfterItemComparer : IComparer<Item>
682
+ internal class AfterItemComparer : IComparer<Item>
683
{
684
public int Compare(Item x, Item y)
685
{
src/WixToolset.Core/LinkContext.cs
+1
-1
@@ -8,7 +8,7 @@ namespace WixToolset.Core
8
using WixToolset.Extensibility;
9
using WixToolset.Extensibility.Data;
10
11
- public class LinkContext : ILinkContext
11
+ internal class LinkContext : ILinkContext
12
{
13
internal LinkContext(IServiceProvider serviceProvider)
14
{
src/WixToolset.Core/Linker.cs
+2
-3
@@ -14,12 +14,11 @@ namespace WixToolset.Core
14
using WixToolset.Extensibility;
15
using WixToolset.Extensibility.Data;
16
using WixToolset.Extensibility.Services;
17
- using WixToolset.Link;
17
18
/// <summary>
19
/// Linker core of the WiX toolset.
20
/// </summary>
22
- public sealed class Linker
21
+ internal class Linker
22
{
23
private static readonly char[] colonCharacter = ":".ToCharArray();
24
private static readonly string emptyGuid = Guid.Empty.ToString("B");
@@ -29,7 +28,7 @@ namespace WixToolset.Core
28
/// <summary>
29
/// Creates a linker.
30
/// </summary>
32
- public Linker(IServiceProvider serviceProvider)
31
+ internal Linker(IServiceProvider serviceProvider)
32
{
33
this.ServiceProvider = serviceProvider;
34
this.Messaging = this.ServiceProvider.GetService<IMessaging>();
src/WixToolset.Core/Localizer.cs
+15
-21
@@ -11,31 +11,25 @@ namespace WixToolset.Core
11
using WixToolset.Extensibility;
12
using WixToolset.Extensibility.Services;
13
14
- /// <summary>
15
- /// Parses localization files and localizes database values.
16
- /// </summary>
17
- public sealed class Localizer
14
+ internal class Localizer : ILocalizer
15
{
16
public static readonly XNamespace WxlNamespace = "http://wixtoolset.org/schemas/v4/wxl";
17
private static string XmlElementName = "WixLocalization";
18
22
- /// <summary>
23
- /// Loads a localization file from a path on disk.
24
- /// </summary>
25
- /// <param name="path">Path to localization file saved on disk.</param>
26
- /// <returns>Returns the loaded localization file.</returns>
27
- public static Localization ParseLocalizationFile(IMessaging messaging, string path)
19
+ internal Localizer(IServiceProvider serviceProvider)
20
+ {
21
+ this.Messaging = serviceProvider.GetService<IMessaging>();
22
+ }
23
+
24
+ private IMessaging Messaging { get; }
25
+
26
+ public Localization ParseLocalizationFile(string path)
27
{
28
var document = XDocument.Load(path);
30
- return ParseLocalizationFile(messaging, document);
29
+ return ParseLocalizationFile(document);
30
}
31
33
- /// <summary>
34
- /// Loads a localization file from memory.
35
- /// </summary>
36
- /// <param name="document">Document to parse as localization file.</param>
37
- /// <returns>Returns the loaded localization file.</returns>
38
- public static Localization ParseLocalizationFile(IMessaging messaging, XDocument document)
32
+ public Localization ParseLocalizationFile(XDocument document)
33
{
34
XElement root = document.Root;
35
Localization localization = null;
@@ -45,23 +39,23 @@ namespace WixToolset.Core
39
{
40
if (Localizer.WxlNamespace == root.Name.Namespace)
41
{
48
- localization = ParseWixLocalizationElement(messaging, root);
42
+ localization = ParseWixLocalizationElement(this.Messaging, root);
43
}
44
else // invalid or missing namespace
45
{
46
if (null == root.Name.Namespace)
47
{
54
- messaging.Write(ErrorMessages.InvalidWixXmlNamespace(sourceLineNumbers, Localizer.XmlElementName, Localizer.WxlNamespace.NamespaceName));
48
+ this.Messaging.Write(ErrorMessages.InvalidWixXmlNamespace(sourceLineNumbers, Localizer.XmlElementName, Localizer.WxlNamespace.NamespaceName));
49
}
50
else
51
{
58
- messaging.Write(ErrorMessages.InvalidWixXmlNamespace(sourceLineNumbers, Localizer.XmlElementName, root.Name.LocalName, Localizer.WxlNamespace.NamespaceName));
52
+ this.Messaging.Write(ErrorMessages.InvalidWixXmlNamespace(sourceLineNumbers, Localizer.XmlElementName, root.Name.LocalName, Localizer.WxlNamespace.NamespaceName));
53
}
54
}
55
}
56
else
57
{
64
- messaging.Write(ErrorMessages.InvalidDocumentElement(sourceLineNumbers, root.Name.LocalName, "localization", Localizer.XmlElementName));
58
+ this.Messaging.Write(ErrorMessages.InvalidDocumentElement(sourceLineNumbers, root.Name.LocalName, "localization", Localizer.XmlElementName));
59
}
60
61
return localization;
src/WixToolset.Core/Mutator.cs
+1
-1
@@ -10,7 +10,7 @@ namespace WixToolset.Core
10
/// <summary>
11
/// The WiX Toolset mutator.
12
/// </summary>
13
- public sealed class Mutator
13
+ public class Mutator
14
{
15
private SortedList extensions;
16
private string extensionArgument;
src/WixToolset.Core/OptimizeCA.cs
+1
-1
@@ -8,7 +8,7 @@ namespace WixToolset.Core
8
/// Values for the OptimizeCA MsiPatchMetdata property, which indicates whether custom actions can be skipped when applying the patch.
9
/// </summary>
10
[Flags]
11
- public enum OptimizeCA
11
+ internal enum OptimizeCA
12
{
13
/// <summary>
14
/// No custom actions are skipped.
src/WixToolset.Core/Preprocess/IfContext.cs
+1
-1
@@ -5,7 +5,7 @@ namespace WixToolset.Core.Preprocess
5
/// <summary>
6
/// Context for an if statement in the preprocessor.
7
/// </summary>
8
- internal sealed class IfContext
8
+ internal class IfContext
9
{
10
private bool keep;
11
src/WixToolset.Core/Preprocess/ProcessedStreamEventHandler.cs
+2
-2
@@ -32,12 +32,12 @@ namespace WixToolset.Core.Preprocess
32
/// Gets the full path of the source file.
33
/// </summary>
34
/// <value>The full path of the source file.</value>
35
- public string SourceFile { get; private set; }
35
+ public string SourceFile { get; }
36
37
/// <summary>
38
/// Gets the preprocessed output stream.
39
/// </summary>
40
/// <value>The the preprocessed output stream.</value>
41
- public XDocument Document { get; private set; }
41
+ public XDocument Document { get; }
42
}
43
}
src/WixToolset.Core/Preprocessor.cs
+8
-8
@@ -20,24 +20,24 @@ namespace WixToolset.Core
20
/// <summary>
21
/// Preprocessor object
22
/// </summary>
23
- public sealed class Preprocessor
23
+ internal class Preprocessor
24
{
25
- private readonly Regex defineRegex = new Regex(@"^\s*(?<varName>.+?)\s*(=\s*(?<varValue>.+?)\s*)?$", RegexOptions.Compiled | RegexOptions.Singleline | RegexOptions.ExplicitCapture);
26
- private readonly Regex pragmaRegex = new Regex(@"^\s*(?<pragmaName>.+?)(?<pragmaValue>[\s\(].+?)?$", RegexOptions.Compiled | RegexOptions.Singleline | RegexOptions.ExplicitCapture);
25
+ private static readonly Regex DefineRegex = new Regex(@"^\s*(?<varName>.+?)\s*(=\s*(?<varValue>.+?)\s*)?$", RegexOptions.Compiled | RegexOptions.Singleline | RegexOptions.ExplicitCapture);
26
+ private static readonly Regex PragmaRegex = new Regex(@"^\s*(?<pragmaName>.+?)(?<pragmaValue>[\s\(].+?)?$", RegexOptions.Compiled | RegexOptions.Singleline | RegexOptions.ExplicitCapture);
27
28
- private readonly XmlReaderSettings DocumentXmlReaderSettings = new XmlReaderSettings()
28
+ private static readonly XmlReaderSettings DocumentXmlReaderSettings = new XmlReaderSettings()
29
{
30
ValidationFlags = System.Xml.Schema.XmlSchemaValidationFlags.None,
31
XmlResolver = null,
32
};
33
- private readonly XmlReaderSettings FragmentXmlReaderSettings = new XmlReaderSettings()
33
+ private static readonly XmlReaderSettings FragmentXmlReaderSettings = new XmlReaderSettings()
34
{
35
ConformanceLevel = ConformanceLevel.Fragment,
36
ValidationFlags = System.Xml.Schema.XmlSchemaValidationFlags.None,
37
XmlResolver = null,
38
};
39
40
- public Preprocessor(IServiceProvider serviceProvider)
40
+ internal Preprocessor(IServiceProvider serviceProvider)
41
{
42
this.ServiceProvider = serviceProvider;
43
@@ -584,7 +584,7 @@ namespace WixToolset.Core
584
/// <param name="originalDefine">Text from source.</param>
585
private void PreprocessDefine(string originalDefine)
586
{
587
- var match = defineRegex.Match(originalDefine);
587
+ var match = DefineRegex.Match(originalDefine);
588
589
if (!match.Success)
590
{
@@ -791,7 +791,7 @@ namespace WixToolset.Core
791
/// <param name="pragmaText">Text from source.</param>
792
private void PreprocessPragma(string pragmaText, XContainer parent)
793
{
794
- var match = pragmaRegex.Match(pragmaText);
794
+ var match = PragmaRegex.Match(pragmaText);
795
796
if (!match.Success)
797
{
src/WixToolset.Core/ResolveContext.cs
+1
-1
@@ -9,7 +9,7 @@ namespace WixToolset.Core
9
using WixToolset.Extensibility.Data;
10
using WixToolset.Extensibility.Services;
11
12
- public class ResolveContext : IResolveContext
12
+ internal class ResolveContext : IResolveContext
13
{
14
internal ResolveContext(IServiceProvider serviceProvider)
15
{
src/WixToolset.Core/Resolver.cs
+3
-3
@@ -15,9 +15,9 @@ namespace WixToolset.Core
15
/// <summary>
16
/// Resolver for the WiX toolset.
17
/// </summary>
18
- public sealed class Resolver
18
+ internal class Resolver
19
{
20
- public Resolver(IServiceProvider serviceProvider)
20
+ internal Resolver(IServiceProvider serviceProvider)
21
{
22
this.ServiceProvider = serviceProvider;
23
@@ -26,7 +26,7 @@ namespace WixToolset.Core
26
27
private IServiceProvider ServiceProvider { get; }
28
29
- public IMessaging Messaging { get; }
29
+ private IMessaging Messaging { get; }
30
31
public IEnumerable<BindPath> BindPaths { get; set; }
32
src/WixToolset.Core/SourceFile.cs
+2
-4
@@ -2,8 +2,6 @@
2
3
namespace WixToolset.Core
4
{
5
- using System.IO;
6
-
5
internal class SourceFile
6
{
7
public SourceFile(string sourcePath, string outputPath)
@@ -12,8 +10,8 @@ namespace WixToolset.Core
10
this.OutputPath = outputPath;
11
}
12
15
- public string OutputPath { get; set; }
13
+ public string OutputPath { get; }
14
17
- public string SourcePath { get; set; }
15
+ public string SourcePath { get; }
16
}
17
}
src/WixToolset.Core/WixToolsetServiceProvider.cs
+4
-1
@@ -10,7 +10,7 @@ namespace WixToolset.Core
10
using WixToolset.Extensibility.Data;
11
using WixToolset.Extensibility.Services;
12
13
- public class WixToolsetServiceProvider : IServiceProvider
13
+ public sealed class WixToolsetServiceProvider : IServiceProvider
14
{
15
public WixToolsetServiceProvider()
16
{
@@ -36,6 +36,9 @@ namespace WixToolset.Core
36
{ typeof(IBindContext), (provider, singletons) => new BindContext(provider) },
37
{ typeof(ILayoutContext), (provider, singletons) => new LayoutContext(provider) },
38
{ typeof(IInscribeContext), (provider, singletons) => new InscribeContext(provider) },
39
+
40
+ // Internal implementations.
41
+ { typeof(ILocalizer), (provider, singletons) => new Localizer(provider) },
42
};
43
44
this.Singletons = new Dictionary<Type, object>();
src/WixToolset.Core/WixVariableResolver.cs
+1
-1
@@ -12,7 +12,7 @@ namespace WixToolset.Core
12
/// <summary>
13
/// WiX variable resolver.
14
/// </summary>
15
- internal sealed class WixVariableResolver : IVariableResolver
15
+ internal class WixVariableResolver : IVariableResolver
16
{
17
private readonly Dictionary<string, BindVariable> locVariables;
18
private readonly Dictionary<string, BindVariable> wixVariables;