[Source Code] Get Unity Version C#


As requested.
This code read unity asset binary and get strings of unity version

C#:
using System;
using System.IO;
using System.Text;
C#:
string UnityVersion(string file)
{
    try
    {
        BinaryReader br = new BinaryReader(File.OpenRead(file));
        string hex = null;
        for (int i = 0x14; i <= 0x1f; i++)
        {
            br.BaseStream.Position = i;
            hex += br.ReadByte().ToString("X2");
        }
        br.Close();
        var bytes = new byte[hex.Length / 2];
        for (var i = 0; i < bytes.Length; i++)
        {
            bytes[i] = Convert.ToByte(hex.Substring(i * 2, 2), 16);
        }
        string str = Encoding.ASCII.GetString(bytes);
        var strs = str.Split('.');
       // Logs("Got unity version");
        return strs[0] + "." + strs[1];
    }
    catch (Exception ex)
    {
        //Logs("Error: Couldn't get unity version. " + ex.Message);
        return "";
    }
}


Kommentarer

Popular Posts

VMOS Pro Global/CN Custom ROMs - Android 5.1.1 and 7.1.2, Root + Xposed

VMOS 1.0.49 MOD APK | Video ads bypassed | Pre-rooted ROM