Changeset 4482
- Timestamp:
- 09/24/10 10:24:20 (14 years ago)
- Location:
- trunk/sources/HeuristicLab.PluginInfrastructure/3.3
- Files:
-
- 2 deleted
- 25 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.PluginInfrastructure/3.3/Advanced/AvailablePluginsView.cs
r4068 r4482 311 311 } 312 312 313 private bool IsNewerThan(IPluginDescription plugin1, IPluginDescription plugin2) {313 private static bool IsNewerThan(IPluginDescription plugin1, IPluginDescription plugin2) { 314 314 // newer: build version is higher, or if build version is the same revision is higher 315 315 if (plugin1.Version.Build < plugin2.Version.Build) return false; -
trunk/sources/HeuristicLab.PluginInfrastructure/3.3/Advanced/BasicUpdateView.cs
r4068 r4482 87 87 } 88 88 89 private bool IsNewerThan(IPluginDescription plugin1, IPluginDescription plugin2) {89 private static bool IsNewerThan(IPluginDescription plugin1, IPluginDescription plugin2) { 90 90 // newer: build version is higher, or if build version is the same revision is higher 91 91 if (plugin1.Version.Build < plugin2.Version.Build) return false; -
trunk/sources/HeuristicLab.PluginInfrastructure/3.3/Advanced/DeploymentService/PluginDescription.cs
r4068 r4482 69 69 } 70 70 71 [Obsolete]72 public DateTime BuildDate {73 get { throw new NotImplementedException(); }74 }75 76 71 /// <summary> 77 72 /// Gets an enumerable of dependencies of the plugin -
trunk/sources/HeuristicLab.PluginInfrastructure/3.3/Advanced/EditProductsView.cs
r4068 r4482 257 257 258 258 // populate plugins list view 259 ListViewItem activeItem = (ListViewItem)productsListView.SelectedItems[0];260 259 pluginListView.SuppressItemCheckedEvents = true; 261 260 foreach (var plugin in plugins.OfType<IPluginDescription>()) { -
trunk/sources/HeuristicLab.PluginInfrastructure/3.3/Advanced/InstallationManager.cs
r4068 r4482 179 179 using (ZipInputStream s = new ZipInputStream(new MemoryStream(zippedPackage))) { 180 180 ZipEntry theEntry; 181 string tmpEntry = String.Empty;182 181 while ((theEntry = s.GetNextEntry()) != null) { 183 182 string directoryName = pluginDir; 184 183 string fileName = Path.GetFileName(theEntry.Name); 185 184 // create directory 186 if ( directoryName != "") {185 if (!string.IsNullOrEmpty(directoryName)) { 187 186 Directory.CreateDirectory(directoryName); 188 187 } 189 if ( fileName != String.Empty) {188 if (!string.IsNullOrEmpty(fileName)) { 190 189 string fullPath = Path.Combine(directoryName, fileName); 191 190 string fullDirPath = Path.GetDirectoryName(fullPath); 192 191 if (!Directory.Exists(fullDirPath)) Directory.CreateDirectory(fullDirPath); 193 FileStream streamWriter = File.Create(fullPath); 194 int size = 2048; 195 byte[] data = new byte[2048]; 196 while (true) { 197 size = s.Read(data, 0, data.Length); 198 if (size > 0) { 199 streamWriter.Write(data, 0, size); 200 } else { 201 break; 192 using (FileStream streamWriter = File.Create(fullPath)) { 193 int size = 2048; 194 byte[] data = new byte[2048]; 195 while (true) { 196 size = s.Read(data, 0, data.Length); 197 if (size > 0) { 198 streamWriter.Write(data, 0, size); 199 } else { 200 break; 201 } 202 202 } 203 streamWriter.Close(); 203 204 } 204 streamWriter.Close();205 205 } 206 206 } -
trunk/sources/HeuristicLab.PluginInfrastructure/3.3/Advanced/InstallationManagerException.cs
r4068 r4482 29 29 public InstallationManagerException(string msg) : base(msg) { } 30 30 public InstallationManagerException(string msg, Exception e) : base(msg, e) { } 31 p ublicInstallationManagerException(SerializationInfo info, StreamingContext context) : base(info, context) { }31 protected InstallationManagerException(SerializationInfo info, StreamingContext context) : base(info, context) { } 32 32 } 33 33 } -
trunk/sources/HeuristicLab.PluginInfrastructure/3.3/Advanced/InstallationManagerForm.cs
r4068 r4482 32 32 internal partial class InstallationManagerForm : Form, IStatusView { 33 33 private InstallationManager installationManager; 34 private PluginManager pluginManager;35 34 private string pluginDir; 36 35 … … 40 39 FileVersionInfo pluginInfrastructureVersion = FileVersionInfo.GetVersionInfo(GetType().Assembly.Location); 41 40 Text = "HeuristicLab Plugin Manager " + pluginInfrastructureVersion.FileVersion; 42 43 this.pluginManager = pluginManager;44 41 45 42 pluginManager.PluginLoaded += pluginManager_PluginLoaded; … … 142 139 #region button events 143 140 private void connectionSettingsToolStripMenuItem_Click(object sender, EventArgs e) { 144 new ConnectionSetupView().ShowDialog(this); 141 using (var conSetupView = new ConnectionSetupView()) { 142 conSetupView.ShowDialog(this); 143 } 145 144 } 146 145 private void tabControl_SelectedIndexChanged(object sender, EventArgs e) { … … 157 156 } 158 157 } 159 return (new ConfirmationDialog("Confirm Delete", "Do you want to delete following files?", strBuilder.ToString())).ShowDialog(this) == DialogResult.OK; 158 using (var confirmationDialog = new ConfirmationDialog("Confirm Delete", "Do you want to delete following files?", strBuilder.ToString())) { 159 return (confirmationDialog.ShowDialog(this)) == DialogResult.OK; 160 } 160 161 } 161 162 … … 165 166 strBuilder.AppendLine(plugin.ToString()); 166 167 } 167 return (new ConfirmationDialog("Confirm Update", "Do you want to update following plugins?", strBuilder.ToString())).ShowDialog(this) == DialogResult.OK; 168 using (var confirmationDialog = new ConfirmationDialog("Confirm Update", "Do you want to update following plugins?", strBuilder.ToString())) { 169 return (confirmationDialog.ShowDialog(this)) == DialogResult.OK; 170 } 168 171 } 169 172 … … 171 174 foreach (var plugin in plugins) { 172 175 if (!string.IsNullOrEmpty(plugin.LicenseText)) { 173 var licenseConfirmationBox = new LicenseConfirmationDialog(plugin); 174 if (licenseConfirmationBox.ShowDialog(this) != DialogResult.OK) 175 return false; 176 using (var licenseConfirmationBox = new LicenseConfirmationDialog(plugin)) { 177 if (licenseConfirmationBox.ShowDialog(this) != DialogResult.OK) 178 return false; 179 } 176 180 } 177 181 } … … 207 211 208 212 public void ShowProgressIndicator(double percentProgress) { 209 if (percentProgress < 0.0 || percentProgress > 1.0) throw new ArgumentException( );213 if (percentProgress < 0.0 || percentProgress > 1.0) throw new ArgumentException("percentProgress"); 210 214 toolStripProgressBar.Visible = true; 211 215 toolStripProgressBar.Style = ProgressBarStyle.Continuous; … … 224 228 225 229 public void ShowMessage(string message) { 226 if ( toolStripStatusLabel.Text == string.Empty)230 if (string.IsNullOrEmpty(toolStripStatusLabel.Text)) 227 231 toolStripStatusLabel.Text = message; 228 232 else -
trunk/sources/HeuristicLab.PluginInfrastructure/3.3/Advanced/InstalledPluginsView.cs
r4068 r4482 120 120 } 121 121 122 private bool IsNewerThan(IPluginDescription plugin1, IPluginDescription plugin2) {122 private static bool IsNewerThan(IPluginDescription plugin1, IPluginDescription plugin2) { 123 123 // newer: build version is higher, or if build version is the same revision is higher 124 124 if (plugin1.Version.Build < plugin2.Version.Build) return false; … … 153 153 } 154 154 155 private ListViewItem CreateListViewItem(PluginDescription plugin) {155 private static ListViewItem CreateListViewItem(PluginDescription plugin) { 156 156 ListViewItem item = new ListViewItem(new string[] { plugin.Name, plugin.Version.ToString(), plugin.Description }); 157 157 item.Tag = plugin; … … 190 190 List<ListViewItem> modifiedItems = new List<ListViewItem>(); 191 191 foreach (ListViewItem item in localPluginsListView.SelectedItems) { 192 var plugin = (IPluginDescription)item.Tag;193 192 modifiedItems.Add(item); 194 193 } -
trunk/sources/HeuristicLab.PluginInfrastructure/3.3/Advanced/MultiSelectListView.cs
r4068 r4482 22 22 using System.Linq; 23 23 using System.Windows.Forms; 24 using System; 24 25 25 26 namespace HeuristicLab.PluginInfrastructure.Advanced { … … 43 44 // and then one the item whose checkbox was clicked 44 45 protected override void OnItemCheck(ItemCheckEventArgs ice) { 46 if (ice == null) throw new ArgumentNullException("ice"); 45 47 // don't change the checked state of items that were not clicked directly 46 48 if (inhibitAutoCheck) { -
trunk/sources/HeuristicLab.PluginInfrastructure/3.3/Advanced/UploadPluginsView.cs
r4068 r4482 260 260 } 261 261 262 private byte[] CreateZipPackage(IPluginDescription plugin) {262 private static byte[] CreateZipPackage(IPluginDescription plugin) { 263 263 using (MemoryStream stream = new MemoryStream()) { 264 264 ZipFile zipFile = new ZipFile(stream); -
trunk/sources/HeuristicLab.PluginInfrastructure/3.3/Attributes/PluginAttribute.cs
r4068 r4482 53 53 } 54 54 55 [Obsolete]56 public PluginAttribute(string name) : this(name, "0.0.0.0") { }57 58 55 /// <summary> 59 56 /// Initializes a new instance of <see cref="PluginAttribute"/>. … … 74 71 if (string.IsNullOrEmpty(name)) throw new ArgumentException("Plugin name is null or empty."); 75 72 if (description == null) throw new ArgumentNullException("description"); 76 if (string.IsNullOrEmpty(version)) new ArgumentException("Version string is null or empty.");73 if (string.IsNullOrEmpty(version)) throw new ArgumentException("Version string is null or empty."); 77 74 this.name = name; 78 75 this.description = description; -
trunk/sources/HeuristicLab.PluginInfrastructure/3.3/Attributes/PluginDependencyAttribute.cs
r4068 r4482 46 46 47 47 /// <summary> 48 /// Initializes a new instance of <see cref="PluginDependencyAttribute"/>.49 /// <param name="dependency">The name of the plugin that is needed to load a plugin.</param>50 /// </summary>51 [Obsolete]52 public PluginDependencyAttribute(string dependency)53 : this(dependency, "0.0.0.0") {54 }55 56 /// <summary>57 48 /// Initializes a new instance of <see cref="PluginDependencyAttribute" />. 58 49 /// </summary> -
trunk/sources/HeuristicLab.PluginInfrastructure/3.3/BaseClasses/PluginBase.cs
r4068 r4482 29 29 /// Initializes a new instance of <see cref="PluginBase"/>. 30 30 /// </summary> 31 p ublicPluginBase() { }31 protected PluginBase() { } 32 32 33 33 private PluginAttribute PluginAttribute { -
trunk/sources/HeuristicLab.PluginInfrastructure/3.3/DefaultApplicationManager.cs
r4068 r4482 310 310 /// <returns>The description of the plugin that declares the given type or null if the type has not been declared by a known plugin.</returns> 311 311 public IPluginDescription GetDeclaringPlugin(Type type) { 312 if (type == null) throw new ArgumentNullException("type"); 312 313 foreach (PluginDescription info in Plugins) { 313 314 if (info.AssemblyLocations.Contains(Path.GetFullPath(type.Assembly.Location))) return info; -
trunk/sources/HeuristicLab.PluginInfrastructure/3.3/ErrorHandling/ErrorHandling.cs
r3758 r4482 57 57 } 58 58 public static void ShowErrorDialog(Control owner, string message, Exception exception) { 59 if (owner == null) throw new ArgumentNullException("owner"); 59 60 if (owner.InvokeRequired) { 60 61 owner.Invoke(new Action<Control, string, Exception>(ShowErrorDialog), owner, message, exception); -
trunk/sources/HeuristicLab.PluginInfrastructure/3.3/HeuristicLab.PluginInfrastructure-3.3.csproj
r4065 r4482 178 178 <Compile Include="Advanced\DeploymentService\DeploymentService.cs" /> 179 179 <Compile Include="Advanced\DeploymentService\UpdateClientFactory.cs" /> 180 <Compile Include="Advanced\InstallationManagerConsole.cs" />181 180 <Compile Include="Advanced\InstallationManager.cs" /> 182 181 <Compile Include="Advanced\InstallationManagerForm.cs"> … … 212 211 </Compile> 213 212 <Compile Include="Attributes\ApplicationAttribute.cs" /> 214 <Compile Include="Attributes\AssemblyBuildDateAttribute.cs" />215 213 <Compile Include="Attributes\ContactInformationAttribute.cs" /> 216 214 <Compile Include="Attributes\PluginAttribute.cs" /> -
trunk/sources/HeuristicLab.PluginInfrastructure/3.3/Interfaces/IPluginDescription.cs
r2922 r4482 41 41 string Description { get; } 42 42 /// <summary> 43 /// Gets the build date of the plugin.44 /// </summary>45 [Obsolete]46 DateTime BuildDate { get; }47 /// <summary>48 43 /// Gets the dependencies of the plugin. 49 44 /// </summary> -
trunk/sources/HeuristicLab.PluginInfrastructure/3.3/LightweightApplicationManager.cs
r4068 r4482 33 33 /// </summary> 34 34 internal sealed class LightweightApplicationManager : IApplicationManager { 35 internal LightweightApplicationManager() { 36 AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(CurrentDomain_AssemblyResolve); 37 } 38 39 Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args) { 40 return null; 41 } 42 35 43 36 44 #region IApplicationManager Members … … 102 110 /// <returns>Enumerable of the discovered types.</returns> 103 111 private static IEnumerable<Type> GetTypes(Type type, Assembly assembly, bool onlyInstantiable) { 104 return from t in assembly.GetTypes() 105 where CheckTypeCompatibility(type, t) 106 where onlyInstantiable == false || (!t.IsAbstract && !t.IsInterface && !t.HasElementType) 107 select BuildType(t, type); 112 try { 113 var assemblyTypes = assembly.GetTypes(); 114 115 return from t in assemblyTypes 116 where CheckTypeCompatibility(type, t) 117 where onlyInstantiable == false || (!t.IsAbstract && !t.IsInterface && !t.HasElementType) 118 select BuildType(t, type); 119 } 120 catch (TypeLoadException) { 121 return Enumerable.Empty<Type>(); 122 } 123 catch (ReflectionTypeLoadException) { 124 return Enumerable.Empty<Type>(); 125 } 108 126 } 109 127 -
trunk/sources/HeuristicLab.PluginInfrastructure/3.3/Manager/PluginDescription.cs
r4068 r4482 58 58 internal set { version = value; } 59 59 } 60 [Obsolete]61 private DateTime buildDate;62 /// <summary>63 /// Gets the build date of the plugin.64 /// </summary>65 [Obsolete]66 public DateTime BuildDate {67 get { return buildDate; }68 internal set { buildDate = value; }69 }70 60 71 61 private string contactName; -
trunk/sources/HeuristicLab.PluginInfrastructure/3.3/Manager/PluginManager.cs
r4414 r4482 24 24 using System.Linq; 25 25 using System.Reflection; 26 using System.Security.Permissions; 26 27 27 28 namespace HeuristicLab.PluginInfrastructure.Manager { … … 204 205 /// </summary> 205 206 /// <returns><c>null</c>.</returns> 207 [SecurityPermission(SecurityAction.LinkDemand, Flags=SecurityPermissionFlag.Infrastructure)] 206 208 public override object InitializeLifetimeService() { 207 209 return null; -
trunk/sources/HeuristicLab.PluginInfrastructure/3.3/Manager/PluginValidator.cs
r4068 r4482 301 301 } 302 302 303 private st ring ReadLicenseFiles(IEnumerable<PluginFile> pluginFiles) {303 private static string ReadLicenseFiles(IEnumerable<PluginFile> pluginFiles) { 304 304 // combine the contents of all plugin files 305 305 var licenseFiles = from file in pluginFiles … … 432 432 /// <param name="requested">The requested version that must be matched.</param> 433 433 /// <returns></returns> 434 private bool IsCompatiblePluginVersion(Version available, Version requested) {434 private static bool IsCompatiblePluginVersion(Version available, Version requested) { 435 435 // this condition must be removed after all plugins have been updated to declare plugin and dependency versions 436 436 if ( -
trunk/sources/HeuristicLab.PluginInfrastructure/3.3/Sandboxing/SandboxManager.cs
r4414 r4482 32 32 namespace HeuristicLab.PluginInfrastructure.Sandboxing { 33 33 public class SandboxManager { 34 35 // static class 36 private SandboxManager() { } 34 37 35 38 private static StrongName CreateStrongName(Assembly assembly) { -
trunk/sources/HeuristicLab.PluginInfrastructure/3.3/Starter/AboutDialog.cs
r4068 r4482 40 40 var curAssembly = this.GetType().Assembly; 41 41 productTextBox.Text = GetProduct(curAssembly); 42 versionTextBox.Text = GetVersion( curAssembly);42 versionTextBox.Text = GetVersion(); 43 43 copyrightTextBox.Text = GetCopyright(curAssembly); 44 44 imageList.Images.Add(HeuristicLab.PluginInfrastructure.Resources.Plugin); … … 79 79 } 80 80 81 private string GetVersion( Assembly asm) {81 private string GetVersion() { 82 82 FileVersionInfo pluginInfrastructureVersion = FileVersionInfo.GetVersionInfo(GetType().Assembly.Location); 83 83 return pluginInfrastructureVersion.FileVersion; -
trunk/sources/HeuristicLab.PluginInfrastructure/3.3/Starter/SplashScreen.cs
r4068 r4482 32 32 private Timer fadeTimer; 33 33 private int initialInterval; 34 private PluginManager manager;35 34 36 35 internal SplashScreen() { … … 41 40 : this() { 42 41 this.initialInterval = initialInterval; 43 this.manager = manager;44 42 45 43 manager.ApplicationStarted += new EventHandler<PluginInfrastructureEventArgs>(manager_ApplicationStarted); -
trunk/sources/HeuristicLab.PluginInfrastructure/3.3/Starter/StarterForm.cs
r4068 r4482 93 93 try { 94 94 Cursor = Cursors.AppStarting; 95 InstallationManagerForm form = new InstallationManagerForm(pluginManager); 96 form.ShowDialog(this); 95 using (InstallationManagerForm form = new InstallationManagerForm(pluginManager)) { 96 form.ShowDialog(this); 97 } 97 98 UpdateApplicationsList(); 98 99 } … … 180 181 private void aboutButton_Click(object sender, EventArgs e) { 181 182 List<IPluginDescription> plugins = new List<IPluginDescription>(pluginManager.Plugins.OfType<IPluginDescription>()); 182 var dialog = new AboutDialog(plugins); 183 dialog.ShowDialog(); 183 using (var dialog = new AboutDialog(plugins)) { 184 dialog.ShowDialog(); 185 } 184 186 } 185 187 }
Note: See TracChangeset
for help on using the changeset viewer.