Files
SabreTools/SabreTools.FileTypes/BaseArchive.cs

87 lines
2.3 KiB
C#
Raw Normal View History

using System.Collections.Generic;
2020-06-11 11:44:46 -07:00
using System.IO;
2020-12-10 22:31:23 -08:00
2020-12-08 14:53:49 -08:00
namespace SabreTools.FileTypes
{
public abstract class BaseArchive : Folder
{
#region Protected instance variables
2020-09-18 01:50:44 -07:00
2025-01-04 21:40:45 -05:00
/// <summary>
/// Determines if real dates are written
/// </summary>
protected bool _realDates = false;
/// <summary>
/// Buffer size used by archives
/// </summary>
protected const int _bufferSize = 4096 * 128;
#endregion
#region Construtors
/// <summary>
/// Create a new Archive with no base file
/// </summary>
2025-01-04 21:55:14 -05:00
public BaseArchive() : base(writeToParent: false) { }
/// <summary>
2025-01-04 20:24:56 -05:00
/// Create a new BaseArchive from the given file
/// </summary>
2025-01-04 20:24:56 -05:00
/// <param name="filename">Name of the file to use</param>
2025-01-04 21:55:14 -05:00
public BaseArchive(string filename) : base(filename, writeToParent: false) { }
#endregion
#region Extraction
2020-12-08 11:09:05 -08:00
/// <inheritdoc/>
public override abstract bool CopyAll(string outDir);
2020-12-08 11:09:05 -08:00
/// <inheritdoc/>
2024-02-28 19:19:50 -05:00
public override abstract string? CopyToFile(string entryName, string outDir);
2020-12-08 11:09:05 -08:00
/// <inheritdoc/>
2024-07-15 21:37:38 -04:00
public override abstract (Stream?, string?) GetEntryStream(string entryName);
#endregion
#region Information
2020-12-08 11:09:05 -08:00
/// <inheritdoc/>
2024-02-28 19:19:50 -05:00
public override abstract List<BaseFile>? GetChildren();
2020-12-08 11:09:05 -08:00
/// <inheritdoc/>
public override abstract List<string> GetEmptyFolders();
/// <summary>
/// Check whether the input file is a standardized format
/// </summary>
2025-01-04 21:42:46 -05:00
public abstract bool IsStandardized();
#endregion
#region Writing
2025-01-04 21:40:45 -05:00
/// <summary>
/// Set if real dates are written
/// </summary>
public void SetRealDates(bool realDates)
{
_realDates = realDates;
}
2020-12-08 11:09:05 -08:00
/// <inheritdoc/>
2024-02-28 19:19:50 -05:00
public override abstract bool Write(string inputFile, string outDir, BaseFile? baseFile);
2020-12-08 11:09:05 -08:00
/// <inheritdoc/>
2024-02-28 19:19:50 -05:00
public override abstract bool Write(Stream? inputStream, string outDir, BaseFile? baseFile);
2020-12-08 11:09:05 -08:00
/// <inheritdoc/>
2024-02-28 19:19:50 -05:00
public override abstract bool Write(List<string> inputFiles, string outDir, List<BaseFile>? baseFiles);
#endregion
}
}