Skip to content

Commit b9a8c83

Browse files
committed
Solves #161 where .XCZ files are marked as untrimmed.
Prevents .XCZ file to be trimmed.
1 parent e286f35 commit b9a8c83

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

Switch Backup Manager/Util.cs

+9-1
Original file line numberDiff line numberDiff line change
@@ -803,6 +803,14 @@ public static bool TrimXCIFile(FileData file)
803803

804804
if (file != null)
805805
{
806+
string extension = Path.GetExtension(file.FilePath).ToLower();
807+
808+
if (extension == ".xcz")
809+
{
810+
logger.Warning(".XCZ files are not supposed to be trimmed! Aborting!!");
811+
return result;
812+
}
813+
806814
if (!file.IsTrimmed)
807815
{
808816
logger.Info("Trimming file "+file.FileNameWithExt+". Old size: "+Convert.ToString(file.ROMSizeBytes)+". New size: "+Convert.ToString(file.UsedSpaceBytes));
@@ -3073,7 +3081,7 @@ public static FileData GetFileData(string filepath)
30733081
}
30743082
result.UsedSpace = $"{num3_fs:0.##} {array_fs[num2_fs]}";
30753083

3076-
result.IsTrimmed = (result.UsedSpaceBytes == result.ROMSizeBytes);
3084+
result.IsTrimmed = Path.GetExtension(filepath).ToLower() == ".xcz" ? true : (result.UsedSpaceBytes == result.ROMSizeBytes);
30773085
result.CartSize = GetCapacity(XCI.XCI_Headers[0].CardSize1);
30783086

30793087
//Load Deep File Info (Probably we should clean it a bit more)

0 commit comments

Comments
 (0)