Пример #1
0
        private static void AddEntry(string outputFile, string inputFile, string entryName)
        {
            FileStream outputStream = OpenStream(outputFile, FileMode.Append, FileAccess.Write);
            FileStream inputStream  = OpenStream(inputFile, FileMode.Open, FileAccess.Read);
            DataStream dataStream   = new DataStream(outputStream);

            PakEntry.Serialize(dataStream, inputStream, entryName);

            inputStream.Dispose();
            outputStream.Dispose();
        }
Пример #2
0
        private static void CreatePackage(string inputFile, string outputFile)
        {
            FileStream outputStream = OpenStream(outputFile, FileMode.Create, FileAccess.Write);
            DataStream dataStream   = new DataStream(outputStream);

            if (!inputFile.EndsWith("\\"))
            {
                inputFile += "\\";
            }

            foreach (string file in Directory.GetFiles(inputFile, "*", SearchOption.AllDirectories))
            {
                string     entryName   = file.Substring(inputFile.Length);
                FileStream inputStream = OpenStream(file, FileMode.Open, FileAccess.Read);

                PakEntry.Serialize(dataStream, inputStream, entryName);

                inputStream.Dispose();
            }

            outputStream.Dispose();
        }