using Newtonsoft.Json;
using System;
using System.IO;
using UnityEngine;
namespace Assets.StreetLight
{
public sealed class Configuration
{
private string homographyFilePath;
///
/// The file path to the csv file containing the homography for mapping world coodrinates to Unity coordinates.
///
[JsonRequired]
public string HomographyFilePath
{
get => homographyFilePath;
set
{
if (!File.Exists(value))
{
throw new InvalidOperationException($"File \"{value}\" does not exist.");
}
homographyFilePath = value;
}
}
private static readonly Lazy lazy = new(() => JsonConvert.DeserializeObject(File.ReadAllText(Path.Combine(Application.streamingAssetsPath, "Configuration.json"))));
public static Configuration Instance => lazy.Value;
private Configuration() { }
}
}