예제 #1
0
        public Component Generate(string name, bool isExecute)
        {
            Thread.Sleep(100);
            var rnd = new Random();
            var currentComponent = new Component(name, isExecute)
                                    {
                                        Roles = new string[rnd.Next(1, ComponentRolesMaxCount)],
                                        Dependencies = new string[rnd.Next(isExecute ? 1 : 0, ComponentDependenciesMaxCount)]
                                    };
            if (isExecute)
            {
                currentComponent.Roles = null;
            }
            else
            {
                for (var i = 0; i < currentComponent.Roles.Length; i++)
                {
                    currentComponent.Roles[i] = "R" + rnd.Next(RolesCount);
                }
            }

            for (var i = 0; i < currentComponent.Dependencies.Length; i++)
            {
                currentComponent.Dependencies[i] = "R" + rnd.Next(i, RolesCount);
            }

            Console.WriteLine(currentComponent.Name + " Complete");
            return currentComponent;
        }
예제 #2
0
        private void FindDependencies(Component instruction, ref Schema schema)
        {
            var dependencies = instruction.Dependencies;
            foreach (var dependency in dependencies)
            {
                var componentTo = FindComponent(dependency);
                schema.Components.Add(componentTo.Name);
                schema.AddConnection(instruction.Name, dependency, componentTo.Name);

                FindDependencies(componentTo, ref schema);
            }
        }
예제 #3
0
        public static void SimpleResolved(Component instruction, ref Schema schema)
        {
            var dependencies = instruction.Dependencies;
            foreach (var dependency in dependencies)
            {
                var componentTo = FindComponent(dependency);
                schema.Components.Add(componentTo.Name);
                schema.AddConnection(instruction.Name, dependency, componentTo.Name);

                SimpleResolved(componentTo, ref schema);
            }
        }