private static UpdateState CheckForNewerVersion() { UpdateState updateState = null; Version curVersion = Assembly.GetExecutingAssembly().GetName().Version; WebClient client = null; try { client = new WebClient(); Version newVer = new Version(client.DownloadString(String.Format("{0}WabbitcodeVersion.txt", Hostname))); updateState = new UpdateState(curVersion.CompareTo(newVer) < 0); } catch (WebException) { return(new UpdateState(false)); } catch (Exception ex) { DockingService.ShowError("Unable to check for update", ex); } finally { if (client != null) { client.Dispose(); } } return(updateState); }
public void LoadPlugins() { string dir = Path.GetDirectoryName(Application.ExecutablePath); if (dir == null) { return; } var dllFileNames = Directory.GetFiles(dir, "*.dll"); var assemblies = new List <Assembly>(); assemblies.AddRange(dllFileNames.Select(AssemblyName.GetAssemblyName).Select(Assembly.Load)); Type pluginType = typeof(IWabbitcodePlugin); ICollection <Type> pluginTypes = assemblies.Where(a => a != null) .Select(assembly => { try { return(assembly.GetTypes()); } catch (ReflectionTypeLoadException) { return(null); } }) .Where(t => t != null) .SelectMany(types => types .Where(type => !type.IsInterface && !type.IsAbstract && type.GetInterface(pluginType.FullName) != null)) .ToList(); foreach (IWabbitcodePlugin plugin in pluginTypes.Select(type => (IWabbitcodePlugin)Activator.CreateInstance(type))) { try { _plugins.Add(plugin); plugin.Loaded(); } catch (Exception ex) { string message = string.Format("There was an exception loading plugin {0}, it will not be available", plugin.Name); DockingService.ShowError(message, ex); } } }
public Editor OpenDocument(string filename) { try { var doc = new Editor(); OpenDocuments.Add(doc); //DockingService.StatusBar.ShowProgress(); //DockingService.StatusBar.SetProgress(.1, "Open", OperationStatus.Error); OpenDocument(doc, filename); //DockingService.StatusBar.SetProgress(.9, "Open", OperationStatus.Error); //DockingService.StatusBar.HideProgress(); dockingService.ShowDockPanel(doc); doc.Activate(); return(doc); } catch (Exception ex) { DockingService.ShowError("Error opening file " + filename, ex); return(null); } }