Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
02/11/10 13:41:52 (15 years ago)
Author:
gkronber
Message:

Added a way to store information why a plugin is disabled in plugin descriptions as suggested by abeham after code review. #863.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.PluginInfrastructure/Advanced/InstallationManager.cs

    r2778 r2779  
    105105      StringBuilder builder = new StringBuilder();
    106106      builder.AppendLine("Problem report:");
    107       var missingFiles = from x in desc.Files
    108                          where !File.Exists(x.Name)
    109                          select x.Name;
    110       if (missingFiles.Count() > 0) {
    111         foreach (string fileName in from file in desc.Files select file.Name) {
    112           if (!File.Exists(fileName)) builder.Append("Missing file: ").AppendLine(fileName);
    113         }
    114         return builder.ToString();
    115       } else {
    116         // or any dependency is disabled
    117         var disabledDependencies = from x in desc.Dependencies
    118                                    where x.PluginState == PluginState.Disabled
    119                                    select x;
    120         if (disabledDependencies.Count() > 0) {
    121           foreach (var dependency in disabledDependencies) {
    122             builder.Append(dependency.Name).AppendLine(" is disabled.").AppendLine(DetermineProblem(dependency));
    123           }
    124           return builder.ToString();
    125         } else {
    126           // or any dependency is missing / not installed
    127           var declaredDependencies = GetDeclaredDependencies(desc);
    128           if (declaredDependencies.Count() != desc.Dependencies.Count()) {
    129             var missingDependencies = from x in declaredDependencies
    130                                       where !desc.Dependencies.Any(dep => dep.Name == x)
    131                                       select x;
    132             builder.AppendLine("Necessary dependencies are missing:");
    133             foreach (string missingDependency in missingDependencies) {
    134               builder.AppendLine(missingDependency);
    135             }
    136           } else {
    137             // or there was a problem loading the assemblies
    138             builder.AppendLine("There was a problem while loading assemblies: ");
    139             foreach (string assemblyLocation in desc.AssemblyLocations) {
    140               builder.AppendLine(assemblyLocation + ": " + AssemblyName.GetAssemblyName(assemblyLocation).FullName);
    141             }
    142             return builder.ToString();
    143           }
    144         }
    145       }
    146       return "There is an unknown problem with plugin: " + desc.Name;
     107      builder.AppendLine(desc.LoadingErrorInformation);
     108      return builder.ToString();
    147109    }
    148110
Note: See TracChangeset for help on using the changeset viewer.