Example #1
0
        public IProperties TryParse(String @string)
        {
            if (String.IsNullOrEmpty(@string))
            {
                return(null);
            }

            var properties = new MemoryProperties();

            foreach (var line in lineSplitter.SplitLines(@string))
            {
                if (line.TrimStart().StartsWith("#"))
                {
                    continue;
                }

                if (!line.Contains("="))
                {
                    continue;
                }

                var parts         = line.Split(new[] { '=' }, 2);
                var propertyName  = parts[0].Trim();
                var propertyValue = parts[1].Trim();

                properties.Set(propertyName, propertyValue);
            }

            return(properties);
        }
Example #2
0
 private static void Patch(MemoryProperties baseProperties, IProperties deltaProperties)
 {
     foreach (var property in deltaProperties.ToDictionary())
     {
         baseProperties.Set(property.Key, property.Value);
     }
 }