private static Types GetTypesResult(TypeMetrics metrics)
        {
            Types type = new Types();

            type.AddRange(MetricsReportBuilder.GetTypeResults(metrics));
            return(type);
        }
示例#2
0
        public void LoadAllTypes(string webApiModuleFilePath)
        {
            var webApiApplicationModule = ModuleDefinition
                                          .ReadModule(webApiModuleFilePath);

            var corlib = ModuleDefinition.ReadModule(typeof(object).Module.FullyQualifiedName);

            Types.AddRange(corlib.GetTypes());

            Types.AddRange(webApiApplicationModule.GetTypes());

            var moduleDirectoryName = Path.GetDirectoryName(webApiModuleFilePath);

            foreach (var reference in webApiApplicationModule.AssemblyReferences)
            {
                var fileName = $"{reference.Name}.dll";
                var path     = Path.Combine(moduleDirectoryName, fileName);

                if (!File.Exists(path))
                {
                    continue;
                }

                var moduleDefinition = ModuleDefinition.ReadModule(path);
                Types.AddRange(moduleDefinition.GetTypes());
            }
        }
示例#3
0
        void Parse()
        {
            TemplateProviders.AddRange(Type
                                       .GetCustomAttributes(typeof(IRouteTemplateProvider), true)
                                       .Cast <IRouteTemplateProvider>().ToList());

            var actionMethods = Type
                                .GetMethods(BindingFlags.Public | BindingFlags.Instance)
                                .Where(a => a.DeclaringType == Type);

            foreach (var actionMethod in actionMethods)
            {
                var returnType = ApiAction.GetCleanReturnType(actionMethod.ReturnType);

                if (returnType == null ||
                    actionMethod.GetCustomAttribute(typeof(NonActionAttribute)) != null)
                {
                    continue;
                }

                var action = new ApiAction(actionMethod, TemplateProviders);

                Actions.Add(action);

                Types.AddRange(action.Types.Where(t => !Types.Contains(t)));
            }
        }
示例#4
0
        private async void CollectTypes()
        {
            if (!string.IsNullOrWhiteSpace(myAssemblyToAnalyseLocation) && File.Exists(myAssemblyToAnalyseLocation))
            {
                var types = await myInheritanceClient.GetAllTypesAsync(myAssemblyToAnalyseLocation, new CancellationTokenSource().Token);

                Types.AddRange(types);
            }
        }
示例#5
0
        /// <summary>
        /// Создать <see cref="SecurityTypesComboBox"/>.
        /// </summary>
        public SecurityTypesComboBox()
        {
            Types.AddRange(Enum.GetValues(typeof(SecurityTypes)).Cast <SecurityTypes>());
            ItemsSource = Types;

            SelectedTypes = new UniqueObservableCollection <SecurityTypes>
            {
                SecurityTypes.Stock
            };
        }
        public void Initialize()
        {
            var version = Environment.OSVersion.Version;

            IsWindows8OrGreater = (version.Major == 6 && version.Minor >= 2) || version.Major > 6;

            Types.Add(LocationDefault);
            Types.AddRange(typeof(Notification.Types).GetProperties().Select(property => property.Name).ToList());

            Settings = new AudibleNotifierSettings(Types);

            this.viewModel = new AudibleNotificationsSettingsViewModel();
        }
示例#7
0
        public void Explore(IMetadataAssembly assembly)
        {
            using (ReadLockCookie.Create())
            {
                var types = assembly.GetTypes()
                            .Flatten(x => x.GetNestedTypes())
                            .Where(x => x.FullyQualifiedName != "<Module>");

                Types.AddRange(types.Select(x => x.AsTypeInfo()));

                foreach (var type in Types)
                {
                    Fields.AddRange(type.GetFields());
                }
            }
        }
示例#8
0
        public void Scan()
        {
            Types.Clear();
            Assemblies.Clear();

            var assemblyFilePaths = Directory.GetFiles(_appSettings.PathToWorkingDirectory, "*.dll", SearchOption.AllDirectories)
                .Where(x => !Blacklisted(x));

            foreach (var assemblyFilePath in assemblyFilePaths)
            {
                try { Assemblies.Add(Assembly.LoadFrom(assemblyFilePath)); }
                catch (FileLoadException) { }
                catch (BadImageFormatException) { }
            }

            foreach (var assembly in Assemblies)
            {
                Types.AddRange(assembly.GetTypes().Where(type => !type.IsCompilerGenerated()));
            }
        }
