2019-10-06 21:58:36 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.IO;
|
|
|
|
|
|
|
|
|
|
namespace Compression.BSA
|
|
|
|
|
{
|
|
|
|
|
public interface IBSAReader : IDisposable
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// The files defined by the archive
|
|
|
|
|
/// </summary>
|
|
|
|
|
IEnumerable<IFile> Files { get; }
|
2019-10-07 22:13:38 +00:00
|
|
|
|
|
|
|
|
|
ArchiveStateObject State { get; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public interface IBSABuilder : IDisposable
|
|
|
|
|
{
|
2019-11-16 00:01:37 +00:00
|
|
|
|
void AddFile(FileStateObject state, Stream src);
|
|
|
|
|
void Build(string filename);
|
2019-10-07 22:13:38 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class ArchiveStateObject
|
|
|
|
|
{
|
|
|
|
|
public virtual IBSABuilder MakeBuilder()
|
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
2019-10-06 21:58:36 +00:00
|
|
|
|
}
|
|
|
|
|
|
2019-10-07 22:13:38 +00:00
|
|
|
|
public class FileStateObject
|
|
|
|
|
{
|
|
|
|
|
public int Index { get; set; }
|
2019-10-10 05:04:28 +00:00
|
|
|
|
public string Path { get; set; }
|
2019-10-07 22:13:38 +00:00
|
|
|
|
}
|
|
|
|
|
|
2019-10-06 21:58:36 +00:00
|
|
|
|
public interface IFile
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// The path of the file inside the archive
|
|
|
|
|
/// </summary>
|
|
|
|
|
string Path { get; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// The uncompressed file size
|
|
|
|
|
/// </summary>
|
|
|
|
|
uint Size { get; }
|
|
|
|
|
|
2019-10-07 22:13:38 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Get the metadata for the file.
|
|
|
|
|
/// </summary>
|
|
|
|
|
FileStateObject State { get; }
|
|
|
|
|
|
2019-10-06 21:58:36 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Copies this entry to the given stream. 100% thread safe, the .bsa will be opened multiple times
|
|
|
|
|
/// in order to maintain thread-safe access.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="output"></param>
|
2019-11-16 00:01:37 +00:00
|
|
|
|
void CopyDataTo(Stream output);
|
2019-10-06 21:58:36 +00:00
|
|
|
|
}
|
|
|
|
|
}
|