Beispiel #1
0
        private static List <string> RenderHeader(SlnFileHeader header)
        {
            if (String.IsNullOrEmpty(header.FormatVersion))
            {
                throw new ArgumentNullException(nameof(header.FormatVersion));
            }
            if (String.IsNullOrEmpty(header.CurrentVisualStudioVersion))
            {
                throw new ArgumentNullException(nameof(header.CurrentVisualStudioVersion));
            }
            if (String.IsNullOrEmpty(header.FullVisualStudioVersion))
            {
                throw new ArgumentNullException(nameof(header.FullVisualStudioVersion));
            }
            if (String.IsNullOrEmpty(header.MinimumVisualStudioVersion))
            {
                throw new ArgumentNullException(nameof(header.MinimumVisualStudioVersion));
            }

            return(new()
            {
                $"Microsoft Visual Studio Solution File, Format Version {header.FormatVersion}",
                $"# {header.CurrentVisualStudioVersion}",
                $"VisualStudioVersion = {header.FullVisualStudioVersion}",
                $"MinimumVisualStudioVersion = {header.MinimumVisualStudioVersion}"
            });
        }
Beispiel #2
0
        private static bool ParseHeaderLine(SlnFileHeader header, string line)
        {
            if (line.StartsWith(FormatVersionPrefix))
            {
                header.FormatVersion = line.Replace(FormatVersionPrefix, String.Empty);
                return(true);
            }

            if (line.StartsWith(CurrentVisualStudioVersionPrefix))
            {
                header.CurrentVisualStudioVersion = line.Trim(' ', '#');
                return(true);
            }

            if (line.StartsWith(FullVisualStudioVersionPrefix))
            {
                header.FullVisualStudioVersion = line.Replace(FullVisualStudioVersionPrefix, String.Empty);
                return(true);
            }

            if (line.StartsWith(MinimumVisualStudioVersionPrefix))
            {
                header.MinimumVisualStudioVersion = line.Replace(MinimumVisualStudioVersionPrefix, String.Empty);
                return(true);
            }

            return(false);
        }