Changeset 91 for trunk/sources/HeuristicLab.PluginInfrastructure.GUI
- Timestamp:
- 03/22/08 15:59:07 (16 years ago)
- Location:
- trunk/sources/HeuristicLab.PluginInfrastructure.GUI
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.PluginInfrastructure.GUI/ManagerForm.cs
r38 r91 147 147 private void publishButton_Click(object sender, EventArgs args) { 148 148 PluginInfo plugin = ((PluginTag)pluginTreeView.SelectedNode.Tag).Plugin; 149 publishPlugin(plugin); 150 } 151 152 private void publishPlugin(PluginInfo plugin) { 149 153 try { 150 154 string packageFileName = plugin.Name + "-" + plugin.Version + ".zip"; … … 165 169 infoTextBox.Text += "Upload this file to your plugin source and add the following entry to" + 166 170 " the file plugins.xml residing in the base directory of your plugin source.\n\n"; 167 infoTextBox.Text += " <Plugin Name=\"" + plugin.Name + "\" Version=\"" + plugin.Version + "\">\n"; 171 infoTextBox.Text += " <Plugin Name=\"" + plugin.Name + "\" Version=\"" 172 + plugin.Version + "\" Build=\"" + plugin.BuildDate.ToUniversalTime().ToString(System.Globalization.CultureInfo.InvariantCulture.DateTimeFormat) + "\">\n"; 168 173 foreach(PluginInfo dependency in plugin.Dependencies) { 169 174 infoTextBox.Text += " <Dependency Name=\"" + dependency.Name + "\" />\n"; … … 251 256 if(samePlugins.Count > 1) { 252 257 samePlugins.ForEach(delegate(PluginDescription tag2) { 253 if(tag2.Version > mostRecentVersion.Version) { 258 if(tag2.Version > mostRecentVersion.Version || 259 (tag2.Version == mostRecentVersion.Version && tag2.BuildDate>mostRecentVersion.BuildDate)) { 254 260 mostRecentVersion = tag2; 255 261 } … … 288 294 allAvailablePlugins.ForEach(delegate(PluginDescription availablePlugin) { 289 295 List<PluginTag> oldPlugins = allTags.FindAll(delegate(PluginTag currentPlugin) { 290 return currentPlugin.PluginName == availablePlugin.Name && 291 (currentPlugin.State & (PluginState.Installed | PluginState.Disabled)) != 0;296 return currentPlugin.PluginName == availablePlugin.Name && 297 (currentPlugin.State & (PluginState.Installed | PluginState.Disabled)) != 0; 292 298 }); 293 299 294 300 if(oldPlugins.Count == 1) { 295 if(oldPlugins[0].PluginVersion < availablePlugin.Version) { 301 if(oldPlugins[0].PluginVersion < availablePlugin.Version || 302 (oldPlugins[0].PluginVersion == availablePlugin.Version && oldPlugins[0].PluginBuildDate<availablePlugin.BuildDate)) { 296 303 upgrades.Add(availablePlugin); 297 304 } … … 309 316 }); 310 317 311 if(currentPlugins.Count == 1 && currentPlugins[0].PluginVersion < availablePlugin.Version) { 318 if(currentPlugins.Count == 1 && (currentPlugins[0].PluginVersion < availablePlugin.Version || 319 (currentPlugins[0].PluginVersion==availablePlugin.Version && currentPlugins[0].PluginBuildDate<availablePlugin.BuildDate))) { 312 320 overrides.Add(availablePlugin); 313 321 } -
trunk/sources/HeuristicLab.PluginInfrastructure.GUI/PluginDescription.cs
r2 r91 28 28 class PluginDescription { 29 29 private string name; 30 31 30 public string Name { 32 31 get { return name; } … … 34 33 } 35 34 private Version version; 36 37 35 public Version Version { 38 36 get { return version; } 39 37 set { version = value; } 38 } 39 private DateTime buildDate; 40 public DateTime BuildDate { 41 get { return buildDate; } 42 set { buildDate = value; } 40 43 } 41 44 … … 50 53 } 51 54 52 public PluginDescription(string name, Version version, PluginSource source) {55 public PluginDescription(string name, Version version, DateTime buildDate, PluginSource source) { 53 56 this.name = name; 54 57 this.version = version; 55 58 this.source = source; 59 this.buildDate = buildDate; 56 60 } 57 61 } -
trunk/sources/HeuristicLab.PluginInfrastructure.GUI/PluginSource.cs
r2 r91 77 77 string version = child.Attributes["Version"].Value; 78 78 79 PluginDescription description = new PluginDescription(name, new Version(version), this); 79 DateTime buildDate; 80 if(child.Attributes["Build"] != null) { 81 string build = child.Attributes["Build"].Value; 82 DateTime.TryParse(build, System.Globalization.CultureInfo.InvariantCulture.DateTimeFormat, System.Globalization.DateTimeStyles.AssumeUniversal, out buildDate); 83 } else { 84 buildDate = DateTime.MinValue; 85 } 86 PluginDescription description = new PluginDescription(name, new Version(version), buildDate, this); 80 87 availablePlugins.Add(description); 81 88 -
trunk/sources/HeuristicLab.PluginInfrastructure.GUI/PluginTag.cs
r37 r91 36 36 class PluginTag { 37 37 private PluginInfo plugin; 38 39 38 public PluginInfo Plugin { 40 39 get { return plugin; } … … 50 49 } 51 50 } 52 53 51 54 52 private PluginDescription upgradePluginDescription; … … 74 72 set { pluginVersion = value; } 75 73 } 74 private DateTime pluginBuildDate; 75 public DateTime PluginBuildDate { 76 get { return pluginBuildDate; } 77 set { pluginBuildDate = value; } 78 } 76 79 77 80 private string pluginDetails; … … 96 99 this.state = state; 97 100 this.allTags = allTags; 98 99 101 this.pluginName = plugin.Name; 100 102 this.pluginVersion = plugin.Version; 103 this.pluginBuildDate = plugin.BuildDate; 101 104 this.message = plugin.Message; 102 105 pluginDetails = GeneratePluginDetails(plugin); … … 108 111 this.state = state; 109 112 this.allTags = allTags; 110 111 113 this.pluginName = plugin.Name; 112 114 this.pluginVersion = plugin.Version; 113 115 this.pluginBuildDate = plugin.BuildDate; 114 116 pluginDetails = GeneratePluginDetails(plugin); 115 117 pluginDependencies = GeneratePluginDependencies(plugin); … … 132 134 }); 133 135 return "Plugin: " + plugin.Name + "\n" + 134 "Version: " + plugin.Version + "\n\n" + 136 "Version: " + plugin.Version + "\n" + 137 "Build: " +plugin.BuildDate + "\n\n" + 135 138 (dependencies.Length != 0 ? "Requires: \n" + dependencies + "\n" : "") + 136 139 (dependents.Length != 0 ? "Used by:\n" + dependents + "\n" : "") + … … 146 149 return "plugin: " + plugin.Name + "\n" + 147 150 "Version: " + plugin.Version + "\n" + 151 "Build: "+plugin.BuildDate +"\n" + 148 152 "Installed from: " + plugin.Source + "\n" + 149 153 "Requires: \n" + dependencies; … … 156 160 } 157 161 return "plugin: " + upgrade.Name + "\n" + 158 "Current version: " + plugin.Version + " will be upgraded to new version: " + upgrade.Version + "\n"+162 "Current version: " + plugin.Version + " ("+plugin.BuildDate+") will be upgraded to new version: " + upgrade.Version + " ("+upgrade.BuildDate+")\n"+ 159 163 "Upgraded from: " + upgrade.Source + "\n" + 160 164 "Requires: \n" + dependencies; … … 163 167 private List<string> GeneratePluginDependencies(PluginInfo plugin) { 164 168 List<string> dependencies = new List<string>(); 165 166 169 plugin.Dependencies.ForEach(delegate(PluginInfo dependency) { 167 170 dependencies.Add(dependency.Name); 168 171 }); 169 170 172 return dependencies; 171 173 }
Note: See TracChangeset
for help on using the changeset viewer.