mirror of https://github.com/noisymime/Arduino.git
Added "category" field in libraries.
This commit is contained in:
parent
4932831f8b
commit
ce5ff8c299
|
@ -21,6 +21,7 @@ public class Library {
|
||||||
private String sentence;
|
private String sentence;
|
||||||
private String paragraph;
|
private String paragraph;
|
||||||
private String url;
|
private String url;
|
||||||
|
private String category;
|
||||||
private List<String> architectures;
|
private List<String> architectures;
|
||||||
private File folder;
|
private File folder;
|
||||||
private File srcFolder;
|
private File srcFolder;
|
||||||
|
@ -31,6 +32,11 @@ public class Library {
|
||||||
.asList(new String[] { "name", "version", "author", "maintainer",
|
.asList(new String[] { "name", "version", "author", "maintainer",
|
||||||
"sentence", "paragraph", "url" });
|
"sentence", "paragraph", "url" });
|
||||||
|
|
||||||
|
private static final List<String> CATEGORIES = Arrays.asList(new String[] {
|
||||||
|
"Display", "Communication", "Signal Input/Output", "Sensors",
|
||||||
|
"Device Control", "Timing", "Data Storage", "Data Processing", "Other",
|
||||||
|
"Uncategorized" });
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Scans inside a folder and create a Library object out of it. Automatically
|
* Scans inside a folder and create a Library object out of it. Automatically
|
||||||
* detects legacy libraries. Automatically fills metadata from
|
* detects legacy libraries. Automatically fills metadata from
|
||||||
|
@ -113,6 +119,12 @@ public class Library {
|
||||||
for (String arch : architectures.split(","))
|
for (String arch : architectures.split(","))
|
||||||
archs.add(arch.trim());
|
archs.add(arch.trim());
|
||||||
|
|
||||||
|
String category = properties.get("category");
|
||||||
|
if (category == null)
|
||||||
|
category = "Uncategorized";
|
||||||
|
if (!CATEGORIES.contains(category))
|
||||||
|
category = "Uncategorized";
|
||||||
|
|
||||||
Library res = new Library();
|
Library res = new Library();
|
||||||
res.folder = libFolder;
|
res.folder = libFolder;
|
||||||
res.srcFolder = srcFolder;
|
res.srcFolder = srcFolder;
|
||||||
|
@ -123,6 +135,7 @@ public class Library {
|
||||||
res.sentence = properties.get("sentence").trim();
|
res.sentence = properties.get("sentence").trim();
|
||||||
res.paragraph = properties.get("paragraph").trim();
|
res.paragraph = properties.get("paragraph").trim();
|
||||||
res.url = properties.get("url").trim();
|
res.url = properties.get("url").trim();
|
||||||
|
res.category = category.trim();
|
||||||
res.architectures = archs;
|
res.architectures = archs;
|
||||||
res.useRecursion = useRecursion;
|
res.useRecursion = useRecursion;
|
||||||
res.isLegacy = false;
|
res.isLegacy = false;
|
||||||
|
@ -183,6 +196,14 @@ public class Library {
|
||||||
return url;
|
return url;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getCategory() {
|
||||||
|
return category;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<String> getCategories() {
|
||||||
|
return CATEGORIES;
|
||||||
|
}
|
||||||
|
|
||||||
public String getVersion() {
|
public String getVersion() {
|
||||||
return version;
|
return version;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue