39 lines
930 B
C#
39 lines
930 B
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 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;
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
}
|