feat: Add options to save the current world name/id to screenshot metadata/filenames

This commit is contained in:
Teacup
2023-02-11 18:30:53 -05:00
parent 8aae8f3b78
commit 0f3b8c732a
10 changed files with 265 additions and 6 deletions

View File

@@ -634,5 +634,27 @@ namespace VRCX
{
}
}
public void AddScreenshotMetadata(string path, string worldName, string worldId, bool changeFilename = false)
{
try
{
string fileName = Path.GetFileNameWithoutExtension(path);
if (!File.Exists(path) || !path.EndsWith(".png") || !fileName.StartsWith("VRChat_")) return;
if (changeFilename)
{
var newFileName = $"{fileName}_{worldId}";
var newPath = Path.Combine(Path.GetDirectoryName(path), newFileName + Path.GetExtension(path));
File.Move(path, newPath);
path = newPath;
}
string metadataString = $"{Program.Version}||{worldId}||{worldName}";
ScreenshotHelper.WritePNGDescription(path, metadataString);
}
catch { }
}
}
}