Пример #1
0
        public async Task ReadArcPau(string inArc, string parName, string componentName)
        {
            using (ArcFile arcFile = new ArcFile(inArc))
            {
                using (EntryStack entryStack = await arcFile.GetEntryRecursive(parName))
                {
                    using UIComponent component = await UIComponent.CreateUIComponent(await entryStack.Entry.GetData());

                    using UISubcomponent uIComponent = component[0];
                }
            }
        }
Пример #2
0
        public async Task WriteXlsxTest(string xlsxName, string arcName, string commuList)
        {
            using CommuToXlsx commu         = new CommuToXlsx(xlsxName, true);
            using StreamReader streamReader = new StreamReader(commuList);
            using ArcFile arcFile           = new ArcFile(arcName);
            while (!streamReader.EndOfStream)
            {
                string fileName = streamReader.ReadLine();
                using EntryStack entryStack = await arcFile.GetEntryRecursive(fileName);

                ContainerEntry entry = entryStack.Entry;
                using Stream memStream = await entry.GetData();

                commu.GetAndWriteCommu(memStream, fileName);
            }
        }
Пример #3
0
        public async Task GetEntryRecursiveAndWriteToFile(string filename, string entryFilepath, string expectedFile)
        {
            using ArcFile arcFile  = new ArcFile(filename);
            using EntryStack stack = await arcFile.GetEntryRecursive(entryFilepath);

            if (stack == null)
            {
                Assert.Fail("Entry not found.");
            }
            using (Stream stream = await stack.Entry.GetData())
            {
                using FileStream fileStream = new FileStream("temp.dat", FileMode.Create, FileAccess.Write);
                stream.CopyTo(fileStream);
            }
            bool eq = Compare.CompareFiles(expectedFile, "temp.dat");

            File.Delete("temp.dat");
            Assert.IsTrue(eq);
        }
Пример #4
0
        public async Task WritePau(string inArc, string parName, string outputName)
        {
            using (ArcFile arcFile = new ArcFile(inArc))
            {
                using (EntryStack entryStack = await arcFile.GetEntryRecursive(parName))
                {
                    using UIComponent component = await UIComponent.CreateUIComponent(await entryStack.Entry.GetData());

                    using UISubcomponent uIComponent = component[0];

                    using (FileStream outStream = new FileStream("temp.pau", FileMode.Create, FileAccess.Write))
                    {
                        uIComponent.WritePauStream(outStream);
                    }

                    Assert.IsTrue(Compare.CompareFiles("temp.pau", outputName));
                }
            }
        }