Beispiel #1
0
        //----- field -----

        //----- property -----

        //----- method -----

        public static bool CheckCryptoFile(string assetBundlePath, string aesKey, string aesIv)
        {
            var changed = true;

            var packageCryptoFilePath = PathUtility.Combine(assetBundlePath, CryptoFileName);

            var packageCrypto = new PackageCrypto
            {
                cryptoKey = aesKey,
                cryptoIv  = aesIv,
            };

            var text = string.Empty;

            if (File.Exists(packageCryptoFilePath))
            {
                try
                {
                    text = File.ReadAllText(packageCryptoFilePath);

                    var prev = JsonConvert.DeserializeObject <PackageCrypto>(text);

                    if (prev.cryptoKey == packageCrypto.cryptoKey && prev.cryptoIv == packageCrypto.cryptoIv)
                    {
                        changed = false;
                    }
                }
                catch
                {
                    /* Ignore Exception */
                }
            }

            return(changed);
        }
Beispiel #2
0
        public static void CreateCryptoFile(string assetBundlePath, string aesKey, string aesIv)
        {
            var packageCryptoFilePath = PathUtility.Combine(assetBundlePath, CryptoFileName);

            var packageCrypto = new PackageCrypto
            {
                cryptoKey = aesKey,
                cryptoIv  = aesIv,
            };

            var json = packageCrypto.ToJson(true);

            File.WriteAllText(packageCryptoFilePath, json);
        }