private void UpdatePropertyPageNames()
        {
            IEnumerable <Assembly> enumerable = from assem in AppDomain.CurrentDomain.GetAssemblies()
                                                where assem.GetName().Name == "Microsoft.Exchange.Management.SnapIn.Esm"
                                                select assem;

            if (enumerable.Count <Assembly>() == 0)
            {
                throw new ArgumentException("Microsoft.Exchange.Management.SnapIn.Esm not loaded");
            }
            foreach (Assembly assembly in enumerable)
            {
                IEnumerable <string> enumerable2 = from type in DDIValidationHelper.GetAssemblyTypes(assembly)
                                                   where !type.IsAbstract && type.IsSubclassOf(typeof(ExchangePropertyPageControl))
                                                   select type.Name;
                foreach (string item in enumerable2)
                {
                    DDIValidPropertyPageNameAttribute.propertyPageNames.Add(item);
                }
            }
        }
Пример #2
0
        private void UpdateCmdlets()
        {
            IEnumerable <Assembly> source = from assemb in AppDomain.CurrentDomain.GetAssemblies()
                                            where CmdletAssemblyHelper.IsCmdletAssembly(assemb.GetName().Name)
                                            select assemb;

            if (source.Count <Assembly>() == 0)
            {
                throw new ArgumentException("Microsoft.Exchange.Management dll is not loaded");
            }
            DDIValidCommandTextAttribute.cmdlets.Add("New-EdgeSubscription".ToUpper());
            IEnumerable <object> enumerable = from type in DDIValidationHelper.GetAssemblyTypes(source.First <Assembly>())
                                              where !type.IsAbstract && type.GetCustomAttributes(typeof(CmdletAttribute), false).Count <object>() == 1
                                              select type.GetCustomAttributes(typeof(CmdletAttribute), false)[0];

            foreach (object obj in enumerable)
            {
                CmdletAttribute cmdletAttribute = (CmdletAttribute)obj;
                DDIValidCommandTextAttribute.cmdlets.Add((cmdletAttribute.VerbName + "-" + cmdletAttribute.NounName).ToUpper());
            }
        }