-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
dlc support. forgot to include in initial release, whoops
- Loading branch information
1 parent
321a06d
commit 59721f6
Showing
3 changed files
with
54 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace Pandora.Patch.Patchers; | ||
public class FileCache | ||
{ | ||
|
||
private Dictionary<string, FileInfo> pathMap = new Dictionary<string, FileInfo>(); | ||
|
||
public FileInfo GetFile(string path) | ||
{ | ||
FileInfo? fileInfo = null; | ||
|
||
if (!pathMap.TryGetValue(path, out fileInfo)) | ||
{ | ||
pathMap.Add(path, fileInfo = new FileInfo(path)); | ||
} | ||
|
||
return fileInfo; | ||
} | ||
|
||
public FileInfo[] GetFiles(DirectoryInfo directory) | ||
{ | ||
var fileArray = directory.GetFiles(); | ||
|
||
for (int i = 0; i < fileArray.Length; i++) | ||
{ | ||
FileInfo? fileInfo; | ||
if (pathMap.TryGetValue(fileArray[i].FullName, out fileInfo)) | ||
{ | ||
fileArray[i] = fileInfo; | ||
continue; | ||
} | ||
fileInfo = fileArray[i]; | ||
pathMap.Add(fileInfo.FullName, fileInfo ); | ||
} | ||
return fileArray; | ||
} | ||
} |