Esempio n. 1
0
        private static void processCompreResultVo(CompreResultVo cr)
        {
            StringBuilder packHead     = new StringBuilder();
            StringBuilder packConstant = new StringBuilder();

            foreach (var item in xmlMapping.Keys)
            {
                StringBuilder sb = xmlMapping[item];
                packHead.Append(item).Append("|").Append(sb.ToString().Length).Append(";");
                packConstant.Append(sb.ToString());
            }

            ByteArray myByteArr = new ByteArray();

            myByteArr.Seek(0, SeekOrigin.Begin);
            myByteArr.WriteString(packHead.ToString());
            myByteArr.WriteString(packConstant.ToString());


            myByteArr.Seek(0, SeekOrigin.Begin);
            byte[] resultArr = new byte[myByteArr.Length];
            myByteArr.Read(resultArr, 0, (int)myByteArr.Length);
            myByteArr.Close();


            //  压缩 后 加密

            EncryptionManager encryptionManager = new EncryptionManager();

            encryptionManager.Awake();
            byte[] encryptionAndComressByteArr = encryptionManager.encryption(resultArr);

            //  写入Resources中
            File.WriteAllBytes(Application.dataPath + "/" + cr.filePath.Replace("\r\n", "").Trim(), encryptionAndComressByteArr);
        }