Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blacklist and Image Packs update #246

Merged
merged 2 commits into from
Feb 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion blacklist.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@
"HDD-3.hdf",
"HDD-4.hdf",
"beta.bin",
"mpu.bin"
"mpu.bin",
"bios_1_0_usa.pce"
]
6 changes: 6 additions & 0 deletions pupdate.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@
</ItemGroup>
<ItemGroup>
<None Include=".editorconfig" />
<None Update="blacklist.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="image_packs.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<RuntimeHostConfigurationOption Include="System.Globalization.Invariant" Value="true" />
Expand Down
3 changes: 1 addition & 2 deletions src/models/Core.cs
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,6 @@ public async Task<Dictionary<string, object>> DownloadAssets()
if (slot.filename != null && !slot.filename.EndsWith(".sav") &&
!GlobalHelper.Blacklist.Contains(slot.filename))
{

if (slot.IsCoreSpecific())
{
path = Path.Combine(platformPath, this.identifier);
Expand All @@ -230,7 +229,7 @@ public async Task<Dictionary<string, object>> DownloadAssets()

if (slot.alternate_filenames != null)
{
files.AddRange(slot.alternate_filenames);
files.AddRange(slot.alternate_filenames.Where(f => !GlobalHelper.Blacklist.Contains(f)));
}

foreach (string f in files)
Expand Down
4 changes: 4 additions & 0 deletions src/services/AssetsService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,11 @@ public static void BackupSaves(string directory, string backupLocation)

public static async Task<string[]> GetBlacklist()
{
#if DEBUG
string json = await File.ReadAllTextAsync("blacklist.json");
#else
Comment on lines +48 to +50
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great idea, simple but useful

string json = await HttpHelper.Instance.GetHTML(BLACKLIST);
#endif
string[] files = JsonSerializer.Deserialize<string[]>(json);

return files ?? Array.Empty<string>();
Expand Down
4 changes: 4 additions & 0 deletions src/services/ImagePacksService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ public static class ImagePacksService

public static async Task<ImagePack[]> GetImagePacks()
{
#if DEBUG
string json = await File.ReadAllTextAsync("image_packs.json");
#else
string json = await HttpHelper.Instance.GetHTML(END_POINT);
#endif
ImagePack[] packs = JsonSerializer.Deserialize<ImagePack[]>(json);

return packs ?? Array.Empty<ImagePack>();
Expand Down
Loading