From 3eb8300084df9d74c3ad49f7c70d1548131cb583 Mon Sep 17 00:00:00 2001 From: Jim Radford Date: Mon, 16 Nov 2009 01:13:30 +0000 Subject: [PATCH] LIBOMV-765 WinGridProxy Do additional checks to verify registry entry is an installed viewer git-svn-id: http://libopenmetaverse.googlecode.com/svn/libopenmetaverse/trunk@3225 52acb1d6-8a22-11de-b505-999d5b087335 --- Programs/WinGridProxy/FormWinGridProxy.cs | 24 +++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/Programs/WinGridProxy/FormWinGridProxy.cs b/Programs/WinGridProxy/FormWinGridProxy.cs index b0e13281..70290c07 100644 --- a/Programs/WinGridProxy/FormWinGridProxy.cs +++ b/Programs/WinGridProxy/FormWinGridProxy.cs @@ -106,7 +106,7 @@ namespace WinGridProxy private Session m_CurrentSession; public FormWinGridProxy() - { + { InitializeComponent(); m_SessionViewItems = new List(); @@ -202,7 +202,7 @@ namespace WinGridProxy string exe = me.GetValue("Exe").ToString(); // the executable name string ver = me.GetValue("Version").ToString(); // the viewer version - if (File.Exists(Path.Combine(dir, exe))) + if (!String.IsNullOrEmpty(dir) && !String.IsNullOrEmpty(exe) && !String.IsNullOrEmpty(ver) && File.Exists(Path.Combine(dir, exe))) { toolStripComboBox1.Items.Add(viewer + " " + ver); m_InstalledViewers.Add(viewer + " " + ver, Path.Combine(dir, exe)); @@ -1008,7 +1008,6 @@ namespace WinGridProxy // turn the map into a list OSDMapToSessions(map); - SetProgressVisible(false); } })); @@ -1020,11 +1019,10 @@ namespace WinGridProxy if (!map.ContainsKey("sessions")) return; - if (this.InvokeRequired) - this.Invoke(new MethodInvoker(delegate() { OSDMapToSessions(map); })); + if (listViewSessions.InvokeRequired) + listViewSessions.BeginInvoke((MethodInvoker)(() => OSDMapToSessions(map))); else { - OSDArray sessionsArray = (OSDArray)map["sessions"]; progressBar1.Maximum = sessionsArray.Count; @@ -1041,11 +1039,17 @@ namespace WinGridProxy for (int i = 0; i < sessionsArray.Count; i++) { OSDMap session = (OSDMap)sessionsArray[i]; + + Session importedSession = (Session)m_CurrentAssembly.CreateInstance("WinGridProxy." + session["type"].AsString()); + if (importedSession == null) + { - Session importedSession = (Session)m_CurrentAssembly.CreateInstance("WinGridProxy." + session["type"].AsString()); - importedSession.Deserialize(session["tag"].AsBinary()); - m_SessionViewItems.Add(importedSession); - progressBar1.PerformStep(); + // System.Diagnostics.Debug.Assert(importedSession != null, session["type"].AsString() + ); + } + + importedSession.Deserialize(session["tag"].AsBinary()); + m_SessionViewItems.Add(importedSession); + progressBar1.PerformStep(); } listViewSessions.VirtualListSize = m_SessionViewItems.Count;