private static Settings Load()
{
var settings = default(Settings);
try { settings = JsonValue.Parse(File.ReadAllText(SETTINGS_PATH, DefaultEncoding)).As<Settings>(); }
catch (Exception readError) { Debug.LogWarning("Failed to read settings for Charon: " + readError.Message); }
if (settings == null)
{
settings = new Settings
{
ToolsPort = 43210,
ToolsPath = null,
GameDataPaths = (from id in AssetDatabase.FindAssets("GameData")
let path = FileUtils.MakeProjectRelative(AssetDatabase.GUIDToAssetPath(id))
where path != null && path.EndsWith(".json", StringComparison.OrdinalIgnoreCase)
select path).ToArray(),
SelectedLicense = null,
LicenseServerAddress = null,
Verbose = false
};
try { File.WriteAllText(SETTINGS_PATH, JsonObject.From(settings).Stringify(), DefaultEncoding); }
catch { /* ignore */ }
}
settings.Validate();
return settings;
}