62 lines
1.5 KiB
C#
62 lines
1.5 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Runtime.CompilerServices;
|
|
|
|
namespace CPlus_GW
|
|
{
|
|
static class TallysmanConfirm
|
|
{
|
|
private static Dictionary<int, String> toBeConfirmed = new Dictionary<int, String>();
|
|
private static int index;
|
|
|
|
static TallysmanConfirm()
|
|
{
|
|
index = 65534;
|
|
}
|
|
|
|
public static int addToConfirmationQueue(String seq_idFromSD)
|
|
{
|
|
lock (toBeConfirmed)
|
|
{
|
|
if (!toBeConfirmed.ContainsKey(index))
|
|
{
|
|
toBeConfirmed.Add(index, seq_idFromSD);
|
|
}
|
|
else
|
|
{
|
|
toBeConfirmed[index] = seq_idFromSD;
|
|
}
|
|
if (index < 65535)
|
|
{
|
|
index++;
|
|
return index - 1;
|
|
}
|
|
else
|
|
{
|
|
index = 1;
|
|
return 65535;
|
|
}
|
|
}
|
|
}
|
|
|
|
public static String getFromConfirmationQueue(int index)
|
|
{
|
|
String toReturn;
|
|
lock (toBeConfirmed)
|
|
{
|
|
if (toBeConfirmed.ContainsKey(index))
|
|
{
|
|
toReturn = toBeConfirmed[index];
|
|
}
|
|
else
|
|
{
|
|
toReturn = "";
|
|
}
|
|
return toReturn;
|
|
}
|
|
}
|
|
}
|
|
}
|