Esempio n. 1
0
 private void setBoardOptions(ProjectTransferData.vtBoard boardInfo)
 {
     selectedBoard = boards?.FirstOrDefault(b => b.name == boardInfo.name) ?? boards?.FirstOrDefault();
     if (selectedBoard != null)
     {
         if (boardInfo.options != null)
         {
             foreach (var option in boardInfo.options)
             {
                 var optionSet = selectedBoard.optionSets.FirstOrDefault(x => x.name == option.Key);
                 if (optionSet != null)
                 {
                     optionSet.selectedOption = optionSet.options.FirstOrDefault(x => x.name == option.Value);
                 }
             }
         }
     }
 }
Esempio n. 2
0
        public void parseBoardsTxt(string bt)
        {
            string btp = bt;

            boards.Clear();

            if (bt == null)
            {
                if (setupType == SetupTypes.expert)
                {
                    if (!coreBase.isOk)
                    {
                        return;
                    }
                    btp = Path.Combine(coreBase.path, "boards.txt");
                }
                else
                {
                    if (setup?.arduinoBaseError != null)
                    {
                        return;
                    }
                    btp = setup?.arduinoBoardsTxt;
                }
            }



            //  var vboards = BoardsTxt.parse(bt ?? boardTxtPath);
            //var vboards = BoardsTxt.parse(btp);

            ProjectTransferData.vtBoard tmp = new ProjectTransferData.vtBoard(selectedBoard);
            //  boards = BoardsTxt.parse(bt ?? boardTxtPath).Where(b => b.core == "teensy3" || b.core == "teensy4").ToList();
            boards = BoardsTxt.parse(btp).Where(b => b.core == "teensy3" || b.core == "teensy4").ToList();
            setBoardOptions(tmp);
        }