daily update on 20240422 by nitload youmu, ssd structure improve
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StgSharp.Data
|
||||
{
|
||||
|
||||
public partial class Area
|
||||
{
|
||||
private static byte leastUnusedDisc;
|
||||
|
||||
public byte NewDisc(byte raidWith)
|
||||
{
|
||||
byte ret = leastUnusedDisc;
|
||||
leastUnusedDisc++;
|
||||
return ret;
|
||||
}
|
||||
|
||||
public void ClearDiscIDBuffer()
|
||||
{
|
||||
leastUnusedDisc = 0;
|
||||
}
|
||||
|
||||
private static int leastUnusedID;
|
||||
|
||||
public static int NewID()
|
||||
{
|
||||
int ret = leastUnusedID;
|
||||
if (ret == int.MaxValue)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("Reaches max IDs that one ssd file can provide.");
|
||||
}
|
||||
leastUnusedID++;
|
||||
return ret;
|
||||
}
|
||||
|
||||
public static void ClearIDBuffer()
|
||||
{
|
||||
leastUnusedID = 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user