示例#1
0
        // Load assembly and find video provider descriptors there
        private void LoadAssembly(string fname)
        {
            try
            {
                Type     typeVideoSourceDesc = typeof(VsICoreProviderDescription);
                Assembly asm = null;

                try
                {
                    // 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 VsICoreProviderDescription
                        if (Array.IndexOf(interfaces, typeVideoSourceDesc) != -1)
                        {
                            VsICoreProviderDescription desc = null;

                            try
                            {
                                // create an instance of the type
                                desc = (VsICoreProviderDescription)Activator.CreateInstance(type);
                                // create provider object
                                InnerList.Add(new VsProvider(desc));
                            }
                            catch (Exception err)
                            {
                                logger.Log(LogLevel.Error, err.Message + " " + err.Source + " " + err.StackTrace);;
                            }
                        }
                    }
                }
                catch (Exception err)
                {
                    //logger.Log(LogLevel.Error, err.Message + " " + err.Source + " " + err.StackTrace);;
                    Console.WriteLine(err.Message);
                }
            }
            catch (Exception err)
            {
                //logger.Log(LogLevel.Error, err.Message + " " + err.Source + " " + err.StackTrace);;
                Console.WriteLine(err.Message);
            }
        }
示例#2
0
 // Constructor
 public VsProvider(VsICoreProviderDescription sourceDesc)
 {
     this.sourceDesc = sourceDesc;
 }
示例#3
0
		// Constructor
		public VsProvider(VsICoreProviderDescription sourceDesc)
		{
			this.sourceDesc = sourceDesc;
		}