public void Load(string detectorAssembly) { Reset(); // Get CustomerInterface Type interfaceType = typeof(IValueDetector); Assembly assembly = Assembly.LoadFrom(detectorAssembly); Type[] types = assembly.GetTypes(); // Find a class that implement Customer Interface foreach (Type type in types) { if (type.IsClass && interfaceType.IsAssignableFrom(type) == true) { // Create an instance detector = assembly.CreateInstance(type.FullName) as IValueDetector; } } if (detector == null) { throw new Exception(StringResource.LoadingAutoDetectorFailed); } }
public void Reset() { if (detector != null) { detector.Dispose(); } detector = null; UtilCallBackFunctions.WriteLog = (message, newline, style) => { if (DetectLogCallback != null) { DetectLogCallback(message, style); } }; }
/// <summary> /// Reset AutoDetection settings /// </summary> public void Reset() { CloseLogger(); if (valueDetector != null) { valueDetector.Dispose(); valueDetector = null; } if (cts != null) { cts.Dispose(); } UtilCallBackFunctions.WriteLog = (message, newline, style) => { if (DetectLogCallback != null) { DetectLogCallback(message, style); } }; stepsLocker.EnterWriteLock(); try { detectSteps = ValueDetector.GetDetectionSteps(); } finally { stepsLocker.ExitWriteLock(); } SetDetectionStatus(DetectionStatus.NotStart); taskCanceled = false; detectedException = null; }
public void Reset() { if (detector != null) detector.Dispose(); detector = null; UtilCallBackFunctions.WriteLog = (message, newline, style) => { if (DetectLogCallback != null) DetectLogCallback(message, style); }; }
public void Load(string detectorAssembly) { Reset(); // Get CustomerInterface Type interfaceType = typeof(IValueDetector); Assembly assembly = Assembly.LoadFrom(detectorAssembly); Type[] types = assembly.GetTypes(); // Find a class that implement Customer Interface foreach (Type type in types) { if (type.IsClass && interfaceType.IsAssignableFrom(type) == true) { // Create an instance detector = assembly.CreateInstance(type.FullName) as IValueDetector; } } if (detector == null) throw new Exception(StringResource.LoadingAutoDetectorFailed); }