56 lines
1.3 KiB
C#
56 lines
1.3 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace LibXom.Data
|
|
{
|
|
public class XomContainer : XomFileComponent
|
|
{
|
|
|
|
private string typeBelongs;
|
|
internal byte[] data;
|
|
|
|
public XomType Type
|
|
{
|
|
get
|
|
{
|
|
return this.fileBelongs.GetTypeByName(typeBelongs);
|
|
}
|
|
}
|
|
public override int Id
|
|
{
|
|
get
|
|
{
|
|
return this.fileBelongs.calculateIdForXomFileComponent(this.uuid, fileBelongs.XomContainers);
|
|
}
|
|
}
|
|
public byte[] Data
|
|
{
|
|
get
|
|
{
|
|
return data;
|
|
}
|
|
set
|
|
{
|
|
this.Type.ReplaceContainerData(this, value);
|
|
}
|
|
}
|
|
|
|
public int[] Decompress()
|
|
{
|
|
byte[] compressedData = new byte[Data.Length - 3];
|
|
Array.ConstrainedCopy(Data, 3, compressedData, 0, compressedData.Length);
|
|
return XomCompressor.Decompress(compressedData);
|
|
}
|
|
|
|
internal XomContainer(XomFile fromFile, string fromType, byte[] data)
|
|
{
|
|
fileBelongs = fromFile;
|
|
typeBelongs = fromType;
|
|
this.data = data;
|
|
}
|
|
}
|
|
}
|