Changeset 11
- Timestamp:
- 02/20/08 13:15:31 (17 years ago)
- Location:
- trunk/sources
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.PluginInfrastructure.GUI/ManagerForm.cs
r10 r11 37 37 private TreeNode availablePlugins; 38 38 private TreeNode allPlugins; 39 40 39 private List<PluginTag> allTags = new List<PluginTag>(); 41 40 private Dictionary<PluginTag, PluginAction> actions = new Dictionary<PluginTag, PluginAction>(); 42 41 private List<PluginDescription> allAvailablePlugins = new List<PluginDescription>(); 43 42 private string pluginDir = Application.StartupPath + "/" + HeuristicLab.PluginInfrastructure.GUI.Properties.Settings.Default.PluginDir; 44 43 private string cacheDir = Application.StartupPath + "/" + HeuristicLab.PluginInfrastructure.GUI.Properties.Settings.Default.CacheDir; … … 48 47 public ManagerForm() { 49 48 InitializeComponent(); 50 51 49 InitializePlugins(); 52 50 } 53 51 54 52 private void InitializePlugins() { 55 56 53 pluginTreeView.Nodes.Clear(); 57 54 allTags.Clear(); … … 102 99 } 103 100 104 // TASK populate the "inactive plugins" node by reading a list of inactive plugins from the PluginManager 101 allAvailablePlugins = FilterMostRecentPluginVersions(allAvailablePlugins); 102 // find all plugins that are installed for which a new version is available 103 List<PluginDescription> upgrades = FindUpgrades(allTags, allAvailablePlugins); 104 // find all available plugins that are not installed and new (= new name not new version) since the last update 105 List<PluginDescription> newPlugins = FindNewPlugins(allTags, allAvailablePlugins); 106 // find all plugins that are available (not installed) for which a new version has been released since the last update 107 List<PluginDescription> overridingPlugins = FindOverridingPlugins(allTags, allAvailablePlugins); 108 newPlugins.ForEach(delegate(PluginDescription plugin) { 109 PluginTag tag = new PluginTag(allTags, plugin, PluginState.Available); 110 allTags.Add(tag); 111 TreeNode node = new TreeNode(plugin.Name); 112 node.ContextMenuStrip = pluginContextMenuStrip; 113 node.Tag = tag; 114 node.ImageIndex = 0; 115 allPlugins.Nodes.Add(node); 116 TreeNode availableNode = new TreeNode(plugin.Name); 117 availableNode.ContextMenuStrip = pluginContextMenuStrip; 118 availableNode.Tag = tag; 119 availablePlugins.Nodes.Add(availableNode); 120 121 }); 122 upgrades.ForEach(delegate(PluginDescription upgrade) { 123 // find the installed plugins that have the same name 124 List<PluginTag> oldPlugins = allTags.FindAll(delegate(PluginTag tag) { 125 return tag.PluginName == upgrade.Name; 126 }); 127 PluginTag oldPlugin = oldPlugins[0]; 128 // store the upgrade in the old plugin 129 oldPlugin.UpgradePluginDescription = upgrade; 130 UpdateTreeNodes(oldPlugins); 131 }); 132 overridingPlugins.ForEach(delegate(PluginDescription overridingPlugin) { 133 List<PluginTag> currentPlugins = allTags.FindAll(delegate(PluginTag tag) { 134 return tag.PluginName == overridingPlugin.Name; 135 }); 136 PluginTag currentPlugin = currentPlugins[0]; 137 // replace the plugin description of the available plugin to point to the overriding plugin 138 currentPlugin.PluginDescription = overridingPlugin; 139 }); 140 RebuildActionHulls(); 105 141 } 106 142 … … 111 147 112 148 private void publishButton_Click(object sender, EventArgs args) { 113 114 149 PluginInfo plugin = ((PluginTag)pluginTreeView.SelectedNode.Tag).Plugin; 115 116 150 try { 117 151 string packageFileName = plugin.Name + "-" + plugin.Version + ".zip"; … … 128 162 zipFile.CommitUpdate(); 129 163 zipFile.Close(); 130 131 164 FileInfo fileInfo = new FileInfo(packageFileName); 132 133 165 infoTextBox.Text += "\nCreated " + packageFileName + " (" + fileInfo.Length + " bytes)\n"; 134 166 infoTextBox.Text += "Upload this file to your plugin source and add the following entry to" + … … 145 177 146 178 private void updateButton_Click(object sender, EventArgs e) { 147 148 179 // connect to all plugin sources and get a list of available plugins 149 180 // log progress in the infoPane … … 162 193 163 194 worker.DoWork += delegate(object doWorkSender, DoWorkEventArgs args) { 164 List<PluginDescription> allAvailablePlugins = new List<PluginDescription>(); 165 166 //infoTextBox.Text = "Updating available plugins...\n"; 195 allAvailablePlugins.Clear(); 167 196 dialog.SetDownloadDescription("Updating available plugins..."); 168 169 197 int i = 0; 170 198 int n = HeuristicLab.PluginInfrastructure.GUI.Properties.Settings.Default.PluginSources.Count; 171 172 199 foreach(string pluginSourceUrl in HeuristicLab.PluginInfrastructure.GUI.Properties.Settings.Default.PluginSources) { 173 200 if(!worker.CancellationPending) { … … 200 227 worker.RunWorkerCompleted += delegate(object runWorkerCompletedSender, RunWorkerCompletedEventArgs args) { 201 228 if(!args.Cancelled && args.Error == null) { 202 List<PluginDescription> allAvailablePlugins = (List<PluginDescription>)args.Result; 203 allAvailablePlugins = FilterMostRecentPluginVersions(allAvailablePlugins); 204 205 // find all plugins that are installed for which a new version is available 206 List<PluginDescription> upgrades = FindUpgrades(allTags, allAvailablePlugins); 207 208 // find all available plugins that are not installed and new (= new name not new version) since the last update 209 List<PluginDescription> newPlugins = FindNewPlugins(allTags, allAvailablePlugins); 210 211 // find all plugins that are available (not installed) for which a new version has been released since the last update 212 List<PluginDescription> overridingPlugins = FindOverridingPlugins(allTags, allAvailablePlugins); 213 214 newPlugins.ForEach(delegate(PluginDescription plugin) { 215 PluginTag tag = new PluginTag(allTags, plugin, PluginState.Available); 216 allTags.Add(tag); 217 218 TreeNode node = new TreeNode(plugin.Name); 219 node.ContextMenuStrip = pluginContextMenuStrip; 220 node.Tag = tag; 221 node.ImageIndex = 0; 222 allPlugins.Nodes.Add(node); 223 224 TreeNode availableNode = new TreeNode(plugin.Name); 225 availableNode.ContextMenuStrip = pluginContextMenuStrip; 226 availableNode.Tag = tag; 227 availablePlugins.Nodes.Add(availableNode); 228 229 }); 230 231 upgrades.ForEach(delegate(PluginDescription upgrade) { 232 // find the installed plugins that have the same name 233 List<PluginTag> oldPlugins = allTags.FindAll(delegate(PluginTag tag) { 234 return tag.PluginName == upgrade.Name; 235 }); 236 PluginTag oldPlugin = oldPlugins[0]; 237 238 // store the upgrade in the old plugin 239 oldPlugin.UpgradePluginDescription = upgrade; 240 241 UpdateTreeNodes(oldPlugins); 242 }); 243 244 overridingPlugins.ForEach(delegate(PluginDescription overridingPlugin) { 245 List<PluginTag> currentPlugins = allTags.FindAll(delegate(PluginTag tag) { 246 return tag.PluginName == overridingPlugin.Name; 247 }); 248 249 PluginTag currentPlugin = currentPlugins[0]; 250 251 // replace the plugin description of the available plugin to point to the overriding plugin 252 currentPlugin.PluginDescription = overridingPlugin; 253 }); 254 255 RebuildActionHulls(); 229 InitializePlugins(); 256 230 } 257 231 dialog.Close(); -
trunk/sources/HeuristicLab.PluginInfrastructure/Loader.cs
r8 r11 41 41 42 42 private List<string> loadablePlugins = new List<string>(); 43 private string pluginDir = Application.StartupPath +"/"+ HeuristicLab.PluginInfrastructure.Properties.Settings.Default.PluginDir;43 private string pluginDir = Application.StartupPath + "/" + HeuristicLab.PluginInfrastructure.Properties.Settings.Default.PluginDir; 44 44 45 45 internal event PluginLoadFailedEventHandler MissingPluginFile; … … 207 207 if(filenameArg.MemberInfo != null && filetypeArg.MemberInfo != null) { 208 208 if((PluginFileType)filetypeArg.TypedValue.Value == PluginFileType.Assembly) { 209 pluginAssemblies.Add(pluginDir + "/"+ (string)filenameArg.TypedValue.Value);209 pluginAssemblies.Add(pluginDir + "/" + (string)filenameArg.TypedValue.Value); 210 210 } 211 211 } … … 296 296 string filename = pluginDir + "/" + file; 297 297 // always use \ as the directory separator 298 pluginInfo.Files.Add(filename.Replace('/', '\\'));298 pluginInfo.Files.Add(filename.Replace('/', '\\')); 299 299 }); 300 300
Note: See TracChangeset
for help on using the changeset viewer.