From 629b19b2ed60fb092d933d2c05ed6a2cf9ba6a68 Mon Sep 17 00:00:00 2001 From: Bitl Date: Mon, 11 Dec 2023 16:40:32 -0700 Subject: [PATCH] add the ability for novetus to generate _meta.ini files! --- changelog.txt | 1 + .../novetusexts/webproxy/AwardBadge.cs | 25 ++++++++----------- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/changelog.txt b/changelog.txt index 20e99b5..8853b98 100644 --- a/changelog.txt +++ b/changelog.txt @@ -2,6 +2,7 @@ EDGE Snapshot v23.8745.28516.1 Enhancements: - Play Solo now uses the current server port (defined in the Host menu.) - This makes it easier to launch Play Solo on some computers. +- Novetus will now create basic _meta.ini files for games that have badges! They can then be filled out with correct information by map creators and archivists. Fixes: - Fixed the AwardBadge and HasBadge extensions not working properly. ---------------------------------------------------------------------------- diff --git a/defaultaddons/novetusexts/webproxy/AwardBadge.cs b/defaultaddons/novetusexts/webproxy/AwardBadge.cs index 22330af..1a5805e 100644 --- a/defaultaddons/novetusexts/webproxy/AwardBadge.cs +++ b/defaultaddons/novetusexts/webproxy/AwardBadge.cs @@ -72,21 +72,18 @@ public class AwardBadge : IWebProxyExtension metaFile = GlobalPaths.DataDir + "\\Appreciation_meta.ini"; } - if (File.Exists(metaFile)) + try + { + INIFile metaIni = new INIFile(metaFile, !(File.Exists(metaFile)); + string section = BadgeID.ToString(); + + string name = metaIni.IniReadValue(section, "BadgeName", "Unknown Badge #" + BadgeID.ToString()); + string creator = metaIni.IniReadValue(section, "BadgeCreatorName", "Unknown"); + result.BadgeName = name; + result.BadgeCreatorName = creator; + } + catch (Exception) { - try - { - INIFile metaIni = new INIFile(metaFile, false); - string section = BadgeID.ToString(); - - string name = metaIni.IniReadValue(section, "BadgeName", BadgeID.ToString()); - string creator = metaIni.IniReadValue(section, "BadgeCreatorName", "Unknown"); - result.BadgeName = name; - result.BadgeCreatorName = creator; - } - catch (Exception) - { - } } return result;