/// <summary>
        /// public virtual bool SavePacket(string secretKey, byte[] data, Version version, AlgorithmType algType, AlgorithmKeyType algKeyType)
        /// </summary>
        /// <param name="secretKey"></param>
        /// <param name="data"></param>
        /// <param name="version"></param>
        /// <param name="algType"></param>
        /// <param name="algKeyType"></param>
        /// <returns></returns>
        public virtual bool SavePacket(string secretKey, byte[] data, Version version, AlgorithmType algType, AlgorithmKeyType algKeyType)
        {
            bool flag = false;

            switch (algType)
            {
            case AlgorithmType.DES:
                try
                {
                    Encryptor = new AlgorithmDES(secretKey, algKeyType);
                    WriteFile(secretKey, data, version, Encryptor, AlgorithmType.DES, algKeyType);
                    flag = true;
                }
                catch { flag = false; }
                break;

            case AlgorithmType.Rijndael:
                try
                {
                    Encryptor = new AlgorithmRijndael(secretKey, algKeyType);
                    WriteFile(secretKey, data, version, Encryptor, AlgorithmType.Rijndael, algKeyType);
                    flag = true;
                }
                catch { flag = false; }
                break;

            case AlgorithmType.TripleDES:
                try
                {
                    Encryptor = new AlgorithmTripleDES(secretKey, algKeyType);
                    WriteFile(secretKey, data, version, Encryptor, AlgorithmType.TripleDES, algKeyType);
                    flag = true;
                }
                catch { flag = false; }
                break;

            case AlgorithmType.None:
                try
                {
                    WriteFile(data, version, AlgorithmType.None, AlgorithmKeyType.None);
                    flag = true;
                }
                catch { flag = false; }
                break;

            default:
                break;
            }
            return(flag);
        }
        /// <summary>
        /// public virtual byte[] OpenPacket(string secretKey, Version version)
        /// </summary>
        /// <param name="secretKey"></param>
        /// <param name="version"></param>
        /// <returns></returns>
        public virtual byte[] OpenPacket(string secretKey, Version version)
        {
            AlgorithmType    algType;
            AlgorithmKeyType algKeyType;

            byte[] value = null;
            byte[] data  = ReadFile(5, version, out algType, out algKeyType);
            if (data != null)
            {
                switch (algType)
                {
                case AlgorithmType.DES:
                    try
                    {
                        Encryptor = new AlgorithmDES(secretKey, algKeyType);
                        value     = Encryptor.ObjectCryptography(data, TransformType.DECRYPT);
                    }
                    catch (Exception ex) { throw ex; }
                    break;

                case AlgorithmType.Rijndael:
                    try
                    {
                        Encryptor = new AlgorithmRijndael(secretKey, algKeyType);
                        value     = Encryptor.ObjectCryptography(data, TransformType.DECRYPT);
                    }
                    catch (Exception ex) { throw ex; }
                    break;

                case AlgorithmType.TripleDES:
                    try
                    {
                        Encryptor = new AlgorithmTripleDES(secretKey, algKeyType);
                        value     = Encryptor.ObjectCryptography(data, TransformType.DECRYPT);
                    }
                    catch (Exception ex) { throw ex; }
                    break;

                case AlgorithmType.None:
                    value = data;
                    break;

                default:
                    break;
                }
            }
            return(value);
        }
        /// <summary>
        /// public virtual void SaveLicense(string secretKey, string data, Version version, AlgorithmType algType, AlgorithmKeyType algKeyType)
        /// </summary>
        /// <param name="secretKey"></param>
        /// <param name="data"></param>
        /// <param name="version"></param>
        /// <param name="algType"></param>
        /// <param name="algKeyType"></param>
        public virtual void SaveLicense(string secretKey, string data, Version version, AlgorithmType algType, AlgorithmKeyType algKeyType)
        {
            switch (algType)
            {
            case AlgorithmType.DES:
                try
                {
                    Encryptor = new AlgorithmDES(secretKey, algKeyType);
                    WriteFile(secretKey, data, version, Encryptor, AlgorithmType.DES, algKeyType);
                }
                catch {
                    return;
                }
                break;

            case AlgorithmType.Rijndael:
                try
                {
                    Encryptor = new AlgorithmRijndael(secretKey, algKeyType);
                    WriteFile(secretKey, data, version, Encryptor, AlgorithmType.Rijndael, algKeyType);
                }
                catch {
                    return;
                }
                break;

            case AlgorithmType.TripleDES:
                try
                {
                    Encryptor = new AlgorithmTripleDES(secretKey, algKeyType);
                    WriteFile(secretKey, data, version, Encryptor, AlgorithmType.TripleDES, algKeyType);
                }
                catch {
                    return;
                }
                break;

            case AlgorithmType.None:
                try
                {
                    WriteFile(data, version, AlgorithmType.None, AlgorithmKeyType.None);
                }
                catch {
                    return;
                }
                break;
            }
        }
        /// <summary>
        /// public virtual byte[] MemoryPacket(string secretKey, byte[] data, Version version, AlgorithmType algType, AlgorithmKeyType algKeyType)
        /// </summary>
        /// <param name="secretKey"></param>
        /// <param name="data"></param>
        /// <param name="version"></param>
        /// <param name="algType"></param>
        /// <param name="algKeyType"></param>
        /// <returns></returns>
        public virtual byte[] MemoryPacket(string secretKey, byte[] data, Version version, AlgorithmType algType, AlgorithmKeyType algKeyType)
        {
            byte[] value = null;
            switch (algType)
            {
            case AlgorithmType.DES:
                try
                {
                    Encryptor = new AlgorithmDES(secretKey, algKeyType);
                    value     = WriteMenoryStream(secretKey, data, version, Encryptor, AlgorithmType.DES, algKeyType);
                }
                catch (Exception e) { throw e; }
                break;

            case AlgorithmType.Rijndael:
                try
                {
                    Encryptor = new AlgorithmRijndael(secretKey, algKeyType);
                    value     = WriteMenoryStream(secretKey, data, version, Encryptor, AlgorithmType.Rijndael, algKeyType);
                }
                catch (Exception e) { throw e; }
                break;

            case AlgorithmType.TripleDES:
                try
                {
                    Encryptor = new AlgorithmTripleDES(secretKey, algKeyType);
                    value     = WriteMenoryStream(secretKey, data, version, Encryptor, AlgorithmType.TripleDES, algKeyType);
                }
                catch (Exception e) { throw e; }
                break;

            case AlgorithmType.None:
                try
                {
                    value = WriteMenoryStream(data, version, AlgorithmType.None, AlgorithmKeyType.None);
                }
                catch (Exception e) { throw e; }
                break;

            default:
                break;
            }
            return(value);
        }