Exemplo n.º 1
0
        public void Initialize(BuildComponent component)
        {
            if (_isInitialized)
            {
                return;
            }
            if (component == null)
            {
                throw new ArgumentNullException();
            }

            BuildAssembler assembler = component.BuildAssembler;

            if (assembler == null)
            {
                throw new ArgumentException();
            }

            _messageHandler = assembler.MessageHandler;
            _isInitialized  = (_messageHandler != null);
        }
Exemplo n.º 2
0
        public async Task AddComponentToBuild(int buildId, int componentId)
        {
            await using (_context = new Sep3DBContext())
            {
                BuildModel buildModel = await _context.Builds.FirstAsync(b => b.Id == buildId);

                ComponentModel componentModel = await _context.Components
                                                .Include(c => c.Ratings)
                                                .FirstAsync(c => c.Id == componentId);

                BuildComponent buildComponent = new BuildComponent
                {
                    BuildId        = buildModel.Id,
                    BuildModel     = buildModel,
                    ComponentId    = componentModel.Id,
                    ComponentModel = componentModel
                };
                if (buildModel.BuildComponents == null)
                {
                    buildModel.BuildComponents = new List <BuildComponent>();
                    buildModel.BuildComponents.Add(buildComponent);
                    Console.WriteLine("added from null");
                }
                else
                {
                    buildModel.BuildComponents.Add(buildComponent);
                    Console.WriteLine("added from existed");
                }

                foreach (var variable in buildModel.BuildComponents)
                {
                    Console.WriteLine("buildId= " + variable.BuildId + "\n Build model= " + variable.BuildModel + "componentId= " + variable.ComponentId +
                                      "\n Component model= " + variable.ComponentModel);
                }
                _context.Update(buildModel);
                await _context.SaveChangesAsync();
            }
        }
Exemplo n.º 3
0
        public override void Apply(XmlDocument document, string key)
        {
            if (_listItems == null || _listItems.Count == 0)
            {
                return;
            }

            try
            {
                int itemCount = _listItems.Count;
                for (int i = 0; i < itemCount; i++)
                {
                    BuildComponent component = _listItems[i];
                    if (component != null)
                    {
                        component.Apply(document, key);
                    }
                }
            }
            catch (Exception ex)
            {
                this.WriteMessage(MessageLevel.Error, ex);
            }
        }
Exemplo n.º 4
0
        private static void PrintBuildComponenet(BuildComponent buildComponent, int level)
        {
            var spacesNeeded = level * 5;

            for (int i = 0; i < spacesNeeded; i++)
            {
                Console.Write("-");
            }

            if (verbose)
            {
                Console.Write($"{buildComponent.Recipe.Component.Name} needs {buildComponent.NumberOfBuilders} {buildComponent.Recipe.MachineType}(s) To Produce {buildComponent.ProducedPerMinute} with a build target of {buildComponent.BuildTargetPerMinute}\r\n");
            }
            else
            {
                Console.Write($"{buildComponent.Recipe.Component.Name} needs {buildComponent.NumberOfBuilders} {buildComponent.Recipe.MachineType}(s)\r\n");
            }


            foreach (var buildComponentInputComponent in buildComponent.InputComponents)
            {
                PrintBuildComponenet(buildComponentInputComponent, level + 1);
            }
        }
Exemplo n.º 5
0
        public void stSolutionTest3()
        {
            BuildComponent target = new BuildComponent(Env);

            Assert.AreEqual(Value.Empty, target.parse("[Build solution.NotRealProperty]"));
        }
Exemplo n.º 6
0
        public void isDeployableTest1()
        {
            BuildComponent target = new BuildComponent(Env);

            Assert.AreEqual(Value.Empty, target.parse("[Build projects.find(\"project1\").IsDeployable = true]"));
        }
Exemplo n.º 7
0
        public void stProjectConfTest2()
        {
            BuildComponent target = new BuildComponent(Env);

            target.parse("[Build projects.find(\"project1\").NotExist = true]");
        }
Exemplo n.º 8
0
        public void stProjectConfTest1()
        {
            BuildComponent target = new BuildComponent(Env);

            target.parse("[Build projects.find(\"project1\").IsBuildable = val]");
        }
Exemplo n.º 9
0
        public void stProjectsTest2()
        {
            BuildComponent target = new BuildComponent(Env);

            target.parse("[Build projects.find(\"NotExist\").]");
        }
Exemplo n.º 10
0
        public void stTypeTest2()
        {
            BuildComponent target = new BuildComponent(Env);

            target.parse("[Build type = true]");
        }
Exemplo n.º 11
0
 private DbUpdateStatement GetQuery_UpdateQuery(BuildComponent _obj)
 {
     return(DbMgr.CreateUpdateClause("BuildComponents", GetFields(_obj), "BuildComponentID", _obj.BuildComponentID));
 }
Exemplo n.º 12
0
        private DbInsertStatement GetQuery_InsertQuery(BuildComponent _obj)
        {
            Dictionary <string, DbFieldEntry> fields = GetFields(_obj);

            return(DbMgr.CreateInsertClause("BuildComponents", fields));
        }
Exemplo n.º 13
0
    //private bool isMenuActive = false;

    private void Awake()
    {
        instance = this;
    }