• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

SamboyCoding / Cpp2IL / 12284684366

11 Dec 2024 08:50PM UTC coverage: 28.154% (-0.02%) from 28.172%
12284684366

Pull #390

github

web-flow
Merge a07e6a76a into edbb9949b
Pull Request #390: Set AssemblyDefinition::PublicKey when generating AsmResolver assemblies

1266 of 6242 branches covered (20.28%)

Branch coverage included in aggregate %.

1 of 12 new or added lines in 4 files covered. (8.33%)

1 existing line in 1 file now uncovered.

3385 of 10278 relevant lines covered (32.93%)

124847.75 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

59.38
/LibCpp2IL/Metadata/Il2CppAssemblyNameDefinition.cs
1
using System;
2
using System.Linq;
3

4
namespace LibCpp2IL.Metadata;
5

6
public class Il2CppAssemblyNameDefinition : ReadableClass
7
{
8
    public int nameIndex;
9
    public int cultureIndex;
10

11
    [Version(Max = 24.1f)] [Version(Min = 24.2f, Max = 24.3f)] //Not present in 24.15
12
    public int hashValueIndex;
13

14
    public int publicKeyIndex;
15
    public uint hash_alg;
16
    public int hash_len;
17
    public uint flags;
18
    public int major;
19
    public int minor;
20
    public int build;
21
    public int revision;
22
    public ulong publicKeyToken;
23

24
    public string Name => LibCpp2IlMain.TheMetadata!.GetStringFromIndex(nameIndex);
1,272✔
25
    public string Culture => LibCpp2IlMain.TheMetadata!.GetStringFromIndex(cultureIndex);
×
26

27
    public byte[]? PublicKey
28
    {
29
        get
30
        {
NEW
31
            var result = LibCpp2IlMain.TheMetadata!.GetByteArrayFromIndex(publicKeyIndex);
×
NEW
32
            return result.Length == 0 ? null : result;
×
33
        }
34
    }
35

36
    /// <summary>
37
    /// This returns the public key token as a byte array, or null if the token is 0.
38
    /// </summary>
39
    /// <remarks>
40
    /// Returning null is necessary to match the behavior of AsmResolver.
41
    /// </remarks>
42
    public byte[]? PublicKeyToken
43
    {
44
        get
45
        {
NEW
46
            return publicKeyToken == default ? null : BitConverter.GetBytes(publicKeyToken);
×
47
        }
48
    }
49

50
    public string HashValue => LibCpp2IlMain.MetadataVersion > 24.3f ? "NULL" : LibCpp2IlMain.TheMetadata!.GetStringFromIndex(hashValueIndex);
×
51

52
    public override string ToString()
53
    {
54
        var pkt = string.Join("-", BitConverter.GetBytes(publicKeyToken).Select(b => b.ToString("X2")));
×
55
        return $"{Name}, Version={major}.{minor}.{build}.{revision}, PublicKeyToken={pkt}";
×
56
    }
57

58
    public override void Read(ClassReadingBinaryReader reader)
59
    {
60
        nameIndex = reader.ReadInt32();
1,061✔
61
        cultureIndex = reader.ReadInt32();
1,061✔
62
        if (IsAtMost(24.3f) && IsNot(24.15f))
1,061✔
63
            hashValueIndex = reader.ReadInt32();
193✔
64
        publicKeyIndex = reader.ReadInt32();
1,061✔
65
        hash_alg = reader.ReadUInt32();
1,061✔
66
        hash_len = reader.ReadInt32();
1,061✔
67
        flags = reader.ReadUInt32();
1,061✔
68
        major = reader.ReadInt32();
1,061✔
69
        minor = reader.ReadInt32();
1,061✔
70
        build = reader.ReadInt32();
1,061✔
71
        revision = reader.ReadInt32();
1,061✔
72
        publicKeyToken = reader.ReadUInt64();
1,061✔
73
    }
1,061✔
74
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc