JobManager/ProtocolLib/PacketIO/PacketDirectory.cs

54 lines
1.0 KiB
C#
Raw Normal View History

2024-06-01 12:28:32 +09:00
namespace PacketIO;
public class PacketDirectory : IPacketFile
{
private string fileName;
private List<IPacketFile> files;
public PacketDirectory(string fileName, params IPacketFile[] files)
{
this.fileName = fileName;
this.files = new List<IPacketFile>();
this.files.AddRange(files);
}
public IEnumerable<IPacketFile> EnumerableFiles()
{
return this.files.ToList();
}
public string GetFileName()
{
return this.fileName;
}
public long GetFileSize()
{
return 0;
}
public PacketFileType GetFileType()
{
return PacketFileType.Directory;
}
public long AddFile(IPacketFile file)
{
this.files.Add(file);
return this.files.LongCount();
}
public bool RemoveFile(IPacketFile file)
{
return this.files.Remove(file);
}
public void Dispose()
{
foreach (IPacketFile file in this.EnumerableFiles())
{
file.Dispose();
}
}
}