コード例 #1
0
        public async Task EditThenSaveArcAsTwice(string filename, string entryPath, string replacementFile, string expectedFile)
        {
            using (ArcFile arcFile = new ArcFile(filename))
            {
                ContainerEntry arcEntry = arcFile.GetEntry(entryPath);
                if (arcEntry == null)
                {
                    Assert.Fail("Entry not found.");
                }
                using (FileStream fileStream = new FileStream(replacementFile, FileMode.Open, FileAccess.Read))
                {
                    await arcEntry.SetData(fileStream);
                }
                await arcFile.SaveAs("temp1.arc", progress);

                await arcFile.SaveAs("temp2.arc", progress);
            }
            bool eq1 = Compare.CompareFiles(expectedFile, "temp1.arc");
            bool eq2 = Compare.CompareFiles(ArcFile.GetBinName(expectedFile), "temp1.bin");
            bool eq3 = Compare.CompareFiles(expectedFile, "temp2.arc");
            bool eq4 = Compare.CompareFiles(ArcFile.GetBinName(expectedFile), "temp2.bin");

            File.Delete("temp1.arc");
            File.Delete("temp1.bin");
            File.Delete("temp2.arc");
            File.Delete("temp2.bin");
            Assert.IsTrue(eq1);
            Assert.IsTrue(eq2);
            Assert.IsTrue(eq3);
            Assert.IsTrue(eq4);
        }
コード例 #2
0
        public async Task SaveArcAs(string filename)
        {
            using (ArcFile arcFile = new ArcFile(filename))
            {
                await arcFile.SaveAs("temp.arc", progress);
            }
            bool eq = Compare.CompareFiles(filename, "temp.arc") && Compare.CompareFiles(ArcFile.GetBinName(filename), "temp.bin");

            File.Delete("temp.arc");
            File.Delete("temp.bin");
            Assert.IsTrue(eq);
        }