示例#9
0
        /// <summary>
        /// Searchs an Assembly for a specific Services
        /// </summary>
        /// <typeparam name="AbstractType">The type that will be registered.</typeparam>
        public void ScanTypes <AbstractType>(Assembly assembly)
        {
            var types = assembly.FindInterfaces <AbstractType>();

            Types.AddRange(types);
        }
示例#10
0
 public ConfirmRecordResult(int id, IEnumerable <ConfirmRecordType> types)
 {
     Id = id;
     Types.AddRange(types ?? new ConfirmRecordType[0]);
 }
示例#11
0
        public virtual void TopologicalSort()
        {
            using (new Measure(Logger, "Topological Sorting", logLevel: LogLevel.Trace))
            {
                var graph = new DependencyGraph();

                Logger.ZLogTrace("\tTopological sorting first iteration...");

                var hitCounters = new long[7];

                foreach (var t in Types)
                {
                    hitCounters[0]++;
                    var parents        = GetParents(t.Type);
                    var reflectionName = GetReflectionName(t.Type);
                    var tProcess       = graph.Processes.FirstOrDefault(p => p.Name == reflectionName);
                    if (tProcess == null)
                    {
                        hitCounters[1]++;
                        tProcess = new OrderedProcess(graph, reflectionName);
                    }

                    for (int i = parents.Count - 1; i > -1; i--)
                    {
                        hitCounters[2]++;
                        var x = parents[i];
                        reflectionName = GetReflectionName(x.Type);
                        if (tProcess.Predecessors.All(p => p.Name != reflectionName))
                        {
                            hitCounters[3]++;

                            var dProcess = graph.Processes.FirstOrDefault(p => p.Name == reflectionName);
                            if (dProcess == null)
                            {
                                hitCounters[4]++;
                                dProcess = new OrderedProcess(graph, reflectionName);
                            }

                            if (tProcess != dProcess && dProcess.Predecessors.All(p => p.Name != tProcess.Name))
                            {
                                hitCounters[4]++;
                                tProcess.After(dProcess);
                            }
                        }
                    }
                }

                for (int i = 0; i < hitCounters.Length; i++)
                {
                    Logger.ZLogTrace("\t\tHitCounter{0} = {1}", i, hitCounters[i]);
                }

                Logger.ZLogTrace("\tTopological sorting first iteration done");

                if (graph.ProcessCount > 0)
                {
                    ITypeInfo      tInfo           = null;
                    OrderedProcess handlingProcess = null;
                    try
                    {
                        Logger.ZLogTrace("\tTopological sorting third iteration...");

                        System.Array.Clear(hitCounters, 0, hitCounters.Length);

                        Logger.ZLogTrace("\t\tCalculate sorting...");
                        TopologicalSort sorted = graph.CalculateSort();
                        Logger.ZLogTrace("\t\tCalculate sorting done");

                        Logger.ZLogTrace("\t\tGetting Reflection names for {0} types...", Types.Count);

                        var list = new List <ITypeInfo>(Types.Count);
                        // The fix required for Mono 5.0.0.94
                        // It does not "understand" TopologicalSort's Enumerator in foreach
                        // foreach (var processes in sorted)
                        // The code is modified to get it "directly" and "typed"
                        var sortedISetEnumerable = sorted as IEnumerable <ISet <OrderedProcess> >;
                        Logger.ZLogTrace("\t\tGot Enumerable<ISet<OrderedProcess>>");

                        var sortedISetEnumerator = sortedISetEnumerable.GetEnumerator();
                        Logger.ZLogTrace("\t\tGot Enumerator<ISet<OrderedProcess>>");

                        while (sortedISetEnumerator.MoveNext())
                        {
                            var processes = sortedISetEnumerator.Current;

                            hitCounters[0]++;

                            foreach (var process in processes)
                            {
                                handlingProcess = process;
                                hitCounters[1]++;

                                tInfo = Types.First(ti => GetReflectionName(ti.Type) == process.Name);

                                var reflectionName = GetReflectionName(tInfo.Type);

                                if (list.All(t => GetReflectionName(t.Type) != reflectionName))
                                {
                                    hitCounters[2]++;
                                    list.Add(tInfo);
                                }
                            }
                        }

                        Logger.ZLogTrace("\t\tGetting Reflection names done");

                        Types.Clear();
                        Types.AddRange(list);

                        for (int i = 0; i < hitCounters.Length; i++)
                        {
                            Logger.ZLogTrace("\t\tHitCounter{0} = {1}", i, hitCounters[i]);
                        }

                        Logger.ZLogTrace("\tTopological sorting third iteration done");
                    }
                    catch (System.Exception ex)
                    {
                        Logger.LogWarning($"Topological sort failed {(tInfo != null || handlingProcess != null ? "at type " + (tInfo != null ? tInfo.Type.ReflectionName : handlingProcess.Name) : string.Empty)} with error {ex}");
                    }
                }
                cacheParents = null;
                activeTypes  = null;
            }
        }
