예제 #1
0
        /// <summary>
        /// Initializes the <see cref="Fingerprint"/> class.
        /// </summary>
        public static void Init()
        {
            if (Fingerprint.Initialized)
            {
                return;
            }

            try
            {
                if (!Fingerprint.Patched)
                {
                    FileInfo file = new FileInfo($@"{Directory.GetCurrentDirectory()}\Gamefiles\fingerprint.json");

                    if (file.Exists)
                    {
                        Fingerprint.Json = file.ReadAllText();

                        LogicJSONObject json = LogicJSONParser.ParseObject(Fingerprint.Json);
                        Fingerprint.Sha     = json.GetJsonString("sha").GetStringValue();
                        Fingerprint.Version = json.GetJsonString("version").GetStringValue().Split('.');
                    }
                    else
                    {
                        Debugger.Error("The Fingerprint cannot be loaded, the file does not exist.");
                    }
                }
            }
            catch (Exception exception)
            {
                Debugger.Error($"{exception.GetType().Name} while parsing the fingerprint.");
            }

            Fingerprint.Initialized = true;
        }