Expand description

Operations over SEGA ICE archives, used in Phantasy Star Online 2.

Currently, only ICE versions 3 and 4 are supported for reading and writing. These are the only kinds of ICE files in the game client and protocol, so it should be usable for all available ICE files.

Examples

Reading an ICE file:

use std::fs::File;
use ages_ice_archive::{Group, IceArchive, IceGroupIter};

let ice_archive = IceArchive::load(
    File::open("ice_file.ice").unwrap()
).unwrap();
let g1_data = ice_archive.decompress_group(Group::Group1).unwrap();
let g2_data = ice_archive.decompress_group(Group::Group2).unwrap();

println!("Group 1:");
let g1_iter = IceGroupIter::new(&g1_data[..], ice_archive.group_count(Group::Group1)).unwrap();
for f in g1_iter {
    println!("\t{}", f.name().unwrap());
}

println!("Group 2:");
let g2_iter = IceGroupIter::new(&g2_data[..], ice_archive.group_count(Group::Group2)).unwrap();
for f in g2_iter {
    println!("\t{}", f.name().unwrap());
}

Writing an ICE file:

use std::io::Write;
use ages_ice_archive::{Group, IceWriter};
use ascii::AsciiStr;

let mut ice_writer = IceWriter::new(4, true, true, false).unwrap();
{
    let mut file = ice_writer.begin_file(
        AsciiStr::from_ascii("hello.txt").unwrap(),
        AsciiStr::from_ascii("txt").unwrap(),
        Group::Group1,
    );
    file.write_all(b"hello world");
    file.finish();
}
let mut buf = Vec::new(); // any Write sink is acceptable
ice_writer.finish(&mut buf).unwrap();

Structs

A loaded ICE archive.

A handle to an ICE Archive’s file entry.

An IO sink for writing bytes to a file before completing its insertion into an in-progress ICE group.

Type for writing an ICE archive.

Error indicating that the provided ICE version is unsupported by this implementation.

Enums

One of the two file groups in an ICE archive.