public List <ArduinoLibrary> extractLibrariesFromIno(StreamReader inoReader) { var arduinoLibraries = new List <ArduinoLibrary>(); var libraryNames = extractLibrariesFromStream(inoReader); foreach (var libName in libraryNames) { arduinoLibraries.Add(ArduinoLibrary.createFromIncludeFile(libName)); } return(arduinoLibraries); }
static public ArduinoLibrary createFromIncludeFile(string includeFilename) { // Notes: // We process the ino to extract header files. // The .h is removed from filename, and used to locate the library in the following locations: // Documents\Arduino\Libraries // C:\Program Files (x86)\Arduino\libraries // C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries // If the Library itself has a library.properties file, it needs to be parsed // to see which architectures are supported. // * - sources and header are in Library\src // avr or sam - header is in Library\src, sources are in Library\src\$arch\ ArduinoLibrary lib = null; var libraryName = Path.GetFileNameWithoutExtension(includeFilename); var libraryPath = ArduinoLibrary.findLibraryPath(libraryName); if (!string.IsNullOrEmpty(libraryPath)) { lib = new ArduinoLibrary(libraryPath); } return(lib); }