public static void AddRecentFile(int pos, string fileName)
{
int found = -1;
int count = 0;
string[] files = new string[10];
// Load recently used files list
RegistryAccess ra = new RegistryAccess(Registry.CurrentUser, RegPaths.Halo2RecentFiles);
for (int i = 0; i < files.Length; i++)
{
files[i] = ra.getValue(i.ToString());
if (files[i] != null) count++;
if (files[i] == fileName) found = i;
}
ra.CloseReg();
if (found == -1) found = count;
if (found < pos)
{
int z = found;
found = pos;
pos = z;
}
for (int i = found; i > pos; i--)
setValue(Registry.CurrentUser, RegistryAccess.RegPaths.Halo2RecentFiles, i.ToString(), files[i-1]);
setValue(Registry.CurrentUser, RegistryAccess.RegPaths.Halo2RecentFiles, pos.ToString(), fileName);
}