mirror of
https://github.com/greenshot/greenshot
synced 2025-07-16 10:03:44 -07:00
Improved the support for dragging and dropping images from a website, now also parsing HTML img src information, to be able to download that image. For this we need the HtmlAgilityPack.dll (#294)
Removed a lot of dead code, and remove the old OCR code as we don't even know if it still works.
This commit is contained in:
parent
90cab1e8a3
commit
26fe579d31
151 changed files with 1138 additions and 8174 deletions
|
@ -20,9 +20,7 @@
|
|||
*/
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using System.Threading;
|
||||
using GreenshotPlugin.Interfaces;
|
||||
using log4net;
|
||||
|
||||
namespace GreenshotPlugin.Core {
|
||||
|
@ -33,42 +31,28 @@ namespace GreenshotPlugin.Core {
|
|||
private static readonly ILog LOG = LogManager.GetLogger(typeof(InterfaceUtils));
|
||||
|
||||
public static List<Type> GetSubclassesOf(Type type, bool excludeSystemTypes) {
|
||||
List<Type> list = new List<Type>();
|
||||
foreach(Assembly currentAssembly in Thread.GetDomain().GetAssemblies()) {
|
||||
var list = new List<Type>();
|
||||
foreach(var currentAssembly in Thread.GetDomain().GetAssemblies()) {
|
||||
try {
|
||||
Type[] types = currentAssembly.GetTypes();
|
||||
if (!excludeSystemTypes || (excludeSystemTypes && !currentAssembly.FullName.StartsWith("System."))) {
|
||||
foreach(Type currentType in types) {
|
||||
if (type.IsInterface) {
|
||||
if (currentType.GetInterface(type.FullName) != null) {
|
||||
list.Add(currentType);
|
||||
}
|
||||
} else if (currentType.IsSubclassOf(type)) {
|
||||
list.Add(currentType);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
if (excludeSystemTypes && (!excludeSystemTypes || currentAssembly.FullName.StartsWith("System.")))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
foreach(var currentType in types) {
|
||||
if (type.IsInterface) {
|
||||
if (currentType.GetInterface(type.FullName) != null) {
|
||||
list.Add(currentType);
|
||||
}
|
||||
} else if (currentType.IsSubclassOf(type)) {
|
||||
list.Add(currentType);
|
||||
}
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
LOG.WarnFormat("Problem getting subclasses of type: {0}, message: {1}", type.FullName, ex.Message);
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public static List<IProcessor> GetProcessors() {
|
||||
List<IProcessor> processors = new List<IProcessor>();
|
||||
foreach(Type processorType in GetSubclassesOf(typeof(IProcessor), true)) {
|
||||
if (!processorType.IsAbstract) {
|
||||
IProcessor processor = (IProcessor)Activator.CreateInstance(processorType);
|
||||
if (processor.isActive) {
|
||||
LOG.DebugFormat("Found processor {0} with designation {1}", processorType.Name, processor.Designation);
|
||||
processors.Add(processor);
|
||||
} else {
|
||||
LOG.DebugFormat("Ignoring processor {0} with designation {1}", processorType.Name, processor.Designation);
|
||||
}
|
||||
}
|
||||
}
|
||||
return processors;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue