public void ReadRevision(out string revision) { revision = default(string); var offset = 0; offset += VersionParserUtility.AssertChar(Contents, _index + offset, ' '); offset += VersionParserUtility.AssertChar(Contents, _index + offset, 'r'); var offsetParenthesis = VersionParserUtility.TryAssertChar(Contents, _index + offset, '('); if (offsetParenthesis > 0) { offset += offsetParenthesis; string revisionFlag; offset += VersionParserUtility.ReadWord(Contents, _index + offset, out revisionFlag); if (revisionFlag != "Unknown") { throw new VersionFormatException("Expected flag for unknown revision but found '" + revisionFlag + "'"); } offset += VersionParserUtility.AssertChar(Contents, _index + offset, ')'); } else { int revisionNumber; offset += VersionParserUtility.ReadPositiveInteger(Contents, _index + offset, out revisionNumber); revision = "r" + revisionNumber; //string revisionData; //offset += VersionParserUtility.ReadWord(Contents, _index + offset, out revisionData); //revision = "r" + revisionData; } _index += offset; }
public void ReadBuildType(out VersionBuildType buildType, out int buildNumber) { buildType = default(VersionBuildType); buildNumber = default(int); var offset = 0; offset += VersionParserUtility.AssertChar(Contents, _index + offset, '-'); string buildTypeString; offset += VersionParserUtility.ReadWord(Contents, _index + offset, out buildTypeString); switch (buildTypeString) { case "beta": buildType = VersionBuildType.Beta; break; case "custom": buildType = VersionBuildType.Custom; break; default: throw new VersionFormatException("Unknown build type: " + buildTypeString); } offset += VersionParserUtility.ReadPositiveInteger(Contents, _index + offset, out buildNumber); _index += offset; }
public void ReadSourceFlag(out bool isSource) { isSource = default(bool); var offset = 0; offset += VersionParserUtility.AssertChar(Contents, _index + offset, '-'); string sourceFlag; offset += VersionParserUtility.ReadWord(Contents, _index + offset, out sourceFlag); if (sourceFlag != "source") { throw new VersionFormatException("Unknown flag: " + sourceFlag); } isSource = true; _index += offset; }
public void ReadWord(out string value) { var offset = VersionParserUtility.ReadWord(Contents, _index, out value); _index += offset; }
public void ReadProductName(out string productName) { var offset = VersionParserUtility.ReadWord(Contents, _index, out productName); _index += offset; }