/// <summary> /// Save data settings to the file /// </summary> /// <param name="settings">Data settings</param> /// <param name="fileProvider">File provider</param> public static void SaveSettings(DataSettings settings, IResearchFileProvider fileProvider = null) { Singleton <DataSettings> .Instance = settings ?? throw new ArgumentNullException(nameof(settings)); fileProvider = fileProvider ?? CommonHelper.DefaultFileProvider; var filePath = fileProvider.MapPath(ResearchDataSettingsDefaults.FilePath); //create file if not exists fileProvider.CreateFile(filePath); //save data settings to the file var text = JsonConvert.SerializeObject(Singleton <DataSettings> .Instance, Formatting.Indented); fileProvider.WriteAllText(filePath, text, Encoding.UTF8); }