public static void AddFiles(TreeNode parentNode, IArchiveFile archiveFile, string[] Files)
        {
            if (Files == null || Files.Length <= 0 || !archiveFile.CanAddFiles)
            {
                return;
            }

            for (int i = 0; i < Files.Length; i++)
            {
                var    File     = ArchiveFileWrapper.FromPath(Files[i], archiveFile);
                string FileName = Path.GetFileName(Files[i]);

                //Don't add the root file name
                if (parentNode.FullPath != string.Empty || !(parentNode is ArchiveRootNodeWrapper))
                {
                    File.ArchiveFileInfo.FileName = Path.Combine(parentNode.FullPath, FileName);
                }
                else
                {
                    File.ArchiveFileInfo.FileName = FileName;
                }

                bool HasAddedFile = archiveFile.AddFile(File.ArchiveFileInfo);

                if (HasAddedFile)
                {
                    parentNode.Nodes.Add(File);
                }
            }
        }
Ejemplo n.º 2
0
            public void AddTexture(string fileName)
            {
                BNTX bntx = BNTX.CreateBNTXFromTexture(fileName);
                var  mem  = new MemoryStream();

                bntx.Save(mem);

                string filePath = fileName;

                ArchiveFile.AddFile(new ArchiveFileInfo()
                {
                    FileData   = mem.ToArray(),
                    FileFormat = bntx,
                    FileName   = filePath,
                });
            }