public void ReplaceMobileProvision(byte[] mobileProvisionBytes) { m_zipFile.BeginUpdate(); MemoryStreamDataSource mobileProvisionDataSource = new MemoryStreamDataSource(mobileProvisionBytes); m_zipFile.Add(mobileProvisionDataSource, m_appDirectoryPath + MobileProvisionFileName); CodeResourcesFile codeResources = GetCodeResourcesFile(); codeResources.UpdateFileHash(MobileProvisionFileName, mobileProvisionBytes); MobileProvisionFile mobileProvision = new MobileProvisionFile(mobileProvisionBytes); string provisionedBundleIdentifier = mobileProvision.PList.Entitlements.BundleIdentifier; if (provisionedBundleIdentifier != GetBundleIdentifier()) { // We must update the info.plist's CFBundleIdentifier to match the one from the mobile provision InfoFile infoFile = GetInfoFile(); infoFile.BundleIdentifier = provisionedBundleIdentifier; byte[] infoBytes = infoFile.GetBytes(); MemoryStreamDataSource infoDataSource = new MemoryStreamDataSource(infoBytes); m_zipFile.Add(infoDataSource, m_appDirectoryPath + InfoFileName); codeResources.UpdateFileHash(InfoFileName, infoBytes); } byte[] codeResourcesBytes = codeResources.GetBytes(); MemoryStreamDataSource codeResourcesDataSource = new MemoryStreamDataSource(codeResourcesBytes); m_zipFile.Add(codeResourcesDataSource, m_appDirectoryPath + CodeResourcesFilePath); m_zipFile.CommitUpdate(); }
private void ReplaceExecutable(byte[] executableBytes) { m_zipFile.BeginUpdate(); MemoryStreamDataSource executableDataSource = new MemoryStreamDataSource(executableBytes); string executableName = GetExecutableName(); m_zipFile.Add(executableDataSource, m_appDirectoryPath + executableName); m_zipFile.CommitUpdate(); }