// Load assembly and find video analyzer descriptors there private void LoadAssembly(string fname) { try { Type typeVideoSourceDesc = typeof(VsICoreAnalyzerDescription); Assembly asm = null; // try to load assembly asm = Assembly.LoadFrom(fname); // get types of the assembly Type[] types = asm.GetTypes(); // check all types foreach (Type type in types) { // get interfaces ot the type Type[] interfaces = type.GetInterfaces(); // check, if the type is inherited from VsICoreAnalyzerDescription if (Array.IndexOf(interfaces, typeVideoSourceDesc) != -1) { VsICoreAnalyzerDescription desc = null; try { // create an instance of the type desc = (VsICoreAnalyzerDescription)Activator.CreateInstance(type); // create analyzer object InnerList.Add(new VsAnalyzer(desc)); } catch (Exception err) { // something failed during instance creatinion Console.WriteLine(err.Message); } } } } catch (Exception err) { //logger.Log(LogLevel.Error, err.Message + " " + err.Source + " " + err.StackTrace);; Console.WriteLine(err.Message); } }
// Constructor public VsAnalyzer(VsICoreAnalyzerDescription analyserDesc) { this.analyserDesc = analyserDesc; }