Exemplo n.º 1
0
        public async Task ExtractContentFromFileCreatedExternally()
        {
            using var file = new IntuneWinFile(@"sample.intunewin");

            const string contentFileName = "extracted-sample-content.intunewin";

            await file.ExtractContentFileAsync(contentFileName);

            Assert.True(File.Exists(contentFileName));

            Assert.AreEqual(new FileInfo(contentFileName).Length, 3078);

            Assert.True(FilesAreEqual(
                            new FileInfo("extracted-sample-content.intunewin"),
                            new FileInfo(@"sample.zip")));
        }
Exemplo n.º 2
0
        public async Task CreateNewFile()
        {
            using var file = new IntuneWinFile("created.intunewin", "Lorem", "LoremIpsumDolorSetAmet",
                                               "lorem.intunewin", "file.txt");

            await file.EmbedContentFileAsync(@"sample.zip");

            Assert.IsNotEmpty(file.ApplicationInfo.Name);
            Assert.IsNotEmpty(file.ApplicationInfo.FileName);
            Assert.IsNotEmpty(file.ApplicationInfo.SetupFile);
            Assert.Greater(file.ApplicationInfo.UnencryptedContentSize, 0);

            Assert.AreEqual(file.ApplicationInfo.UnencryptedContentSize, 3078);

            Assert.AreEqual(file.ApplicationInfo.EncryptionInfo.FileDigest,
                            "S+ZXJesMxhj1Opq2AWdJEZlmMJrElayFctjtlx3F/nE=");

            await file.ExtractContentFileAsync("extracted-created-content.intunewin");

            Assert.True(FilesAreEqual(
                            new FileInfo("extracted-created-content.intunewin"),
                            new FileInfo(@"sample.zip")));
        }