Skip to content

Commit 60f3baa

Browse files
2 parents ee0b4e9 + a0e232d commit 60f3baa

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

UnrealReZen/Core/FIoPack.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ public static void PackFilesToUcas(this List<AssetMetadata> files, Dependency m,
8080
using var f = File.Open(Path.ChangeExtension(outFilename, ".ucas"), FileMode.Create);
8181
for (int i = 0; i < files.Count; i++)
8282
{
83+
WriteProgressBar(i, files.Count - 1);
84+
8385
MemoryMappedFile mmf;
8486
long SizeOfmmf;
8587
string pathToread = Path.Combine(dir.Replace("/", "\\"), files[i].FilePath.Replace("/", "\\"));
@@ -142,6 +144,20 @@ public static void PackFilesToUcas(this List<AssetMetadata> files, Dependency m,
142144
}
143145
mmf.Dispose();
144146
}
147+
148+
// Add a line feed for the progress bar
149+
Console.WriteLine("");
150+
}
151+
152+
public static void WriteProgressBar(int count, int maxCount)
153+
{
154+
// Display a progress bar on the console.
155+
// e.g. WriteProgressBar(54, 100)
156+
// [##########..........] 54/100
157+
const int MaxProgress = 20;
158+
var progress = count * MaxProgress / maxCount;
159+
string str = new string('#', progress) + new string('.', MaxProgress - progress);
160+
Console.Write($"\r[{str}] {count}/{maxCount}");
145161
}
146162

147163
public static byte[] DeparseDirectoryIndex(List<AssetMetadata> files)

0 commit comments

Comments
 (0)