using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
namespace System.Fire.Container {
public partial class ContainerList {
private string _containerName;
private string _path;
private DateTime loadDuration = new DateTime(0);
private DateTime saveDuration = new DateTime(0);
///
/// Get the container list name
///
public string ContainerName {
get {
return this._containerName;
}
set {
this._containerName = value;
}
}
///
/// Get or set the path of the container
/// When setting a new path, it will load the container automaticly
///
public string Path {
get {
return this._path;
}
set {
if (value != this.Path) {
this.Save();
this.ChunkFile.Close();
this.InfoFile.Close();
this.Load(value);
}
}
}
///
/// Get the number of files that are stored in the containers
///
public int NumFiles {
get {
return this._files.Count();
}
}
///
/// Get the max possible container size in bytes, the container list may have, depending on all set containers and empty containers
///
public ulong PossibleContainerListSize {
get {
ulong filledContainers = 0;
int numEmptyContainers = 0;
numEmptyContainers += (256 - this._container.Count) * 256;
for(int i = 0; i < this._container.Count;i++) {
numEmptyContainers += 256 - this._container[i].Count;
for (int j = 0; j < this._container[i].Count;j++) {
filledContainers += (ulong)this._container[i][j].ChunkSize;
}
}
return filledContainers + (ulong)(numEmptyContainers * this._maxContainerSize);
}
}
///
/// Get the size of all containers
///
public long Size {
get {
long tmp = 0;
for (int i = 0, c1 = this._container.Count; i < c1; i++)
for (int j = 0, c2 = this._container[i].Count; j < c2; j++)
tmp += this._container[i][j].ContainerSize;
return tmp;
}
}
///
/// Get the number of containers
///
public int NumContainers {
get {
int tmp = 0;
for (int i = 0, c1 = this._container.Count; i < c1; i++)
tmp += this._container.Count;
return tmp;
}
}
///
/// Get the number of container groups
///
public int NumGroups {
get {
return this._container.Count;
}
}
///
/// Returns the duration the container list needed to load
///
public DateTime LoadDuration {
get {
return this.loadDuration;
}
}
///
/// Returns the duration the container list needed to save
///
public DateTime SaveDuration {
get {
return this.saveDuration;
}
}
}
}