Esempio n. 1
0
 private void ParseGlobalProjectConfigs(string line)
 {
     if (GlobalProjectConfigs == null)
     {
         if (line.Trim() == LineMarkers.GlobalProjectConfigsStart)
         {
             GlobalProjectConfigs = new List <string>();
         }
         else
         {
             State = States.PostGlobalProjectConfig;
             StateProcessor[State](line);
         }
     }
     else if (line.Trim() == LineMarkers.GlobalSectionEnd)
     {
         State = States.PostGlobalProjectConfig;
     }
     else
     {
         GlobalProjectConfigs.Add(line);
     }
 }
Esempio n. 2
0
        internal IEnumerable <string> GetSolution()
        {
            IEnumerable <string> SplitByNewLine(IEnumerable <string> lines)
            {
                foreach (var line in lines)
                {
                    var parts = line.Split(new[] { Environment.NewLine }, StringSplitOptions.None);
                    if (parts.Length > 1)
                    {
                        foreach (var part in parts)
                        {
                            yield return(part);
                        }
                    }
                    else
                    {
                        yield return(line);
                    }
                }
            }

            var blankCount = 0;

            foreach (var line in PreProjects)
            {
                if (string.IsNullOrWhiteSpace(line))
                {
                    if (blankCount == 1)
                    {
                        continue;
                    }

                    blankCount++;
                }
                else
                {
                    blankCount++; // Don't check anymore
                }

                yield return(line);
            }

            foreach (var line in SplitByNewLine(Projects))
            {
                yield return(line);
            }

            yield return(LineMarkers.GlobalStart);

            if (GlobalSharedProjects.Any())
            {
                yield return("\t" + LineMarkers.GlobalSharedProjectStart);

                foreach (var line in SplitByNewLine(GlobalSharedProjects))
                {
                    yield return(line);
                }
                yield return("\t" + LineMarkers.GlobalSectionEnd);
            }

            if (GlobalSolutionConfigs.Any())
            {
                yield return("\t" + LineMarkers.GlobalSolutionConfigsStart);

                foreach (var line in SplitByNewLine(GlobalSolutionConfigs))
                {
                    yield return(line);
                }
                yield return("\t" + LineMarkers.GlobalSectionEnd);
            }

            if (GlobalProjectConfigs.Any())
            {
                yield return("\t" + LineMarkers.GlobalProjectConfigsStart);

                foreach (var line in SplitByNewLine(GlobalProjectConfigs))
                {
                    yield return(line);
                }
                yield return("\t" + LineMarkers.GlobalSectionEnd);
            }

            foreach (var line in SplitByNewLine(PostGlobalProjectConfigs))
            {
                yield return(line);
            }
        }