├── GistRetriever
├── .DS_Store
├── reference
│ ├── allclasses-frame.html
│ ├── allclasses-noframe.html
│ ├── constant-values.html
│ ├── deprecated-list.html
│ ├── help-doc.html
│ ├── index-all.html
│ ├── index.html
│ ├── overview-tree.html
│ ├── package-list
│ ├── script.js
│ ├── stylesheet.css
│ └── template
│ │ └── tool
│ │ ├── GistRetriever.html
│ │ ├── package-frame.html
│ │ ├── package-summary.html
│ │ └── package-tree.html
├── src
│ ├── .DS_Store
│ └── template
│ │ ├── .DS_Store
│ │ └── tool
│ │ └── GistRetriever.java
└── tool
│ ├── .DS_Store
│ ├── GistRetriever.jar
│ └── org.eclipse.egit.github.core-4.3.0-SNAPSHOT.jar
├── GistUploader
├── .DS_Store
├── reference
│ ├── allclasses-frame.html
│ ├── allclasses-noframe.html
│ ├── constant-values.html
│ ├── deprecated-list.html
│ ├── help-doc.html
│ ├── index-all.html
│ ├── index.html
│ ├── overview-tree.html
│ ├── package-list
│ ├── script.js
│ ├── stylesheet.css
│ └── template
│ │ └── tool
│ │ ├── GistUploader.html
│ │ ├── package-frame.html
│ │ ├── package-summary.html
│ │ └── package-tree.html
├── src
│ ├── .DS_Store
│ └── template
│ │ ├── .DS_Store
│ │ └── tool
│ │ └── GistUploader.java
└── tool
│ ├── .DS_Store
│ ├── GistUploader.jar
│ └── org.eclipse.egit.github.core-4.3.0-SNAPSHOT.jar
└── README.txt
/GistRetriever/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/davidvondle/Upload-And-Retrieve-Source/a2d6c23385c93a2f759e8b0a2454fa3bb232f714/GistRetriever/.DS_Store
--------------------------------------------------------------------------------
/GistRetriever/reference/allclasses-frame.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | All Classes (Javadocs: GistRetriever)
7 |
8 |
9 |
10 |
11 |
12 | All Classes
13 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/GistRetriever/reference/allclasses-noframe.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | All Classes (Javadocs: GistRetriever)
7 |
8 |
9 |
10 |
11 |
12 | All Classes
13 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/GistRetriever/reference/constant-values.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Constant Field Values (Javadocs: GistRetriever)
7 |
8 |
9 |
10 |
11 |
12 |
22 |
23 | JavaScript is disabled on your browser.
24 |
25 |
26 |
42 |
69 |
70 |
74 |
75 |
91 |
118 |
119 | processing library GistRetriever by Dave Vondle. (c) 2011
120 |
121 |
122 |
--------------------------------------------------------------------------------
/GistRetriever/reference/deprecated-list.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Deprecated List (Javadocs: GistRetriever)
7 |
8 |
9 |
10 |
11 |
12 |
22 |
23 | JavaScript is disabled on your browser.
24 |
25 |
26 |
42 |
69 |
70 |
74 |
75 |
91 |
118 |
119 | processing library GistRetriever by Dave Vondle. (c) 2011
120 |
121 |
122 |
--------------------------------------------------------------------------------
/GistRetriever/reference/help-doc.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | API Help (Javadocs: GistRetriever)
7 |
8 |
9 |
10 |
11 |
12 |
22 |
23 | JavaScript is disabled on your browser.
24 |
25 |
26 |
42 |
69 |
70 |
74 |
75 |
76 |
77 | Package
78 | Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain six categories:
79 |
80 | Interfaces (italic)
81 | Classes
82 | Enums
83 | Exceptions
84 | Errors
85 | Annotation Types
86 |
87 |
88 |
89 | Class/Interface
90 | Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:
91 |
92 | Class inheritance diagram
93 | Direct Subclasses
94 | All Known Subinterfaces
95 | All Known Implementing Classes
96 | Class/interface declaration
97 | Class/interface description
98 |
99 |
100 | Nested Class Summary
101 | Field Summary
102 | Constructor Summary
103 | Method Summary
104 |
105 |
106 | Field Detail
107 | Constructor Detail
108 | Method Detail
109 |
110 | Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.
111 |
112 |
113 | Annotation Type
114 | Each annotation type has its own separate page with the following sections:
115 |
116 | Annotation Type declaration
117 | Annotation Type description
118 | Required Element Summary
119 | Optional Element Summary
120 | Element Detail
121 |
122 |
123 |
124 | Enum
125 | Each enum has its own separate page with the following sections:
126 |
127 | Enum declaration
128 | Enum description
129 | Enum Constant Summary
130 | Enum Constant Detail
131 |
132 |
133 |
134 | Tree (Class Hierarchy)
135 | There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with java.lang.Object
. The interfaces do not inherit from java.lang.Object
.
136 |
137 | When viewing the Overview page, clicking on "Tree" displays the hierarchy for all packages.
138 | When viewing a particular package, class or interface page, clicking "Tree" displays the hierarchy for only that package.
139 |
140 |
141 |
142 | Deprecated API
143 | The Deprecated API page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.
144 |
145 |
146 | Index
147 | The Index contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.
148 |
149 |
150 | Prev/Next
151 | These links take you to the next or previous class, interface, package, or related page.
152 |
153 |
154 | Frames/No Frames
155 | These links show and hide the HTML frames. All pages are available with or without frames.
156 |
157 |
158 | All Classes
159 | The All Classes link shows all classes and interfaces except non-static nested types.
160 |
161 |
162 | Serialized Form
163 | Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description.
164 |
165 |
166 | Constant Field Values
167 | The Constant Field Values page lists the static final fields and their values.
168 |
169 |
170 |
This help file applies to API documentation generated using the standard doclet.
171 |
172 |
188 |
189 |
190 | Prev
191 | Next
192 |
193 |
197 |
200 |
201 |
211 |
212 |
213 |
214 |
215 |
216 | processing library GistRetriever by Dave Vondle. (c) 2011
217 |
218 |
219 |
--------------------------------------------------------------------------------
/GistRetriever/reference/index-all.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Index (Javadocs: GistRetriever)
7 |
8 |
9 |
10 |
11 |
12 |
22 |
23 | JavaScript is disabled on your browser.
24 |
25 |
26 |
42 |
69 |
70 | C F G I L R T
71 |
72 |
73 |
C
74 |
75 | convertStreamToStr(InputStream) - Static method in class template.tool.GistRetriever
76 |
77 |
78 |
79 |
80 |
81 |
F
82 |
83 | findSerialNumber() - Method in class template.tool.GistRetriever
84 |
85 |
86 |
87 |
88 |
89 |
G
90 |
91 | getMenuTitle() - Method in class template.tool.GistRetriever
92 |
93 | GistRetriever - Class in template.tool
94 |
95 | GistRetriever() - Constructor for class template.tool.GistRetriever
96 |
97 |
98 |
99 |
100 |
101 |
I
102 |
103 | init(Editor) - Method in class template.tool.GistRetriever
104 |
105 | isReachableByPing(String) - Static method in class template.tool.GistRetriever
106 |
107 |
108 |
109 |
110 |
111 |
L
112 |
113 | load(InputStream, Map) - Static method in class template.tool.GistRetriever
114 |
115 |
116 |
117 |
118 |
119 |
R
120 |
121 | run() - Method in class template.tool.GistRetriever
122 |
123 |
124 |
125 |
126 |
127 |
T
128 |
129 | template.tool - package template.tool
130 |
131 |
132 |
C F G I L R T
133 |
134 |
150 |
151 |
152 | Prev
153 | Next
154 |
155 |
159 |
162 |
163 |
173 |
174 |
175 |
176 |
177 |
178 | processing library GistRetriever by Dave Vondle. (c) 2011
179 |
180 |
181 |
--------------------------------------------------------------------------------
/GistRetriever/reference/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Javadocs: GistRetriever
7 |
60 |
61 |
62 |
63 |
64 |
65 |
66 | JavaScript is disabled on your browser.
67 |
68 | Frame Alert
69 | This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. Link to Non-frame version .
70 |
71 |
72 |
73 |
--------------------------------------------------------------------------------
/GistRetriever/reference/overview-tree.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Class Hierarchy (Javadocs: GistRetriever)
7 |
8 |
9 |
10 |
11 |
12 |
22 |
23 | JavaScript is disabled on your browser.
24 |
25 |
26 |
42 |
69 |
70 |
77 |
78 |
Class Hierarchy
79 |
80 | java.lang.Object
81 |
84 |
85 |
86 |
87 |
88 |
104 |
105 |
106 | Prev
107 | Next
108 |
109 |
113 |
116 |
117 |
127 |
128 |
129 |
130 |
131 |
132 | processing library GistRetriever by Dave Vondle. (c) 2011
133 |
134 |
135 |
--------------------------------------------------------------------------------
/GistRetriever/reference/package-list:
--------------------------------------------------------------------------------
1 | template.tool
2 |
--------------------------------------------------------------------------------
/GistRetriever/reference/script.js:
--------------------------------------------------------------------------------
1 | function show(type)
2 | {
3 | count = 0;
4 | for (var key in methods) {
5 | var row = document.getElementById(key);
6 | if ((methods[key] & type) != 0) {
7 | row.style.display = '';
8 | row.className = (count++ % 2) ? rowColor : altColor;
9 | }
10 | else
11 | row.style.display = 'none';
12 | }
13 | updateTabs(type);
14 | }
15 |
16 | function updateTabs(type)
17 | {
18 | for (var value in tabs) {
19 | var sNode = document.getElementById(tabs[value][0]);
20 | var spanNode = sNode.firstChild;
21 | if (value == type) {
22 | sNode.className = activeTableTab;
23 | spanNode.innerHTML = tabs[value][1];
24 | }
25 | else {
26 | sNode.className = tableTab;
27 | spanNode.innerHTML = "" + tabs[value][1] + " ";
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/GistRetriever/reference/stylesheet.css:
--------------------------------------------------------------------------------
1 | /* Javadoc style sheet */
2 | /* Define colors, fonts and other style attributes here to override the defaults */
3 | /* processingLibs style by andreas schlegel, sojamo */
4 |
5 |
6 | body {
7 | margin : 0;
8 | padding : 0;
9 | padding-left : 10px;
10 | padding-right : 8px;
11 | background-color : #FFFFFF;
12 | font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
13 | font-size : 100%;
14 | font-size : 0.7em;
15 | font-weight : normal;
16 | line-height : normal;
17 | margin-bottom:30px;
18 | }
19 |
20 |
21 |
22 |
23 | /* Headings */
24 | h1, h2, h3, h4, h5, th {
25 | font-family :Arial, Helvetica, sans-serif;
26 | font-size:1.2em;
27 | }
28 |
29 |
30 | p {
31 | font-size : 1em;
32 | width:80%;
33 | }
34 |
35 | pre, code {
36 | font-family : "Courier New", Courier, monospace;
37 | font-size : 12px;
38 | line-height : normal;
39 | }
40 |
41 |
42 |
43 | table {
44 | border:0;
45 | margin-bottom:10px;
46 | margin-top:10px;
47 | }
48 |
49 |
50 | tr, td {
51 | border-top: 0px solid;
52 | border-left: 0px solid;
53 | padding-top:8px;
54 | padding-bottom:8px;
55 | }
56 |
57 |
58 |
59 | hr {
60 | border:0;
61 | height:1px;
62 | padding:0;
63 | margin:0;
64 | margin-bottom:4px;
65 |
66 | }
67 |
68 |
69 |
70 | dd, th, td, font {
71 | font-size:1.0em;
72 | line-height:1.0em;
73 | }
74 |
75 |
76 |
77 | dt {
78 | margin-bottom:0px;
79 | }
80 |
81 |
82 |
83 | dd {
84 | margin-top:2px;
85 | margin-bottom:4px;
86 | }
87 |
88 |
89 |
90 | a {
91 | text-decoration: underline;
92 | font-weight: normal;
93 | }
94 |
95 | a:hover,
96 | a:active {
97 | text-decoration: underline;
98 | font-weight: normal;
99 | }
100 |
101 | a:visited,
102 | a:link:visited {
103 | text-decoration: underline;
104 | font-weight: normal;
105 | }
106 |
107 |
108 | img {
109 | border: 0px solid #000000;
110 | }
111 |
112 |
113 |
114 | /* Navigation bar fonts */
115 | .NavBarCell1 {
116 | border:0;
117 | }
118 |
119 | .NavBarCell1Rev {
120 | border:0;
121 | }
122 |
123 | .NavBarFont1 {
124 | font-family: Arial, Helvetica, sans-serif;
125 | font-size:1.1em;
126 | }
127 |
128 |
129 | .NavBarFont1 b {
130 | font-weight:normal;
131 | }
132 |
133 |
134 |
135 | .NavBarFont1:after, .NavBarFont1Rev:after {
136 | font-weight:normal;
137 | content: " \\";
138 | }
139 |
140 |
141 | .NavBarFont1Rev {
142 | font-family: Arial, Helvetica, sans-serif;
143 | font-size:1.1em;
144 | }
145 |
146 | .NavBarFont1Rev b {
147 | font-family: Arial, Helvetica, sans-serif;
148 | font-size:1.1em;
149 | font-weight:normal;
150 | }
151 |
152 | .NavBarCell2 {
153 | font-family: Arial, Helvetica, sans-serif;
154 | }
155 |
156 | .NavBarCell3 {
157 | font-family: Arial, Helvetica, sans-serif;
158 | }
159 |
160 |
161 |
162 | font.FrameItemFont {
163 | font-family: Helvetica, Arial, sans-serif;
164 | font-size:1.1em;
165 | line-height:1.1em;
166 | }
167 |
168 | font.FrameHeadingFont {
169 | font-family: Helvetica, Arial, sans-serif;
170 | line-height:32px;
171 | }
172 |
173 | /* Font used in left-hand frame lists */
174 | .FrameTitleFont {
175 | font-family: Helvetica, Arial, sans-serif
176 | }
177 |
178 |
179 | .toggleList {
180 | padding:0;
181 | margin:0;
182 | margin-top:12px;
183 | }
184 |
185 | .toggleList dt {
186 | font-weight:bold;
187 | font-size:12px;
188 | font-family:arial,sans-serif;
189 | padding:0px;
190 | margin:10px 0px 10px 0px;
191 | }
192 |
193 | .toggleList dt span {
194 | font-family: monospace;
195 | padding:0;
196 | margin:0;
197 | }
198 |
199 |
200 | .toggleList dd {
201 | margin:0;
202 | padding:0;
203 | }
204 |
205 | html.isjs .toggleList dd {
206 | display: none;
207 | }
208 |
209 | .toggleList pre {
210 | padding: 4px 4px 4px 4px;
211 | }
212 |
213 |
214 |
215 |
216 |
217 | /* COLORS */
218 |
219 | pre, code {
220 | color: #000000;
221 | }
222 |
223 |
224 | body {
225 | color : #333333;
226 | background-color :#FFFFFF;
227 | }
228 |
229 |
230 | h1, h2, h3, h4, h5, h6 {
231 | color:#555;
232 | }
233 |
234 | a,
235 | .toggleList dt {
236 | color: #1a7eb0;
237 | }
238 |
239 | a:hover,
240 | a:active {
241 | color: #1a7eb0;
242 | }
243 |
244 | a:visited,
245 | a:link:visited {
246 | color: #1a7eb0;
247 | }
248 |
249 | td,tr {
250 | border-color: #999999;
251 | }
252 |
253 | hr {
254 | color:#999999;
255 | background:#999999;
256 | }
257 |
258 |
259 | .TableHeadingColor {
260 | background: #dcdcdc;
261 | color: #555;
262 | }
263 |
264 |
265 | .TableSubHeadingColor {
266 | background: #EEEEFF
267 | }
268 |
269 | .TableRowColor {
270 | background: #FFFFFF
271 | }
272 |
273 |
274 | .NavBarCell1 {
275 | background-color:#dcdcdc;
276 | color:#000;
277 | }
278 |
279 | .NavBarCell1 a {
280 | color:#333;
281 | }
282 |
283 |
284 | .NavBarCell1Rev {
285 | background-color:transparent;
286 | }
287 |
288 | .NavBarFont1 {
289 | color:#333;
290 | }
291 |
292 |
293 | .NavBarFont1Rev {
294 | color:#fff;
295 | }
296 |
297 | .NavBarCell2 {
298 | background-color:#999;
299 | }
300 |
301 | .NavBarCell2 a {
302 | color:#fff;
303 | }
304 |
305 |
306 |
307 | .NavBarCell3 {
308 | background-color:#dcdcdc;
309 | }
310 |
311 |
--------------------------------------------------------------------------------
/GistRetriever/reference/template/tool/GistRetriever.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | GistRetriever (Javadocs: GistRetriever)
7 |
8 |
9 |
10 |
11 |
12 |
28 |
29 | JavaScript is disabled on your browser.
30 |
31 |
32 |
48 |
49 |
50 | Prev Class
51 | Next Class
52 |
53 |
57 |
60 |
61 |
71 |
72 |
73 |
74 | Summary:
75 | Nested |
76 | Field |
77 | Constr |
78 | Method
79 |
80 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
96 |
97 |
98 | java.lang.Object
99 |
100 |
101 | template.tool.GistRetriever
102 |
103 |
104 |
105 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 | Constructor Summary
124 |
125 | Constructors
126 |
127 | Constructor and Description
128 |
129 |
130 | GistRetriever ()
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 | Method Summary
141 |
142 | All Methods Static Methods Instance Methods Concrete Methods
143 |
144 | Modifier and Type
145 | Method and Description
146 |
147 |
148 | static java.lang.String
149 | convertStreamToStr (java.io.InputStream is)
150 |
151 |
152 | java.lang.String
153 | findSerialNumber ()
154 |
155 |
156 | java.lang.String
157 | getMenuTitle ()
158 |
159 |
160 | void
161 | init (Editor editor)
162 |
163 |
164 | static boolean
165 | isReachableByPing (java.lang.String host)
166 |
167 |
168 | static void
169 | load (java.io.InputStream input,
170 | java.util.Map table)
171 |
172 |
173 | void
174 | run ()
175 |
176 |
177 |
178 |
179 |
180 |
181 | Methods inherited from class java.lang.Object
182 | equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
183 |
184 |
185 |
186 |
187 |
188 |
189 |
190 |
191 |
192 |
193 |
194 |
195 |
196 |
197 | Constructor Detail
198 |
199 |
200 |
201 |
202 |
203 | GistRetriever
204 | public GistRetriever()
205 |
206 |
207 |
208 |
209 |
210 |
291 |
292 |
293 |
294 |
295 |
296 |
297 |
313 |
314 |
315 | Prev Class
316 | Next Class
317 |
318 |
322 |
325 |
326 |
336 |
337 |
338 |
339 | Summary:
340 | Nested |
341 | Field |
342 | Constr |
343 | Method
344 |
345 |
346 | Detail:
347 | Field |
348 | Constr |
349 | Method
350 |
351 |
352 |
353 |
354 |
355 |
356 | processing library GistRetriever by Dave Vondle. (c) 2011
357 |
358 |
359 |
--------------------------------------------------------------------------------
/GistRetriever/reference/template/tool/package-frame.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | template.tool (Javadocs: GistRetriever)
7 |
8 |
9 |
10 |
11 |
12 |
13 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/GistRetriever/reference/template/tool/package-summary.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | template.tool (Javadocs: GistRetriever)
7 |
8 |
9 |
10 |
11 |
12 |
22 |
23 | JavaScript is disabled on your browser.
24 |
25 |
26 |
42 |
43 |
44 | Prev Package
45 | Next Package
46 |
47 |
51 |
54 |
55 |
65 |
66 |
67 |
68 |
69 |
70 |
73 |
74 |
75 |
76 |
77 | Class Summary
78 |
79 | Class
80 | Description
81 |
82 |
83 |
84 | GistRetriever
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
109 |
110 |
111 | Prev Package
112 | Next Package
113 |
114 |
118 |
121 |
122 |
132 |
133 |
134 |
135 |
136 |
137 | processing library GistRetriever by Dave Vondle. (c) 2011
138 |
139 |
140 |
--------------------------------------------------------------------------------
/GistRetriever/reference/template/tool/package-tree.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | template.tool Class Hierarchy (Javadocs: GistRetriever)
7 |
8 |
9 |
10 |
11 |
12 |
22 |
23 | JavaScript is disabled on your browser.
24 |
25 |
26 |
42 |
69 |
70 |
73 |
74 |
Class Hierarchy
75 |
76 | java.lang.Object
77 |
80 |
81 |
82 |
83 |
84 |
100 |
101 |
102 | Prev
103 | Next
104 |
105 |
109 |
112 |
113 |
123 |
124 |
125 |
126 |
127 |
128 | processing library GistRetriever by Dave Vondle. (c) 2011
129 |
130 |
131 |
--------------------------------------------------------------------------------
/GistRetriever/src/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/davidvondle/Upload-And-Retrieve-Source/a2d6c23385c93a2f759e8b0a2454fa3bb232f714/GistRetriever/src/.DS_Store
--------------------------------------------------------------------------------
/GistRetriever/src/template/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/davidvondle/Upload-And-Retrieve-Source/a2d6c23385c93a2f759e8b0a2454fa3bb232f714/GistRetriever/src/template/.DS_Store
--------------------------------------------------------------------------------
/GistRetriever/src/template/tool/GistRetriever.java:
--------------------------------------------------------------------------------
1 | /**
2 | * you can put a one sentence description of your tool here.
3 | *
4 | * (c) 2011
5 | *
6 | * This library is free software; you can redistribute it and/or
7 | * modify it under the terms of the GNU Lesser General Public
8 | * License as published by the Free Software Foundation; either
9 | * version 2.1 of the License, or (at your option) any later version.
10 | *
11 | * This library is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 | * Lesser General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Lesser General
17 | * Public License along with this library; if not, write to the
18 | * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
19 | * Boston, MA 02111-1307 USA
20 | *
21 | * @author Dave Vondle http://labs.ideo.com
22 | * @modified 10/25/2017
23 | * @version 0.2
24 | */
25 |
26 | package template.tool;
27 |
28 | //import java.awt.FileDialog;
29 | import java.io.BufferedReader;
30 | import java.io.File;
31 | import java.io.FileInputStream;
32 | import java.io.IOException;
33 | import java.io.InputStream;
34 | import java.io.InputStreamReader;
35 | import java.io.PrintWriter;
36 | import java.io.Reader;
37 | import java.io.StringWriter;
38 | import java.io.Writer;
39 | import java.net.InetAddress;
40 | //import java.util.Collections;
41 | //import java.util.Enumeration;
42 | //import java.util.Hashtable;
43 | import java.util.Iterator;
44 | import java.util.LinkedHashMap;
45 | import java.util.List;
46 | import java.util.Map;
47 |
48 | import org.eclipse.egit.github.core.Gist;
49 | //import org.eclipse.egit.github.core.GistFile;
50 | import org.eclipse.egit.github.core.client.GitHubClient;
51 | import org.eclipse.egit.github.core.service.GistService;
52 |
53 |
54 | import processing.app.*;
55 | import processing.app.helpers.OSUtils;
56 | import processing.app.tools.Tool;
57 | import processing.app.legacy.PApplet;
58 |
59 |
60 |
61 | public class GistRetriever implements Tool {
62 |
63 | // when creating a tool, the name of the main class which implements Tool
64 | // must be the same as the value defined for project.name in your build.properties
65 |
66 | Editor editor;
67 | EditorTab editorTab;
68 | static LinkedHashMap table = new LinkedHashMap();
69 | static final String GIST_FILE = "gistCredentials.txt";
70 | static File gistCredFile;
71 | Gist gist = new Gist();
72 | Gist newGist = new Gist();
73 | boolean foundFirstGist=false;
74 |
75 | public String getMenuTitle() {
76 | return "Retrieve Source";
77 | }
78 |
79 | public void init(Editor editor) {
80 | this.editor=editor;
81 |
82 | //Arduino moves tools into the library folder when you change boards in the boards menu. Then it gives you an error of this happens. This fixes that.
83 | deleteDir(new File(BaseNoGui.getSketchbookLibrariesFolder(), "GistRetriever"));
84 | }
85 |
86 | void deleteDir(File file) {
87 | File[] contents = file.listFiles();
88 | if (contents != null) {
89 | for (File f : contents) {
90 | deleteDir(f);
91 | }
92 | }
93 | file.delete();
94 | }
95 |
96 | public void run() {
97 | String serialNumber;
98 | String username="";
99 | String password="";
100 |
101 | //first look for different github accounts
102 | gistCredFile = BaseNoGui.getSettingsFile(GIST_FILE);
103 | try {
104 | load(new FileInputStream(gistCredFile));
105 | //now "table" should hold username/password pairs
106 |
107 | } catch (Exception ex) {
108 | Base.showError("Error reading github credentials",
109 | "Error reading github credentials. " +
110 | "Please delete (or move)\n" +
111 | gistCredFile.getAbsolutePath() +
112 | " and restart Arduino.", ex);
113 | }
114 |
115 | //then find gist
116 | try {
117 | InetAddress address = InetAddress.getByName("api.github.com");
118 | System.out.println(address.toString());
119 | //if (isReachableByPing("api.github.com")){
120 | serialNumber=findSerialNumber();
121 | if (!serialNumber.isEmpty()){
122 | Iterator iterator = table.keySet().iterator();
123 | boolean foundSource = false;
124 |
125 | while (iterator.hasNext() && foundSource==false) {
126 | Object key = (String) iterator.next();
127 | username=(String) key;
128 | password=(String) table.get(key);
129 | foundSource=retrieveFromGitHub(serialNumber,username, password);
130 | }
131 |
132 | if(!foundSource){
133 | System.out.println("No source was found for this board.");
134 | }else{
135 | editorTab=editor.getTabs().get(0);
136 | for (String key : gist.getFiles().keySet()) {
137 | if(key.contains(".pde") || key.contains(".ino")){
138 | //editor.getSketch().setCurrentCode(0);//goes to original pane
139 | //if(!editor.getTabs().isEmpty()){
140 | editorTab.setText(gist.getFiles().get(key).getContent()); //gets the first sketch, puts it in the window
141 | //}
142 | }else{ //make libraries
143 | //File newDirectory = new File(editor.getSketch().getFolder(), "temp_gist");
144 | File newDirectory = new File(editorTab.getSketch().getSketch().getFolder(), "temp_gist");
145 | File testFile = new File(newDirectory, gist.getFiles().get(key).getFilename());
146 | PrintWriter writer = PApplet.createWriter(testFile);
147 | writer.println(gist.getFiles().get(key).getContent());
148 | writer.flush();
149 | writer.close();
150 | // now do the work of adding the file
151 | editorTab.getSketch().addFile(testFile);
152 |
153 | testFile.delete();
154 | newDirectory.delete();
155 | }
156 | }
157 | System.out.println("Found Source: " + gist.getHtmlUrl());
158 | }
159 | }else{
160 | System.out.println("Could not find your board, make sure it's plugged into USB.");
161 | if (OSUtils.isWindows()){
162 | System.out.println("Make sure you are running Arduino as an administrator (right click on icon > Run as administrator)");
163 | }
164 | }
165 | //}else{
166 | // System.out.println("github service is unavailable, cannot retrieve source.");
167 | //}
168 | } catch (Exception e) {
169 | System.out.println("You are not connected to the internet, or github is down, cannot retrieve source.");
170 | System.out.println(e);
171 | }
172 | }
173 |
174 |
175 | private boolean retrieveFromGitHub(String serialNumber, String username, String password) {
176 |
177 |
178 | GitHubClient client = new GitHubClient().setCredentials(username, password);
179 | GistService service = new GistService(client);
180 |
181 | try{
182 | List gists = service.getGists(username);
183 | Boolean foundMatchingGist=false;
184 | for (int i = gists.size(); --i >= 0;){ //backwards so the first one found is the oldest one
185 | newGist = (Gist)gists.get(i);
186 | if(newGist.getDescription().toUpperCase().contains(serialNumber.toUpperCase())){ //found the last matching gist , uppercase because windows capitalizes everything...
187 | if(foundMatchingGist==true){ //if one has already been found then an extra was made in error and needs to be cleaned up
188 | //delete the spurious gist
189 | service.deleteGist(newGist.getId());
190 | }else{
191 | newGist=service.getGist(newGist.getId());//get it again because the other capture only gets the meta-data
192 | if(!foundFirstGist){
193 | gist=newGist;
194 | foundFirstGist=true;
195 | }else if(newGist.getHistory().get(0).getCommittedAt().after(gist.getHistory().get(0).getCommittedAt())){//look for most recent gist in case you have the same board on multiple accounts
196 | gist=newGist;
197 | }
198 | foundMatchingGist=true;
199 | }
200 | }
201 | }
202 | if(foundMatchingGist==false){ //if no gist exists for the board
203 | return false;
204 | }else{
205 | return true;
206 | }
207 | }catch(IOException e){
208 | System.out.println(e.getMessage());
209 | return false;
210 | }
211 | }
212 |
213 | public String findSerialNumber() {
214 | if (OSUtils.isMacOS()) {
215 | String getUsbArgs[] = new String[2];
216 | getUsbArgs[0]="system_profiler";
217 | getUsbArgs[1]="SPUSBDataType";
218 | try{
219 | Process process = new ProcessBuilder(getUsbArgs).start();
220 | InputStream is = process.getInputStream();
221 | InputStreamReader isr = new InputStreamReader(is);
222 | BufferedReader br = new BufferedReader(isr);
223 | String line;
224 |
225 | boolean foundArduino=false;
226 | boolean foundSerial=false;
227 | int serialNumPosition;
228 | while ((line = br.readLine()) != null && !foundSerial) {
229 | if(line.indexOf("Arduino") > 0 || line.indexOf("FT232R") > 0 || line.indexOf("Vendor ID: 0x20a0") > 0 || line.indexOf("Vendor ID: 0x2341") > 0 || line.indexOf("Vendor ID: 0x16c0") > 0){ //Vendor ID: 0x20a0 is freetronics, 2a03 are fake arduinos, 2341 are real arduinos, 16c0 are teensys.
230 | foundArduino=true;
231 | }else if(line.indexOf("Vendor ID: 0x2a03") > 0){
232 | foundArduino=true;
233 | //System.out.println("Did you know you are using an unofficial Arduino? Please support Arduino.cc!");
234 | }
235 | if(foundArduino){
236 | serialNumPosition = line.indexOf("Serial Number");
237 | if(serialNumPosition > 0){
238 | foundSerial=true;
239 | return line.substring((serialNumPosition+15));
240 | }
241 | }
242 | }
243 | if(foundSerial==false){
244 | return "";
245 | }
246 | }
247 | catch(IOException e){
248 | System.out.println(e.getMessage());
249 | }
250 | }else if (OSUtils.isLinux()){
251 | String response="";
252 | ProcessBuilder pb = new ProcessBuilder("bash", "-c", ("udevadm info --name="+Preferences.get("serial.port")+" --attribute-walk | grep ATTRS{serial}"));
253 | pb.redirectErrorStream(true);
254 | try {
255 | Process shell = pb.start();
256 | // To capture output from the shell
257 | InputStream shellIn = shell.getInputStream();
258 | shell.waitFor();
259 | response = convertStreamToStr(shellIn);
260 | shellIn.close();
261 | if(response.contains("ATTRS{serial}")){
262 | return response.substring((response.indexOf("\"")+1), (response.indexOf("\n")-1));
263 | }else{
264 | return("");
265 | }
266 | }catch (IOException e) {
267 | System.out.println("Error occured while executing Linux command. Error Description: "
268 | + e.getMessage());
269 | }catch (InterruptedException e) {
270 | System.out.println("Error occured while executing Linux command. Error Description: "
271 | + e.getMessage());
272 | }
273 | }else if (OSUtils.isWindows()){
274 | String response = "";
275 | ProcessBuilder pb = new ProcessBuilder("cmd", "/c", ("\""+BaseNoGui.getSketchbookFolder().getAbsolutePath()+"\\tools\\devcon.exe\""), "find", "USB\\VID_2341*");//non FTDI
276 | pb.redirectErrorStream(true);
277 | try {
278 | Process shell = pb.start();
279 | // To capture output from the shell
280 | InputStream shellIn = shell.getInputStream();
281 | shell.waitFor();
282 | response = convertStreamToStr(shellIn);
283 | shellIn.close();
284 | }catch (IOException e) {
285 | System.out.println("Error occured while executing Windows command. Error Description: "
286 | + e.getMessage());
287 | }catch (InterruptedException e) {
288 | System.out.println("Error occured while executing Windows command. Error Description: "
289 | + e.getMessage());
290 | }
291 | if(response.contains("USB\\VID")){
292 | return response.substring((response.lastIndexOf("\\")+1), (response.indexOf(" ")));
293 | }else if(response.contains("No matching devices found")){
294 | pb = new ProcessBuilder("cmd", "/c", ("\""+BaseNoGui.getSketchbookFolder().getAbsolutePath()+"\\tools\\devcon.exe\""), "find", "FTDI*");// FTDI
295 | try {
296 | Process shell = pb.start();
297 | // To capture output from the shell
298 | InputStream shellIn = shell.getInputStream();
299 | shell.waitFor();
300 | response = convertStreamToStr(shellIn);
301 | shellIn.close();
302 | }catch (IOException e) {
303 | System.out.println("Error occured while executing Windows command. Error Description: "
304 | + e.getMessage());
305 | }catch (InterruptedException e) {
306 | System.out.println("Error occured while executing Windows command. Error Description: "
307 | + e.getMessage());
308 | }
309 | if(response.contains("FTDI")){
310 | return response.substring((response.lastIndexOf("+")+1), (response.lastIndexOf("+")+9));
311 | }else if(response.contains("No matching devices found")){
312 | pb = new ProcessBuilder("cmd", "/c", ("\""+BaseNoGui.getSketchbookFolder().getAbsolutePath()+"\\tools\\devcon.exe\""), "find", "USB\\VID_20A0*");//freetronics? either shows up as VID_20A0 or VID_20a0
313 | try {
314 | Process shell = pb.start();
315 | // To capture output from the shell
316 | InputStream shellIn = shell.getInputStream();
317 | shell.waitFor();
318 | response = convertStreamToStr(shellIn);
319 | shellIn.close();
320 | }catch (IOException e) {
321 | System.out.println("Error occured while executing Windows command. Error Description: "
322 | + e.getMessage());
323 | }catch (InterruptedException e) {
324 | System.out.println("Error occured while executing Windows command. Error Description: "
325 | + e.getMessage());
326 | }
327 | if(response.contains("USB\\VID")){
328 | return response.substring((response.lastIndexOf("\\")+1), (response.indexOf(" ")));
329 | }
330 | else if(response.contains("No matching devices found")) {
331 | pb = new ProcessBuilder("cmd", "/c", ("\""+BaseNoGui.getSketchbookFolder().getAbsolutePath()+"\\tools\\devcon.exe\""), "find", "USB\\VID_2A03*");//Fake Arduino.org board
332 | try {
333 | Process shell = pb.start();
334 | // To capture output from the shell
335 | InputStream shellIn = shell.getInputStream();
336 | shell.waitFor();
337 | response = convertStreamToStr(shellIn);
338 | shellIn.close();
339 | }catch (IOException e) {
340 | System.out.println("Error occured while executing Windows command. Error Description: "
341 | + e.getMessage());
342 | }catch (InterruptedException e) {
343 | System.out.println("Error occured while executing Windows command. Error Description: "
344 | + e.getMessage());
345 | }
346 | if(response.contains("USB\\VID")){
347 | return response.substring((response.lastIndexOf("\\")+1), (response.indexOf(" ")));
348 | }
349 | else if(response.contains("No matching devices found")) {
350 | pb = new ProcessBuilder("cmd", "/c", ("\""+BaseNoGui.getSketchbookFolder().getAbsolutePath()+"\\tools\\devcon.exe\""), "find", "USB\\VID_2341*");//Real Arduino Board
351 | try {
352 | Process shell = pb.start();
353 | // To capture output from the shell
354 | InputStream shellIn = shell.getInputStream();
355 | shell.waitFor();
356 | response = convertStreamToStr(shellIn);
357 | shellIn.close();
358 | }catch (IOException e) {
359 | System.out.println("Error occured while executing Windows command. Error Description: "
360 | + e.getMessage());
361 | }catch (InterruptedException e) {
362 | System.out.println("Error occured while executing Windows command. Error Description: "
363 | + e.getMessage());
364 | }
365 | if(response.contains("USB\\VID")){
366 | return response.substring((response.lastIndexOf("\\")+1), (response.indexOf(" ")));
367 | }
368 | else if(response.contains("No matching devices found")) {
369 | pb = new ProcessBuilder("cmd", "/c", ("\""+BaseNoGui.getSketchbookFolder().getAbsolutePath()+"\\tools\\devcon.exe\""), "find", "USB\\VID_16C0*");//Teensy
370 | try {
371 | Process shell = pb.start();
372 | // To capture output from the shell
373 | InputStream shellIn = shell.getInputStream();
374 | shell.waitFor();
375 | response = convertStreamToStr(shellIn);
376 | shellIn.close();
377 | }catch (IOException e) {
378 | System.out.println("Error occured while executing Windows command. Error Description: "
379 | + e.getMessage());
380 | }catch (InterruptedException e) {
381 | System.out.println("Error occured while executing Windows command. Error Description: "
382 | + e.getMessage());
383 | }
384 | if(response.contains("USB\\VID")){
385 | return response.substring((response.lastIndexOf("\\")+1), (response.indexOf(" ")));
386 | }
387 | }
388 | }
389 | }
390 | }
391 | }
392 | }
393 | return "";
394 | }
395 |
396 | public static String convertStreamToStr(InputStream is) throws IOException {
397 |
398 | if (is != null) {
399 | Writer writer = new StringWriter();
400 |
401 | char[] buffer = new char[1024];
402 | try {
403 | Reader reader = new BufferedReader(new InputStreamReader(is,"UTF-8"));
404 | int n;
405 | while ((n = reader.read(buffer)) != -1) {
406 | writer.write(buffer, 0, n);
407 | }
408 | } finally {
409 | is.close();
410 | }
411 | return writer.toString();
412 | }
413 | else {
414 | return "";
415 | }
416 | }
417 |
418 | static protected void load(InputStream input) throws IOException {
419 | load(input, table);
420 | }
421 |
422 | static public void load(InputStream input, Map table) throws IOException {
423 | String[] lines = PApplet.loadStrings(input); // Reads as UTF-8
424 | for (String line : lines) {
425 | if ((line.length() == 0) ||
426 | (line.charAt(0) == '#')) continue;
427 |
428 | // this won't properly handle = signs being in the text
429 | int equals = line.indexOf('=');
430 | if (equals != -1) {
431 | String key = line.substring(0, equals).trim();
432 | String value = line.substring(equals + 1).trim();
433 | table.put(key, value);
434 | }
435 | }
436 | }
437 | static public boolean isReachableByPing(String host) {
438 | try{
439 | String cmd = "";
440 |
441 | if(System.getProperty("os.name").startsWith("Windows"))
442 | cmd = "ping -n 1 " + host; // For Windows
443 | else
444 | cmd = "ping -c 1 " + host; // For Linux and OSX
445 |
446 | Process myProcess = Runtime.getRuntime().exec(cmd);
447 | myProcess.waitFor();
448 |
449 | return myProcess.exitValue() == 0;
450 | } catch( Exception e ) {
451 | System.out.println(e.getMessage());
452 | return false;
453 | }
454 | }
455 | }
456 |
457 |
458 |
459 |
--------------------------------------------------------------------------------
/GistRetriever/tool/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/davidvondle/Upload-And-Retrieve-Source/a2d6c23385c93a2f759e8b0a2454fa3bb232f714/GistRetriever/tool/.DS_Store
--------------------------------------------------------------------------------
/GistRetriever/tool/GistRetriever.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/davidvondle/Upload-And-Retrieve-Source/a2d6c23385c93a2f759e8b0a2454fa3bb232f714/GistRetriever/tool/GistRetriever.jar
--------------------------------------------------------------------------------
/GistRetriever/tool/org.eclipse.egit.github.core-4.3.0-SNAPSHOT.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/davidvondle/Upload-And-Retrieve-Source/a2d6c23385c93a2f759e8b0a2454fa3bb232f714/GistRetriever/tool/org.eclipse.egit.github.core-4.3.0-SNAPSHOT.jar
--------------------------------------------------------------------------------
/GistUploader/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/davidvondle/Upload-And-Retrieve-Source/a2d6c23385c93a2f759e8b0a2454fa3bb232f714/GistUploader/.DS_Store
--------------------------------------------------------------------------------
/GistUploader/reference/allclasses-frame.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | All Classes (Javadocs: GistUploader)
7 |
8 |
9 |
10 |
11 |
12 | All Classes
13 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/GistUploader/reference/allclasses-noframe.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | All Classes (Javadocs: GistUploader)
7 |
8 |
9 |
10 |
11 |
12 | All Classes
13 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/GistUploader/reference/constant-values.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Constant Field Values (Javadocs: GistUploader)
7 |
8 |
9 |
10 |
11 |
12 |
22 |
23 | JavaScript is disabled on your browser.
24 |
25 |
26 |
42 |
69 |
70 |
74 |
75 |
91 |
118 |
119 | processing library GistUploader by Dave Vondle. (c) 2011
120 |
121 |
122 |
--------------------------------------------------------------------------------
/GistUploader/reference/deprecated-list.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Deprecated List (Javadocs: GistUploader)
7 |
8 |
9 |
10 |
11 |
12 |
22 |
23 | JavaScript is disabled on your browser.
24 |
25 |
26 |
42 |
69 |
70 |
74 |
75 |
91 |
118 |
119 | processing library GistUploader by Dave Vondle. (c) 2011
120 |
121 |
122 |
--------------------------------------------------------------------------------
/GistUploader/reference/help-doc.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | API Help (Javadocs: GistUploader)
7 |
8 |
9 |
10 |
11 |
12 |
22 |
23 | JavaScript is disabled on your browser.
24 |
25 |
26 |
42 |
69 |
70 |
74 |
75 |
76 |
77 | Package
78 | Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain six categories:
79 |
80 | Interfaces (italic)
81 | Classes
82 | Enums
83 | Exceptions
84 | Errors
85 | Annotation Types
86 |
87 |
88 |
89 | Class/Interface
90 | Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:
91 |
92 | Class inheritance diagram
93 | Direct Subclasses
94 | All Known Subinterfaces
95 | All Known Implementing Classes
96 | Class/interface declaration
97 | Class/interface description
98 |
99 |
100 | Nested Class Summary
101 | Field Summary
102 | Constructor Summary
103 | Method Summary
104 |
105 |
106 | Field Detail
107 | Constructor Detail
108 | Method Detail
109 |
110 | Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.
111 |
112 |
113 | Annotation Type
114 | Each annotation type has its own separate page with the following sections:
115 |
116 | Annotation Type declaration
117 | Annotation Type description
118 | Required Element Summary
119 | Optional Element Summary
120 | Element Detail
121 |
122 |
123 |
124 | Enum
125 | Each enum has its own separate page with the following sections:
126 |
127 | Enum declaration
128 | Enum description
129 | Enum Constant Summary
130 | Enum Constant Detail
131 |
132 |
133 |
134 | Tree (Class Hierarchy)
135 | There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with java.lang.Object
. The interfaces do not inherit from java.lang.Object
.
136 |
137 | When viewing the Overview page, clicking on "Tree" displays the hierarchy for all packages.
138 | When viewing a particular package, class or interface page, clicking "Tree" displays the hierarchy for only that package.
139 |
140 |
141 |
142 | Deprecated API
143 | The Deprecated API page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.
144 |
145 |
146 | Index
147 | The Index contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.
148 |
149 |
150 | Prev/Next
151 | These links take you to the next or previous class, interface, package, or related page.
152 |
153 |
154 | Frames/No Frames
155 | These links show and hide the HTML frames. All pages are available with or without frames.
156 |
157 |
158 | All Classes
159 | The All Classes link shows all classes and interfaces except non-static nested types.
160 |
161 |
162 | Serialized Form
163 | Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description.
164 |
165 |
166 | Constant Field Values
167 | The Constant Field Values page lists the static final fields and their values.
168 |
169 |
170 |
This help file applies to API documentation generated using the standard doclet.
171 |
172 |
188 |
189 |
190 | Prev
191 | Next
192 |
193 |
197 |
200 |
201 |
211 |
212 |
213 |
214 |
215 |
216 | processing library GistUploader by Dave Vondle. (c) 2011
217 |
218 |
219 |
--------------------------------------------------------------------------------
/GistUploader/reference/index-all.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Index (Javadocs: GistUploader)
7 |
8 |
9 |
10 |
11 |
12 |
22 |
23 | JavaScript is disabled on your browser.
24 |
25 |
26 |
42 |
69 |
70 | C D F G I L R T
71 |
72 |
73 |
C
74 |
75 | convertStreamToStr(InputStream) - Static method in class template.tool.GistUploader
76 |
77 |
78 |
79 |
80 |
81 |
D
82 |
83 | deleteGistsOnOtherAccounts(String, String) - Method in class template.tool.GistUploader
84 |
85 |
86 |
87 |
88 |
89 |
F
90 |
91 | findSerialNumber() - Method in class template.tool.GistUploader
92 |
93 |
94 |
95 |
96 |
97 |
G
98 |
99 | getCurrentBoard() - Method in class template.tool.GistUploader
100 |
101 | getMenuTitle() - Method in class template.tool.GistUploader
102 |
103 | GistUploader - Class in template.tool
104 |
105 | GistUploader() - Constructor for class template.tool.GistUploader
106 |
107 |
108 |
109 |
110 |
111 |
I
112 |
113 | init(Editor) - Method in class template.tool.GistUploader
114 |
115 |
116 |
117 |
118 |
119 |
L
120 |
121 | load(InputStream, Map) - Static method in class template.tool.GistUploader
122 |
123 | loadDefaults() - Method in class template.tool.GistUploader
124 |
125 |
126 |
127 |
128 |
129 |
R
130 |
131 | run() - Method in class template.tool.GistUploader
132 |
133 |
134 |
135 |
136 |
137 |
T
138 |
139 | template.tool - package template.tool
140 |
141 |
142 |
C D F G I L R T
143 |
144 |
160 |
161 |
162 | Prev
163 | Next
164 |
165 |
169 |
172 |
173 |
183 |
184 |
185 |
186 |
187 |
188 | processing library GistUploader by Dave Vondle. (c) 2011
189 |
190 |
191 |
--------------------------------------------------------------------------------
/GistUploader/reference/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Javadocs: GistUploader
7 |
60 |
61 |
62 |
63 |
64 |
65 |
66 | JavaScript is disabled on your browser.
67 |
68 | Frame Alert
69 | This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. Link to Non-frame version .
70 |
71 |
72 |
73 |
--------------------------------------------------------------------------------
/GistUploader/reference/overview-tree.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Class Hierarchy (Javadocs: GistUploader)
7 |
8 |
9 |
10 |
11 |
12 |
22 |
23 | JavaScript is disabled on your browser.
24 |
25 |
26 |
42 |
69 |
70 |
77 |
78 |
Class Hierarchy
79 |
80 | java.lang.Object
81 |
84 |
85 |
86 |
87 |
88 |
104 |
105 |
106 | Prev
107 | Next
108 |
109 |
113 |
116 |
117 |
127 |
128 |
129 |
130 |
131 |
132 | processing library GistUploader by Dave Vondle. (c) 2011
133 |
134 |
135 |
--------------------------------------------------------------------------------
/GistUploader/reference/package-list:
--------------------------------------------------------------------------------
1 | template.tool
2 |
--------------------------------------------------------------------------------
/GistUploader/reference/script.js:
--------------------------------------------------------------------------------
1 | function show(type)
2 | {
3 | count = 0;
4 | for (var key in methods) {
5 | var row = document.getElementById(key);
6 | if ((methods[key] & type) != 0) {
7 | row.style.display = '';
8 | row.className = (count++ % 2) ? rowColor : altColor;
9 | }
10 | else
11 | row.style.display = 'none';
12 | }
13 | updateTabs(type);
14 | }
15 |
16 | function updateTabs(type)
17 | {
18 | for (var value in tabs) {
19 | var sNode = document.getElementById(tabs[value][0]);
20 | var spanNode = sNode.firstChild;
21 | if (value == type) {
22 | sNode.className = activeTableTab;
23 | spanNode.innerHTML = tabs[value][1];
24 | }
25 | else {
26 | sNode.className = tableTab;
27 | spanNode.innerHTML = "" + tabs[value][1] + " ";
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/GistUploader/reference/stylesheet.css:
--------------------------------------------------------------------------------
1 | /* Javadoc style sheet */
2 | /* Define colors, fonts and other style attributes here to override the defaults */
3 | /* processingLibs style by andreas schlegel, sojamo */
4 |
5 |
6 | body {
7 | margin : 0;
8 | padding : 0;
9 | padding-left : 10px;
10 | padding-right : 8px;
11 | background-color : #FFFFFF;
12 | font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
13 | font-size : 100%;
14 | font-size : 0.7em;
15 | font-weight : normal;
16 | line-height : normal;
17 | margin-bottom:30px;
18 | }
19 |
20 |
21 |
22 |
23 | /* Headings */
24 | h1, h2, h3, h4, h5, th {
25 | font-family :Arial, Helvetica, sans-serif;
26 | font-size:1.2em;
27 | }
28 |
29 |
30 | p {
31 | font-size : 1em;
32 | width:80%;
33 | }
34 |
35 | pre, code {
36 | font-family : "Courier New", Courier, monospace;
37 | font-size : 12px;
38 | line-height : normal;
39 | }
40 |
41 |
42 |
43 | table {
44 | border:0;
45 | margin-bottom:10px;
46 | margin-top:10px;
47 | }
48 |
49 |
50 | tr, td {
51 | border-top: 0px solid;
52 | border-left: 0px solid;
53 | padding-top:8px;
54 | padding-bottom:8px;
55 | }
56 |
57 |
58 |
59 | hr {
60 | border:0;
61 | height:1px;
62 | padding:0;
63 | margin:0;
64 | margin-bottom:4px;
65 |
66 | }
67 |
68 |
69 |
70 | dd, th, td, font {
71 | font-size:1.0em;
72 | line-height:1.0em;
73 | }
74 |
75 |
76 |
77 | dt {
78 | margin-bottom:0px;
79 | }
80 |
81 |
82 |
83 | dd {
84 | margin-top:2px;
85 | margin-bottom:4px;
86 | }
87 |
88 |
89 |
90 | a {
91 | text-decoration: underline;
92 | font-weight: normal;
93 | }
94 |
95 | a:hover,
96 | a:active {
97 | text-decoration: underline;
98 | font-weight: normal;
99 | }
100 |
101 | a:visited,
102 | a:link:visited {
103 | text-decoration: underline;
104 | font-weight: normal;
105 | }
106 |
107 |
108 | img {
109 | border: 0px solid #000000;
110 | }
111 |
112 |
113 |
114 | /* Navigation bar fonts */
115 | .NavBarCell1 {
116 | border:0;
117 | }
118 |
119 | .NavBarCell1Rev {
120 | border:0;
121 | }
122 |
123 | .NavBarFont1 {
124 | font-family: Arial, Helvetica, sans-serif;
125 | font-size:1.1em;
126 | }
127 |
128 |
129 | .NavBarFont1 b {
130 | font-weight:normal;
131 | }
132 |
133 |
134 |
135 | .NavBarFont1:after, .NavBarFont1Rev:after {
136 | font-weight:normal;
137 | content: " \\";
138 | }
139 |
140 |
141 | .NavBarFont1Rev {
142 | font-family: Arial, Helvetica, sans-serif;
143 | font-size:1.1em;
144 | }
145 |
146 | .NavBarFont1Rev b {
147 | font-family: Arial, Helvetica, sans-serif;
148 | font-size:1.1em;
149 | font-weight:normal;
150 | }
151 |
152 | .NavBarCell2 {
153 | font-family: Arial, Helvetica, sans-serif;
154 | }
155 |
156 | .NavBarCell3 {
157 | font-family: Arial, Helvetica, sans-serif;
158 | }
159 |
160 |
161 |
162 | font.FrameItemFont {
163 | font-family: Helvetica, Arial, sans-serif;
164 | font-size:1.1em;
165 | line-height:1.1em;
166 | }
167 |
168 | font.FrameHeadingFont {
169 | font-family: Helvetica, Arial, sans-serif;
170 | line-height:32px;
171 | }
172 |
173 | /* Font used in left-hand frame lists */
174 | .FrameTitleFont {
175 | font-family: Helvetica, Arial, sans-serif
176 | }
177 |
178 |
179 | .toggleList {
180 | padding:0;
181 | margin:0;
182 | margin-top:12px;
183 | }
184 |
185 | .toggleList dt {
186 | font-weight:bold;
187 | font-size:12px;
188 | font-family:arial,sans-serif;
189 | padding:0px;
190 | margin:10px 0px 10px 0px;
191 | }
192 |
193 | .toggleList dt span {
194 | font-family: monospace;
195 | padding:0;
196 | margin:0;
197 | }
198 |
199 |
200 | .toggleList dd {
201 | margin:0;
202 | padding:0;
203 | }
204 |
205 | html.isjs .toggleList dd {
206 | display: none;
207 | }
208 |
209 | .toggleList pre {
210 | padding: 4px 4px 4px 4px;
211 | }
212 |
213 |
214 |
215 |
216 |
217 | /* COLORS */
218 |
219 | pre, code {
220 | color: #000000;
221 | }
222 |
223 |
224 | body {
225 | color : #333333;
226 | background-color :#FFFFFF;
227 | }
228 |
229 |
230 | h1, h2, h3, h4, h5, h6 {
231 | color:#555;
232 | }
233 |
234 | a,
235 | .toggleList dt {
236 | color: #1a7eb0;
237 | }
238 |
239 | a:hover,
240 | a:active {
241 | color: #1a7eb0;
242 | }
243 |
244 | a:visited,
245 | a:link:visited {
246 | color: #1a7eb0;
247 | }
248 |
249 | td,tr {
250 | border-color: #999999;
251 | }
252 |
253 | hr {
254 | color:#999999;
255 | background:#999999;
256 | }
257 |
258 |
259 | .TableHeadingColor {
260 | background: #dcdcdc;
261 | color: #555;
262 | }
263 |
264 |
265 | .TableSubHeadingColor {
266 | background: #EEEEFF
267 | }
268 |
269 | .TableRowColor {
270 | background: #FFFFFF
271 | }
272 |
273 |
274 | .NavBarCell1 {
275 | background-color:#dcdcdc;
276 | color:#000;
277 | }
278 |
279 | .NavBarCell1 a {
280 | color:#333;
281 | }
282 |
283 |
284 | .NavBarCell1Rev {
285 | background-color:transparent;
286 | }
287 |
288 | .NavBarFont1 {
289 | color:#333;
290 | }
291 |
292 |
293 | .NavBarFont1Rev {
294 | color:#fff;
295 | }
296 |
297 | .NavBarCell2 {
298 | background-color:#999;
299 | }
300 |
301 | .NavBarCell2 a {
302 | color:#fff;
303 | }
304 |
305 |
306 |
307 | .NavBarCell3 {
308 | background-color:#dcdcdc;
309 | }
310 |
311 |
--------------------------------------------------------------------------------
/GistUploader/reference/template/tool/GistUploader.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | GistUploader (Javadocs: GistUploader)
7 |
8 |
9 |
10 |
11 |
12 |
28 |
29 | JavaScript is disabled on your browser.
30 |
31 |
32 |
48 |
49 |
50 | Prev Class
51 | Next Class
52 |
53 |
57 |
60 |
61 |
71 |
72 |
73 |
74 | Summary:
75 | Nested |
76 | Field |
77 | Constr |
78 | Method
79 |
80 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
96 |
97 |
98 | java.lang.Object
99 |
100 |
101 | template.tool.GistUploader
102 |
103 |
104 |
105 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 | Constructor Summary
124 |
125 | Constructors
126 |
127 | Constructor and Description
128 |
129 |
130 | GistUploader ()
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 | Method Summary
141 |
186 |
187 |
188 |
189 |
190 | Methods inherited from class java.lang.Object
191 | equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
192 |
193 |
194 |
195 |
196 |
197 |
198 |
199 |
200 |
201 |
202 |
203 |
204 |
205 |
206 | Constructor Detail
207 |
208 |
209 |
210 |
211 |
212 | GistUploader
213 | public GistUploader()
214 |
215 |
216 |
217 |
218 |
219 |
319 |
320 |
321 |
322 |
323 |
324 |
325 |
341 |
342 |
343 | Prev Class
344 | Next Class
345 |
346 |
350 |
353 |
354 |
364 |
365 |
366 |
367 | Summary:
368 | Nested |
369 | Field |
370 | Constr |
371 | Method
372 |
373 |
374 | Detail:
375 | Field |
376 | Constr |
377 | Method
378 |
379 |
380 |
381 |
382 |
383 |
384 | processing library GistUploader by Dave Vondle. (c) 2011
385 |
386 |
387 |
--------------------------------------------------------------------------------
/GistUploader/reference/template/tool/package-frame.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | template.tool (Javadocs: GistUploader)
7 |
8 |
9 |
10 |
11 |
12 |
13 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/GistUploader/reference/template/tool/package-summary.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | template.tool (Javadocs: GistUploader)
7 |
8 |
9 |
10 |
11 |
12 |
22 |
23 | JavaScript is disabled on your browser.
24 |
25 |
26 |
42 |
43 |
44 | Prev Package
45 | Next Package
46 |
47 |
51 |
54 |
55 |
65 |
66 |
67 |
68 |
69 |
70 |
73 |
74 |
75 |
76 |
77 | Class Summary
78 |
79 | Class
80 | Description
81 |
82 |
83 |
84 | GistUploader
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
109 |
110 |
111 | Prev Package
112 | Next Package
113 |
114 |
118 |
121 |
122 |
132 |
133 |
134 |
135 |
136 |
137 | processing library GistUploader by Dave Vondle. (c) 2011
138 |
139 |
140 |
--------------------------------------------------------------------------------
/GistUploader/reference/template/tool/package-tree.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | template.tool Class Hierarchy (Javadocs: GistUploader)
7 |
8 |
9 |
10 |
11 |
12 |
22 |
23 | JavaScript is disabled on your browser.
24 |
25 |
26 |
42 |
69 |
70 |
73 |
74 |
Class Hierarchy
75 |
76 | java.lang.Object
77 |
80 |
81 |
82 |
83 |
84 |
100 |
101 |
102 | Prev
103 | Next
104 |
105 |
109 |
112 |
113 |
123 |
124 |
125 |
126 |
127 |
128 | processing library GistUploader by Dave Vondle. (c) 2011
129 |
130 |
131 |
--------------------------------------------------------------------------------
/GistUploader/src/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/davidvondle/Upload-And-Retrieve-Source/a2d6c23385c93a2f759e8b0a2454fa3bb232f714/GistUploader/src/.DS_Store
--------------------------------------------------------------------------------
/GistUploader/src/template/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/davidvondle/Upload-And-Retrieve-Source/a2d6c23385c93a2f759e8b0a2454fa3bb232f714/GistUploader/src/template/.DS_Store
--------------------------------------------------------------------------------
/GistUploader/src/template/tool/GistUploader.java:
--------------------------------------------------------------------------------
1 | /**
2 | * you can put a one sentence description of your tool here.
3 | *
4 | * ##copyright##
5 | *
6 | * This library is free software; you can redistribute it and/or
7 | * modify it under the terms of the GNU Lesser General Public
8 | * License as published by the Free Software Foundation; either
9 | * version 2.1 of the License, or (at your option) any later version.
10 | *
11 | * This library is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 | * Lesser General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Lesser General
17 | * Public License along with this library; if not, write to the
18 | * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
19 | * Boston, MA 02111-1307 USA
20 | *
21 | * @author Dave Vondle http://labs.ideo.com
22 | * @modified 10/25/2017
23 | * @version 0.2
24 | */
25 |
26 | package template.tool;
27 |
28 | //import java.awt.SystemColor;
29 | import java.io.BufferedReader;
30 | import java.io.File;
31 | import java.io.FileInputStream;
32 | import java.io.IOException;
33 | import java.io.InputStream;
34 | import java.io.InputStreamReader;
35 | import java.io.PrintWriter;
36 | import java.io.Reader;
37 | import java.io.StringWriter;
38 | import java.io.Writer;
39 | import java.net.InetAddress;
40 | import java.util.Arrays;
41 | import java.util.Collections;
42 | //import java.util.Enumeration;
43 | //import java.util.Hashtable;
44 | import java.util.Iterator;
45 | import java.util.LinkedHashMap;
46 | import java.util.List;
47 | import java.util.Map;
48 | import java.util.HashMap;
49 | //import java.util.Set;
50 | import java.util.concurrent.TimeUnit;
51 |
52 | import org.eclipse.egit.github.core.Gist;
53 | import org.eclipse.egit.github.core.GistFile;
54 | import org.eclipse.egit.github.core.client.GitHubClient;
55 | import org.eclipse.egit.github.core.service.GistService;
56 |
57 |
58 | import processing.app.*;
59 | import processing.app.helpers.OSUtils;
60 | //import processing.app.debug.Target;
61 | import processing.app.tools.Tool;
62 | import processing.app.legacy.PApplet;
63 |
64 | public class GistUploader implements Tool {
65 |
66 | // when creating a tool, the name of the main class which implements Tool
67 | // must be the same as the value defined for project.name in your build.properties
68 |
69 | Editor editor;
70 |
71 | static LinkedHashMap table = new LinkedHashMap();
72 | static final String GIST_FILE = "gistCredentials.txt";
73 | static File gistCredFile;
74 |
75 |
76 |
77 |
78 | public String getMenuTitle() {
79 | return "Upload Source to Github";
80 | }
81 |
82 |
83 | public void init(Editor editor) {
84 | this.editor=editor;
85 |
86 | //Arduino moves tools into the library folder when you change boards in the boards menu. Then it gives you an error of this happens. This fixes that.
87 | deleteDir(new File(BaseNoGui.getSketchbookLibrariesFolder(), "GistUploader"));
88 |
89 | // next load user preferences file
90 | //gistCredFile = Base.getSettingsFile(GIST_FILE);
91 | gistCredFile = BaseNoGui.getSettingsFile(GIST_FILE);
92 | if (!gistCredFile.exists()) {
93 | // create a new preferences file if none exists
94 | // saves the defaults out to the file
95 | loadDefaults();
96 | save();
97 |
98 | } else {
99 | // load the previous preferences file
100 |
101 | try {
102 | load(new FileInputStream(gistCredFile));
103 |
104 | } catch (Exception ex) {
105 | Base.showError("Error reading github credentials",
106 | "Error reading github credentials. " +
107 | "Please delete (or move)\n" +
108 | gistCredFile.getAbsolutePath() +
109 | " and restart Arduino.", ex);
110 | }
111 | }
112 | }
113 |
114 | void deleteDir(File file) {
115 | File[] contents = file.listFiles();
116 | if (contents != null) {
117 | for (File f : contents) {
118 | deleteDir(f);
119 | }
120 | }
121 | file.delete();
122 | }
123 |
124 | public void run() {
125 |
126 | try {
127 | //int timeout = 2000;
128 | InetAddress address = InetAddress.getByName("api.github.com");
129 | getSerialNumberAndSend();
130 | /* //isReachable is prone to failure due to firewall issues etc.
131 | if (address.isReachable(timeout)){
132 | getSerialNumberAndSend();
133 | }else{
134 | System.out.println("github service is unavailable, source will not be sent.");
135 | System.out.println(address.getHostAddress());
136 | System.out.println("Make sure to save locally!");
137 | }
138 | */
139 | }catch (Exception e) {
140 | System.out.println("Can't get through to github. You may not be connected to the internet, source will not be sent.");
141 | System.out.println("Make sure to save locally!");
142 | System.out.println(e);
143 | }
144 | }
145 |
146 |
147 | private void getSerialNumberAndSend() {
148 | String serialNumber=findSerialNumber();
149 | if (!serialNumber.isEmpty()){
150 | uploadToGitHub(serialNumber);
151 | }else{
152 | System.out.println("Could not find your board, make sure it's plugged into USB.");
153 | if (OSUtils.isWindows()){
154 | System.out.println("Make sure you are running Arduino as an administrator (right click on icon > Run as administrator)");
155 | }
156 | }
157 | }
158 |
159 | private void uploadToGitHub(String serialNumber) {
160 | String username="";
161 | String password="";
162 |
163 | SketchFile[] theSketches;
164 | String[] theSketchesContent;
165 |
166 | GitHubClient client;
167 | GistService service;
168 | GistFile[] file;
169 | String[] filename;
170 | Gist gist = new Gist();
171 | Map mp=new HashMap();
172 |
173 | //Look
174 | theSketches=editor.getSketch().getFiles();
175 | theSketchesContent = new String[theSketches.length];
176 | file=new GistFile[theSketches.length];
177 | filename = new String[theSketches.length];
178 | int indexOfUsername=-1;
179 | boolean makePrivate=false;
180 |
181 | for(int j =0; j gists = service.getGists(username);
215 | Boolean foundMatchingGist=false;
216 | for (int i = gists.size(); --i >= 0;){ //backwards so the first one found is the oldest one
217 | gist = (Gist)gists.get(i);
218 | if(gist.getDescription().toUpperCase().contains(serialNumber.toUpperCase())){ //found the last matching gist. toUpperCase is because Windows capitalizes the letters I hope this isn't a problem!
219 | if(foundMatchingGist==true){ //if one has already been found then an extra was made in error and needs to be cleaned up
220 | //delete the spurious gist
221 | service.deleteGist(gist.getId());
222 | }else if(gist.isPublic()==!makePrivate){// rewrite the gist if there is already one and the privacy settings are the same
223 | for (String key : gist.getFiles().keySet()) {// "delete" old ones, if this wasn't here every time you saved a sketch with a new name it would not overwrite the old sketch
224 | boolean matchingFile=false;
225 | for(int j =0; j gists = service.getGists(username);
291 | //Boolean foundMatchingGist=false;
292 | for (int i = gists.size(); --i >= 0;){
293 | gist = (Gist)gists.get(i);
294 | if(gist.getDescription().toUpperCase().contains(serialNumber.toUpperCase())){ //found the last matching gist. toUpperCase is because Windows capitalizes the letters I hope this isn't a problem!
295 | service.deleteGist(gist.getId());
296 | }
297 | }
298 | }catch(Exception e){
299 | System.out.println("Some login credentials are incorrect, please correct gistCredentials.txt");
300 | System.out.println(e);
301 | }
302 | }
303 | }
304 | }
305 |
306 | public String getCurrentBoard() {
307 | //System.out.println("rebuilding boards menu");
308 | return BaseNoGui.getTargetBoard().getName();
309 | /*
310 | for (Target target : Base.targetsTable.values()) {
311 | for (String board : target.getBoards().keySet()) {
312 | if (target.getName().equals(Preferences.get("target")) &&
313 | board.equals(Preferences.get("board"))) {
314 | return target.getBoards().get(board).get("name");
315 | }
316 | }
317 | }
318 | //return "";
319 |
320 | */
321 | }
322 |
323 |
324 | public String findSerialNumber() {
325 | if (OSUtils.isMacOS()) {
326 | String getUsbArgs[] = new String[2];
327 | getUsbArgs[0]="system_profiler";
328 | getUsbArgs[1]="SPUSBDataType";
329 | try{
330 | Process process = new ProcessBuilder(getUsbArgs).start();
331 | InputStream is = process.getInputStream();
332 | InputStreamReader isr = new InputStreamReader(is);
333 | BufferedReader br = new BufferedReader(isr);
334 | BufferedReader br2 = new BufferedReader(isr);
335 | String line;
336 |
337 | boolean foundArduino=false;
338 | boolean foundSerial=false;
339 | int serialNumPosition;
340 |
341 | while ((line = br.readLine()) != null && !foundSerial) {
342 | if(line.indexOf("Arduino") > 0 || line.indexOf("FT232R") > 0 || line.indexOf("Vendor ID: 0x20a0") > 0 || line.indexOf("Vendor ID: 0x2341") > 0 || line.indexOf("Vendor ID: 0x16c0") > 0){ //Vendor ID: 0x20a0 is freetronics, 2a03 are fake arduinos, 2341 are real arduinos, 16c0 are teensys.
343 | foundArduino=true;
344 | }else if(line.indexOf("Vendor ID: 0x2a03") > 0){
345 | foundArduino=true;
346 | //System.out.println("Did you know you are using an unofficial Arduino? Please support Arduino.cc!");
347 | }
348 | if(foundArduino){
349 | serialNumPosition = line.indexOf("Serial Number");
350 | if(serialNumPosition > 0){
351 | foundSerial=true;
352 | return line.substring((serialNumPosition+15));
353 | }
354 | }
355 | }
356 | if(foundSerial==false){
357 | return "";
358 | }
359 | }
360 | catch(IOException e){
361 | System.out.println(e.getMessage());
362 | }
363 | }else if (OSUtils.isLinux()){
364 | String response="";
365 | ProcessBuilder pb = new ProcessBuilder("bash", "-c", ("udevadm info --name="+Preferences.get("serial.port")+" --attribute-walk | grep ATTRS{serial}"));
366 | pb.redirectErrorStream(true);
367 | try {
368 | Process shell = pb.start();
369 | // To capture output from the shell
370 | InputStream shellIn = shell.getInputStream();
371 | shell.waitFor();
372 | response = convertStreamToStr(shellIn);
373 | shellIn.close();
374 | if(response.contains("ATTRS{serial}")){
375 | return response.substring((response.indexOf("\"")+1), (response.indexOf("\n")-1));
376 | }else{
377 | return("");
378 | }
379 | }catch (IOException e) {
380 | System.out.println("Error occured while executing Linux command. Error Description: "
381 | + e.getMessage());
382 | }catch (InterruptedException e) {
383 | System.out.println("Error occured while executing Linux command. Error Description: "
384 | + e.getMessage());
385 | }
386 | }else if (OSUtils.isWindows()){
387 | String response = "";
388 | ProcessBuilder pb = new ProcessBuilder("cmd", "/c", ("\""+BaseNoGui.getSketchbookFolder().getAbsolutePath()+"\\tools\\devcon.exe\""), "find", "USB\\VID_2341*");//non FTDI
389 | pb.redirectErrorStream(true);
390 | try {
391 | Process shell = pb.start();
392 | // To capture output from the shell
393 | InputStream shellIn = shell.getInputStream();
394 | shell.waitFor();
395 | response = convertStreamToStr(shellIn);
396 | shellIn.close();
397 | }catch (IOException e) {
398 | System.out.println("Error occured while executing Windows command. Error Description: "
399 | + e.getMessage());
400 | }catch (InterruptedException e) {
401 | System.out.println("Error occured while executing Windows command. Error Description: "
402 | + e.getMessage());
403 | }
404 | if(response.contains("USB\\VID")){
405 | return response.substring((response.lastIndexOf("\\")+1), (response.indexOf(" ")));
406 | }else if(response.contains("No matching devices found")){
407 | pb = new ProcessBuilder("cmd", "/c", ("\""+BaseNoGui.getSketchbookFolder().getAbsolutePath()+"\\tools\\devcon.exe\""), "find", "FTDI*");// FTDI
408 | try {
409 | Process shell = pb.start();
410 | // To capture output from the shell
411 | InputStream shellIn = shell.getInputStream();
412 | shell.waitFor();
413 | response = convertStreamToStr(shellIn);
414 | shellIn.close();
415 | }catch (IOException e) {
416 | System.out.println("Error occured while executing Windows command. Error Description: "
417 | + e.getMessage());
418 | }catch (InterruptedException e) {
419 | System.out.println("Error occured while executing Windows command. Error Description: "
420 | + e.getMessage());
421 | }
422 | if(response.contains("FTDI")){
423 | return response.substring((response.lastIndexOf("+")+1), (response.lastIndexOf("+")+9));
424 | }else if(response.contains("No matching devices found")){
425 | pb = new ProcessBuilder("cmd", "/c", ("\""+BaseNoGui.getSketchbookFolder().getAbsolutePath()+"\\tools\\devcon.exe\""), "find", "USB\\VID_20A0*");//freetronics? either shows up as VID_20A0 or VID_20a0
426 | try {
427 | Process shell = pb.start();
428 | // To capture output from the shell
429 | InputStream shellIn = shell.getInputStream();
430 | shell.waitFor();
431 | response = convertStreamToStr(shellIn);
432 | shellIn.close();
433 | }catch (IOException e) {
434 | System.out.println("Error occured while executing Windows command. Error Description: "
435 | + e.getMessage());
436 | }catch (InterruptedException e) {
437 | System.out.println("Error occured while executing Windows command. Error Description: "
438 | + e.getMessage());
439 | }
440 | if(response.contains("USB\\VID")){
441 | return response.substring((response.lastIndexOf("\\")+1), (response.indexOf(" ")));
442 | }
443 | else if(response.contains("No matching devices found")) {
444 | pb = new ProcessBuilder("cmd", "/c", ("\""+BaseNoGui.getSketchbookFolder().getAbsolutePath()+"\\tools\\devcon.exe\""), "find", "USB\\VID_2A03*");//Fake Arduino.org board
445 | try {
446 | Process shell = pb.start();
447 | // To capture output from the shell
448 | InputStream shellIn = shell.getInputStream();
449 | shell.waitFor();
450 | response = convertStreamToStr(shellIn);
451 | shellIn.close();
452 | }catch (IOException e) {
453 | System.out.println("Error occured while executing Windows command. Error Description: "
454 | + e.getMessage());
455 | }catch (InterruptedException e) {
456 | System.out.println("Error occured while executing Windows command. Error Description: "
457 | + e.getMessage());
458 | }
459 | if(response.contains("USB\\VID")){
460 | return response.substring((response.lastIndexOf("\\")+1), (response.indexOf(" ")));
461 | }
462 | else if(response.contains("No matching devices found")) {
463 | pb = new ProcessBuilder("cmd", "/c", ("\""+BaseNoGui.getSketchbookFolder().getAbsolutePath()+"\\tools\\devcon.exe\""), "find", "USB\\VID_2341*");//Real Arduino Board
464 | try {
465 | Process shell = pb.start();
466 | // To capture output from the shell
467 | InputStream shellIn = shell.getInputStream();
468 | shell.waitFor();
469 | response = convertStreamToStr(shellIn);
470 | shellIn.close();
471 | }catch (IOException e) {
472 | System.out.println("Error occured while executing Windows command. Error Description: "
473 | + e.getMessage());
474 | }catch (InterruptedException e) {
475 | System.out.println("Error occured while executing Windows command. Error Description: "
476 | + e.getMessage());
477 | }
478 | if(response.contains("USB\\VID")){
479 | return response.substring((response.lastIndexOf("\\")+1), (response.indexOf(" ")));
480 | }
481 | else if(response.contains("No matching devices found")) {
482 | pb = new ProcessBuilder("cmd", "/c", ("\""+BaseNoGui.getSketchbookFolder().getAbsolutePath()+"\\tools\\devcon.exe\""), "find", "USB\\VID_16C0*");//Teensy
483 | try {
484 | Process shell = pb.start();
485 | // To capture output from the shell
486 | InputStream shellIn = shell.getInputStream();
487 | shell.waitFor();
488 | response = convertStreamToStr(shellIn);
489 | shellIn.close();
490 | }catch (IOException e) {
491 | System.out.println("Error occured while executing Windows command. Error Description: "
492 | + e.getMessage());
493 | }catch (InterruptedException e) {
494 | System.out.println("Error occured while executing Windows command. Error Description: "
495 | + e.getMessage());
496 | }
497 | if(response.contains("USB\\VID")){
498 | return response.substring((response.lastIndexOf("\\")+1), (response.indexOf(" ")));
499 | }
500 | }
501 | }
502 | }
503 | }
504 | }
505 | }
506 | return "";
507 | }
508 |
509 |
510 | public static String convertStreamToStr(InputStream is) throws IOException {
511 |
512 | if (is != null) {
513 | Writer writer = new StringWriter();
514 |
515 | char[] buffer = new char[1024];
516 | try {
517 | Reader reader = new BufferedReader(new InputStreamReader(is,"UTF-8"));
518 | int n;
519 | while ((n = reader.read(buffer)) != -1) {
520 | writer.write(buffer, 0, n);
521 | }
522 | } finally {
523 | is.close();
524 | }
525 | return writer.toString();
526 | }
527 | else {
528 | return "";
529 | }
530 | }
531 |
532 |
533 |
534 |
535 |
536 | static protected void load(InputStream input) throws IOException {
537 | load(input, table);
538 | }
539 |
540 | static public void load(InputStream input, Map table) throws IOException {
541 | String[] lines = PApplet.loadStrings(input); // Reads as UTF-8
542 | for (String line : lines) {
543 | if ((line.length() == 0) ||
544 | (line.charAt(0) == '#')) continue;
545 |
546 | // this won't properly handle = signs being in the text
547 | int equals = line.indexOf('=');
548 | if (equals != -1) {
549 | String key = line.substring(0, equals).trim();
550 | String value = line.substring(equals + 1).trim();
551 | table.put(key, value);
552 | }
553 | }
554 | }
555 |
556 | public void loadDefaults() {
557 | table.put("arduinoboard", "1knowmysource");
558 | }
559 |
560 | static protected void save() {
561 | // on startup, don't worry about it
562 | // this is trying to update the prefs for who is open
563 | // before Preferences.init() has been called.
564 | if (gistCredFile == null) return;
565 |
566 | PrintWriter writer = PApplet.createWriter(gistCredFile);
567 | writer.println("# add usernames and passwords for github accounts here");
568 | writer.println("# the format is =");
569 | writer.println("# in the comments of your code specify the account you want in the comments with:");
570 | writer.println("# USE_GITHUB_USERNAME=");
571 | writer.println("# if no account is specified it will use the first one");
572 | writer.println("#");
573 |
574 | Iterator iterator = table.keySet().iterator();
575 | while (iterator.hasNext()) { //in case there's a need for multiple defaults in the future
576 | Object key = (String) iterator.next();
577 | writer.println((String) key + "=" + ((String) table.get(key)));
578 | }
579 |
580 | writer.flush();
581 | writer.close();
582 | }
583 |
584 | }
585 |
--------------------------------------------------------------------------------
/GistUploader/tool/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/davidvondle/Upload-And-Retrieve-Source/a2d6c23385c93a2f759e8b0a2454fa3bb232f714/GistUploader/tool/.DS_Store
--------------------------------------------------------------------------------
/GistUploader/tool/GistUploader.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/davidvondle/Upload-And-Retrieve-Source/a2d6c23385c93a2f759e8b0a2454fa3bb232f714/GistUploader/tool/GistUploader.jar
--------------------------------------------------------------------------------
/GistUploader/tool/org.eclipse.egit.github.core-4.3.0-SNAPSHOT.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/davidvondle/Upload-And-Retrieve-Source/a2d6c23385c93a2f759e8b0a2454fa3bb232f714/GistUploader/tool/org.eclipse.egit.github.core-4.3.0-SNAPSHOT.jar
--------------------------------------------------------------------------------
/README.txt:
--------------------------------------------------------------------------------
1 | These tools allow you Arduino board to be the link to it's own source stored online.
2 |
3 | To install, place the folders "GistUploader" and "GistRetriever" in Documents/Arduino/tools.
4 | On Windows you will need the "DevCon" command line utility, download directly from Microsoft here: http://support.microsoft.com/kb/311272
5 | devcon.exe should be placed in the same "tools" folder as everything else.
6 |
7 | Due to security features of Windows, you now need to run Arduino as an Administrator for this software to work. When launching Arduino, right-click the icon and select “Run as Administrator”.
8 |
9 | When you are finished programming your Arduino, select "Save and Upload Source to Github from the "Tools" dropdown menu.
10 |
11 | If you ever need the source for that board, plug the board into USB, and select "Retrieve Source". The code will show up in the editor window.
12 |
13 | PROTIPS:
14 |
15 | Using your own github account:
16 |
17 | The github username/password file is in the same folder your Arduino preferences.txt file is. it is called "gistCredentials". You can add your own github login information into that file if you prefer to save to your own account.
18 | in your code you can specify which account you want the code to go to by putting this in the comments at the top:
19 | USE_GITHUB_USERNAME=davidvondle
20 | Keep in mind these accounts are the same account that the retriever uses to find the code, so if you use a personal account and want to retrieve the code on another machine, make sure your credentials are on that machine as well.
21 |
22 | Making the code private:
23 |
24 | To make the code private, put this string in the comments:
25 | MAKE_PRIVATE_ON_GITHUB
26 | This only really makes sense on your own github account, as the login information for the general account is not secret.
27 |
28 | Libraries:
29 | This code supports libraries that are in the same folder as the .ino/.pde file.
30 |
31 | For an extensive write-up on this project read my post on IDEO Labs here:
32 | http://labs.ideo.com/2012/03/09/arduino-tool-that-connects-each-board-to-its-own-source/
33 |
34 | ENJOY!
35 |
36 |
37 |
38 | Copyright 2012 Dave Vondle
39 |
40 | Licensed under the Apache License, Version 2.0 (the "License");
41 | you may not use this file except in compliance with the License.
42 | You may obtain a copy of the License at
43 |
44 | http://www.apache.org/licenses/LICENSE-2.0
45 |
46 | Unless required by applicable law or agreed to in writing, software
47 | distributed under the License is distributed on an "AS IS" BASIS,
48 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
49 | See the License for the specific language governing permissions and
50 | limitations under the License.
51 |
52 | Dependencies:
53 |
54 | This code depends on
55 | egit, which is under the EDL License:
56 | http://www.eclipse.org/org/documents/edl-v10.php
57 |
58 | gson, commons-codec, commons-logging, httpclient, and httpcore are all under the Apache License 2.0
59 | http://www.apache.org/licenses/LICENSE-2.0
60 |
61 |
62 |
--------------------------------------------------------------------------------