示例#1
0
    public static void SaveProfile(this Profile _pr)
    {
        var encrypting = MainGameManager.Instance.usingEncryption;

        var    startTime   = DateTime.UtcNow;
        string profilePath = Path.Combine(Application.persistentDataPath, ConstantsResourcesPath.FILE_PROFILE);

        Debug.Log("[GLOBAL.PROFILE] Starting save profile: " + profilePath);

        string json = JsonUtility.ToJson((Profile)_pr, true);

        if (!File.Exists(profilePath + ".json"))
        {
            File.Create(profilePath + ".json").Dispose();
        }

        //Шифруем
        if (encrypting)
        {
            json = SimpleEncrypting.Encode(json);
        }

        File.WriteAllText(profilePath + ".json", json);

        Debug.Log("<color=#FFD800>[GLOBAL.PROFILE] Save profile complete</color>");
        Debug.Log("[GLOBAL.PROFILE] TOTAL TIME (ms): " + (DateTime.UtcNow - startTime).TotalMilliseconds);
    }
 private void OnCode()
 {
     //Шифруем
     secondData = SimpleEncrypting.Encode(firstData);
 }