コード例 #1
0
        private void PathExport(string path)
        {
            VirtualFilesystemDirectory rootDir = new VirtualFilesystemDirectory("archive");

            // Write text
            MemoryStream       bmgFile   = new MemoryStream();
            EndianBinaryWriter bmgWriter = new EndianBinaryWriter(bmgFile, Endian.Big);

            LoadedTextFile.Export(bmgWriter);
            VirtualFilesystemFile bmg = new VirtualFilesystemFile("zel_00", ".bmg", new VirtualFileContents(bmgFile.ToArray()));

            rootDir.Children.Add(bmg);

            // Write color
            MemoryStream       bmcFile   = new MemoryStream();
            EndianBinaryWriter bmcWriter = new EndianBinaryWriter(bmcFile, Endian.Big);

            LoadedColorFile.Export(bmcWriter);
            VirtualFilesystemFile bmc = new VirtualFilesystemFile("color", ".bmc", new VirtualFileContents(bmcFile.ToArray()));

            rootDir.Children.Add(bmc);

            if (m_isCompressed)
            {
                WArchiveTools.ArchiveUtilities.WriteArchive(path, rootDir, WArchiveTools.ArchiveCompression.Yaz0);
            }
            else
            {
                WArchiveTools.ArchiveUtilities.WriteArchive(path, rootDir);
            }
        }
コード例 #2
0
        private void PathExport(string path)
        {
            /*
             * VirtualFilesystemDirectory rootDir = new VirtualFilesystemDirectory("archive");
             *
             * // Write text
             * MemoryStream bmgFile = new MemoryStream();
             * EndianBinaryWriter bmgWriter = new EndianBinaryWriter(bmgFile, Endian.Big);
             * LoadedTextFile.Export(bmgWriter);
             * VirtualFilesystemFile bmg = new VirtualFilesystemFile("zel_00", ".bmg", new VirtualFileContents(bmgFile.ToArray()));
             * rootDir.Children.Add(bmg);
             *
             * // Write color
             * MemoryStream bmcFile = new MemoryStream();
             * EndianBinaryWriter bmcWriter = new EndianBinaryWriter(bmcFile, Endian.Big);
             * LoadedColorFile.Export(bmcWriter);
             * VirtualFilesystemFile bmc = new VirtualFilesystemFile("color", ".bmc", new VirtualFileContents(bmcFile.ToArray()));
             * rootDir.Children.Add(bmc);
             */

            VirtualFilesystemDirectory rootDir = new VirtualFilesystemDirectory("archive");

            foreach (VirtualFilesystemNode node in m_loadedDirRoot.Children)
            {
                if (node is VirtualFilesystemFile)
                {
                    VirtualFilesystemFile oldFile       = node as VirtualFilesystemFile;
                    MemoryStream          newFileData   = new MemoryStream();
                    EndianBinaryWriter    newFileWriter = new EndianBinaryWriter(newFileData, Endian.Big);

                    if (oldFile.Extension == ".bmg")
                    {
                        LoadedTextFile.Export(newFileWriter);
                    }
                    else if (oldFile.Extension == ".bmc")
                    {
                        LoadedColorFile.Export(newFileWriter);
                    }
                    else
                    {
                        rootDir.Children.Add(oldFile);
                        continue;
                    }

                    VirtualFilesystemFile newFile = new VirtualFilesystemFile(oldFile.Name, oldFile.Extension, newFileData.ToArray());
                    rootDir.Children.Add(newFile);
                }
            }

            if (m_isCompressed)
            {
                WArchiveTools.ArchiveUtilities.WriteArchive(path, rootDir, WArchiveTools.ArchiveCompression.Yaz0);
            }
            else
            {
                WArchiveTools.ArchiveUtilities.WriteArchive(path, rootDir);
            }
        }