using System;
using System.Threading;
using System.Threading.Tasks;
namespace pkNX.Containers;
///
/// Array of Files
///
public interface IFileContainer
{
///
/// Path the was loaded from.
///
string? FilePath { get; set; }
///
/// Indication if the contents of the have been modified.
///
bool Modified { get; set; }
///
/// Count of files inside the .
///
int Count { get; }
///
/// File access for individually indexed files.
///
/// File number to fetch
/// Data representing the file at the specified index.
byte[] this[int index] { get; set; }
Task GetFiles();
Task GetFile(int file, int subFile = 0);
Task SetFile(int file, byte[] value, int subFile = 0);
Task SaveAs(string path, ContainerHandler handler, CancellationToken token);
void Dump(string path, ContainerHandler handler);
void CancelEdits();
}
public static class FileContainerExtensions
{
public static string GetFileFormatString(this IFileContainer c) => "D" + Math.Ceiling(Math.Log10(c.Count));
}