2013-11-04 00:36:15 +00:00
|
|
|
|
using System;
|
2014-02-04 21:15:33 +00:00
|
|
|
|
using System.Collections.Generic;
|
2013-11-04 00:36:15 +00:00
|
|
|
|
using System.IO;
|
2013-11-28 22:06:38 +00:00
|
|
|
|
using System.Text;
|
2013-11-04 00:36:15 +00:00
|
|
|
|
|
2014-07-03 19:05:56 +00:00
|
|
|
|
using BizHawk.Common.BufferExtensions;
|
|
|
|
|
|
2013-11-04 00:36:15 +00:00
|
|
|
|
namespace BizHawk.Common
|
2013-10-27 22:07:40 +00:00
|
|
|
|
{
|
2013-12-14 00:03:03 +00:00
|
|
|
|
public static unsafe class Util
|
2013-10-27 22:07:40 +00:00
|
|
|
|
{
|
2013-12-14 00:03:03 +00:00
|
|
|
|
private static readonly char[] HexConvArr = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
|
|
|
|
|
private static System.Runtime.InteropServices.GCHandle HexConvHandle;
|
2014-01-01 03:03:10 +00:00
|
|
|
|
|
2013-12-14 00:03:03 +00:00
|
|
|
|
static Util()
|
2013-11-04 00:36:15 +00:00
|
|
|
|
{
|
|
|
|
|
HexConvHandle = System.Runtime.InteropServices.GCHandle.Alloc(HexConvArr, System.Runtime.InteropServices.GCHandleType.Pinned);
|
|
|
|
|
HexConvPtr = (char*)HexConvHandle.AddrOfPinnedObject().ToPointer();
|
|
|
|
|
}
|
|
|
|
|
|
2014-10-26 14:22:26 +00:00
|
|
|
|
public static void CopyStream(Stream src, Stream dest, long len)
|
|
|
|
|
{
|
|
|
|
|
const int size = 0x2000;
|
|
|
|
|
byte[] buffer = new byte[size];
|
|
|
|
|
while (len > 0)
|
|
|
|
|
{
|
|
|
|
|
long todo = len;
|
|
|
|
|
if (len > size) todo = size;
|
|
|
|
|
int n = src.Read(buffer, 0, (int)todo);
|
|
|
|
|
dest.Write(buffer, 0, n);
|
|
|
|
|
len -= n;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-02-04 21:15:33 +00:00
|
|
|
|
public static char* HexConvPtr { get; set; }
|
|
|
|
|
|
2013-11-04 00:36:15 +00:00
|
|
|
|
public static bool IsPowerOfTwo(int x)
|
|
|
|
|
{
|
2013-12-14 00:03:03 +00:00
|
|
|
|
if (x == 0 || x == 1)
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2013-11-04 00:36:15 +00:00
|
|
|
|
return (x & (x - 1)) == 0;
|
|
|
|
|
}
|
|
|
|
|
|
2013-12-14 00:03:03 +00:00
|
|
|
|
public static int SaveRamBytesUsed(byte[] saveRam)
|
2013-11-04 00:36:15 +00:00
|
|
|
|
{
|
2014-02-04 21:15:33 +00:00
|
|
|
|
for (var i = saveRam.Length - 1; i >= 0; i--)
|
2013-12-14 00:03:03 +00:00
|
|
|
|
{
|
2014-02-04 21:15:33 +00:00
|
|
|
|
if (saveRam[i] != 0)
|
2013-12-14 00:03:03 +00:00
|
|
|
|
{
|
2014-02-04 21:15:33 +00:00
|
|
|
|
return i + 1;
|
2013-12-14 00:03:03 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-11-04 00:36:15 +00:00
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2013-12-14 00:03:03 +00:00
|
|
|
|
// Could be extension method
|
2013-11-04 00:36:15 +00:00
|
|
|
|
public static byte[] HexStringToBytes(string str)
|
|
|
|
|
{
|
2013-12-14 00:03:03 +00:00
|
|
|
|
var ms = new MemoryStream();
|
|
|
|
|
if (str.Length % 2 != 0)
|
|
|
|
|
{
|
|
|
|
|
throw new ArgumentException();
|
|
|
|
|
}
|
|
|
|
|
|
2013-11-04 00:36:15 +00:00
|
|
|
|
int len = str.Length / 2;
|
|
|
|
|
for (int i = 0; i < len; i++)
|
|
|
|
|
{
|
|
|
|
|
int d = 0;
|
|
|
|
|
for (int j = 0; j < 2; j++)
|
|
|
|
|
{
|
2014-02-04 21:15:33 +00:00
|
|
|
|
var c = char.ToLower(str[(i * 2) + j]);
|
2013-11-04 00:36:15 +00:00
|
|
|
|
if (c >= '0' && c <= '9')
|
2013-12-14 00:03:03 +00:00
|
|
|
|
{
|
|
|
|
|
d += c - '0';
|
|
|
|
|
}
|
2013-11-04 00:36:15 +00:00
|
|
|
|
else if (c >= 'a' && c <= 'f')
|
2013-12-14 00:03:03 +00:00
|
|
|
|
{
|
2013-11-04 00:36:15 +00:00
|
|
|
|
d += (c - 'a') + 10;
|
2013-12-14 00:03:03 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
throw new ArgumentException();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (j == 0)
|
|
|
|
|
{
|
|
|
|
|
d <<= 4;
|
|
|
|
|
}
|
2013-11-04 00:36:15 +00:00
|
|
|
|
}
|
2013-12-14 00:03:03 +00:00
|
|
|
|
|
2013-11-04 00:36:15 +00:00
|
|
|
|
ms.WriteByte((byte)d);
|
|
|
|
|
}
|
2014-02-04 21:15:33 +00:00
|
|
|
|
|
2013-11-04 00:36:15 +00:00
|
|
|
|
return ms.ToArray();
|
|
|
|
|
}
|
|
|
|
|
|
2013-12-14 00:03:03 +00:00
|
|
|
|
// Could be extension method
|
2013-11-04 00:36:15 +00:00
|
|
|
|
public static void WriteByteBuffer(BinaryWriter bw, byte[] data)
|
|
|
|
|
{
|
2013-12-14 00:03:03 +00:00
|
|
|
|
if (data == null)
|
|
|
|
|
{
|
|
|
|
|
bw.Write(0);
|
|
|
|
|
}
|
2013-11-04 00:36:15 +00:00
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
bw.Write(data.Length);
|
|
|
|
|
bw.Write(data);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-10-06 16:00:24 +00:00
|
|
|
|
public static bool[] ByteBufferToBoolBuffer(byte[] buf)
|
|
|
|
|
{
|
|
|
|
|
var ret = new bool[buf.Length];
|
|
|
|
|
for (int i = 0; i < buf.Length; i++)
|
|
|
|
|
{
|
|
|
|
|
ret[i] = buf[i] != 0;
|
|
|
|
|
}
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static byte[] BoolBufferToByteBuffer(bool[] buf)
|
|
|
|
|
{
|
|
|
|
|
var ret = new byte[buf.Length];
|
|
|
|
|
for (int i = 0; i < buf.Length; i++)
|
|
|
|
|
{
|
|
|
|
|
ret[i] = (byte)(buf[i] ? 1 : 0);
|
|
|
|
|
}
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
2013-11-04 00:36:15 +00:00
|
|
|
|
public static short[] ByteBufferToShortBuffer(byte[] buf)
|
|
|
|
|
{
|
|
|
|
|
int num = buf.Length / 2;
|
2013-12-14 00:03:03 +00:00
|
|
|
|
var ret = new short[num];
|
2013-11-04 00:36:15 +00:00
|
|
|
|
for (int i = 0; i < num; i++)
|
|
|
|
|
{
|
|
|
|
|
ret[i] = (short)(buf[i * 2] | (buf[i * 2 + 1] << 8));
|
|
|
|
|
}
|
2013-12-14 00:03:03 +00:00
|
|
|
|
|
2013-11-04 00:36:15 +00:00
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static byte[] ShortBufferToByteBuffer(short[] buf)
|
|
|
|
|
{
|
|
|
|
|
int num = buf.Length;
|
2013-12-14 00:03:03 +00:00
|
|
|
|
var ret = new byte[num * 2];
|
2013-11-04 00:36:15 +00:00
|
|
|
|
for (int i = 0; i < num; i++)
|
|
|
|
|
{
|
|
|
|
|
ret[i * 2 + 0] = (byte)(buf[i] & 0xFF);
|
|
|
|
|
ret[i * 2 + 1] = (byte)((buf[i] >> 8) & 0xFF);
|
|
|
|
|
}
|
2013-12-14 00:03:03 +00:00
|
|
|
|
|
2013-11-04 00:36:15 +00:00
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
2014-04-07 04:50:19 +00:00
|
|
|
|
public static ushort[] ByteBufferToUshortBuffer(byte[] buf)
|
|
|
|
|
{
|
|
|
|
|
int num = buf.Length / 2;
|
|
|
|
|
var ret = new ushort[num];
|
|
|
|
|
for (int i = 0; i < num; i++)
|
|
|
|
|
{
|
|
|
|
|
ret[i] = (ushort)(buf[i * 2] | (buf[i * 2 + 1] << 8));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static byte[] UshortBufferToByteBuffer(ushort[] buf)
|
|
|
|
|
{
|
|
|
|
|
int num = buf.Length;
|
|
|
|
|
var ret = new byte[num * 2];
|
|
|
|
|
for (int i = 0; i < num; i++)
|
|
|
|
|
{
|
|
|
|
|
ret[i * 2 + 0] = (byte)(buf[i] & 0xFF);
|
|
|
|
|
ret[i * 2 + 1] = (byte)((buf[i] >> 8) & 0xFF);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
2013-11-04 00:36:15 +00:00
|
|
|
|
public static uint[] ByteBufferToUintBuffer(byte[] buf)
|
|
|
|
|
{
|
|
|
|
|
int num = buf.Length / 4;
|
2013-12-14 00:03:03 +00:00
|
|
|
|
var ret = new uint[num];
|
2013-11-04 00:36:15 +00:00
|
|
|
|
for (int i = 0; i < num; i++)
|
|
|
|
|
{
|
|
|
|
|
ret[i] = (uint)(buf[i * 4] | (buf[i * 4 + 1] << 8) | (buf[i * 4 + 2] << 16) | (buf[i * 4 + 3] << 24));
|
|
|
|
|
}
|
2013-12-14 00:03:03 +00:00
|
|
|
|
|
2013-11-04 00:36:15 +00:00
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static byte[] UintBufferToByteBuffer(uint[] buf)
|
|
|
|
|
{
|
|
|
|
|
int num = buf.Length;
|
2013-12-14 00:03:03 +00:00
|
|
|
|
var ret = new byte[num * 4];
|
2013-11-04 00:36:15 +00:00
|
|
|
|
for (int i = 0; i < num; i++)
|
|
|
|
|
{
|
|
|
|
|
ret[i * 4 + 0] = (byte)(buf[i] & 0xFF);
|
|
|
|
|
ret[i * 4 + 1] = (byte)((buf[i] >> 8) & 0xFF);
|
|
|
|
|
ret[i * 4 + 2] = (byte)((buf[i] >> 16) & 0xFF);
|
|
|
|
|
ret[i * 4 + 3] = (byte)((buf[i] >> 24) & 0xFF);
|
|
|
|
|
}
|
2013-12-14 00:03:03 +00:00
|
|
|
|
|
2013-11-04 00:36:15 +00:00
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static int[] ByteBufferToIntBuffer(byte[] buf)
|
|
|
|
|
{
|
|
|
|
|
int num = buf.Length / 4;
|
2013-12-14 00:03:03 +00:00
|
|
|
|
var ret = new int[num];
|
2013-11-04 00:36:15 +00:00
|
|
|
|
for (int i = 0; i < num; i++)
|
|
|
|
|
{
|
|
|
|
|
ret[i] = buf[(i * 4) + 3];
|
|
|
|
|
ret[i] <<= 8;
|
|
|
|
|
ret[i] |= buf[(i * 4) + 2];
|
|
|
|
|
ret[i] <<= 8;
|
|
|
|
|
ret[i] |= buf[(i * 4) + 1];
|
|
|
|
|
ret[i] <<= 8;
|
|
|
|
|
ret[i] |= buf[(i * 4)];
|
|
|
|
|
}
|
2013-12-14 00:03:03 +00:00
|
|
|
|
|
2013-11-04 00:36:15 +00:00
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static byte[] IntBufferToByteBuffer(int[] buf)
|
|
|
|
|
{
|
|
|
|
|
int num = buf.Length;
|
2013-12-14 00:03:03 +00:00
|
|
|
|
var ret = new byte[num * 4];
|
2013-11-04 00:36:15 +00:00
|
|
|
|
for (int i = 0; i < num; i++)
|
|
|
|
|
{
|
|
|
|
|
ret[i * 4 + 0] = (byte)(buf[i] & 0xFF);
|
|
|
|
|
ret[i * 4 + 1] = (byte)((buf[i] >> 8) & 0xFF);
|
|
|
|
|
ret[i * 4 + 2] = (byte)((buf[i] >> 16) & 0xFF);
|
|
|
|
|
ret[i * 4 + 3] = (byte)((buf[i] >> 24) & 0xFF);
|
|
|
|
|
}
|
2013-12-14 00:03:03 +00:00
|
|
|
|
|
2013-11-04 00:36:15 +00:00
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
2013-12-14 00:03:03 +00:00
|
|
|
|
public static byte[] ReadByteBuffer(BinaryReader br, bool returnNull)
|
2013-11-04 00:36:15 +00:00
|
|
|
|
{
|
|
|
|
|
int len = br.ReadInt32();
|
2013-12-14 00:03:03 +00:00
|
|
|
|
if (len == 0 && returnNull)
|
|
|
|
|
{
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var ret = new byte[len];
|
2013-11-04 00:36:15 +00:00
|
|
|
|
int ofs = 0;
|
|
|
|
|
while (len > 0)
|
|
|
|
|
{
|
|
|
|
|
int done = br.Read(ret, ofs, len);
|
|
|
|
|
ofs += done;
|
|
|
|
|
len -= done;
|
|
|
|
|
}
|
2013-12-14 00:03:03 +00:00
|
|
|
|
|
2013-11-04 00:36:15 +00:00
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
2013-12-14 00:03:03 +00:00
|
|
|
|
public static int Memcmp(void* a, string b, int len)
|
2013-11-04 00:36:15 +00:00
|
|
|
|
{
|
2013-11-04 03:12:50 +00:00
|
|
|
|
fixed (byte* bp = Encoding.ASCII.GetBytes(b))
|
2013-12-14 00:03:03 +00:00
|
|
|
|
return Memcmp(a, bp, len);
|
2013-11-04 00:36:15 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-12-14 00:03:03 +00:00
|
|
|
|
public static int Memcmp(void* a, void* b, int len)
|
2013-11-04 00:36:15 +00:00
|
|
|
|
{
|
2013-12-14 00:03:03 +00:00
|
|
|
|
var ba = (byte*)a;
|
|
|
|
|
var bb = (byte*)b;
|
2013-11-04 00:36:15 +00:00
|
|
|
|
for (int i = 0; i < len; i++)
|
|
|
|
|
{
|
|
|
|
|
byte _a = ba[i];
|
|
|
|
|
byte _b = bb[i];
|
|
|
|
|
int c = _a - _b;
|
2013-12-14 00:03:03 +00:00
|
|
|
|
if (c != 0)
|
|
|
|
|
{
|
|
|
|
|
return c;
|
|
|
|
|
}
|
2013-11-04 00:36:15 +00:00
|
|
|
|
}
|
2013-12-14 00:03:03 +00:00
|
|
|
|
|
2013-11-04 00:36:15 +00:00
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2013-12-14 00:03:03 +00:00
|
|
|
|
public static void Memset(void* ptr, int val, int len)
|
2013-11-04 00:36:15 +00:00
|
|
|
|
{
|
2013-12-14 00:03:03 +00:00
|
|
|
|
var bptr = (byte*)ptr;
|
2013-11-04 00:36:15 +00:00
|
|
|
|
for (int i = 0; i < len; i++)
|
2013-12-14 00:03:03 +00:00
|
|
|
|
{
|
2013-11-04 00:36:15 +00:00
|
|
|
|
bptr[i] = (byte)val;
|
2013-12-14 00:03:03 +00:00
|
|
|
|
}
|
2013-11-04 00:36:15 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-12-14 00:03:03 +00:00
|
|
|
|
public static void Memset32(void* ptr, int val, int len)
|
2013-11-04 00:36:15 +00:00
|
|
|
|
{
|
|
|
|
|
System.Diagnostics.Debug.Assert(len % 4 == 0);
|
|
|
|
|
int dwords = len / 4;
|
|
|
|
|
int* dwptr = (int*)ptr;
|
|
|
|
|
for (int i = 0; i < dwords; i++)
|
2013-12-14 00:03:03 +00:00
|
|
|
|
{
|
2013-11-04 00:36:15 +00:00
|
|
|
|
dwptr[i] = val;
|
2013-12-14 00:03:03 +00:00
|
|
|
|
}
|
2013-11-04 00:36:15 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static string FormatFileSize(long filesize)
|
|
|
|
|
{
|
2014-02-04 21:15:33 +00:00
|
|
|
|
decimal size = filesize;
|
2013-11-04 00:36:15 +00:00
|
|
|
|
|
|
|
|
|
string suffix;
|
|
|
|
|
if (size > 1024 * 1024 * 1024)
|
|
|
|
|
{
|
|
|
|
|
size /= 1024 * 1024 * 1024;
|
|
|
|
|
suffix = "GB";
|
|
|
|
|
}
|
|
|
|
|
else if (size > 1024 * 1024)
|
|
|
|
|
{
|
|
|
|
|
size /= 1024 * 1024;
|
|
|
|
|
suffix = "MB";
|
|
|
|
|
}
|
|
|
|
|
else if (size > 1024)
|
|
|
|
|
{
|
|
|
|
|
size /= 1024;
|
|
|
|
|
suffix = "KB";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2014-04-08 02:25:46 +00:00
|
|
|
|
suffix = "B";
|
2013-11-04 00:36:15 +00:00
|
|
|
|
}
|
|
|
|
|
|
2014-02-04 21:15:33 +00:00
|
|
|
|
const string precision = "2";
|
|
|
|
|
return string.Format("{0:N" + precision + "}{1}", size, suffix);
|
2013-11-04 00:36:15 +00:00
|
|
|
|
}
|
2014-01-01 03:03:10 +00:00
|
|
|
|
|
|
|
|
|
// http://stackoverflow.com/questions/3928822/comparing-2-dictionarystring-string-instances
|
|
|
|
|
public static bool DictionaryEqual<TKey, TValue>(
|
|
|
|
|
IDictionary<TKey, TValue> first, IDictionary<TKey, TValue> second)
|
|
|
|
|
{
|
2014-02-04 21:15:33 +00:00
|
|
|
|
if (first == second)
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ((first == null) || (second == null))
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (first.Count != second.Count)
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2014-01-01 03:03:10 +00:00
|
|
|
|
|
|
|
|
|
var comparer = EqualityComparer<TValue>.Default;
|
|
|
|
|
|
2014-02-04 21:15:33 +00:00
|
|
|
|
foreach (var kvp in first)
|
2014-01-01 03:03:10 +00:00
|
|
|
|
{
|
|
|
|
|
TValue secondValue;
|
2014-02-04 21:15:33 +00:00
|
|
|
|
if (!second.TryGetValue(kvp.Key, out secondValue))
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!comparer.Equals(kvp.Value, secondValue))
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2014-01-01 03:03:10 +00:00
|
|
|
|
}
|
2014-02-04 21:15:33 +00:00
|
|
|
|
|
2014-01-01 03:03:10 +00:00
|
|
|
|
return true;
|
|
|
|
|
}
|
2013-11-04 00:36:15 +00:00
|
|
|
|
}
|
|
|
|
|
|
2015-01-17 06:19:13 +00:00
|
|
|
|
public static class BitConverterLE
|
|
|
|
|
{
|
|
|
|
|
public static void WriteBytes(ushort value, byte[] dst, int startIndex)
|
|
|
|
|
{
|
|
|
|
|
dst[startIndex ] = (byte)(value );
|
|
|
|
|
dst[startIndex + 1] = (byte)(value >> 8);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void WriteBytes(uint value, byte[] dst, int startIndex)
|
|
|
|
|
{
|
|
|
|
|
dst[startIndex ] = (byte)(value );
|
|
|
|
|
dst[startIndex + 1] = (byte)(value >> 8);
|
|
|
|
|
dst[startIndex + 2] = (byte)(value >> 16);
|
|
|
|
|
dst[startIndex + 3] = (byte)(value >> 24);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-11-15 00:22:08 +00:00
|
|
|
|
[Serializable]
|
|
|
|
|
public class NotTestedException : Exception
|
|
|
|
|
{
|
|
|
|
|
}
|
2013-11-22 09:33:56 +00:00
|
|
|
|
|
2013-12-14 00:03:03 +00:00
|
|
|
|
internal class SuperGloballyUniqueID
|
2013-11-22 09:33:56 +00:00
|
|
|
|
{
|
2014-02-04 21:15:33 +00:00
|
|
|
|
private static readonly string StaticPart;
|
|
|
|
|
private static int ctr;
|
|
|
|
|
|
|
|
|
|
static SuperGloballyUniqueID()
|
|
|
|
|
{
|
|
|
|
|
StaticPart = "bizhawk-" + System.Diagnostics.Process.GetCurrentProcess().Id + "-" + Guid.NewGuid();
|
|
|
|
|
}
|
|
|
|
|
|
2013-11-22 09:33:56 +00:00
|
|
|
|
public static string Next()
|
|
|
|
|
{
|
|
|
|
|
int myctr;
|
|
|
|
|
lock (typeof(SuperGloballyUniqueID))
|
2013-12-14 00:03:03 +00:00
|
|
|
|
{
|
2013-11-22 09:33:56 +00:00
|
|
|
|
myctr = ctr++;
|
2013-12-14 00:03:03 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return StaticPart + "-" + myctr;
|
2013-11-22 09:33:56 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2013-11-04 00:36:15 +00:00
|
|
|
|
}
|