|
|
@@ -13,37 +13,62 @@ namespace ClickForensics.Quartz.Manager |
|
|
|
{
|
|
|
|
List<ConnectionInfo> lastConnections = new List<ConnectionInfo>();
|
|
|
|
|
|
|
|
RegistryKey key = Registry.CurrentUser.CreateSubKey("QuartzNetManager").CreateSubKey("MRUList");
|
|
|
|
if (key != null)
|
|
|
|
RegistryKey managerKey = Registry.CurrentUser.CreateSubKey("QuartzNetManager");
|
|
|
|
RegistryKey key = null;
|
|
|
|
if (managerKey == null)
|
|
|
|
{
|
|
|
|
for (int i = 0; i < 5; i++)
|
|
|
|
return lastConnections;
|
|
|
|
}
|
|
|
|
|
|
|
|
key = managerKey.CreateSubKey("MRUList");
|
|
|
|
|
|
|
|
if (key == null)
|
|
|
|
{
|
|
|
|
return lastConnections;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (int i = 0; i < 5; i++)
|
|
|
|
{
|
|
|
|
ConnectionInfo info = ConnectionInfo.Parse((key.GetValue(string.Format("connection{0}", i), null) as string));
|
|
|
|
if (info != null)
|
|
|
|
{
|
|
|
|
ConnectionInfo info = ConnectionInfo.Parse((key.GetValue(string.Format("connection{0}", i), null) as string));
|
|
|
|
if (info != null)
|
|
|
|
{
|
|
|
|
lastConnections.Add(info);
|
|
|
|
}
|
|
|
|
lastConnections.Add(info);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
key.Close();
|
|
|
|
managerKey.Close();
|
|
|
|
|
|
|
|
return lastConnections;
|
|
|
|
}
|
|
|
|
public static void AddConnection(ConnectionInfo info)
|
|
|
|
{
|
|
|
|
RegistryKey key = Registry.CurrentUser.CreateSubKey("QuartzNetManager").CreateSubKey("MRUList");
|
|
|
|
if (key != null)
|
|
|
|
RegistryKey managerKey = Registry.CurrentUser.CreateSubKey("QuartzNetManager");
|
|
|
|
RegistryKey key = null;
|
|
|
|
if (managerKey == null)
|
|
|
|
{
|
|
|
|
for (int i = 4; i > 0; i--)
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
key = managerKey.CreateSubKey("MRUList");
|
|
|
|
|
|
|
|
if (key == null)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
//TODO: check that the key doesn't exist before trying to add. if it exists, move it to the top, but don't add it
|
|
|
|
|
|
|
|
for (int i = 4; i > 0; i--)
|
|
|
|
{
|
|
|
|
var previous = key.GetValue(string.Format("connection{0}", i - 1), null);
|
|
|
|
if (previous != null)
|
|
|
|
{
|
|
|
|
var previous = key.GetValue(string.Format("connection{0}", i - 1), null);
|
|
|
|
if (previous != null)
|
|
|
|
{
|
|
|
|
key.SetValue(string.Format("connection{0}", i), previous);
|
|
|
|
key.SetValue(string.Format("connection{0}", i), previous);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
key.SetValue("connection0", info, RegistryValueKind.String);
|
|
|
|
}
|
|
|
|
key.SetValue("connection0", info, RegistryValueKind.String);
|
|
|
|
|
|
|
|
}
|
|
|
|
private static object lockObject = new object();
|
|
|
|
}
|
|
|
|