Merge lp:~bpjjteam/bpjj/adobereader into lp:~bpjjteam/bpjj/testing
- adobereader
- Merge into testing
Proposed by
Alexander Gabriel
Status: | Merged |
---|---|
Merged at revision: | 90 |
Proposed branch: | lp:~bpjjteam/bpjj/adobereader |
Merge into: | lp:~bpjjteam/bpjj/testing |
Diff against target: |
1315 lines (+1011/-83) (has conflicts) 24 files modified
logger/src/daemon/ARConnection.java (+20/-0) logger/src/daemon/AREvent.java (+44/-0) logger/src/daemon/Dispatcher.java (+105/-1) logger/src/tests/ARConnectionTest.java (+44/-0) logger/src/tests/CommandTest.java (+41/-0) logger/src/tests/DataPacketTest.java (+49/-0) logger/src/tests/DataTest.java (+57/-0) logger/src/tests/EventPacketTest.java (+52/-0) logger/src/tests/ResponsePacketTest.java (+33/-0) logger/src/tests/TBCommandFactoryTest.java (+46/-0) logger/src/tests/TBCommandTest.java (+50/-0) logger/src/tests/TBConnectionTest.java (+44/-0) logger/src/tests/TBEventTest.java (+62/-0) sensors/adobe/Adobe-Sensor.cs (+0/-82) sensors/adobe/ConsoleApplication1/ConsoleApplication1.sln (+20/-0) sensors/adobe/ConsoleApplication1/ConsoleApplication1/AdobeSensor.csproj (+61/-0) sensors/adobe/ConsoleApplication1/ConsoleApplication1/Communicator.cs (+88/-0) sensors/adobe/ConsoleApplication1/ConsoleApplication1/Program.cs (+117/-0) sensors/adobe/ConsoleApplication1/ConsoleApplication1/Properties/AssemblyInfo.cs (+36/-0) sensors/adobe/ConsoleApplication1/ConsoleApplication1/bin/Debug/ConsoleApplication1.vshost.exe.manifest (+11/-0) sensors/adobe/ConsoleApplication1/ConsoleApplication1/bin/Release/ConsoleApplication1.vshost.exe.manifest (+11/-0) sensors/adobe/ConsoleApplication1/ConsoleApplication1/obj/x86/Debug/ConsoleApplication1.csproj.FileListAbsolute.txt (+5/-0) sensors/adobe/ConsoleApplication1/ConsoleApplication1/obj/x86/Release/AdobeSensor.csproj.FileListAbsolute.txt (+10/-0) sensors/adobe/ConsoleApplication1/ConsoleApplication1/obj/x86/Release/ConsoleApplication1.csproj.FileListAbsolute.txt (+5/-0) Text conflict in logger/src/daemon/ARConnection.java Text conflict in logger/src/daemon/Dispatcher.java Conflict adding file logger/src/tests/ARConnectionTest.java. Moved existing file to logger/src/tests/ARConnectionTest.java.moved. Conflict adding file logger/src/tests/CommandTest.java. Moved existing file to logger/src/tests/CommandTest.java.moved. Conflict adding file logger/src/tests/DataPacketTest.java. Moved existing file to logger/src/tests/DataPacketTest.java.moved. Conflict adding file logger/src/tests/DataTest.java. Moved existing file to logger/src/tests/DataTest.java.moved. Conflict adding file logger/src/tests/EventPacketTest.java. Moved existing file to logger/src/tests/EventPacketTest.java.moved. Conflict adding file logger/src/tests/ResponsePacketTest.java. Moved existing file to logger/src/tests/ResponsePacketTest.java.moved. Conflict adding file logger/src/tests/TBCommandFactoryTest.java. Moved existing file to logger/src/tests/TBCommandFactoryTest.java.moved. Conflict adding file logger/src/tests/TBCommandTest.java. Moved existing file to logger/src/tests/TBCommandTest.java.moved. Conflict adding file logger/src/tests/TBConnectionTest.java. Moved existing file to logger/src/tests/TBConnectionTest.java.moved. Conflict adding file logger/src/tests/TBEventTest.java. Moved existing file to logger/src/tests/TBEventTest.java.moved. |
To merge this branch: | bzr merge lp:~bpjjteam/bpjj/adobereader |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Alexander Gabriel | Pending | ||
Review via email: mp+71722@code.launchpad.net |
Commit message
adds adobe reader sensor
Description of the change
adds adobe reader
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'logger/src/daemon/ARConnection.java' |
2 | --- logger/src/daemon/ARConnection.java 2011-07-06 00:49:30 +0000 |
3 | +++ logger/src/daemon/ARConnection.java 2011-08-16 15:43:57 +0000 |
4 | @@ -21,6 +21,7 @@ |
5 | } |
6 | |
7 | @Override |
8 | +<<<<<<< TREE |
9 | public void handleData(Data data) throws IOException { |
10 | // TODO Auto-generated method stub |
11 | |
12 | @@ -40,6 +41,25 @@ |
13 | |
14 | @Override |
15 | public String getID() { |
16 | +======= |
17 | + public void handleData(Data data) throws IOException { |
18 | + // TODO Auto-generated method stub |
19 | + } |
20 | + |
21 | + @Override |
22 | + public void handleEvent(EventPacket evt) throws IOException { |
23 | + AREvent event = new AREvent(evt); |
24 | + System.out.println( "received Event:\n" + event ); |
25 | + } |
26 | + |
27 | + @Override |
28 | + public void handleResponse(ResponsePacket response) { |
29 | + System.out.println( "received Response:\n" + response ); |
30 | + } |
31 | + |
32 | + @Override |
33 | + public String getID() { |
34 | +>>>>>>> MERGE-SOURCE |
35 | return "AR"; |
36 | } |
37 | |
38 | |
39 | === added file 'logger/src/daemon/AREvent.java' |
40 | --- logger/src/daemon/AREvent.java 1970-01-01 00:00:00 +0000 |
41 | +++ logger/src/daemon/AREvent.java 2011-08-16 15:43:57 +0000 |
42 | @@ -0,0 +1,44 @@ |
43 | +package daemon; |
44 | + |
45 | +import java.util.Date; |
46 | + |
47 | +public class AREvent { |
48 | + |
49 | + private int type; |
50 | + private Date timestamp; |
51 | + private String docName; |
52 | + private String docPath; |
53 | + private String pagenumber; |
54 | + |
55 | + public AREvent (EventPacket event) { |
56 | + this.type = event.getType(); |
57 | + this.timestamp = event.getTimestamp(); |
58 | + byte[] data = event.getData(); |
59 | + |
60 | + // extract name of the document |
61 | + StringBuffer sb = new StringBuffer(1024); |
62 | + for(int i = 0; i<data.length-3; i++){ |
63 | + sb.append((char)data[i]); |
64 | + } |
65 | + String temp = sb.toString(); |
66 | + |
67 | + int index = temp.indexOf("[PATH]"); |
68 | + |
69 | + docName = (String) temp.subSequence(0, index); |
70 | + docPath = (String) temp.substring(index+6); |
71 | + |
72 | + // extract pagenumber (the last three bytes) |
73 | + sb = new StringBuffer(1024); |
74 | + sb.append((char)data[data.length-3]); |
75 | + sb.append((char)data[data.length-2]); |
76 | + sb.append((char)data[data.length-1]); |
77 | + pagenumber = sb.toString(); |
78 | + |
79 | + } |
80 | + |
81 | + public String toString () { |
82 | + String output = "Event von Adobe: Das Dokument " + docName + " unter " + docPath + " ist geöffnet auf Seite: " + pagenumber ; |
83 | + output = output + " -- " + timestamp.toString(); |
84 | + return output; |
85 | + } |
86 | +} |
87 | |
88 | === modified file 'logger/src/daemon/Dispatcher.java' |
89 | --- logger/src/daemon/Dispatcher.java 2011-07-11 15:33:43 +0000 |
90 | +++ logger/src/daemon/Dispatcher.java 2011-08-16 15:43:57 +0000 |
91 | @@ -42,11 +42,19 @@ |
92 | */ |
93 | public void run() { |
94 | try { |
95 | +<<<<<<< TREE |
96 | setUpServerSocket(); |
97 | while (!finished) { |
98 | Pair<DataOutputStream, DataInputStream> streams = acceptSensorConnection(); |
99 | Connection connection = this.handshake(streams); |
100 | handleConnection(connection); |
101 | +======= |
102 | + setUpServerSocket(); |
103 | + while (!finished) { |
104 | + Pair<DataOutputStream, DataInputStream> streams = acceptSensorConnection(); |
105 | + Connection connection = createConnection(this.handshake(streams), streams); |
106 | + handleConnection(connection); |
107 | +>>>>>>> MERGE-SOURCE |
108 | } |
109 | closeConnections(); |
110 | } catch (Exception e) { |
111 | @@ -54,6 +62,7 @@ |
112 | e.printStackTrace(); |
113 | } |
114 | } |
115 | +<<<<<<< TREE |
116 | |
117 | private void handleConnection(Connection connection) { |
118 | this.inputQueueMap.put(connection.getID(), |
119 | @@ -132,11 +141,27 @@ |
120 | bsensor[0] = istream.readByte(); |
121 | bsensor[1] = istream.readByte(); |
122 | String sensor = new String(bsensor); |
123 | +======= |
124 | + |
125 | + private Connection createConnection(String sensor, |
126 | + Pair<DataOutputStream, DataInputStream> streams) throws IOException { |
127 | + |
128 | + DataOutputStream ostream = streams.getFirst(); |
129 | + DataInputStream istream = streams.getSecond(); |
130 | + |
131 | +>>>>>>> MERGE-SOURCE |
132 | LinkedBlockingQueue<Command> inputQueue = new LinkedBlockingQueue<Command>(); |
133 | + |
134 | if (sensor.equals(Dispatcher.ID_THUNDERBIRD)) { |
135 | - return new TBConnection(istream, ostream, inputQueue, outputQueue); |
136 | +<<<<<<< TREE |
137 | + return new TBConnection(istream, ostream, inputQueue, outputQueue); |
138 | +======= |
139 | + return new TBConnection(istream, ostream, inputQueue, outputQueue); |
140 | + |
141 | +>>>>>>> MERGE-SOURCE |
142 | } else if (sensor.equals(Dispatcher.ID_ADOBEREADER)) { |
143 | return new ARConnection(istream, ostream, inputQueue, outputQueue); |
144 | + |
145 | } else { |
146 | System.out.println("Closing socket"); |
147 | ostream.writeBytes("KO"); |
148 | @@ -147,4 +172,83 @@ |
149 | return null; |
150 | } |
151 | } |
152 | + |
153 | + private void handleConnection(Connection connection) { |
154 | + this.inputQueueMap.put(connection.getID(), |
155 | + connection.getInputQueue()); |
156 | + (new Thread(connection, connection.getID() + "Connection")) |
157 | + .start(); |
158 | + } |
159 | + |
160 | + |
161 | + private Pair<DataOutputStream, DataInputStream> acceptSensorConnection() throws IOException { |
162 | + Socket socket; |
163 | + while (true) { |
164 | + try { |
165 | + socket = serverSocket.accept(); |
166 | + } catch (IOException e) { |
167 | + //timeout |
168 | + continue; |
169 | + } |
170 | + System.out.println("Connection incoming"); |
171 | + DataOutputStream ostream = new DataOutputStream( |
172 | + socket.getOutputStream()); |
173 | + DataInputStream istream = new DataInputStream( |
174 | + socket.getInputStream()); |
175 | + return new Pair<DataOutputStream, DataInputStream>(ostream, istream); |
176 | + } |
177 | + } |
178 | + |
179 | + |
180 | + |
181 | + private void setUpServerSocket() throws IOException { |
182 | + serverSocket = new ServerSocket(Dispatcher.PORT); |
183 | + serverSocket.setSoTimeout(1000); |
184 | + } |
185 | + |
186 | + /** |
187 | + * @throws IOException |
188 | + * |
189 | + */ |
190 | + private void closeConnections() throws IOException { |
191 | + Command command = new Command(Command.CLOSE_CONNECTION, 0); |
192 | + for(LinkedBlockingQueue<Command> commandQueue : this.inputQueueMap.values()){ |
193 | + try { |
194 | + commandQueue.put(command); |
195 | + } catch (InterruptedException e) { |
196 | + e.printStackTrace(); |
197 | + } |
198 | + } |
199 | + serverSocket.close(); |
200 | + } |
201 | + |
202 | + |
203 | + /** |
204 | + * |
205 | + */ |
206 | + public void close() { |
207 | + |
208 | + this.finished = true; |
209 | + |
210 | + } |
211 | + |
212 | + /** |
213 | + * first part of the handshake. The other part is made in Connection. |
214 | + * |
215 | + * @param istream The DataInputStream to be used for the Connection |
216 | + * @param ostream The DataOutputStream to be used for the Connection |
217 | + * @return the Sensor ID |
218 | + * @throws IOException |
219 | + */ |
220 | + private String handshake(Pair<DataOutputStream, DataInputStream> streams) throws IOException { |
221 | + System.out.println("Sending Hello"); |
222 | + DataOutputStream ostream = streams.getFirst(); |
223 | + DataInputStream istream = streams.getSecond(); |
224 | + ostream.writeBytes("HELLO"); |
225 | + ostream.flush(); |
226 | + byte[] bsensor = new byte[2]; |
227 | + bsensor[0] = istream.readByte(); |
228 | + bsensor[1] = istream.readByte(); |
229 | + return new String(bsensor); |
230 | + } |
231 | } |
232 | |
233 | === added file 'logger/src/tests/ARConnectionTest.java' |
234 | --- logger/src/tests/ARConnectionTest.java 1970-01-01 00:00:00 +0000 |
235 | +++ logger/src/tests/ARConnectionTest.java 2011-08-16 15:43:57 +0000 |
236 | @@ -0,0 +1,44 @@ |
237 | +package tests; |
238 | + |
239 | +import static org.junit.Assert.*; |
240 | + |
241 | +import org.junit.Before; |
242 | +import org.junit.Test; |
243 | + |
244 | +public class ARConnectionTest { |
245 | + |
246 | + @Before |
247 | + public void setUp() throws Exception { |
248 | + } |
249 | + |
250 | + @Test |
251 | + public void testGetName() { |
252 | + fail("Not yet implemented"); // TODO |
253 | + } |
254 | + |
255 | + @Test |
256 | + public void testHandleEvent() { |
257 | + fail("Not yet implemented"); // TODO |
258 | + } |
259 | + |
260 | + @Test |
261 | + public void testHandleData() { |
262 | + fail("Not yet implemented"); // TODO |
263 | + } |
264 | + |
265 | + @Test |
266 | + public void testHandleResponse() { |
267 | + fail("Not yet implemented"); // TODO |
268 | + } |
269 | + |
270 | + @Test |
271 | + public void testGetId() { |
272 | + fail("Not yet implemented"); // TODO |
273 | + } |
274 | + |
275 | + @Test |
276 | + public void testARConnection() { |
277 | + fail("Not yet implemented"); // TODO |
278 | + } |
279 | + |
280 | +} |
281 | |
282 | === renamed file 'logger/src/tests/ARConnectionTest.java' => 'logger/src/tests/ARConnectionTest.java.moved' |
283 | === added file 'logger/src/tests/CommandTest.java' |
284 | --- logger/src/tests/CommandTest.java 1970-01-01 00:00:00 +0000 |
285 | +++ logger/src/tests/CommandTest.java 2011-08-16 15:43:57 +0000 |
286 | @@ -0,0 +1,41 @@ |
287 | +package tests; |
288 | + |
289 | +import static org.junit.Assert.*; |
290 | + |
291 | +import org.junit.Before; |
292 | +import org.junit.Test; |
293 | + |
294 | +import daemon.Command; |
295 | + |
296 | +public class CommandTest { |
297 | + |
298 | + private Command[] commands; |
299 | + |
300 | + @Before |
301 | + public void setUp() throws Exception { |
302 | + this.commands = new Command[4]; |
303 | + for (int i = 0; i < 4; i++) { |
304 | + this.commands[i] = new Command(i,i); |
305 | + } |
306 | + } |
307 | + |
308 | + @Test |
309 | + public void testGetType() { |
310 | + for (int i = 0; i < 4; i++) { |
311 | + assertEquals(i, this.commands[i].getType()); |
312 | + } |
313 | + } |
314 | + |
315 | + @Test |
316 | + public void testGetID() { |
317 | + for (int i = 0; i < 4; i++) { |
318 | + assertEquals(i, this.commands[i].getID()); |
319 | + } |
320 | + } |
321 | + |
322 | + @Test |
323 | + public void testSend() { |
324 | + fail("Not yet implemented"); // TODO |
325 | + } |
326 | + |
327 | +} |
328 | |
329 | === renamed file 'logger/src/tests/CommandTest.java' => 'logger/src/tests/CommandTest.java.moved' |
330 | === added file 'logger/src/tests/DataPacketTest.java' |
331 | --- logger/src/tests/DataPacketTest.java 1970-01-01 00:00:00 +0000 |
332 | +++ logger/src/tests/DataPacketTest.java 2011-08-16 15:43:57 +0000 |
333 | @@ -0,0 +1,49 @@ |
334 | +package tests; |
335 | + |
336 | +import static org.junit.Assert.*; |
337 | + |
338 | +import org.junit.Before; |
339 | +import org.junit.Test; |
340 | + |
341 | +public class DataPacketTest { |
342 | + |
343 | + @Before |
344 | + public void setUp() throws Exception { |
345 | + } |
346 | + |
347 | + @Test |
348 | + public void testDataPacket() { |
349 | + fail("Not yet implemented"); // TODO |
350 | + } |
351 | + |
352 | + @Test |
353 | + public void testGetTotalPackets() { |
354 | + fail("Not yet implemented"); // TODO |
355 | + } |
356 | + |
357 | + @Test |
358 | + public void testGetCurrentPacket() { |
359 | + fail("Not yet implemented"); // TODO |
360 | + } |
361 | + |
362 | + @Test |
363 | + public void testGetId() { |
364 | + fail("Not yet implemented"); // TODO |
365 | + } |
366 | + |
367 | + @Test |
368 | + public void testGetType() { |
369 | + fail("Not yet implemented"); // TODO |
370 | + } |
371 | + |
372 | + @Test |
373 | + public void testGetData() { |
374 | + fail("Not yet implemented"); // TODO |
375 | + } |
376 | + |
377 | + @Test |
378 | + public void testToString() { |
379 | + fail("Not yet implemented"); // TODO |
380 | + } |
381 | + |
382 | +} |
383 | |
384 | === renamed file 'logger/src/tests/DataPacketTest.java' => 'logger/src/tests/DataPacketTest.java.moved' |
385 | === added file 'logger/src/tests/DataTest.java' |
386 | --- logger/src/tests/DataTest.java 1970-01-01 00:00:00 +0000 |
387 | +++ logger/src/tests/DataTest.java 2011-08-16 15:43:57 +0000 |
388 | @@ -0,0 +1,57 @@ |
389 | +package tests; |
390 | + |
391 | +import static org.junit.Assert.*; |
392 | + |
393 | +import org.junit.Before; |
394 | +import org.junit.Test; |
395 | + |
396 | +import daemon.Data; |
397 | +import daemon.DataPacket; |
398 | +import daemon.PacketException; |
399 | + |
400 | +public class DataTest { |
401 | + |
402 | + private Data data; |
403 | + private byte[] bytes1; |
404 | + private byte[] bytes2; |
405 | + |
406 | + @Before |
407 | + public void setUp() throws Exception { |
408 | + this.bytes1 = new byte[3]; |
409 | + this.bytes1[0] = 1; |
410 | + this.bytes1[2] = 5; |
411 | + this.bytes1[3] = 7; |
412 | + this.bytes2 = new byte[2]; |
413 | + this.bytes2[0] = 10; |
414 | + this.bytes2[2] = 12; |
415 | + DataPacket dataPacket = new DataPacket(1, 4, 3, 2, this.bytes1); |
416 | + this.data = new Data(dataPacket); |
417 | + } |
418 | + |
419 | + @Test |
420 | + public void testAddPacket() throws PacketException { |
421 | + fail("Not yet implemented"); // TODO |
422 | + } |
423 | + |
424 | + @Test |
425 | + public void testGetData() { |
426 | + assertEquals(this.bytes1, this.data.getData()); |
427 | + } |
428 | + |
429 | + @Test |
430 | + public void testGetId() { |
431 | + assertEquals(4, this.data.getId()); |
432 | + } |
433 | + |
434 | + @Test |
435 | + public void testGetType() { |
436 | + assertEquals(1, this.data.getType()); |
437 | + } |
438 | + |
439 | + @Test |
440 | + public void testIsComplete() { |
441 | + assertEquals(false, this.data.isComplete()); |
442 | + fail("Not yet implemented"); // TODO |
443 | + } |
444 | + |
445 | +} |
446 | |
447 | === renamed file 'logger/src/tests/DataTest.java' => 'logger/src/tests/DataTest.java.moved' |
448 | === added file 'logger/src/tests/EventPacketTest.java' |
449 | --- logger/src/tests/EventPacketTest.java 1970-01-01 00:00:00 +0000 |
450 | +++ logger/src/tests/EventPacketTest.java 2011-08-16 15:43:57 +0000 |
451 | @@ -0,0 +1,52 @@ |
452 | +package tests; |
453 | + |
454 | +import static org.junit.Assert.*; |
455 | + |
456 | +import java.util.Date; |
457 | + |
458 | +import org.junit.Before; |
459 | +import org.junit.Test; |
460 | + |
461 | +import daemon.EventPacket; |
462 | +import daemon.PacketException; |
463 | + |
464 | +public class EventPacketTest { |
465 | + |
466 | + private EventPacket eventPacket; |
467 | + private Date timestamp; |
468 | + private byte[] data; |
469 | + |
470 | + @Before |
471 | + public void setUp() throws Exception { |
472 | + this.timestamp = new Date(); |
473 | + this.data = new byte[3]; |
474 | + this.data[0] = 1; |
475 | + this.data[1] = 2; |
476 | + this.data[2] = 3; |
477 | + this.eventPacket = new EventPacket(0, this.timestamp, this.data); |
478 | + } |
479 | + |
480 | + @Test |
481 | + public void testGetType() { |
482 | + assertEquals(0, this.eventPacket.getType()); |
483 | + } |
484 | + |
485 | + @Test |
486 | + public void testGetTimestamp() { |
487 | + assertEquals(this.timestamp, this.eventPacket.getTimestamp()); |
488 | + } |
489 | + |
490 | + @Test |
491 | + public void testGetData() { |
492 | + assertEquals(this.data, this.eventPacket.getData()); |
493 | + } |
494 | + |
495 | + @Test |
496 | + public void testToString() throws PacketException { |
497 | + for (int i = 0; i < 6; i++) { |
498 | + this.eventPacket = new EventPacket(i, this.timestamp, this.data); |
499 | + assertEquals("incoming event of type " + i + " on timestamp " + this.timestamp, this.eventPacket.toString()); |
500 | + } |
501 | + } |
502 | + |
503 | +} |
504 | |
505 | === renamed file 'logger/src/tests/EventPacketTest.java' => 'logger/src/tests/EventPacketTest.java.moved' |
506 | === added file 'logger/src/tests/ResponsePacketTest.java' |
507 | --- logger/src/tests/ResponsePacketTest.java 1970-01-01 00:00:00 +0000 |
508 | +++ logger/src/tests/ResponsePacketTest.java 2011-08-16 15:43:57 +0000 |
509 | @@ -0,0 +1,33 @@ |
510 | +package tests; |
511 | + |
512 | +import static org.junit.Assert.*; |
513 | + |
514 | +import org.junit.Before; |
515 | +import org.junit.Test; |
516 | + |
517 | +import daemon.ResponsePacket; |
518 | + |
519 | +public class ResponsePacketTest { |
520 | + |
521 | + private ResponsePacket responseACK; |
522 | + private ResponsePacket responseERR; |
523 | + |
524 | + @Before |
525 | + public void setUp() throws Exception { |
526 | + this.responseACK = new ResponsePacket(0,"ACK"); |
527 | + this.responseERR = new ResponsePacket(1,"ERR"); |
528 | + } |
529 | + |
530 | + @Test |
531 | + public void testGetErrorCode() { |
532 | + assertEquals("ACK", this.responseACK.getErrorCode()); |
533 | + assertEquals("ERR", this.responseERR.getErrorCode()); |
534 | + } |
535 | + |
536 | + @Test |
537 | + public void testGetId() { |
538 | + assertEquals(0, this.responseACK.getId()); |
539 | + assertEquals(1, this.responseERR.getId()); |
540 | + } |
541 | + |
542 | +} |
543 | |
544 | === renamed file 'logger/src/tests/ResponsePacketTest.java' => 'logger/src/tests/ResponsePacketTest.java.moved' |
545 | === added file 'logger/src/tests/TBCommandFactoryTest.java' |
546 | --- logger/src/tests/TBCommandFactoryTest.java 1970-01-01 00:00:00 +0000 |
547 | +++ logger/src/tests/TBCommandFactoryTest.java 2011-08-16 15:43:57 +0000 |
548 | @@ -0,0 +1,46 @@ |
549 | +package tests; |
550 | + |
551 | +import static org.junit.Assert.*; |
552 | + |
553 | +import org.junit.Before; |
554 | +import org.junit.Test; |
555 | + |
556 | +import daemon.CommandException; |
557 | +import daemon.TBCommand; |
558 | +import daemon.TBCommandFactory; |
559 | + |
560 | +public class TBCommandFactoryTest { |
561 | + |
562 | + private TBCommandFactory comFac; |
563 | + |
564 | + @Before |
565 | + public void setUp() throws Exception { |
566 | + this.comFac = new TBCommandFactory(); |
567 | + } |
568 | + |
569 | + @Test |
570 | + public void testCreateCommandInt() throws CommandException { |
571 | + TBCommand command; |
572 | + for (int i = 1; i < 3; i++) { |
573 | + command = this.comFac.createCommand(i+1); |
574 | + assertEquals(i+1, command.getType()); |
575 | + assertEquals(i, command.getID()); |
576 | + assertEquals(0, command.getFolderID()); |
577 | + assertEquals(0, command.getMailID()); |
578 | + } |
579 | + try { |
580 | + command = this.comFac.createCommand(4); |
581 | + fail("Expected Exception"); |
582 | + } catch (CommandException e) { |
583 | + assertEquals("Tried creating invalid Command.", e.getMessage()); |
584 | + } |
585 | + try { |
586 | + command = this.comFac.createCommand(0); |
587 | + fail("Expected Exception"); |
588 | + } catch (CommandException e) { |
589 | + assertEquals("Tried creating invalid Command.", e.getMessage()); |
590 | + } |
591 | + |
592 | + } |
593 | + |
594 | +} |
595 | |
596 | === renamed file 'logger/src/tests/TBCommandFactoryTest.java' => 'logger/src/tests/TBCommandFactoryTest.java.moved' |
597 | === added file 'logger/src/tests/TBCommandTest.java' |
598 | --- logger/src/tests/TBCommandTest.java 1970-01-01 00:00:00 +0000 |
599 | +++ logger/src/tests/TBCommandTest.java 2011-08-16 15:43:57 +0000 |
600 | @@ -0,0 +1,50 @@ |
601 | +package tests; |
602 | + |
603 | +import static org.junit.Assert.*; |
604 | + |
605 | +import org.junit.Before; |
606 | +import org.junit.Test; |
607 | + |
608 | +import daemon.TBCommand; |
609 | + |
610 | +public class TBCommandTest { |
611 | + |
612 | + private TBCommand command; |
613 | + |
614 | + @Before |
615 | + public void setUp() throws Exception { |
616 | + this.command = new TBCommand(1, 0); |
617 | + this.command.setMailID(1); |
618 | + this.command.setFolderID(2); |
619 | + } |
620 | + |
621 | + @Test |
622 | + public void testSend() { |
623 | + fail("Not yet implemented"); // TODO |
624 | + } |
625 | + |
626 | + @Test |
627 | + public void testSetMailID() { |
628 | + assertEquals(1, this.command.getMailID()); |
629 | + this.command.setMailID(3); |
630 | + assertEquals(3, this.command.getMailID()); |
631 | + } |
632 | + |
633 | + @Test |
634 | + public void testSetFolderID() { |
635 | + assertEquals(2, this.command.getFolderID()); |
636 | + this.command.setFolderID(4); |
637 | + assertEquals(4, this.command.getFolderID()); |
638 | + } |
639 | + |
640 | + @Test |
641 | + public void testGetFolderID() { |
642 | + assertEquals(2, this.command.getFolderID()); |
643 | + } |
644 | + |
645 | + @Test |
646 | + public void testGetMailID() { |
647 | + assertEquals(1, this.command.getMailID()); |
648 | + } |
649 | + |
650 | +} |
651 | |
652 | === renamed file 'logger/src/tests/TBCommandTest.java' => 'logger/src/tests/TBCommandTest.java.moved' |
653 | === added file 'logger/src/tests/TBConnectionTest.java' |
654 | --- logger/src/tests/TBConnectionTest.java 1970-01-01 00:00:00 +0000 |
655 | +++ logger/src/tests/TBConnectionTest.java 2011-08-16 15:43:57 +0000 |
656 | @@ -0,0 +1,44 @@ |
657 | +package tests; |
658 | + |
659 | +import static org.junit.Assert.*; |
660 | + |
661 | +import org.junit.Before; |
662 | +import org.junit.Test; |
663 | + |
664 | +public class TBConnectionTest { |
665 | + |
666 | + @Before |
667 | + public void setUp() throws Exception { |
668 | + } |
669 | + |
670 | + @Test |
671 | + public void testGetName() { |
672 | + fail("Not yet implemented"); // TODO |
673 | + } |
674 | + |
675 | + @Test |
676 | + public void testHandleEvent() { |
677 | + fail("Not yet implemented"); // TODO |
678 | + } |
679 | + |
680 | + @Test |
681 | + public void testHandleData() { |
682 | + fail("Not yet implemented"); // TODO |
683 | + } |
684 | + |
685 | + @Test |
686 | + public void testHandleResponse() { |
687 | + fail("Not yet implemented"); // TODO |
688 | + } |
689 | + |
690 | + @Test |
691 | + public void testGetId() { |
692 | + fail("Not yet implemented"); // TODO |
693 | + } |
694 | + |
695 | + @Test |
696 | + public void testTBConnection() { |
697 | + fail("Not yet implemented"); // TODO |
698 | + } |
699 | + |
700 | +} |
701 | |
702 | === renamed file 'logger/src/tests/TBConnectionTest.java' => 'logger/src/tests/TBConnectionTest.java.moved' |
703 | === added file 'logger/src/tests/TBEventTest.java' |
704 | --- logger/src/tests/TBEventTest.java 1970-01-01 00:00:00 +0000 |
705 | +++ logger/src/tests/TBEventTest.java 2011-08-16 15:43:57 +0000 |
706 | @@ -0,0 +1,62 @@ |
707 | +package tests; |
708 | + |
709 | +import static org.junit.Assert.*; |
710 | + |
711 | +import java.util.Date; |
712 | + |
713 | +import org.junit.Before; |
714 | +import org.junit.Test; |
715 | + |
716 | +import daemon.EventPacket; |
717 | +import daemon.PacketException; |
718 | +import daemon.TBEvent; |
719 | + |
720 | +public class TBEventTest { |
721 | + |
722 | + private TBEvent event; |
723 | + private byte[] data; |
724 | + private Date timestamp; |
725 | + |
726 | + @Before |
727 | + public void setUp() throws Exception { |
728 | + this.data = new byte[8]; |
729 | + this.data[0] = 0; |
730 | + this.data[1] = 0; |
731 | + this.data[2] = 0; |
732 | + this.data[3] = 6; |
733 | + this.data[4] = 0; |
734 | + this.data[5] = 0; |
735 | + this.data[6] = 0; |
736 | + this.data[7] = 4; |
737 | + this.timestamp = new Date(); |
738 | + EventPacket eventPacket = new EventPacket(0, this.timestamp, this.data); |
739 | + this.event = new TBEvent(eventPacket); |
740 | + } |
741 | + |
742 | + @Test |
743 | + public void testToString() throws PacketException { |
744 | + String[] types = new String[6]; |
745 | + types[0] = "gelesen markiert."; |
746 | + types[1] = "ungelesen markiert."; |
747 | + types[2] = "empfangen erkannt."; |
748 | + types[3] = "Favorit markiert."; |
749 | + types[4] = "Nicht-Favorit markiert."; |
750 | + types[5] = "beantwortet erkannt."; |
751 | + for (int i = 0; i < 6; i++) { |
752 | + EventPacket eventPacket = new EventPacket(i, this.timestamp, this.data); |
753 | + this.event = new TBEvent(eventPacket); |
754 | + assertEquals("Event von Thunderbird: Die E-Mail mit der ID 4, (Folder: 6) wurde als " + types[i] + " -- " + this.timestamp.toString(), this.event.toString()); |
755 | + } |
756 | + } |
757 | + |
758 | + @Test |
759 | + public void testGetFolderId() { |
760 | + assertEquals(6, this.event.getFolderId()); |
761 | + } |
762 | + |
763 | + @Test |
764 | + public void testGetMailId() { |
765 | + assertEquals(4, this.event.getMailId()); |
766 | + } |
767 | + |
768 | +} |
769 | |
770 | === renamed file 'logger/src/tests/TBEventTest.java' => 'logger/src/tests/TBEventTest.java.moved' |
771 | === removed file 'sensors/adobe/Adobe-Sensor.cs' |
772 | --- sensors/adobe/Adobe-Sensor.cs 2011-06-25 15:04:17 +0000 |
773 | +++ sensors/adobe/Adobe-Sensor.cs 1970-01-01 00:00:00 +0000 |
774 | @@ -1,82 +0,0 @@ |
775 | -using System; |
776 | -using System.Collections.Generic; |
777 | -using System.Linq; |
778 | -using System.Text; |
779 | -using System.Windows.Automation; |
780 | -//using System.Windows.Automation.Condition; |
781 | -//using System.Windows.Automation.TreeScope; |
782 | -using System.Windows.Forms; |
783 | - |
784 | -namespace ConsoleApplication1 |
785 | -{ |
786 | - class Program |
787 | - { |
788 | - static void Main(string[] args) |
789 | - { |
790 | - // all main-Automations on Desktop |
791 | - AutomationElementCollection desktopChildren = AutomationElement.RootElement.FindAll(TreeScope.Children, Condition.TrueCondition); |
792 | - |
793 | - // collection for open Adobe windows |
794 | - LinkedList<AutomationElement> openPDFs = new LinkedList<AutomationElement>(); |
795 | - |
796 | - int anzahlAutomations = desktopChildren.Count; |
797 | - Console.WriteLine("Anzahl Automations: " + anzahlAutomations); |
798 | - |
799 | - // iterate over desktopChildren, searching for Adobe windows |
800 | - for (int i = 0; i < anzahlAutomations; i++) |
801 | - { |
802 | - AutomationElement current = desktopChildren[i]; |
803 | - String currentName = current.Current.Name; |
804 | - Console.WriteLine("Number " + i + " is " + currentName); |
805 | - if ((currentName.EndsWith("- Adobe Reader"))) |
806 | - openPDFs.AddFirst(current); |
807 | - } |
808 | - |
809 | - AutomationElement temp = AutomationElement.RootElement; |
810 | - |
811 | - // prints all founded Adobe Windows |
812 | - for (LinkedListNode<AutomationElement> i = openPDFs.First; i != null; i = i.Next) |
813 | - { |
814 | - Console.WriteLine(i.Value.Current.Name + " was selected."); |
815 | - temp = i.Value; |
816 | - } |
817 | - |
818 | - // search the current pagenumber |
819 | - AutomationElementCollection adobeChildren = temp.FindAll(TreeScope.Children, Condition.TrueCondition); |
820 | - AutomationElementCollection adobeContent = adobeChildren[6].FindAll(TreeScope.Descendants, Condition.TrueCondition); |
821 | - |
822 | - AutomationElement pagenumber = AutomationElement.RootElement; |
823 | - for (int i = 0; i < adobeContent.Count; i++) |
824 | - { |
825 | - AutomationElement current = adobeContent[i]; |
826 | - String currentType = current.Current.LocalizedControlType; |
827 | - if (currentType.Equals("Dokument")) |
828 | - { |
829 | - Console.WriteLine(currentType + " was found."); |
830 | - pagenumber = current; |
831 | - } |
832 | - } |
833 | - |
834 | - |
835 | - |
836 | - |
837 | - if (pagenumber != null) |
838 | - { |
839 | - try |
840 | - { |
841 | - Console.WriteLine("WTF " + pagenumber.Current.LocalizedControlType); |
842 | - ValuePattern valuePattern = pagenumber.GetCurrentPattern(ValuePattern.Pattern) as ValuePattern; |
843 | - Console.WriteLine("Pagenumber is " + valuePattern.Current.Value); |
844 | - } |
845 | - catch (InvalidOperationException ex) |
846 | - { |
847 | - Console.WriteLine(ex.Message); |
848 | - } |
849 | - } |
850 | - |
851 | - // set the focus |
852 | - // adobe2.SetFocus(); |
853 | - |
854 | - } |
855 | - } |
856 | -} |
857 | |
858 | === added directory 'sensors/adobe/ConsoleApplication1' |
859 | === added directory 'sensors/adobe/ConsoleApplication1/ConsoleApplication1' |
860 | === added file 'sensors/adobe/ConsoleApplication1/ConsoleApplication1.sln' |
861 | --- sensors/adobe/ConsoleApplication1/ConsoleApplication1.sln 1970-01-01 00:00:00 +0000 |
862 | +++ sensors/adobe/ConsoleApplication1/ConsoleApplication1.sln 2011-08-16 15:43:57 +0000 |
863 | @@ -0,0 +1,20 @@ |
864 | + |
865 | +Microsoft Visual Studio Solution File, Format Version 11.00 |
866 | +# Visual Studio 2010 |
867 | +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AdobeSensor", "ConsoleApplication1\AdobeSensor.csproj", "{F87D1B49-0185-46AF-B910-916AB434BC31}" |
868 | +EndProject |
869 | +Global |
870 | + GlobalSection(SolutionConfigurationPlatforms) = preSolution |
871 | + Debug|x86 = Debug|x86 |
872 | + Release|x86 = Release|x86 |
873 | + EndGlobalSection |
874 | + GlobalSection(ProjectConfigurationPlatforms) = postSolution |
875 | + {F87D1B49-0185-46AF-B910-916AB434BC31}.Debug|x86.ActiveCfg = Debug|x86 |
876 | + {F87D1B49-0185-46AF-B910-916AB434BC31}.Debug|x86.Build.0 = Debug|x86 |
877 | + {F87D1B49-0185-46AF-B910-916AB434BC31}.Release|x86.ActiveCfg = Release|x86 |
878 | + {F87D1B49-0185-46AF-B910-916AB434BC31}.Release|x86.Build.0 = Release|x86 |
879 | + EndGlobalSection |
880 | + GlobalSection(SolutionProperties) = preSolution |
881 | + HideSolutionNode = FALSE |
882 | + EndGlobalSection |
883 | +EndGlobal |
884 | |
885 | === added file 'sensors/adobe/ConsoleApplication1/ConsoleApplication1.suo' |
886 | Binary files sensors/adobe/ConsoleApplication1/ConsoleApplication1.suo 1970-01-01 00:00:00 +0000 and sensors/adobe/ConsoleApplication1/ConsoleApplication1.suo 2011-08-16 15:43:57 +0000 differ |
887 | === added file 'sensors/adobe/ConsoleApplication1/ConsoleApplication1/AdobeSensor.csproj' |
888 | --- sensors/adobe/ConsoleApplication1/ConsoleApplication1/AdobeSensor.csproj 1970-01-01 00:00:00 +0000 |
889 | +++ sensors/adobe/ConsoleApplication1/ConsoleApplication1/AdobeSensor.csproj 2011-08-16 15:43:57 +0000 |
890 | @@ -0,0 +1,61 @@ |
891 | +<?xml version="1.0" encoding="utf-8"?> |
892 | +<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
893 | + <PropertyGroup> |
894 | + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> |
895 | + <Platform Condition=" '$(Platform)' == '' ">x86</Platform> |
896 | + <ProductVersion>8.0.30703</ProductVersion> |
897 | + <SchemaVersion>2.0</SchemaVersion> |
898 | + <ProjectGuid>{F87D1B49-0185-46AF-B910-916AB434BC31}</ProjectGuid> |
899 | + <OutputType>Exe</OutputType> |
900 | + <AppDesignerFolder>Properties</AppDesignerFolder> |
901 | + <RootNamespace>ConsoleApplication1</RootNamespace> |
902 | + <AssemblyName>ConsoleApplication1</AssemblyName> |
903 | + <TargetFrameworkVersion>v4.0</TargetFrameworkVersion> |
904 | + <TargetFrameworkProfile>Client</TargetFrameworkProfile> |
905 | + <FileAlignment>512</FileAlignment> |
906 | + </PropertyGroup> |
907 | + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' "> |
908 | + <PlatformTarget>x86</PlatformTarget> |
909 | + <DebugSymbols>true</DebugSymbols> |
910 | + <DebugType>full</DebugType> |
911 | + <Optimize>false</Optimize> |
912 | + <OutputPath>bin\Debug\</OutputPath> |
913 | + <DefineConstants>DEBUG;TRACE</DefineConstants> |
914 | + <ErrorReport>prompt</ErrorReport> |
915 | + <WarningLevel>4</WarningLevel> |
916 | + </PropertyGroup> |
917 | + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' "> |
918 | + <PlatformTarget>x86</PlatformTarget> |
919 | + <DebugType>pdbonly</DebugType> |
920 | + <Optimize>true</Optimize> |
921 | + <OutputPath>bin\Release\</OutputPath> |
922 | + <DefineConstants>TRACE</DefineConstants> |
923 | + <ErrorReport>prompt</ErrorReport> |
924 | + <WarningLevel>4</WarningLevel> |
925 | + </PropertyGroup> |
926 | + <ItemGroup> |
927 | + <Reference Include="System" /> |
928 | + <Reference Include="System.Core" /> |
929 | + <Reference Include="System.Windows.Forms" /> |
930 | + <Reference Include="System.Xml.Linq" /> |
931 | + <Reference Include="System.Data.DataSetExtensions" /> |
932 | + <Reference Include="Microsoft.CSharp" /> |
933 | + <Reference Include="System.Data" /> |
934 | + <Reference Include="System.Xml" /> |
935 | + <Reference Include="UIAutomationClient" /> |
936 | + <Reference Include="UIAutomationTypes" /> |
937 | + </ItemGroup> |
938 | + <ItemGroup> |
939 | + <Compile Include="..\..\..\..\..\Desktop\Dropbox\Adobe-Sensor.cs" /> |
940 | + <Compile Include="Communicator.cs" /> |
941 | + <Compile Include="Properties\AssemblyInfo.cs" /> |
942 | + </ItemGroup> |
943 | + <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> |
944 | + <!-- To modify your build process, add your task inside one of the targets below and uncomment it. |
945 | + Other similar extension points exist, see Microsoft.Common.targets. |
946 | + <Target Name="BeforeBuild"> |
947 | + </Target> |
948 | + <Target Name="AfterBuild"> |
949 | + </Target> |
950 | + --> |
951 | +</Project> |
952 | \ No newline at end of file |
953 | |
954 | === added file 'sensors/adobe/ConsoleApplication1/ConsoleApplication1/Communicator.cs' |
955 | --- sensors/adobe/ConsoleApplication1/ConsoleApplication1/Communicator.cs 1970-01-01 00:00:00 +0000 |
956 | +++ sensors/adobe/ConsoleApplication1/ConsoleApplication1/Communicator.cs 2011-08-16 15:43:57 +0000 |
957 | @@ -0,0 +1,88 @@ |
958 | +using System; |
959 | +using System.Text; |
960 | +using System.Net.Sockets; |
961 | + |
962 | +class Communicator |
963 | +{ |
964 | + private const int port = 4444; |
965 | + |
966 | + private TcpClient client; |
967 | + private NetworkStream stream; |
968 | + private String application; |
969 | + |
970 | + public Communicator(String application) |
971 | + { |
972 | + this.application = application; |
973 | + } |
974 | + |
975 | + public NetworkStream getStream() {return stream;} |
976 | + |
977 | + public void start() |
978 | + { |
979 | + try |
980 | + { |
981 | + this.client = new TcpClient("localhost", port); |
982 | + if (client.Connected) |
983 | + { |
984 | + this.stream = client.GetStream(); |
985 | + Console.WriteLine("Verbindung hergestellt."); |
986 | + } |
987 | + } |
988 | + catch (SocketException) |
989 | + { |
990 | + Console.WriteLine("Kommunikationsfehler: Der Logger ist nicht erreichbar."); |
991 | + } |
992 | + if (handShake()) |
993 | + Console.WriteLine("Handshake mit Logger erfolgreich."); |
994 | + else |
995 | + Console.WriteLine("Handshake mit Logger nicht erfolgreich."); |
996 | + } |
997 | + |
998 | + public void stop() |
999 | + { |
1000 | + stream.Close(); |
1001 | + client.Close(); |
1002 | + } |
1003 | + |
1004 | + private bool handShake() |
1005 | + { |
1006 | + if (readString(5) == "HELLO") |
1007 | + { |
1008 | + stream.Write(Encoding.ASCII.GetBytes(application), 0, 2); |
1009 | + if (readString(2) == "OK") |
1010 | + { |
1011 | + return true; |
1012 | + } |
1013 | + else return false; |
1014 | + } |
1015 | + else return false; |
1016 | + } |
1017 | + |
1018 | + private string readString(int length) |
1019 | + { |
1020 | + while (client.Available < length); |
1021 | + byte[] buffer = new byte[length]; |
1022 | + stream.Read(buffer, 0, length); |
1023 | + return Encoding.ASCII.GetString(buffer); |
1024 | + } |
1025 | + |
1026 | + public void write(int number) |
1027 | + { |
1028 | + byte[] temp = BitConverter.GetBytes(number); |
1029 | + Array.Reverse(temp); |
1030 | + stream.Write(temp, 0, 4); |
1031 | + } |
1032 | + |
1033 | + public void write(long number) |
1034 | + { |
1035 | + byte[] temp = BitConverter.GetBytes(number); |
1036 | + Array.Reverse(temp); |
1037 | + stream.Write(temp, 0, 8); |
1038 | + } |
1039 | + |
1040 | + public void write(String character) |
1041 | + { |
1042 | + stream.Write(Encoding.ASCII.GetBytes(character), 0, character.Length); |
1043 | + } |
1044 | + |
1045 | +} |
1046 | \ No newline at end of file |
1047 | |
1048 | === added file 'sensors/adobe/ConsoleApplication1/ConsoleApplication1/Program.cs' |
1049 | --- sensors/adobe/ConsoleApplication1/ConsoleApplication1/Program.cs 1970-01-01 00:00:00 +0000 |
1050 | +++ sensors/adobe/ConsoleApplication1/ConsoleApplication1/Program.cs 2011-08-16 15:43:57 +0000 |
1051 | @@ -0,0 +1,117 @@ |
1052 | +using System; |
1053 | +using System.Collections.Generic; |
1054 | +using System.Linq; |
1055 | +using System.Text; |
1056 | +using System.Windows.Automation; |
1057 | +//using System.Windows.Automation.Condition; |
1058 | +//using System.Windows.Automation.TreeScope; |
1059 | +using System.Windows.Forms; |
1060 | + |
1061 | +namespace ConsoleApplication1 |
1062 | +{ |
1063 | + class Program |
1064 | + { |
1065 | + /// <summary> |
1066 | + /// Retrieves an element in a list, using TreeWalker. |
1067 | + /// </summary> |
1068 | + /// <param name="parent">The list element.</param> |
1069 | + /// <param name="index">The index of the element to find.</param> |
1070 | + /// <returns>The list item.</returns> |
1071 | + static AutomationElement FindChildAt(AutomationElement parent, int index) |
1072 | + { |
1073 | + if (index < 0) |
1074 | + { |
1075 | + throw new ArgumentOutOfRangeException(); |
1076 | + } |
1077 | + TreeWalker walker = TreeWalker.ControlViewWalker; |
1078 | + AutomationElement child = walker.GetFirstChild(parent); |
1079 | + for (int x = 1; x <= index; x++) |
1080 | + { |
1081 | + child = walker.GetNextSibling(child); |
1082 | + if (child == null) |
1083 | + { |
1084 | + throw new ArgumentOutOfRangeException(); |
1085 | + } |
1086 | + } |
1087 | + return child; |
1088 | + } |
1089 | + |
1090 | + private static AutomationElementCollection FindElementFromAutomationID(AutomationElement targetApp, |
1091 | + string automationID) |
1092 | + { |
1093 | + return targetApp.FindAll( |
1094 | + TreeScope.Descendants, |
1095 | + new PropertyCondition(AutomationElement.AutomationIdProperty, automationID)); |
1096 | + } |
1097 | + |
1098 | + //TreeNode baum = new TreeNode(); |
1099 | + //AutomationElement test = AutomationElement.RootElement; |
1100 | + |
1101 | + static void Main(string[] args) |
1102 | + { |
1103 | + |
1104 | + AutomationElementCollection desktopChildren = AutomationElement.RootElement.FindAll(TreeScope.Children, Condition.TrueCondition); |
1105 | + AutomationElement adobe = AutomationElement.RootElement.FindFirst(TreeScope.Children, Condition.TrueCondition); |
1106 | + AutomationElement adobe2 = FindChildAt(AutomationElement.RootElement, 6); |
1107 | + |
1108 | + string zahl = "3644"; |
1109 | + |
1110 | + AutomationElementCollection test = FindElementFromAutomationID(adobe, zahl); |
1111 | + //AutomationElement adobe3 = test[0]; |
1112 | + |
1113 | + Console.WriteLine("Verbindungstest"); |
1114 | + |
1115 | + if (adobe2 != null) |
1116 | + { |
1117 | + Console.WriteLine(adobe2.Current.Name + " was selected."); |
1118 | + } |
1119 | + adobe2.SetFocus(); |
1120 | + } |
1121 | + |
1122 | +// void PropertyCallsExample(AutomationElement elementList) |
1123 | +// { |
1124 | + // The following two calls are equivalent. |
1125 | +// string name = elementList.Current.Name; |
1126 | +// name = elementList.GetCurrentPropertyValue(AutomationElement.NameProperty) as string; |
1127 | + |
1128 | + // The following shows how to ignore the default property, which |
1129 | + // would probably be an empty string if the property is not supported. |
1130 | + // Passing "false" as the second parameter is equivalent to using the overload |
1131 | + // that does not have this parameter. |
1132 | +// object help = elementList.GetCurrentPropertyValue(AutomationElement.HelpTextProperty, true); |
1133 | +// if (help == AutomationElement.NotSupported) |
1134 | +// { |
1135 | +// help = "No help available"; |
1136 | +// } |
1137 | +// string helpText = (string)help; |
1138 | +// } |
1139 | + |
1140 | + /// <summary> |
1141 | + /// Walks the UI Automation tree and adds the control type of each element it finds |
1142 | + /// in the control view to a TreeView. |
1143 | + /// </summary> |
1144 | + /// <param name="rootElement">The root of the search on this iteration.</param> |
1145 | + /// <param name="treeNode">The node in the TreeView for this iteration.</param> |
1146 | + /// <remarks> |
1147 | + /// This is a recursive function that maps out the structure of the subtree beginning at the |
1148 | + /// UI Automation element passed in as rootElement on the first call. This could be, for example, |
1149 | + /// an application window. |
1150 | + /// CAUTION: Do not pass in AutomationElement.RootElement. Attempting to map out the entire subtree of |
1151 | + /// the desktop could take a very long time and even lead to a stack overflow. |
1152 | + /// </remarks> |
1153 | +// private void WalkControlElements(AutomationElement rootElement, TreeNode treeNode) |
1154 | +// { |
1155 | +// // Conditions for the basic views of the subtree (content, control, and raw) |
1156 | +// // are available as fields of TreeWalker, and one of these is used in the |
1157 | +// // following code. |
1158 | +// AutomationElement elementNode = TreeWalker.ControlViewWalker.GetFirstChild(rootElement); |
1159 | +// |
1160 | +// while (elementNode != null) |
1161 | +// { |
1162 | +// TreeNode childTreeNode = treeNode.Nodes.Add(elementNode.Current.ControlType.LocalizedControlType); |
1163 | +// WalkControlElements(elementNode, childTreeNode); |
1164 | +// elementNode = TreeWalker.ControlViewWalker.GetNextSibling(elementNode); |
1165 | +// } |
1166 | +// } |
1167 | + } |
1168 | +} |
1169 | |
1170 | === added directory 'sensors/adobe/ConsoleApplication1/ConsoleApplication1/Properties' |
1171 | === added file 'sensors/adobe/ConsoleApplication1/ConsoleApplication1/Properties/AssemblyInfo.cs' |
1172 | --- sensors/adobe/ConsoleApplication1/ConsoleApplication1/Properties/AssemblyInfo.cs 1970-01-01 00:00:00 +0000 |
1173 | +++ sensors/adobe/ConsoleApplication1/ConsoleApplication1/Properties/AssemblyInfo.cs 2011-08-16 15:43:57 +0000 |
1174 | @@ -0,0 +1,36 @@ |
1175 | +using System.Reflection; |
1176 | +using System.Runtime.CompilerServices; |
1177 | +using System.Runtime.InteropServices; |
1178 | + |
1179 | +// Allgemeine Informationen über eine Assembly werden über die folgenden |
1180 | +// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern, |
1181 | +// die mit einer Assembly verknüpft sind. |
1182 | +[assembly: AssemblyTitle("ConsoleApplication1")] |
1183 | +[assembly: AssemblyDescription("")] |
1184 | +[assembly: AssemblyConfiguration("")] |
1185 | +[assembly: AssemblyCompany("Microsoft")] |
1186 | +[assembly: AssemblyProduct("ConsoleApplication1")] |
1187 | +[assembly: AssemblyCopyright("Copyright © Microsoft 2011")] |
1188 | +[assembly: AssemblyTrademark("")] |
1189 | +[assembly: AssemblyCulture("")] |
1190 | + |
1191 | +// Durch Festlegen von ComVisible auf "false" werden die Typen in dieser Assembly unsichtbar |
1192 | +// für COM-Komponenten. Wenn Sie auf einen Typ in dieser Assembly von |
1193 | +// COM zugreifen müssen, legen Sie das ComVisible-Attribut für diesen Typ auf "true" fest. |
1194 | +[assembly: ComVisible(false)] |
1195 | + |
1196 | +// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird |
1197 | +[assembly: Guid("7e19d9bb-f038-4c5d-80e8-7ead0b809709")] |
1198 | + |
1199 | +// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten: |
1200 | +// |
1201 | +// Hauptversion |
1202 | +// Nebenversion |
1203 | +// Buildnummer |
1204 | +// Revision |
1205 | +// |
1206 | +// Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern |
1207 | +// übernehmen, indem Sie "*" eingeben: |
1208 | +// [assembly: AssemblyVersion("1.0.*")] |
1209 | +[assembly: AssemblyVersion("1.0.0.0")] |
1210 | +[assembly: AssemblyFileVersion("1.0.0.0")] |
1211 | |
1212 | === added directory 'sensors/adobe/ConsoleApplication1/ConsoleApplication1/bin' |
1213 | === added directory 'sensors/adobe/ConsoleApplication1/ConsoleApplication1/bin/Debug' |
1214 | === added file 'sensors/adobe/ConsoleApplication1/ConsoleApplication1/bin/Debug/ConsoleApplication1.exe' |
1215 | Binary files sensors/adobe/ConsoleApplication1/ConsoleApplication1/bin/Debug/ConsoleApplication1.exe 1970-01-01 00:00:00 +0000 and sensors/adobe/ConsoleApplication1/ConsoleApplication1/bin/Debug/ConsoleApplication1.exe 2011-08-16 15:43:57 +0000 differ |
1216 | === added file 'sensors/adobe/ConsoleApplication1/ConsoleApplication1/bin/Debug/ConsoleApplication1.pdb' |
1217 | Binary files sensors/adobe/ConsoleApplication1/ConsoleApplication1/bin/Debug/ConsoleApplication1.pdb 1970-01-01 00:00:00 +0000 and sensors/adobe/ConsoleApplication1/ConsoleApplication1/bin/Debug/ConsoleApplication1.pdb 2011-08-16 15:43:57 +0000 differ |
1218 | === added file 'sensors/adobe/ConsoleApplication1/ConsoleApplication1/bin/Debug/ConsoleApplication1.vshost.exe' |
1219 | Binary files sensors/adobe/ConsoleApplication1/ConsoleApplication1/bin/Debug/ConsoleApplication1.vshost.exe 1970-01-01 00:00:00 +0000 and sensors/adobe/ConsoleApplication1/ConsoleApplication1/bin/Debug/ConsoleApplication1.vshost.exe 2011-08-16 15:43:57 +0000 differ |
1220 | === added file 'sensors/adobe/ConsoleApplication1/ConsoleApplication1/bin/Debug/ConsoleApplication1.vshost.exe.manifest' |
1221 | --- sensors/adobe/ConsoleApplication1/ConsoleApplication1/bin/Debug/ConsoleApplication1.vshost.exe.manifest 1970-01-01 00:00:00 +0000 |
1222 | +++ sensors/adobe/ConsoleApplication1/ConsoleApplication1/bin/Debug/ConsoleApplication1.vshost.exe.manifest 2011-08-16 15:43:57 +0000 |
1223 | @@ -0,0 +1,11 @@ |
1224 | +<?xml version="1.0" encoding="UTF-8" standalone="yes"?> |
1225 | +<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> |
1226 | + <assemblyIdentity version="1.0.0.0" name="MyApplication.app"/> |
1227 | + <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2"> |
1228 | + <security> |
1229 | + <requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3"> |
1230 | + <requestedExecutionLevel level="asInvoker" uiAccess="false"/> |
1231 | + </requestedPrivileges> |
1232 | + </security> |
1233 | + </trustInfo> |
1234 | +</assembly> |
1235 | |
1236 | === added directory 'sensors/adobe/ConsoleApplication1/ConsoleApplication1/bin/Release' |
1237 | === added file 'sensors/adobe/ConsoleApplication1/ConsoleApplication1/bin/Release/ConsoleApplication1.exe' |
1238 | Binary files sensors/adobe/ConsoleApplication1/ConsoleApplication1/bin/Release/ConsoleApplication1.exe 1970-01-01 00:00:00 +0000 and sensors/adobe/ConsoleApplication1/ConsoleApplication1/bin/Release/ConsoleApplication1.exe 2011-08-16 15:43:57 +0000 differ |
1239 | === added file 'sensors/adobe/ConsoleApplication1/ConsoleApplication1/bin/Release/ConsoleApplication1.pdb' |
1240 | Binary files sensors/adobe/ConsoleApplication1/ConsoleApplication1/bin/Release/ConsoleApplication1.pdb 1970-01-01 00:00:00 +0000 and sensors/adobe/ConsoleApplication1/ConsoleApplication1/bin/Release/ConsoleApplication1.pdb 2011-08-16 15:43:57 +0000 differ |
1241 | === added file 'sensors/adobe/ConsoleApplication1/ConsoleApplication1/bin/Release/ConsoleApplication1.vshost.exe' |
1242 | Binary files sensors/adobe/ConsoleApplication1/ConsoleApplication1/bin/Release/ConsoleApplication1.vshost.exe 1970-01-01 00:00:00 +0000 and sensors/adobe/ConsoleApplication1/ConsoleApplication1/bin/Release/ConsoleApplication1.vshost.exe 2011-08-16 15:43:57 +0000 differ |
1243 | === added file 'sensors/adobe/ConsoleApplication1/ConsoleApplication1/bin/Release/ConsoleApplication1.vshost.exe.manifest' |
1244 | --- sensors/adobe/ConsoleApplication1/ConsoleApplication1/bin/Release/ConsoleApplication1.vshost.exe.manifest 1970-01-01 00:00:00 +0000 |
1245 | +++ sensors/adobe/ConsoleApplication1/ConsoleApplication1/bin/Release/ConsoleApplication1.vshost.exe.manifest 2011-08-16 15:43:57 +0000 |
1246 | @@ -0,0 +1,11 @@ |
1247 | +<?xml version="1.0" encoding="UTF-8" standalone="yes"?> |
1248 | +<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> |
1249 | + <assemblyIdentity version="1.0.0.0" name="MyApplication.app"/> |
1250 | + <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2"> |
1251 | + <security> |
1252 | + <requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3"> |
1253 | + <requestedExecutionLevel level="asInvoker" uiAccess="false"/> |
1254 | + </requestedPrivileges> |
1255 | + </security> |
1256 | + </trustInfo> |
1257 | +</assembly> |
1258 | |
1259 | === added file 'sensors/adobe/ConsoleApplication1/ConsoleApplication1/bin/Release/handle.exe' |
1260 | Binary files sensors/adobe/ConsoleApplication1/ConsoleApplication1/bin/Release/handle.exe 1970-01-01 00:00:00 +0000 and sensors/adobe/ConsoleApplication1/ConsoleApplication1/bin/Release/handle.exe 2011-08-16 15:43:57 +0000 differ |
1261 | === added directory 'sensors/adobe/ConsoleApplication1/ConsoleApplication1/obj' |
1262 | === added directory 'sensors/adobe/ConsoleApplication1/ConsoleApplication1/obj/x86' |
1263 | === added directory 'sensors/adobe/ConsoleApplication1/ConsoleApplication1/obj/x86/Debug' |
1264 | === added file 'sensors/adobe/ConsoleApplication1/ConsoleApplication1/obj/x86/Debug/ConsoleApplication1.csproj.FileListAbsolute.txt' |
1265 | --- sensors/adobe/ConsoleApplication1/ConsoleApplication1/obj/x86/Debug/ConsoleApplication1.csproj.FileListAbsolute.txt 1970-01-01 00:00:00 +0000 |
1266 | +++ sensors/adobe/ConsoleApplication1/ConsoleApplication1/obj/x86/Debug/ConsoleApplication1.csproj.FileListAbsolute.txt 2011-08-16 15:43:57 +0000 |
1267 | @@ -0,0 +1,5 @@ |
1268 | +c:\users\xarfai\documents\visual studio 2010\Projects\ConsoleApplication1\ConsoleApplication1\bin\Debug\ConsoleApplication1.exe |
1269 | +c:\users\xarfai\documents\visual studio 2010\Projects\ConsoleApplication1\ConsoleApplication1\bin\Debug\ConsoleApplication1.pdb |
1270 | +c:\users\xarfai\documents\visual studio 2010\Projects\ConsoleApplication1\ConsoleApplication1\obj\x86\Debug\ResolveAssemblyReference.cache |
1271 | +c:\users\xarfai\documents\visual studio 2010\Projects\ConsoleApplication1\ConsoleApplication1\obj\x86\Debug\ConsoleApplication1.exe |
1272 | +c:\users\xarfai\documents\visual studio 2010\Projects\ConsoleApplication1\ConsoleApplication1\obj\x86\Debug\ConsoleApplication1.pdb |
1273 | |
1274 | === added file 'sensors/adobe/ConsoleApplication1/ConsoleApplication1/obj/x86/Debug/ConsoleApplication1.exe' |
1275 | Binary files sensors/adobe/ConsoleApplication1/ConsoleApplication1/obj/x86/Debug/ConsoleApplication1.exe 1970-01-01 00:00:00 +0000 and sensors/adobe/ConsoleApplication1/ConsoleApplication1/obj/x86/Debug/ConsoleApplication1.exe 2011-08-16 15:43:57 +0000 differ |
1276 | === added file 'sensors/adobe/ConsoleApplication1/ConsoleApplication1/obj/x86/Debug/ConsoleApplication1.pdb' |
1277 | Binary files sensors/adobe/ConsoleApplication1/ConsoleApplication1/obj/x86/Debug/ConsoleApplication1.pdb 1970-01-01 00:00:00 +0000 and sensors/adobe/ConsoleApplication1/ConsoleApplication1/obj/x86/Debug/ConsoleApplication1.pdb 2011-08-16 15:43:57 +0000 differ |
1278 | === added file 'sensors/adobe/ConsoleApplication1/ConsoleApplication1/obj/x86/Debug/DesignTimeResolveAssemblyReferencesInput.cache' |
1279 | Binary files sensors/adobe/ConsoleApplication1/ConsoleApplication1/obj/x86/Debug/DesignTimeResolveAssemblyReferencesInput.cache 1970-01-01 00:00:00 +0000 and sensors/adobe/ConsoleApplication1/ConsoleApplication1/obj/x86/Debug/DesignTimeResolveAssemblyReferencesInput.cache 2011-08-16 15:43:57 +0000 differ |
1280 | === added directory 'sensors/adobe/ConsoleApplication1/ConsoleApplication1/obj/x86/Debug/TempPE' |
1281 | === added directory 'sensors/adobe/ConsoleApplication1/ConsoleApplication1/obj/x86/Release' |
1282 | === added file 'sensors/adobe/ConsoleApplication1/ConsoleApplication1/obj/x86/Release/AdobeSensor.csproj.FileListAbsolute.txt' |
1283 | --- sensors/adobe/ConsoleApplication1/ConsoleApplication1/obj/x86/Release/AdobeSensor.csproj.FileListAbsolute.txt 1970-01-01 00:00:00 +0000 |
1284 | +++ sensors/adobe/ConsoleApplication1/ConsoleApplication1/obj/x86/Release/AdobeSensor.csproj.FileListAbsolute.txt 2011-08-16 15:43:57 +0000 |
1285 | @@ -0,0 +1,10 @@ |
1286 | +C:\Users\xarfai\documents\visual studio 2010\Projects\ConsoleApplication1\ConsoleApplication1\bin\Release\ConsoleApplication1.exe |
1287 | +C:\Users\xarfai\documents\visual studio 2010\Projects\ConsoleApplication1\ConsoleApplication1\bin\Release\ConsoleApplication1.pdb |
1288 | +C:\Users\xarfai\documents\visual studio 2010\Projects\ConsoleApplication1\ConsoleApplication1\obj\x86\Release\ResolveAssemblyReference.cache |
1289 | +C:\Users\xarfai\documents\visual studio 2010\Projects\ConsoleApplication1\ConsoleApplication1\obj\x86\Release\ConsoleApplication1.exe |
1290 | +C:\Users\xarfai\documents\visual studio 2010\Projects\ConsoleApplication1\ConsoleApplication1\obj\x86\Release\ConsoleApplication1.pdb |
1291 | +C:\Users\andi\Documents\Visual Studio 2010\Projects\ConsoleApplication1\ConsoleApplication1\obj\x86\Release\ConsoleApplication1.exe |
1292 | +C:\Users\andi\Documents\Visual Studio 2010\Projects\ConsoleApplication1\ConsoleApplication1\obj\x86\Release\ConsoleApplication1.pdb |
1293 | +C:\Users\andi\Documents\Visual Studio 2010\Projects\ConsoleApplication1\ConsoleApplication1\bin\Release\ConsoleApplication1.exe |
1294 | +C:\Users\andi\Documents\Visual Studio 2010\Projects\ConsoleApplication1\ConsoleApplication1\bin\Release\ConsoleApplication1.pdb |
1295 | +C:\Users\andi\Documents\Visual Studio 2010\Projects\ConsoleApplication1\ConsoleApplication1\obj\x86\Release\ResolveAssemblyReference.cache |
1296 | |
1297 | === added file 'sensors/adobe/ConsoleApplication1/ConsoleApplication1/obj/x86/Release/ConsoleApplication1.csproj.FileListAbsolute.txt' |
1298 | --- sensors/adobe/ConsoleApplication1/ConsoleApplication1/obj/x86/Release/ConsoleApplication1.csproj.FileListAbsolute.txt 1970-01-01 00:00:00 +0000 |
1299 | +++ sensors/adobe/ConsoleApplication1/ConsoleApplication1/obj/x86/Release/ConsoleApplication1.csproj.FileListAbsolute.txt 2011-08-16 15:43:57 +0000 |
1300 | @@ -0,0 +1,5 @@ |
1301 | +c:\users\xarfai\documents\visual studio 2010\Projects\ConsoleApplication1\ConsoleApplication1\bin\Release\ConsoleApplication1.exe |
1302 | +c:\users\xarfai\documents\visual studio 2010\Projects\ConsoleApplication1\ConsoleApplication1\bin\Release\ConsoleApplication1.pdb |
1303 | +c:\users\xarfai\documents\visual studio 2010\Projects\ConsoleApplication1\ConsoleApplication1\obj\x86\Release\ResolveAssemblyReference.cache |
1304 | +c:\users\xarfai\documents\visual studio 2010\Projects\ConsoleApplication1\ConsoleApplication1\obj\x86\Release\ConsoleApplication1.exe |
1305 | +c:\users\xarfai\documents\visual studio 2010\Projects\ConsoleApplication1\ConsoleApplication1\obj\x86\Release\ConsoleApplication1.pdb |
1306 | |
1307 | === added file 'sensors/adobe/ConsoleApplication1/ConsoleApplication1/obj/x86/Release/ConsoleApplication1.exe' |
1308 | Binary files sensors/adobe/ConsoleApplication1/ConsoleApplication1/obj/x86/Release/ConsoleApplication1.exe 1970-01-01 00:00:00 +0000 and sensors/adobe/ConsoleApplication1/ConsoleApplication1/obj/x86/Release/ConsoleApplication1.exe 2011-08-16 15:43:57 +0000 differ |
1309 | === added file 'sensors/adobe/ConsoleApplication1/ConsoleApplication1/obj/x86/Release/ConsoleApplication1.pdb' |
1310 | Binary files sensors/adobe/ConsoleApplication1/ConsoleApplication1/obj/x86/Release/ConsoleApplication1.pdb 1970-01-01 00:00:00 +0000 and sensors/adobe/ConsoleApplication1/ConsoleApplication1/obj/x86/Release/ConsoleApplication1.pdb 2011-08-16 15:43:57 +0000 differ |
1311 | === added file 'sensors/adobe/ConsoleApplication1/ConsoleApplication1/obj/x86/Release/DesignTimeResolveAssemblyReferencesInput.cache' |
1312 | Binary files sensors/adobe/ConsoleApplication1/ConsoleApplication1/obj/x86/Release/DesignTimeResolveAssemblyReferencesInput.cache 1970-01-01 00:00:00 +0000 and sensors/adobe/ConsoleApplication1/ConsoleApplication1/obj/x86/Release/DesignTimeResolveAssemblyReferencesInput.cache 2011-08-16 15:43:57 +0000 differ |
1313 | === added file 'sensors/adobe/ConsoleApplication1/ConsoleApplication1/obj/x86/Release/ResolveAssemblyReference.cache' |
1314 | Binary files sensors/adobe/ConsoleApplication1/ConsoleApplication1/obj/x86/Release/ResolveAssemblyReference.cache 1970-01-01 00:00:00 +0000 and sensors/adobe/ConsoleApplication1/ConsoleApplication1/obj/x86/Release/ResolveAssemblyReference.cache 2011-08-16 15:43:57 +0000 differ |
1315 | === added directory 'sensors/adobe/ConsoleApplication1/ConsoleApplication1/obj/x86/Release/TempPE' |