private Dictionary <string, int> getStringToIntDictionary(string keyName, string defaultValue, int fallbackValue, int errorValue) { return(DictionaryStringHelper.DeserializeRawDictionaryString(getValue(keyName, defaultValue), false) .ToDictionary( item => item.Key, item => int.TryParse(item.Value, out int result) ? result : fallbackValue) .Where(x => x.Value != errorValue) .ToDictionary( item => item.Key, item => item.Value)); }
public static void SetProjectsForHost(string host, IEnumerable <Tuple <string, bool> > projects, UserDefinedSettings settings) { Dictionary <string, string> selectedProjects = settings.SelectedProjects; DictionaryStringHelper.UpdateRawDictionaryString( new Dictionary <string, IEnumerable <Tuple <string, string> > > { { host, projects.Select(y => new Tuple <string, string>(y.Item1, y.Item2.ToString())) } }, selectedProjects); settings.SelectedProjects = selectedProjects; }
public static void InitializeSelectedProjects(IEnumerable <HostInProjectsFile> projects, UserDefinedSettings settings) { if (projects == null) { return; } projects = projects .Where(x => !String.IsNullOrEmpty(x.Name) && (x.Projects?.Any() ?? false)); if (!projects.Any()) { return; } Dictionary <string, string> selectedProjects = settings.SelectedProjects; DictionaryStringHelper.UpdateRawDictionaryString( projects.ToDictionary( x => x.Name, x => x.Projects.Select(y => new Tuple <string, string>(y.Path_With_Namespace, bool.TrueString))), selectedProjects); settings.SelectedProjects = selectedProjects; }
private void setStringToIntDictionary(string keyName, Dictionary <string, int> value) { setValue(keyName, DictionaryStringHelper.SerializeRawDictionaryString( value.ToDictionary(item => item.Key, item => item.Value.ToString()))); }
public static IEnumerable <Tuple <string, bool> > GetProjectsForHost(string host, UserDefinedSettings settings) { return(DictionaryStringHelper.GetDictionaryStringValue(host, settings.SelectedProjects) .Select(x => new Tuple <string, bool>(x.Item1, bool.TryParse(x.Item2, out bool result) ? result : false))); }
private void setStringToStringDictionary(string keyName, Dictionary <string, string> value) { setValue(keyName, DictionaryStringHelper.SerializeRawDictionaryString(value)); }
private Dictionary <string, string> getStringToStringDictionary( string keyName, string defaultValue, bool forceLowerCase) { return(DictionaryStringHelper.DeserializeRawDictionaryString( getValue(keyName, defaultValue), forceLowerCase)); }