Delete screenshot metadata

This commit is contained in:
Natsumi
2025-08-09 14:22:39 +12:00
parent eb0843646b
commit d40d0af21f
8 changed files with 250 additions and 102 deletions

View File

@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
@@ -43,7 +43,7 @@ public class PNGFile : IDisposable
ReadAndCacheMetadata();
var chunk = metadataChunkCache.FirstOrDefault((chunk) => chunkTypeFilter.HasFlag(chunk.ChunkTypeEnum));
if (chunk.IsZero())
if (chunk == null || chunk.IsZero())
return null;
return chunk;
@@ -60,7 +60,7 @@ public class PNGFile : IDisposable
public PNGChunk? GetChunkReverse(PNGChunkTypeFilter chunkTypeFilter)
{
var chunk = ReadChunkReverse(chunkTypeFilter);
if (chunk != null && chunk.IsZero())
if (chunk == null || chunk.IsZero())
return null;
return chunk;

View File

@@ -36,7 +36,7 @@ namespace VRCX
/// If true, the function searches from the end of the file using a reverse search bruteforce method.
/// </param>
/// <returns>The text associated with the specified keyword, or null if not found.</returns>
public static string ReadTextChunk(string keyword, PNGFile pngFile, bool legacySearch = false)
public static string? ReadTextChunk(string keyword, PNGFile pngFile, bool legacySearch = false)
{
// Search for legacy text chunks created by old vrchat mods
if (legacySearch)