1
0
mirror of synced 2024-12-03 03:27:23 +01:00
Switch-Toolbox/Switch_Toolbox_Library/Interfaces/IArchiveFile.cs
2019-05-08 16:45:27 -04:00

60 lines
1.5 KiB
C#

using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Switch_Toolbox.Library
{
public enum ArchiveFileState
{
Empty = 0,
Archived = 1,
Added = 2,
Replaced = 4,
Renamed = 8,
Deleted = 16
}
public interface IArchiveFile
{
bool CanAddFiles { get; }
bool CanRenameFiles { get; }
bool CanReplaceFiles { get; }
bool CanDeleteFiles { get; }
IEnumerable<ArchiveFileInfo> Files { get; }
bool AddFile(ArchiveFileInfo archiveFileInfo);
bool DeleteFile(ArchiveFileInfo archiveFileInfo);
}
public class ArchiveFileInfo
{
public FileType FileDataType = FileType.Default;
public string GetSize()
{
return STMath.GetFileSize(FileData.Length, 4);
}
IFileFormat FileFormat = null; //Format attached for saving
protected Stream _fileData = null;
public string FileName { get; set; } = string.Empty; //Full File Name
public string Name { get; set; } = string.Empty; //File Name (No Path)
public virtual Stream FileData
{
get
{
_fileData.Position = 0;
return _fileData;
}
set { _fileData = value; }
}
public ArchiveFileState State { get; set; } = ArchiveFileState.Empty;
}
}