private void SaveUI() { BindFileConfig.Instance.FolderPath = txtFolder.Text; BindFileConfig.Instance.BindText = txtBind.Text; BindFileConfig.Instance.MaxValue = BindFileConfig.TryParseInt(txtMaxValue.Text); BindFileConfig.Instance.ItemsPerFile = BindFileConfig.TryParseInt(txtItemsPerFile.Text); BindFileConfig.Instance.Validate(); }
public static BindFileConfig Load() { string fileName = GetFileName(); string jsonContent = null; if (File.Exists(fileName)) { jsonContent = File.ReadAllText(fileName); } else { jsonContent = RessourcesReader.TextFileRessourceToString(Properties.Resources.BindFileConfig); } BindFileConfig instance = JsonConvert.DeserializeObject <BindFileConfig>(jsonContent); instance.Validate(); return(instance); }