Пример #1
0
        public static ConfigurationPlatform Parse(string source)
        {
            var match    = Regex.Matches(source, ConfigurationPattern).First();
            var platform = new ConfigurationPlatform
            {
                Configuration = match.Groups["configuration"].Value,
                Platform      = match.Groups["platform"].Value,
                Suffix        = match.Groups["suffix"].Value
            };

            Guid.TryParse(match.Groups["guid"].Value, out var tmpGuid);
            platform.ProjectGuid = tmpGuid;
            return(platform);
        }
Пример #2
0
        public void Load(Queue <string> sourceLines)
        {
            var headerLine  = sourceLines.Dequeue()?.Trim();
            var headerMatch = Regex.Matches(headerLine, HeaderPattern).First();

            Type     = Enum.Parse <GlobalSectionType>(headerMatch.Groups["type"].Value);
            Location = Enum.Parse <SolutionLocation>(headerMatch.Groups["location"].Value);

            string assignmentLine;

            while (!"EndGlobalSection".Equals(assignmentLine = sourceLines.Dequeue()?.Trim()))
            {
                var lineMatch = Regex.Matches(assignmentLine, PairPattern).First();
                // Add the internal pairs
                var targetConfiguration = ConfigurationPlatform.Parse(lineMatch.Groups["target"].Value);
                var sourceConfiguration = ConfigurationPlatform.Parse(lineMatch.Groups["source"].Value);

                ConfigurationPairs[sourceConfiguration] = targetConfiguration;
            }
        }