Ejemplo n.º 1
0
    public override void SetPurchasedItems(PurchasedItems purchasedItems)
    {
        var json = JsonUtility.ToJson(purchasedItems);

        Debug.Log("[" + Tag + "] Saving Items To Json: " + json);
        var IV            = EncryptionUtility.GenerateIV();
        var encryptedText = EncryptionUtility.AESEncrypt(json, salt, IV);

        PlayerPrefs.SetString(KeyPurchasedItemsName, encryptedText);
        PlayerPrefs.SetString(KeyPurchasedItemsIVName, IV);
        PlayerPrefs.Save();
    }
Ejemplo n.º 2
0
    public override void SetCurrency(string name, int amount)
    {
        if (!MonetizationManager.Currencies.ContainsKey(name))
        {
            return;
        }

        var IV            = EncryptionUtility.GenerateIV();
        var encryptedText = EncryptionUtility.AESEncrypt(amount.ToString(), salt, IV);

        PlayerPrefs.SetString(GetCurrencyKey(name), encryptedText);
        PlayerPrefs.SetString(GetCurrencyIVKey(name), IV);
        PlayerPrefs.Save();
    }
Ejemplo n.º 3
0
 static void CopyAndEncryption(string file, string fileName)
 {
     if (file.EndsWith(fileName))
     {
         FileStream fsread = File.Open(file, FileMode.Open);
         byte[]     buffer = new byte[fsread.Length];
         fsread.Read(buffer, 0, buffer.Length);
         fsread.Close();
         FileStream fsW           = new FileStream(Path.Combine(CodeDir, $"{fileName}.bytes"), FileMode.Create);
         byte[]     enctryptBytes = EncryptionUtility.AESEncrypt(buffer);
         fsW.Write(enctryptBytes, 0, enctryptBytes.Length);
         fsW.Flush();
         fsW.Close();
     }
 }