1. I am getting {} in the configuration file. What am I doing wrong?

    Code:
    public Configuration config;public class Configuration
    {
        public int Version { get; set; }
    }protected override void LoadDefaultConfig(){}void Loaded()
    {
        if (!Config.Exists())
            InitConfiguration();
        else
            LoadConfiguration();
    }
    void LoadConfiguration()
    {
        config = Config.ReadObject<Configuration>();
    }void InitConfiguration()
    {
        Config.Clear();
        Config.WriteObject<Configuration>(new Configuration
        {
            Version = 1
        }, false);    LoadConfiguration();
    }
     
  2. Wulf

    Wulf Community Admin

    The config exists when it has {} in it. You'd instead need to check if it is empty or not.