Пример #1
0
        public bool ConfigExists(string path)
        {
            if (path == null)
            {
                throw new ArgumentNullException("path");
            }

            return(File.Exists(Pathfinder.MergePath(this.ConfigPath, path)));
        }
Пример #2
0
        public void SaveConfig(string path, object data)
        {
            if (path == null)
            {
                throw new ArgumentNullException("path");
            }

            File.WriteAllText(Pathfinder.MergePath(this.ConfigPath, path), JsonConvert.SerializeObject(data, Formatting.Indented));
        }
Пример #3
0
        public T LoadConfig <T>(string path)
        {
            if (path == null)
            {
                throw new ArgumentNullException("path");
            }

            return(ConfigHelper.Load <T>(Pathfinder.MergePath(this.ConfigPath, path)));
        }
Пример #4
0
        public Core(string modName, string configDirectoryPath, bool logDebugMessages)
        {
            this.Logger = new Logger(modName, logDebugMessages);

            this.ModName  = modName;
            this.RootPath = this.ConfigPath = Pathfinder.FindModRootPath(modName);

            if (configDirectoryPath != null)
            {
                this.ConfigPath = Pathfinder.MergePath(this.ConfigPath, configDirectoryPath);
            }

            this.Logger.LogDebug($"Initialized {modName} mod at path {this.RootPath}, with config root at {this.ConfigPath}");
        }
Пример #5
0
        public Core(string modName, string workshopID, string configDirectoryPath, bool logDebugMessages)
        {
            this.Logger = new Logger(modName, logDebugMessages);

            this.ModName = modName;

            if (Pathfinder.FindModRootPath(modName, workshopID, out var path))
            {
                this.RootPath = this.ConfigPath = path;
            }

            if (configDirectoryPath != null)
            {
                this.ConfigPath = Pathfinder.MergePath(this.ConfigPath, configDirectoryPath);
            }

            this.Logger.Log($"Initialized successfully. Version: {Assembly.GetCallingAssembly().GetName().Version}, Path: {this.RootPath}, Config root: {this.ConfigPath}");
        }
Пример #6
0
 public T LoadConfig <T>(string path)
 {
     return(ConfigHelper.Load <T>(Pathfinder.MergePath(this.ConfigPath, path)));
 }