diff options
Diffstat (limited to 'src/WixToolset.Core.Burn/Bundles/BurnReader.cs')
-rw-r--r-- | src/WixToolset.Core.Burn/Bundles/BurnReader.cs | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/src/WixToolset.Core.Burn/Bundles/BurnReader.cs b/src/WixToolset.Core.Burn/Bundles/BurnReader.cs index 68fdea1c..5b06b31e 100644 --- a/src/WixToolset.Core.Burn/Bundles/BurnReader.cs +++ b/src/WixToolset.Core.Burn/Bundles/BurnReader.cs | |||
@@ -27,7 +27,7 @@ namespace WixToolset.Core.Burn.Bundles | |||
27 | 27 | ||
28 | private bool invalidBundle; | 28 | private bool invalidBundle; |
29 | private BinaryReader binaryReader; | 29 | private BinaryReader binaryReader; |
30 | private List<DictionaryEntry> attachedContainerPayloadNames; | 30 | private readonly List<DictionaryEntry> attachedContainerPayloadNames; |
31 | 31 | ||
32 | /// <summary> | 32 | /// <summary> |
33 | /// Creates a BurnReader for reading a PE file. | 33 | /// Creates a BurnReader for reading a PE file. |
@@ -43,13 +43,7 @@ namespace WixToolset.Core.Burn.Bundles | |||
43 | /// <summary> | 43 | /// <summary> |
44 | /// Gets the underlying stream. | 44 | /// Gets the underlying stream. |
45 | /// </summary> | 45 | /// </summary> |
46 | public Stream Stream | 46 | public Stream Stream => this.binaryReader?.BaseStream; |
47 | { | ||
48 | get | ||
49 | { | ||
50 | return (null != this.binaryReader) ? this.binaryReader.BaseStream : null; | ||
51 | } | ||
52 | } | ||
53 | 47 | ||
54 | internal static BurnReader Open(object inputFilePath) | 48 | internal static BurnReader Open(object inputFilePath) |
55 | { | 49 | { |
@@ -64,7 +58,7 @@ namespace WixToolset.Core.Burn.Bundles | |||
64 | /// <returns>Burn reader.</returns> | 58 | /// <returns>Burn reader.</returns> |
65 | public static BurnReader Open(IMessaging messaging, string fileExe) | 59 | public static BurnReader Open(IMessaging messaging, string fileExe) |
66 | { | 60 | { |
67 | BurnReader reader = new BurnReader(messaging, fileExe); | 61 | var reader = new BurnReader(messaging, fileExe); |
68 | 62 | ||
69 | reader.binaryReader = new BinaryReader(File.Open(fileExe, FileMode.Open, FileAccess.Read, FileShare.Read | FileShare.Delete)); | 63 | reader.binaryReader = new BinaryReader(File.Open(fileExe, FileMode.Open, FileAccess.Read, FileShare.Read | FileShare.Delete)); |
70 | if (!reader.Initialize(reader.binaryReader)) | 64 | if (!reader.Initialize(reader.binaryReader)) |
@@ -109,8 +103,7 @@ namespace WixToolset.Core.Burn.Bundles | |||
109 | cabinet.Extract(outputDirectory); | 103 | cabinet.Extract(outputDirectory); |
110 | 104 | ||
111 | Directory.CreateDirectory(Path.GetDirectoryName(manifestPath)); | 105 | Directory.CreateDirectory(Path.GetDirectoryName(manifestPath)); |
112 | File.Delete(manifestPath); | 106 | FileSystem.MoveFile(manifestOriginalPath, manifestPath); |
113 | File.Move(manifestOriginalPath, manifestPath); | ||
114 | 107 | ||
115 | XmlDocument document = new XmlDocument(); | 108 | XmlDocument document = new XmlDocument(); |
116 | document.Load(manifestPath); | 109 | document.Load(manifestPath); |
@@ -128,8 +121,7 @@ namespace WixToolset.Core.Burn.Bundles | |||
128 | string destinationPath = Path.Combine(outputDirectory, filePathNode.Value); | 121 | string destinationPath = Path.Combine(outputDirectory, filePathNode.Value); |
129 | 122 | ||
130 | Directory.CreateDirectory(Path.GetDirectoryName(destinationPath)); | 123 | Directory.CreateDirectory(Path.GetDirectoryName(destinationPath)); |
131 | File.Delete(destinationPath); | 124 | FileSystem.MoveFile(sourcePath, destinationPath); |
132 | File.Move(sourcePath, destinationPath); | ||
133 | } | 125 | } |
134 | 126 | ||
135 | foreach (XmlNode payload in payloads) | 127 | foreach (XmlNode payload in payloads) |
@@ -193,8 +185,7 @@ namespace WixToolset.Core.Burn.Bundles | |||
193 | string destinationPath = Path.Combine(outputDirectory, (string)entry.Value); | 185 | string destinationPath = Path.Combine(outputDirectory, (string)entry.Value); |
194 | 186 | ||
195 | Directory.CreateDirectory(Path.GetDirectoryName(destinationPath)); | 187 | Directory.CreateDirectory(Path.GetDirectoryName(destinationPath)); |
196 | File.Delete(destinationPath); | 188 | FileSystem.MoveFile(sourcePath, destinationPath); |
197 | File.Move(sourcePath, destinationPath); | ||
198 | } | 189 | } |
199 | 190 | ||
200 | return true; | 191 | return true; |