Skip to content

Commit

Permalink
Profile: Add support for mods to conditionally change behavior based …
Browse files Browse the repository at this point in the history
…on the current FFNx Config
  • Loading branch information
julianxhokaxhiu committed Sep 25, 2022
1 parent e1d30bb commit cc08836
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions 7thHeaven.Code/Profile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,18 @@ private bool IsConfigActive(string spec) {
if (parts.Length != 2) return false;
parts = new[] { parts[0].Trim(), spec.Substring(parts[0].Length, spec.Length - parts[1].Length - parts[0].Length), parts[1].Trim() };

var conf = Settings.Find(c => c.ID.Equals(parts[0], StringComparison.InvariantCultureIgnoreCase));
if (conf == null) return false;
var conf = new ProfileSetting();

if (parts[0].StartsWith("ffnx_", StringComparison.InvariantCultureIgnoreCase))
{
var key = parts[0].Substring(5);
if (Sys.FFNxConfig.HasKey(key)) conf = new ProfileSetting() { ID = key, Value = int.Parse(Sys.FFNxConfig.Get(key)) };
}
else
{
conf = Settings.Find(c => c.ID.Equals(parts[0], StringComparison.InvariantCultureIgnoreCase));
if (conf == null) return false;
}

int val;
if (!int.TryParse(parts[2], out val)) return false;
Expand Down

0 comments on commit cc08836

Please sign in to comment.