2019-10-06 21:58:36 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.IO;
|
2020-04-20 21:36:33 +00:00
|
|
|
|
using System.Threading.Tasks;
|
2020-03-23 12:57:18 +00:00
|
|
|
|
using Wabbajack.Common;
|
2019-10-06 21:58:36 +00:00
|
|
|
|
|
|
|
|
|
namespace Compression.BSA
|
|
|
|
|
{
|
2020-04-17 03:52:19 +00:00
|
|
|
|
public interface IBSAReader : IAsyncDisposable
|
2019-10-06 21:58:36 +00:00
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// The files defined by the archive
|
|
|
|
|
/// </summary>
|
|
|
|
|
IEnumerable<IFile> Files { get; }
|
2019-10-07 22:13:38 +00:00
|
|
|
|
|
|
|
|
|
ArchiveStateObject State { get; }
|
|
|
|
|
}
|
|
|
|
|
|
2020-04-17 03:52:19 +00:00
|
|
|
|
public interface IBSABuilder : IAsyncDisposable
|
2019-10-07 22:13:38 +00:00
|
|
|
|
{
|
2020-04-20 21:36:33 +00:00
|
|
|
|
Task AddFile(FileStateObject state, Stream src);
|
|
|
|
|
Task Build(AbsolutePath filename);
|
2019-10-07 22:13:38 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class ArchiveStateObject
|
|
|
|
|
{
|
2020-03-09 20:38:35 +00:00
|
|
|
|
public virtual IBSABuilder MakeBuilder(long size)
|
2019-10-07 22:13:38 +00:00
|
|
|
|
{
|
|
|
|
|
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; }
|
2020-03-23 12:57:18 +00:00
|
|
|
|
public RelativePath 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>
|
2020-03-23 12:57:18 +00:00
|
|
|
|
RelativePath Path { get; }
|
2019-10-06 21:58:36 +00:00
|
|
|
|
|
|
|
|
|
/// <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
|
|
|
|
}
|
|
|
|
|
}
|