+PackSource::File::File(const File &other, const Pack &p):
+ pack(p),
+ filename(other.filename),
+ offset(other.offset),
+ length(other.length),
+ collection(other.collection)
+{
+ for(const Object &o: other.objects)
+ objects.push_back(Object(o, *this));
+}
+
+RefPtr<IO::Seekable> PackSource::File::open() const
+{
+ if(pack.get_io())
+ // TODO Performance may be poor without buffering
+ return new IO::Slice(*pack.get_io(), pack.get_base_offset()+offset, length);
+ else
+ {
+ IO::BufferedFile *io_file = new IO::BufferedFile(pack.get_filename());
+ IO::Slice *io_slice = new IO::Slice(*io_file, pack.get_base_offset()+offset, length);
+ io_slice->signal_deleted.connect(sigc::bind(sigc::ptr_fun(delete_io), io_file));
+ return io_slice;
+ }
+}
+
+PackSource::FileInfo PackSource::File::get_info() const