mirror of
https://github.com/SteamRE/DepotDownloader.git
synced 2026-11-19 13:17:15 +00:00
Use ReadAllLinesAsync and async main
This commit is contained in:
1 parent
baa64e9e51
commit
6edab0c55e
1 file changed
+8
-9
@@ -13,12 +13,7 @@ namespace DepotDownloader
|
||||
{
|
||||
class Program
|
||||
{
|
||||
static int Main(string[] args)
|
||||
=> MainAsync(args).GetAwaiter().GetResult();
|
||||
|
||||
internal static readonly char[] newLineCharacters = ['\n', '\r'];
|
||||
|
||||
static async Task<int> MainAsync(string[] args)
|
||||
static async Task<int> Main(string[] args)
|
||||
{
|
||||
if (args.Length == 0)
|
||||
{
|
||||
@@ -71,15 +66,19 @@ namespace DepotDownloader
|
||||
|
||||
try
|
||||
{
|
||||
var fileListData = await File.ReadAllTextAsync(fileList);
|
||||
var files = fileListData.Split(newLineCharacters, StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
ContentDownloader.Config.UsingFileList = true;
|
||||
ContentDownloader.Config.FilesToDownload = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
|
||||
ContentDownloader.Config.FilesToDownloadRegex = [];
|
||||
|
||||
var files = await File.ReadAllLinesAsync(fileList);
|
||||
|
||||
foreach (var fileEntry in files)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(fileEntry))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (fileEntry.StartsWith(RegexPrefix))
|
||||
{
|
||||
var rgx = new Regex(fileEntry[RegexPrefix.Length..], RegexOptions.Compiled | RegexOptions.IgnoreCase);
|
||||
|
||||
Reference in new issue
Block a user