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 Read(Stream stream) { using BinaryReader reader = new BinaryReader(stream); author = reader.ReadZString(); country = EnumUtils.intToEnum <VersionBuildCountry>(reader.ReadInt32()); type = EnumUtils.intToEnum <VersionBuildType>(reader.ReadInt32()); v3 = reader.ReadUInt32(); buildVersion = reader.ReadUInt32(); date = reader.ReadZString(); time = reader.ReadZString(); year = reader.ReadUInt32(); vv2 = reader.ReadUInt32(); }
public bool TryReadBuildType(out VersionBuildType buildType, out int buildNumber) { try { ReadBuildType(out buildType, out buildNumber); return(true); } catch (VersionFormatException) { buildType = default(VersionBuildType); buildNumber = default(int); return(false); } }