Skip to content

Commit 676bf58

Browse files
committed
Clean up some console writes
1 parent 0a4fd01 commit 676bf58

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

SabreTools.Serialization/Wrappers/InstallShieldCabinet.Extraction.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ public bool Extract(string outputDirectory, bool includeDebug)
249249
if (directoryName != null && !Directory.Exists(directoryName))
250250
Directory.CreateDirectory(directoryName);
251251

252-
cabinet.FileSave(i, filename);
252+
cabinet.FileSave(i, filename, includeDebug);
253253
}
254254
catch (Exception ex)
255255
{
@@ -269,15 +269,15 @@ public bool Extract(string outputDirectory, bool includeDebug)
269269
/// <summary>
270270
/// Save the file at the given index to the filename specified
271271
/// </summary>
272-
public bool FileSave(int index, string filename, bool useOld = false)
272+
public bool FileSave(int index, string filename, bool includeDebug, bool useOld = false)
273273
{
274274
// Get the file descriptor
275275
if (!TryGetFileDescriptor(index, out var fileDescriptor) || fileDescriptor == null)
276276
return false;
277277

278278
// If the file is split
279279
if (fileDescriptor.LinkFlags == LinkFlags.LINK_PREV)
280-
return FileSave((int)fileDescriptor.LinkPrevious, filename, useOld);
280+
return FileSave((int)fileDescriptor.LinkPrevious, filename, includeDebug, useOld);
281281

282282
// Get the reader at the index
283283
var reader = Reader.Create(this, index, fileDescriptor);
@@ -379,7 +379,7 @@ public bool FileSave(int index, string filename, bool useOld = false)
379379

380380
// Validate the number of bytes written
381381
if ((long)fileDescriptor.ExpandedSize != totalWritten)
382-
Console.WriteLine($"Expanded size of file {index} ({GetFileName(index)}) expected to be {fileDescriptor.ExpandedSize}, but was {totalWritten}");
382+
if (includeDebug) Console.WriteLine($"Expanded size of file {index} ({GetFileName(index)}) expected to be {fileDescriptor.ExpandedSize}, but was {totalWritten}");
383383

384384
// Finalize output values
385385
md5.Terminate();

SabreTools.Serialization/Wrappers/MoPaQ.Extraction.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,7 @@ public partial class MoPaQ : IExtractable
1212
/// <inheritdoc/>
1313
public bool Extract(string outputDirectory, bool includeDebug)
1414
{
15-
#if NET20 || NET35 || !(WINX86 || WINX64)
16-
Console.WriteLine("Extraction is not supported for this framework!");
17-
Console.WriteLine();
18-
return false;
19-
#else
15+
#if (NET452_OR_GREATER || NETCOREAPP) && (WINX86 || WINX64)
2016
try
2117
{
2218
if (Filename == null || !File.Exists(Filename))
@@ -73,6 +69,10 @@ public bool Extract(string outputDirectory, bool includeDebug)
7369
if (includeDebug) System.Console.WriteLine(ex);
7470
return false;
7571
}
72+
#else
73+
Console.WriteLine("Extraction is not supported for this framework!");
74+
Console.WriteLine();
75+
return false;
7676
#endif
7777
}
7878
}

0 commit comments

Comments
 (0)