Skip to content

Commit 2a6e193

Browse files
committed
Formatting cleanup
1 parent 65a86d8 commit 2a6e193

File tree

3 files changed

+14
-17
lines changed

3 files changed

+14
-17
lines changed

SabreTools.Serialization/Readers/MicrosoftCabinet.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,13 +203,13 @@ private static CFDATA ParseDataBlock(Stream data, byte dataReservedSize)
203203
dataBlock.Checksum = data.ReadUInt32LittleEndian();
204204
dataBlock.CompressedSize = data.ReadUInt16LittleEndian();
205205
dataBlock.UncompressedSize = data.ReadUInt16LittleEndian();
206-
206+
207207
if (dataReservedSize > 0)
208208
data.SeekIfPossible(dataReservedSize, SeekOrigin.Current);
209209

210210
if (dataBlock.CompressedSize > 0)
211211
data.SeekIfPossible(dataBlock.CompressedSize, SeekOrigin.Current);
212-
212+
213213
return dataBlock;
214214
}
215215

SabreTools.Serialization/Wrappers/MicrosoftCabinet.Extraction.cs

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -178,19 +178,18 @@ public bool Extract(string outputDirectory, bool includeDebug)
178178
if (f == 0 && (cabinet.Files[0].FolderIndex == FolderIndex.CONTINUED_PREV_AND_NEXT
179179
|| cabinet.Files[0].FolderIndex == FolderIndex.CONTINUED_FROM_PREV))
180180
continue;
181-
181+
182182
var folder = cabinet.Folders[f];
183183
allExtracted &= cabinet.ExtractFolder(Filename, outputDirectory, folder, f, ignorePrev, includeDebug);
184184
}
185185

186186
// Move to the next cabinet, if possible
187187
Array.ForEach(cabinet.Folders, folder => folder.DataBlocks = []);
188-
188+
189189
cabinet = cabinet.Next;
190190
cabinet?.Prev = null;
191-
191+
192192
// TODO: already-extracted data isn't being cleared from memory, at least not nearly enough.
193-
194193
if (cabinet?.Folders == null || cabinet.Folders.Length == 0)
195194
break;
196195
}
@@ -203,7 +202,7 @@ public bool Extract(string outputDirectory, bool includeDebug)
203202
return false;
204203
}
205204
}
206-
205+
207206
/// <summary>
208207
/// Extract the contents of a single folder
209208
/// </summary>
@@ -242,22 +241,21 @@ private bool ExtractFolder(string? filename,
242241
// debug output for inconsistencies would go here
243242
continue;
244243
}
245-
244+
246245
fileList.Add(file);
247246
}
248-
247+
249248
CFFILE[] files = fileList.ToArray();
250249
blockStream.SeekIfPossible(0, SeekOrigin.Begin);
251250
for (int i = 0; i < files.Length; i++)
252251
{
253252
var file = files[i];
254-
255253
allExtracted &= ExtractFiles(outputDirectory, blockStream, file, includeDebug);
256254
}
257255

258256
return allExtracted;
259257
}
260-
258+
261259
// TODO: this will apparently improve memory usage/performance, but it's not clear if this implementation is enough for that to happen
262260
/// <summary>
263261
/// Extract the contents of a single file, intended to be used with all files in a straight shot

SabreTools.Serialization/Wrappers/MicrosoftCabinet.cs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ private static CompressionType GetCompressionType(CFFOLDER folder)
363363
// Return all found blocks in order
364364
return [.. prevBlocks, .. folder.DataBlocks, .. nextBlocks];
365365
}
366-
366+
367367
/// <summary>
368368
/// Loads in all the datablocks for the current folder.
369369
/// </summary>
@@ -390,9 +390,8 @@ public void GetData(CFFOLDER folder)
390390
offset += folder.DataBlocks[i].CompressedSize;
391391
}
392392
}
393-
394393
}
395-
394+
396395
/// <summary>
397396
/// Get all files for the current folder, plus connected spanned folders.
398397
/// </summary>
@@ -423,7 +422,7 @@ private CFFILE[] GetSpannedFiles(string? filename, int folderIndex, bool ignoreP
423422
int fileFolder = GetFolderIndex(f);
424423
return fileFolder == folderIndex;
425424
});
426-
425+
427426
// Check if the folder spans in either direction
428427
bool spanPrev = Array.Exists(files, f => f.FolderIndex == FolderIndex.CONTINUED_FROM_PREV || f.FolderIndex == FolderIndex.CONTINUED_PREV_AND_NEXT);
429428
bool spanNext = Array.Exists(files, f => f.FolderIndex == FolderIndex.CONTINUED_TO_NEXT || f.FolderIndex == FolderIndex.CONTINUED_PREV_AND_NEXT);
@@ -443,7 +442,7 @@ private CFFILE[] GetSpannedFiles(string? filename, int folderIndex, bool ignoreP
443442
prevFiles = Prev.GetSpannedFiles(filename, prevFolderIndex, skipNext: true) ?? [];
444443
}
445444
}
446-
445+
447446
// If the folder spans forward and Next is not being skipped
448447
CFFILE[] nextFiles = [];
449448
if (!skipNext && spanNext)
@@ -459,7 +458,7 @@ private CFFILE[] GetSpannedFiles(string? filename, int folderIndex, bool ignoreP
459458
nextFiles = Next.GetSpannedFiles(filename, 0, skipPrev: true) ?? [];
460459
}
461460
}
462-
461+
463462
// Return all found files in order
464463
return [.. prevFiles, .. files, .. nextFiles];
465464
}

0 commit comments

Comments
 (0)