Пример #1
0
        private void LoadImeList()
        {
            Assembly assembly = GetType().Assembly;

            Type[] d = assembly.GetTypes();


            foreach (Type type in d)
            {
                if (type.Namespace != null && type.Namespace.StartsWith("Studyzy.IMEWLConverter.IME"))
                {
                    object[] att = type.GetCustomAttributes(typeof(ComboBoxShowAttribute), false);
                    if (att.Length > 0)
                    {
                        var cbxa = att[0] as ComboBoxShowAttribute;
                        Debug.WriteLine(cbxa.ShortCode);
                        Debug.WriteLine(cbxa.Index);
                        if (type.GetInterface("IWordLibraryImport") != null)
                        {
                            Debug.WriteLine("Import!!!!" + type.FullName);
                            cbxImportItems.Add(cbxa);
                            imports.Add(cbxa.ShortCode, assembly.CreateInstance(type.FullName) as IWordLibraryImport);
                        }
                        if (type.GetInterface("IWordLibraryExport") != null)
                        {
                            Debug.WriteLine("Export!!!!" + type.FullName);
                            cbxExportItems.Add(cbxa);
                            exports.Add(cbxa.ShortCode, assembly.CreateInstance(type.FullName) as IWordLibraryExport);
                        }
                    }
                }
            }
            cbxImportItems.Sort((a, b) => a.Index - b.Index);
            cbxExportItems.Sort((a, b) => a.Index - b.Index);
        }
Пример #2
0
        public ConsoleCommandDescriptor(Type t)
        {
            this.CommandType = t;
            var ca = CommandType.GetCustomAttributes(typeof(CommandAttribute), true).FirstOrDefault() as CommandAttribute;

            if (ca == null)
            {
                Info = new CommandAttribute()
                {
                    Keyword = CommandType.Name
                };
            }
            else
            {
                Info = ca;
            }

            this.LoadParameters();
        }