Пример #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="path"></param>
        private void Register(string path)
        {
            try
            {
                AssemblyName assemblyName = new AssemblyName();
                assemblyName.Name     = Path.GetFileNameWithoutExtension(path);
                assemblyName.CodeBase = path;
                Assembly assembly = Assembly.Load(assemblyName);
                log.Debug("Loaded " + Path.GetFileName(path));
                this._assemblyList.Add(assembly);

                foreach (Type type in assembly.GetExportedTypes())
                {
                    if (type.IsClass && typeof(IBytesConverter).IsAssignableFrom(type))
                    {
                        IBytesConverter ibc = (IBytesConverter)Activator.CreateInstance(type);
                        this._bytesConverterCollection.Add(ibc);
                        //log.Error("Addin {0} was already registered", addin.Name);
                        //else
                        //{
                        //    addinRegistry.Register(addin);
                        log.Debug("Registered addin: {0}", ibc.GetType());
                        //}
                    }
                }
            }
            catch (Exception ex)
            {
                // NOTE: Since the gui isn't loaded at this point,
                // the trace output will only show up in Visual Studio
                log.Error("Failed to load" + path, ex);
            }
        }
Пример #2
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="bc"></param>
 /// <returns></returns>
 private ListViewItem CreateListViewItem(IBytesConverter bc)
 {
     string assemblyInfo = GetAssemblyInfo(bc);
     //string[] items = new string[] {bc.GetType().FullName , "-", assemblyInfo };
     string[] items = new string[] { bc.GetType().FullName };
     ListViewItem lvi = new ListViewItem(items);
     return lvi;
 }
Пример #3
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="bc"></param>
 /// <returns></returns>
 private string GetAssemblyInfo(IBytesConverter bc)
 {
     return(bc.GetType().Assembly.FullName);
 }
Пример #4
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="bc"></param>
 /// <returns></returns>
 private string GetAssemblyInfo(IBytesConverter bc)
 {
     return bc.GetType().Assembly.FullName;
 }