46 lines
1.1 KiB
C#
46 lines
1.1 KiB
C#
// /**
|
|
// * File: StorageArea.cs
|
|
// * Author: haraldwolff
|
|
// *
|
|
// * This file and it's content is copyrighted by the Author and / or copyright holder.
|
|
// * Any use wihtout proper permission is illegal and may lead to legal actions.
|
|
// *
|
|
// *
|
|
// **/
|
|
using System;
|
|
namespace ln.types.odb.ng.storage
|
|
{
|
|
public class StorageArea
|
|
{
|
|
public int Offset { get; }
|
|
public int Size { get; set; }
|
|
|
|
public Guid ID { get; set; }
|
|
public DateTime TimeStamp { get; set; }
|
|
|
|
public int NextOffset => Offset + Size;
|
|
|
|
public StorageArea(int offset,int size)
|
|
{
|
|
Offset = offset;
|
|
Size = size;
|
|
}
|
|
|
|
public StorageArea Split(int splitSize)
|
|
{
|
|
if (splitSize >= Size)
|
|
throw new ArgumentOutOfRangeException(nameof(splitSize));
|
|
|
|
StorageArea splitArea = new StorageArea(Offset + Size - splitSize,splitSize);
|
|
Size -= splitSize;
|
|
|
|
return splitArea;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
return string.Format("[StorageArea Offset=0x{0:x8} Size=0x{1:x8}]",Offset,Size);
|
|
}
|
|
}
|
|
}
|