示例#1
0
        public void WriteToHyoutaArchive(System.IO.Stream target)
        {
            List <HyoutaUtils.HyoutaArchive.HyoutaArchiveFileInfo> files = new List <HyoutaUtils.HyoutaArchive.HyoutaArchiveFileInfo>();

            foreach (var kvp in Map)
            {
                if (!kvp.Value.WriteToBackup)
                {
                    continue;
                }

                HyoutaUtils.HyoutaArchive.HyoutaArchiveFileInfo file = new HyoutaUtils.HyoutaArchive.HyoutaArchiveFileInfo();
                file.Data = kvp.Value.Data.Duplicate();
                file.sha1 = kvp.Key;
                files.Add(file);
            }
            HyoutaUtils.HyoutaArchive.HyoutaArchiveChunk.Pack(target, files, 0, EndianUtils.Endianness.LittleEndian, null, new HyoutaUtils.HyoutaArchive.Compression.DeflateSharpCompressionInfo(0));
        }
示例#2
0
        public static int Pack(List <string> args)
        {
            if (args.Count < 2)
            {
                Console.WriteLine("Usage: folder-to-pack chunk.hac");
                return(-1);
            }

            List <HyoutaUtils.HyoutaArchive.HyoutaArchiveFileInfo> files = new List <HyoutaUtils.HyoutaArchive.HyoutaArchiveFileInfo>();

            foreach (var fi in new DirectoryInfo(args[0]).GetFiles())
            {
                var f = new HyoutaUtils.HyoutaArchive.HyoutaArchiveFileInfo();
                f.Data     = new DuplicatableFileStream(fi.FullName);
                f.Filename = fi.Name;
                files.Add(f);
            }
            using (var fs = new FileStream(args[1], FileMode.Create)) {
                HyoutaUtils.HyoutaArchive.HyoutaArchiveChunk.Pack(fs, files, 0, HyoutaUtils.EndianUtils.Endianness.LittleEndian, null, null);
            }

            return(0);
        }