Exemple #1
0
 /// <summary>
 /// Updates all hashes of <see cref="Data"/>.
 /// </summary>
 public void Hash()
 {
     var ver = Info.GetKnownRevisionIndex();
     var hash = RevisionChecker.HashInfo[ver];
     var details = hash.GetFile(NameData);
     if (details == null)
         throw new ArgumentNullException(nameof(NameData));
     foreach (var h in details.HashRegions)
         Murmur3.UpdateMurmur32(Data, h.HashOffset, h.BeginOffset, (uint)h.Size);
 }
        public static PersonalOffsets GetOffsets(FileHeaderInfo Info)
        {
            var rev = Info.GetKnownRevisionIndex();

            return(rev switch
            {
                0 => new PersonalOffsets10(),
                1 => new PersonalOffsets11(),
                2 => new PersonalOffsets11(),
                3 => new PersonalOffsets11(),
                4 => new PersonalOffsets11(),
                5 => new PersonalOffsets11(),
                6 => new PersonalOffsets12(),
                7 => new PersonalOffsets12(),
                8 => new PersonalOffsets13(),
                9 => new PersonalOffsets13(),
                10 => new PersonalOffsets14(),
                11 => new PersonalOffsets14(),
                12 => new PersonalOffsets14(),
                13 => new PersonalOffsets15(),
                14 => new PersonalOffsets15(),
                15 => new PersonalOffsets16(),
                16 => new PersonalOffsets17(),
                17 => new PersonalOffsets18(),
                18 => new PersonalOffsets19(),
                19 => new PersonalOffsets110(),
                _ => throw new IndexOutOfRangeException("Unknown revision!" + Environment.NewLine + Info),
            });
Exemple #3
0
        public static MainSaveOffsets GetOffsets(FileHeaderInfo Info)
        {
            var rev = Info.GetKnownRevisionIndex();

            return(rev switch
            {
                0 => new MainSaveOffsets10(),
                1 => new MainSaveOffsets11(),
                2 => new MainSaveOffsets11(),
                _ => throw new IndexOutOfRangeException("Unknown revision!"),
            });
Exemple #4
0
        public static WhereAreNOffsets GetOffsets(FileHeaderInfo Info)
        {
            var rev = Info.GetKnownRevisionIndex();

            return(rev switch
            {
                22 => new WhereAreNOffsets20(),
                23 => new WhereAreNOffsets20(),
                24 => new WhereAreNOffsets20(),
                25 => new WhereAreNOffsets20(),
                26 => new WhereAreNOffsets20(),
                27 => new WhereAreNOffsets20(),
                _ => throw new IndexOutOfRangeException("Unknown revision!" + Environment.NewLine + Info),
            });
Exemple #5
0
        public static PersonalOffsets GetOffsets(FileHeaderInfo Info)
        {
            var rev = Info.GetKnownRevisionIndex();

            return(rev switch
            {
                0 => new PersonalOffsets10(),
                1 => new PersonalOffsets11(),
                2 => new PersonalOffsets11(),
                3 => new PersonalOffsets11(),
                4 => new PersonalOffsets11(),
                5 => new PersonalOffsets11(),
                6 => new PersonalOffsets12(),
                _ => throw new IndexOutOfRangeException("Unknown revision!"),
            });
Exemple #6
0
 public static bool IsRevisionKnown(this FileHeaderInfo info) => info.GetKnownRevisionIndex() >= 0;