Beispiel #1
0
    public EnableFlag GetEnabledFlag(string modObjectName)
    {
        if (DisabledList.Contains(modObjectName))
        {
            return(EnableFlag.Disabled);
        }

        return(EnableFlag.Enabled);
    }
Beispiel #2
0
    public void Save()
    {
        try
        {
            EnsureProfileDirectory();

            NewJSON jsonStructure = new NewJSON()
            {
                DisabledList = new List <string>(DisabledList), Operation = Operation
            };

            if (Operation == SetOperation.Expert)
            {
                // Update the EnabledList based on currently installed mods.
                if (EnabledList == null)
                {
                    EnabledList = new HashSet <string>();
                }
                foreach (string name in ModSelectorService.Instance._allExpertMods)
                {
                    if (DisabledList.Contains(name))
                    {
                        EnabledList.Remove(name);
                    }
                    else
                    {
                        EnabledList.Add(name);
                    }
                }
                jsonStructure.EnabledList = new List <string>(EnabledList);
            }

            string jsonOutput = JsonConvert.SerializeObject(jsonStructure, Formatting.Indented);
            File.WriteAllText(FullPath, jsonOutput);
        }
        catch (Exception ex)
        {
            Debug.LogException(ex);
        }
    }
 public bool IsEnabled(string modObjectName)
 {
     return(!DisabledList.Contains(modObjectName));
 }