Esempio n. 1
0
 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));
 }
Esempio n. 2
0
        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;
        }
Esempio n. 3
0
        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;
        }
Esempio n. 4
0
 private void setStringToIntDictionary(string keyName, Dictionary <string, int> value)
 {
     setValue(keyName, DictionaryStringHelper.SerializeRawDictionaryString(
                  value.ToDictionary(item => item.Key, item => item.Value.ToString())));
 }
Esempio n. 5
0
 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)));
 }
Esempio n. 6
0
 private void setStringToStringDictionary(string keyName, Dictionary <string, string> value)
 {
     setValue(keyName, DictionaryStringHelper.SerializeRawDictionaryString(value));
 }
Esempio n. 7
0
 private Dictionary <string, string> getStringToStringDictionary(
     string keyName, string defaultValue, bool forceLowerCase)
 {
     return(DictionaryStringHelper.DeserializeRawDictionaryString(
                getValue(keyName, defaultValue), forceLowerCase));
 }