示例#12
0
 public void Add(UnitorModel model)
 {
     Types.AddRange(model.Types);
     Namespaces.Clear();
     Namespaces.AddRange(Types.Select(t => t.Namespace).Distinct());
 }
        public void AddNamespace(Assembly assembly, String nameSpace)
        {
            var types = assembly.GetTypes();

            Types.AddRange(types.Where(each => each.IsClass && !each.IsNestedPrivate && each.Namespace != null && each.Namespace.StartsWith(nameSpace)).ToList());
        }
示例#14
0
 public virtual UIElement WithTypes(params string[] types)
 {
     Types.AddRange(types);
     return(this);
 }
        /// <summary>
        /// Инициализация определений функций языка (для определения связки количества и типов параметров)
        /// </summary>
        protected override void InitializeDefs()
        {
            lock (_objNull)
            {
                fieldUpFunctionType = fieldBoolType;

                Types.AddRange(
                    fieldBoolType,
                    fieldNumericType,
                    fieldStringType,
                    fieldDateTimeType,
                    fieldGuidType);


                Functions.AddRange(
                    //ISNULL
                    new FunctionDef(1, fieldBoolType, "ISNULL", "НЕ ЗАПОЛНЕНО", "({0} не заполнено)", new FunctionParameterDef(fieldBoolType)),
                    new FunctionDef(2, fieldBoolType, "ISNULL", "НЕ ЗАПОЛНЕНО", "({0} не заполнено)", new FunctionParameterDef(fieldNumericType)),
                    new FunctionDef(3, fieldBoolType, "ISNULL", "НЕ ЗАПОЛНЕНО", "({0} не заполнено)", new FunctionParameterDef(fieldStringType)),
                    new FunctionDef(4, fieldBoolType, "ISNULL", "НЕ ЗАПОЛНЕНО", "({0} не заполнено)", new FunctionParameterDef(fieldDateTimeType)),
                    new FunctionDef(5, fieldBoolType, "ISNULL", "НЕ ЗАПОЛНЕНО", "({0} не заполнено)", new FunctionParameterDef(fieldGuidType)),
                    //SQLQUERY
                    new FunctionDef(6, fieldQueryType, "SQL", "SQL", "SQL ('{0}')", true, new FunctionParameterDef(fieldStringType)),
                    new FunctionDef(7, fieldBoolType, "SQL", "SQL", "SQL ('{0}')", true, new FunctionParameterDef(fieldStringType)),
                    new FunctionDef(8, fieldNumericType, "SQL", "SQL", "SQL ('{0}')", true, new FunctionParameterDef(fieldStringType)),
                    new FunctionDef(9, fieldStringType, "SQL", "SQL", "SQL ('{0}')", true, new FunctionParameterDef(fieldStringType)),
                    new FunctionDef(10, fieldDateTimeType, "SQL", "SQL", "SQL ('{0}')", true, new FunctionParameterDef(fieldStringType)),
                    //NOT
                    new FunctionDef(11, fieldBoolType, "NOT", "НЕ", "НЕ {0}", new FunctionParameterDef(fieldBoolType)),
                    //OR
                    new FunctionDef(12, fieldBoolType, "OR", "ИЛИ", "({* ИЛИ})", new FunctionParameterDef(fieldBoolType), new FunctionParameterDef(fieldBoolType, true)),
                    //AND
                    new FunctionDef(13, fieldBoolType, "AND", "И", "{* И}", new FunctionParameterDef(fieldBoolType), new FunctionParameterDef(fieldBoolType, true)),
                    //+
                    new FunctionDef(14, fieldNumericType, "+", "+", "({* +})", new FunctionParameterDef(fieldNumericType), new FunctionParameterDef(fieldNumericType, true)),
                    //*
                    new FunctionDef(15, fieldNumericType, "*", "*", "{* *}", new FunctionParameterDef(fieldNumericType), new FunctionParameterDef(fieldNumericType, true)),
                    //-
                    new FunctionDef(16, fieldNumericType, "-", "-", "({0} - {1})", new FunctionParameterDef(fieldNumericType), new FunctionParameterDef(fieldNumericType)),
                    // /
                    new FunctionDef(17, fieldNumericType, "/", "/", "({0} / {1})", new FunctionParameterDef(fieldNumericType), new FunctionParameterDef(fieldNumericType)),
                    //LIKE
                    new FunctionDef(18, fieldBoolType, "LIKE", "ПО МАСКЕ", "({0} УДОВЛ.МАСКЕ {1})", new FunctionParameterDef(fieldStringType), new FunctionParameterDef(fieldStringType)),
                    //<
                    new FunctionDef(19, fieldBoolType, "<", "<", "({0} < {1})", new FunctionParameterDef(fieldNumericType), new FunctionParameterDef(fieldNumericType)),
                    new FunctionDef(20, fieldBoolType, "<", "<", "({0} < {1})", new FunctionParameterDef(fieldStringType), new FunctionParameterDef(fieldStringType)),
                    new FunctionDef(21, fieldBoolType, "<", "<", "({0} < {1})", new FunctionParameterDef(fieldDateTimeType), new FunctionParameterDef(fieldDateTimeType)),
                    //<=
                    new FunctionDef(22, fieldBoolType, "<=", "<=", "({0} <= {1})", new FunctionParameterDef(fieldNumericType), new FunctionParameterDef(fieldNumericType)),
                    new FunctionDef(23, fieldBoolType, "<=", "<=", "({0} <= {1})", new FunctionParameterDef(fieldStringType), new FunctionParameterDef(fieldStringType)),
                    new FunctionDef(24, fieldBoolType, "<=", "<=", "({0} <= {1})", new FunctionParameterDef(fieldDateTimeType), new FunctionParameterDef(fieldDateTimeType)),
                    //>
                    new FunctionDef(25, fieldBoolType, ">", ">", "({0} > {1})", new FunctionParameterDef(fieldNumericType), new FunctionParameterDef(fieldNumericType)),
                    new FunctionDef(26, fieldBoolType, ">", ">", "({0} > {1})", new FunctionParameterDef(fieldStringType), new FunctionParameterDef(fieldStringType)),
                    new FunctionDef(27, fieldBoolType, ">", ">", "({0} > {1})", new FunctionParameterDef(fieldDateTimeType), new FunctionParameterDef(fieldDateTimeType)),
                    //>=
                    new FunctionDef(28, fieldBoolType, ">=", ">=", "({0} >= {1})", new FunctionParameterDef(fieldNumericType), new FunctionParameterDef(fieldNumericType)),
                    new FunctionDef(29, fieldBoolType, ">=", ">=", "({0} >= {1})", new FunctionParameterDef(fieldStringType), new FunctionParameterDef(fieldStringType)),
                    new FunctionDef(30, fieldBoolType, ">=", ">=", "({0} >= {1})", new FunctionParameterDef(fieldDateTimeType), new FunctionParameterDef(fieldDateTimeType)),
                    //<>
                    new FunctionDef(31, fieldBoolType, "<>", "<>", "({0} <> {1})", new FunctionParameterDef(fieldNumericType), new FunctionParameterDef(fieldNumericType)),
                    new FunctionDef(32, fieldBoolType, "<>", "<>", "({0} <> {1})", new FunctionParameterDef(fieldStringType), new FunctionParameterDef(fieldStringType)),
                    new FunctionDef(33, fieldBoolType, "<>", "<>", "({0} <> {1})", new FunctionParameterDef(fieldDateTimeType), new FunctionParameterDef(fieldDateTimeType)),
                    new FunctionDef(34, fieldBoolType, "<>", "<>", "({0} <> {1})", new FunctionParameterDef(fieldGuidType), new FunctionParameterDef(fieldGuidType)),
                    //=
                    new FunctionDef(35, fieldBoolType, "=", "=", "{0} = {1}", new FunctionParameterDef(fieldNumericType), new FunctionParameterDef(fieldNumericType)),
                    new FunctionDef(36, fieldBoolType, "=", "=", "{0} = {1}", new FunctionParameterDef(fieldStringType), new FunctionParameterDef(fieldStringType)),
                    new FunctionDef(37, fieldBoolType, "=", "=", "{0} = {1}", new FunctionParameterDef(fieldDateTimeType), new FunctionParameterDef(fieldDateTimeType)),
                    new FunctionDef(38, fieldBoolType, "=", "=", "{0} = {1}", new FunctionParameterDef(fieldGuidType), new FunctionParameterDef(fieldGuidType)),
                    //IN
                    new FunctionDef(39, fieldBoolType, "IN", "СРЕДИ ЗНАЧЕНИЙ", "({0} СРЕДИ {{{* ,}}})", new FunctionParameterDef(fieldNumericType), new FunctionParameterDef(fieldNumericType, true)),
                    new FunctionDef(40, fieldBoolType, "IN", "СРЕДИ ЗНАЧЕНИЙ", "({0} СРЕДИ {{{* ,}}})", new FunctionParameterDef(fieldStringType), new FunctionParameterDef(fieldStringType, true)),
                    new FunctionDef(41, fieldBoolType, "IN", "СРЕДИ ЗНАЧЕНИЙ", "({0} СРЕДИ {{{* ,}}})", new FunctionParameterDef(fieldDateTimeType), new FunctionParameterDef(fieldDateTimeType, true)),
                    new FunctionDef(42, fieldBoolType, "IN", "СРЕДИ ЗНАЧЕНИЙ", "({0} СРЕДИ {{{* ,}}})", new FunctionParameterDef(fieldGuidType), new FunctionParameterDef(fieldGuidType, true)),
                    //BETWEEN
                    new FunctionDef(43, fieldBoolType, "BETWEEN", "ДИАПАЗОН", "({0} в диапазоне от {1} до {2})", new FunctionParameterDef(fieldNumericType), new FunctionParameterDef(fieldNumericType), new FunctionParameterDef(fieldNumericType)),
                    new FunctionDef(44, fieldBoolType, "BETWEEN", "ДИАПАЗОН", "({0} в диапазоне от {1} до {2})", new FunctionParameterDef(fieldStringType), new FunctionParameterDef(fieldStringType), new FunctionParameterDef(fieldStringType)),
                    new FunctionDef(45, fieldBoolType, "BETWEEN", "ДИАПАЗОН", "({0} в диапазоне от {1} до {2})", new FunctionParameterDef(fieldDateTimeType), new FunctionParameterDef(fieldDateTimeType), new FunctionParameterDef(fieldDateTimeType)),
                    //Равенство Boolean
                    new FunctionDef(46, fieldBoolType, "=", "=", "{0} = {1}", new FunctionParameterDef(BoolType), new FunctionParameterDef(BoolType)),
                    //Неавенство Boolean
                    new FunctionDef(47, fieldBoolType, "<>", "<>", "{0} <> {1}", new FunctionParameterDef(BoolType), new FunctionParameterDef(BoolType))
                    );
            }
        }
示例#16
0
 public void AddAssembly(Assembly assembly)
 {
     Types.AddRange(assembly.GetTypes().Where(ShouldIncludeType).ToList());
 }
示例#17
0
        public void AddNamespace(Assembly assembly, string nameSpace)
        {
            var types = assembly.GetTypes();

            Types.AddRange(types.Where(type => type.Namespace != null && type.Namespace.StartsWith(nameSpace) && ShouldIncludeType(type)).ToList());
        }
示例#18
0
 public void Add(params Type[] types)
 => Types.AddRange(types);
示例#19
0
 public void Add(IEnumerable <Type> types)
 => Types.AddRange(types);
示例#20
0
 public SignatureList(Type[] types)
 {
     Types.AddRange(types);
 }