Sln.Inernal Loc

This commit is contained in:
Piotr Puszkiewicz 2016-12-16 21:45:55 -08:00 committed by Livar Cunha
parent 2a612f88af
commit 4e861a9965
2 changed files with 26 additions and 7 deletions

View file

@ -0,0 +1,19 @@
namespace Microsoft.DotNet.Cli.Sln.Internal
{
internal class LocalizableStrings
{
public const string GlobalSectionMoreThanOnceError = "Global section specified more than once";
public const string GlobalSectionNotClosedError = "Global section not closed";
public const string FileHeaderMissingError = "File header is missing";
public const string ProjectSectionNotClosedError = "Project section not closed";
public const string InvalidSectionTypeError = "Invalid section type: {0}";
public const string SectionIdMissingError = "Section id missing";
public const string ClosingSectionTagNotFoundError = "Closing section tag not found";
}
}

View file

@ -157,7 +157,7 @@ namespace Microsoft.DotNet.Cli.Sln.Internal
{
if (globalFound)
{
throw new InvalidSolutionFormatException(curLineNum, "Global section specified more than once");
throw new InvalidSolutionFormatException(curLineNum, LocalizableStrings.GlobalSectionMoreThanOnceError);
}
globalFound = true;
while ((line = reader.ReadLine()) != null)
@ -181,7 +181,7 @@ namespace Microsoft.DotNet.Cli.Sln.Internal
}
if (line == null)
{
throw new InvalidSolutionFormatException(curLineNum, "Global section not closed");
throw new InvalidSolutionFormatException(curLineNum, LocalizableStrings.GlobalSectionNotClosedError);
}
}
else if (line.IndexOf('=') != -1)
@ -191,7 +191,7 @@ namespace Microsoft.DotNet.Cli.Sln.Internal
}
if (FormatVersion == null)
{
throw new InvalidSolutionFormatException(curLineNum, "File header is missing");
throw new InvalidSolutionFormatException(curLineNum, LocalizableStrings.FileHeaderMissingError);
}
}
@ -318,7 +318,7 @@ namespace Microsoft.DotNet.Cli.Sln.Internal
}
}
throw new InvalidSolutionFormatException(curLineNum, "Project section not closed");
throw new InvalidSolutionFormatException(curLineNum, LocalizableStrings.ProjectSectionNotClosedError);
}
private void FindNext(int ln, string line, ref int i, char c)
@ -468,7 +468,7 @@ namespace Microsoft.DotNet.Cli.Sln.Internal
{
return SlnSectionType.PostProcess;
}
throw new InvalidSolutionFormatException(curLineNum, "Invalid section type: " + s);
throw new InvalidSolutionFormatException(curLineNum, String.Format(LocalizableStrings.InvalidSectionTypeError, s));
}
private string FromSectionType(bool isProjectSection, SlnSectionType type)
@ -489,7 +489,7 @@ namespace Microsoft.DotNet.Cli.Sln.Internal
int k = line.IndexOf('(');
if (k == -1)
{
throw new InvalidSolutionFormatException(curLineNum, "Section id missing");
throw new InvalidSolutionFormatException(curLineNum, LocalizableStrings.SectionIdMissingError);
}
var tag = line.Substring(0, k).Trim();
var k2 = line.IndexOf(')', k);
@ -518,7 +518,7 @@ namespace Microsoft.DotNet.Cli.Sln.Internal
}
if (line == null)
{
throw new InvalidSolutionFormatException(curLineNum, "Closing section tag not found");
throw new InvalidSolutionFormatException(curLineNum, LocalizableStrings.ClosingSectionTagNotFoundError);
}
}