Esempio n. 1
0
        private void Save([NotNull] string filePath, Firmware firmware, bool encode)
        {
            if (firmware == null)
            {
                throw new ArgumentNullException("firmware");
            }
            if (string.IsNullOrEmpty(filePath))
            {
                throw new ArgumentNullException("filePath");
            }

            var data = encode ? m_encoder.Encode(firmware.GetBody()) : firmware.GetBody();

            File.WriteAllBytes(filePath, data);
        }
Esempio n. 2
0
        private void Save([NotNull] string filePath, Firmware firmware, EncryptionType encryptionType)
        {
            if (firmware == null)
            {
                throw new ArgumentNullException("firmware");
            }
            if (string.IsNullOrEmpty(filePath))
            {
                throw new ArgumentNullException("filePath");
            }

            var data = s_encryptors.ContainsKey(encryptionType)
                                ? s_encryptors[encryptionType].Encode(firmware.GetBody())
                                : firmware.GetBody();

            File.WriteAllBytes(filePath, data);
        }