Source/sources/com/google/appinventor/components/runtime/NxtDirectCommands.java
@com.google.appinventor.components.annotations.SimpleFunction(description = "Download a file to the robot.")
    /* Code decompiled incorrectly, please refer to instructions dump. */
    public void DownloadFile(java.lang.String r20, java.lang.String r21) {
        /*
            r19 = this;
            java.lang.String r5 = "DownloadFile"
            r0 = r19
            boolean r14 = r0.checkBluetooth(r5)
            if (r14 != 0) goto L_0x000b
        L_0x000a:
            return
        L_0x000b:
            int r14 = r20.length()
            if (r14 != 0) goto L_0x0027
            r0 = r19
            com.google.appinventor.components.runtime.Form r14 = r0.form
            r15 = 414(0x19e, float:5.8E-43)
            r16 = 0
            r0 = r16
            java.lang.Object[] r0 = new java.lang.Object[r0]
            r16 = r0
            r0 = r19
            r1 = r16
            r14.dispatchErrorOccurredEvent(r0, r5, r15, r1)
            goto L_0x000a
        L_0x0027:
            int r14 = r21.length()
            if (r14 != 0) goto L_0x0043
            r0 = r19
            com.google.appinventor.components.runtime.Form r14 = r0.form
            r15 = 415(0x19f, float:5.82E-43)
            r16 = 0
            r0 = r16
            java.lang.Object[] r0 = new java.lang.Object[r0]
            r16 = r0
            r0 = r19
            r1 = r16
            r14.dispatchErrorOccurredEvent(r0, r5, r15, r1)
            goto L_0x000a
        L_0x0043:
            r0 = r19
            com.google.appinventor.components.runtime.Form r14 = r0.form     // Catch:{ IOException -> 0x0081 }
            r0 = r20
            java.io.File r12 = com.google.appinventor.components.runtime.util.MediaUtil.copyMediaToTempFile(r14, r0)     // Catch:{ IOException -> 0x0081 }
            java.io.BufferedInputStream r9 = new java.io.BufferedInputStream     // Catch:{ all -> 0x00ef }
            java.io.FileInputStream r14 = com.google.appinventor.components.runtime.util.FileUtil.openFile(r12)     // Catch:{ all -> 0x00ef }
            r15 = 1024(0x400, float:1.435E-42)
            r9.<init>(r14, r15)     // Catch:{ all -> 0x00ef }
            long r6 = r12.length()     // Catch:{ all -> 0x00ea }
            java.lang.String r14 = ".rxe"
            r0 = r21
            boolean r14 = r0.endsWith(r14)     // Catch:{ all -> 0x00ea }
            if (r14 != 0) goto L_0x0070
            java.lang.String r14 = ".ric"
            r0 = r21
            boolean r14 = r0.endsWith(r14)     // Catch:{ all -> 0x00ea }
            if (r14 == 0) goto L_0x00a1
        L_0x0070:
            r0 = r19
            r1 = r21
            java.lang.Integer r8 = r0.openWriteLinear(r5, r1, r6)     // Catch:{ all -> 0x00ea }
        L_0x0078:
            if (r8 != 0) goto L_0x00aa
            r9.close()     // Catch:{ all -> 0x00ef }
            r12.delete()     // Catch:{ IOException -> 0x0081 }
            goto L_0x000a
        L_0x0081:
            r4 = move-exception
            r0 = r19
            com.google.appinventor.components.runtime.Form r14 = r0.form
            r15 = 416(0x1a0, float:5.83E-43)
            r16 = 1
            r0 = r16
            java.lang.Object[] r0 = new java.lang.Object[r0]
            r16 = r0
            r17 = 0
            java.lang.String r18 = r4.getMessage()
            r16[r17] = r18
            r0 = r19
            r1 = r16
            r14.dispatchErrorOccurredEvent(r0, r5, r15, r1)
            goto L_0x000a
        L_0x00a1:
            r0 = r19
            r1 = r21
            java.lang.Integer r8 = r0.openWrite(r5, r1, r6)     // Catch:{ all -> 0x00ea }
            goto L_0x0078
        L_0x00aa:
            r14 = 32
            byte[] r2 = new byte[r14]     // Catch:{ all -> 0x00df }
            r10 = 0
        L_0x00b0:
            int r14 = (r10 > r6 ? 1 : (r10 == r6 ? 0 : -1))
            if (r14 >= 0) goto L_0x00ce
            r14 = 32
            long r16 = r6 - r10
            long r14 = java.lang.Math.min(r14, r16)     // Catch:{ all -> 0x00df }
            int r3 = (int) r14     // Catch:{ all -> 0x00df }
            r14 = 0
            r9.read(r2, r14, r3)     // Catch:{ all -> 0x00df }
            int r14 = r8.intValue()     // Catch:{ all -> 0x00df }
            r0 = r19
            int r13 = r0.writeChunk(r5, r14, r2, r3)     // Catch:{ all -> 0x00df }
            long r14 = (long) r13
            long r10 = r10 + r14
            goto L_0x00b0
        L_0x00ce:
            int r14 = r8.intValue()     // Catch:{ all -> 0x00ea }
            r0 = r19
            r0.closeHandle(r5, r14)     // Catch:{ all -> 0x00ea }
            r9.close()     // Catch:{ all -> 0x00ef }
            r12.delete()     // Catch:{ IOException -> 0x0081 }
            goto L_0x000a
        L_0x00df:
            r14 = move-exception
            int r15 = r8.intValue()     // Catch:{ all -> 0x00ea }
            r0 = r19
            r0.closeHandle(r5, r15)     // Catch:{ all -> 0x00ea }
            throw r14     // Catch:{ all -> 0x00ea }
        L_0x00ea:
            r14 = move-exception
            r9.close()     // Catch:{ all -> 0x00ef }
            throw r14     // Catch:{ all -> 0x00ef }
        L_0x00ef:
            r14 = move-exception
            r12.delete()     // Catch:{ IOException -> 0x0081 }
            throw r14     // Catch:{ IOException -> 0x0081 }
        */
        throw new UnsupportedOperationException("Method not decompiled: com.google.appinventor.components.runtime.NxtDirectCommands.DownloadFile(java.lang.String, java.lang.String):void");
    }
/* JADX WARNING: Removed duplicated region for block: B:29:0x00aa  */
JADX WARNING: Removed duplicated region for block: B:29:0x00aa
JADX WARNING : Removed duplicated region for block : B : 29 : 0x00aa
@com.google.appinventor.components.annotations.SimpleFunction(description = "Download a file to the robot.")
    /* Code decompiled incorrectly, please refer to instructions dump. */
    public void DownloadFile(java.lang.String r20, java.lang.String r21) {
        /*
            r19 = this;
            java.lang.String r5 = "DownloadFile"
            r0 = r19
            boolean r14 = r0.checkBluetooth(r5)
            if (r14 != 0) goto L_0x000b
        L_0x000a:
            return
        L_0x000b:
            int r14 = r20.length()
            if (r14 != 0) goto L_0x0027
            r0 = r19
            com.google.appinventor.components.runtime.Form r14 = r0.form
            r15 = 414(0x19e, float:5.8E-43)
            r16 = 0
            r0 = r16
            java.lang.Object[] r0 = new java.lang.Object[r0]
            r16 = r0
            r0 = r19
            r1 = r16
            r14.dispatchErrorOccurredEvent(r0, r5, r15, r1)
            goto L_0x000a
        L_0x0027:
            int r14 = r21.length()
            if (r14 != 0) goto L_0x0043
            r0 = r19
            com.google.appinventor.components.runtime.Form r14 = r0.form
            r15 = 415(0x19f, float:5.82E-43)
            r16 = 0
            r0 = r16
            java.lang.Object[] r0 = new java.lang.Object[r0]
            r16 = r0
            r0 = r19
            r1 = r16
            r14.dispatchErrorOccurredEvent(r0, r5, r15, r1)
            goto L_0x000a
        L_0x0043:
            r0 = r19
            com.google.appinventor.components.runtime.Form r14 = r0.form     // Catch:{ IOException -> 0x0081 }
            r0 = r20
            java.io.File r12 = com.google.appinventor.components.runtime.util.MediaUtil.copyMediaToTempFile(r14, r0)     // Catch:{ IOException -> 0x0081 }
            java.io.BufferedInputStream r9 = new java.io.BufferedInputStream     // Catch:{ all -> 0x00ef }
            java.io.FileInputStream r14 = com.google.appinventor.components.runtime.util.FileUtil.openFile(r12)     // Catch:{ all -> 0x00ef }
            r15 = 1024(0x400, float:1.435E-42)
            r9.<init>(r14, r15)     // Catch:{ all -> 0x00ef }
            long r6 = r12.length()     // Catch:{ all -> 0x00ea }
            java.lang.String r14 = ".rxe"
            r0 = r21
            boolean r14 = r0.endsWith(r14)     // Catch:{ all -> 0x00ea }
            if (r14 != 0) goto L_0x0070
            java.lang.String r14 = ".ric"
            r0 = r21
            boolean r14 = r0.endsWith(r14)     // Catch:{ all -> 0x00ea }
            if (r14 == 0) goto L_0x00a1
        L_0x0070:
            r0 = r19
            r1 = r21
            java.lang.Integer r8 = r0.openWriteLinear(r5, r1, r6)     // Catch:{ all -> 0x00ea }
        L_0x0078:
            if (r8 != 0) goto L_0x00aa
            r9.close()     // Catch:{ all -> 0x00ef }
            r12.delete()     // Catch:{ IOException -> 0x0081 }
            goto L_0x000a
        L_0x0081:
            r4 = move-exception
            r0 = r19
            com.google.appinventor.components.runtime.Form r14 = r0.form
            r15 = 416(0x1a0, float:5.83E-43)
            r16 = 1
            r0 = r16
            java.lang.Object[] r0 = new java.lang.Object[r0]
            r16 = r0
            r17 = 0
            java.lang.String r18 = r4.getMessage()
            r16[r17] = r18
            r0 = r19
            r1 = r16
            r14.dispatchErrorOccurredEvent(r0, r5, r15, r1)
            goto L_0x000a
        L_0x00a1:
            r0 = r19
            r1 = r21
            java.lang.Integer r8 = r0.openWrite(r5, r1, r6)     // Catch:{ all -> 0x00ea }
            goto L_0x0078
        L_0x00aa:
            r14 = 32
            byte[] r2 = new byte[r14]     // Catch:{ all -> 0x00df }
            r10 = 0
        L_0x00b0:
            int r14 = (r10 > r6 ? 1 : (r10 == r6 ? 0 : -1))
            if (r14 >= 0) goto L_0x00ce
            r14 = 32
            long r16 = r6 - r10
            long r14 = java.lang.Math.min(r14, r16)     // Catch:{ all -> 0x00df }
            int r3 = (int) r14     // Catch:{ all -> 0x00df }
            r14 = 0
            r9.read(r2, r14, r3)     // Catch:{ all -> 0x00df }
            int r14 = r8.intValue()     // Catch:{ all -> 0x00df }
            r0 = r19
            int r13 = r0.writeChunk(r5, r14, r2, r3)     // Catch:{ all -> 0x00df }
            long r14 = (long) r13
            long r10 = r10 + r14
            goto L_0x00b0
        L_0x00ce:
            int r14 = r8.intValue()     // Catch:{ all -> 0x00ea }
            r0 = r19
            r0.closeHandle(r5, r14)     // Catch:{ all -> 0x00ea }
            r9.close()     // Catch:{ all -> 0x00ef }
            r12.delete()     // Catch:{ IOException -> 0x0081 }
            goto L_0x000a
        L_0x00df:
            r14 = move-exception
            int r15 = r8.intValue()     // Catch:{ all -> 0x00ea }
            r0 = r19
            r0.closeHandle(r5, r15)     // Catch:{ all -> 0x00ea }
            throw r14     // Catch:{ all -> 0x00ea }
        L_0x00ea:
            r14 = move-exception
            r9.close()     // Catch:{ all -> 0x00ef }
            throw r14     // Catch:{ all -> 0x00ef }
        L_0x00ef:
            r14 = move-exception
            r12.delete()     // Catch:{ IOException -> 0x0081 }
            throw r14     // Catch:{ IOException -> 0x0081 }
        */
        throw new UnsupportedOperationException("Method not decompiled: com.google.appinventor.components.runtime.NxtDirectCommands.DownloadFile(java.lang.String, java.lang.String):void");
    }
@ com . google . appinventor . components . annotations . SimpleFunction ( description = "Download a file to the robot." ) /* Code decompiled incorrectly, please refer to instructions dump. */ public void DownloadFile ( java . lang . String r20 , java . lang . String r21 ) { /*
            r19 = this;
            java.lang.String r5 = "DownloadFile"
            r0 = r19
            boolean r14 = r0.checkBluetooth(r5)
            if (r14 != 0) goto L_0x000b
        L_0x000a:
            return
        L_0x000b:
            int r14 = r20.length()
            if (r14 != 0) goto L_0x0027
            r0 = r19
            com.google.appinventor.components.runtime.Form r14 = r0.form
            r15 = 414(0x19e, float:5.8E-43)
            r16 = 0
            r0 = r16
            java.lang.Object[] r0 = new java.lang.Object[r0]
            r16 = r0
            r0 = r19
            r1 = r16
            r14.dispatchErrorOccurredEvent(r0, r5, r15, r1)
            goto L_0x000a
        L_0x0027:
            int r14 = r21.length()
            if (r14 != 0) goto L_0x0043
            r0 = r19
            com.google.appinventor.components.runtime.Form r14 = r0.form
            r15 = 415(0x19f, float:5.82E-43)
            r16 = 0
            r0 = r16
            java.lang.Object[] r0 = new java.lang.Object[r0]
            r16 = r0
            r0 = r19
            r1 = r16
            r14.dispatchErrorOccurredEvent(r0, r5, r15, r1)
            goto L_0x000a
        L_0x0043:
            r0 = r19
            com.google.appinventor.components.runtime.Form r14 = r0.form     // Catch:{ IOException -> 0x0081 }
            r0 = r20
            java.io.File r12 = com.google.appinventor.components.runtime.util.MediaUtil.copyMediaToTempFile(r14, r0)     // Catch:{ IOException -> 0x0081 }
            java.io.BufferedInputStream r9 = new java.io.BufferedInputStream     // Catch:{ all -> 0x00ef }
            java.io.FileInputStream r14 = com.google.appinventor.components.runtime.util.FileUtil.openFile(r12)     // Catch:{ all -> 0x00ef }
            r15 = 1024(0x400, float:1.435E-42)
            r9.<init>(r14, r15)     // Catch:{ all -> 0x00ef }
            long r6 = r12.length()     // Catch:{ all -> 0x00ea }
            java.lang.String r14 = ".rxe"
            r0 = r21
            boolean r14 = r0.endsWith(r14)     // Catch:{ all -> 0x00ea }
            if (r14 != 0) goto L_0x0070
            java.lang.String r14 = ".ric"
            r0 = r21
            boolean r14 = r0.endsWith(r14)     // Catch:{ all -> 0x00ea }
            if (r14 == 0) goto L_0x00a1
        L_0x0070:
            r0 = r19
            r1 = r21
            java.lang.Integer r8 = r0.openWriteLinear(r5, r1, r6)     // Catch:{ all -> 0x00ea }
        L_0x0078:
            if (r8 != 0) goto L_0x00aa
            r9.close()     // Catch:{ all -> 0x00ef }
            r12.delete()     // Catch:{ IOException -> 0x0081 }
            goto L_0x000a
        L_0x0081:
            r4 = move-exception
            r0 = r19
            com.google.appinventor.components.runtime.Form r14 = r0.form
            r15 = 416(0x1a0, float:5.83E-43)
            r16 = 1
            r0 = r16
            java.lang.Object[] r0 = new java.lang.Object[r0]
            r16 = r0
            r17 = 0
            java.lang.String r18 = r4.getMessage()
            r16[r17] = r18
            r0 = r19
            r1 = r16
            r14.dispatchErrorOccurredEvent(r0, r5, r15, r1)
            goto L_0x000a
        L_0x00a1:
            r0 = r19
            r1 = r21
            java.lang.Integer r8 = r0.openWrite(r5, r1, r6)     // Catch:{ all -> 0x00ea }
            goto L_0x0078
        L_0x00aa:
            r14 = 32
            byte[] r2 = new byte[r14]     // Catch:{ all -> 0x00df }
            r10 = 0
        L_0x00b0:
            int r14 = (r10 > r6 ? 1 : (r10 == r6 ? 0 : -1))
            if (r14 >= 0) goto L_0x00ce
            r14 = 32
            long r16 = r6 - r10
            long r14 = java.lang.Math.min(r14, r16)     // Catch:{ all -> 0x00df }
            int r3 = (int) r14     // Catch:{ all -> 0x00df }
            r14 = 0
            r9.read(r2, r14, r3)     // Catch:{ all -> 0x00df }
            int r14 = r8.intValue()     // Catch:{ all -> 0x00df }
            r0 = r19
            int r13 = r0.writeChunk(r5, r14, r2, r3)     // Catch:{ all -> 0x00df }
            long r14 = (long) r13
            long r10 = r10 + r14
            goto L_0x00b0
        L_0x00ce:
            int r14 = r8.intValue()     // Catch:{ all -> 0x00ea }
            r0 = r19
            r0.closeHandle(r5, r14)     // Catch:{ all -> 0x00ea }
            r9.close()     // Catch:{ all -> 0x00ef }
            r12.delete()     // Catch:{ IOException -> 0x0081 }
            goto L_0x000a
        L_0x00df:
            r14 = move-exception
            int r15 = r8.intValue()     // Catch:{ all -> 0x00ea }
            r0 = r19
            r0.closeHandle(r5, r15)     // Catch:{ all -> 0x00ea }
            throw r14     // Catch:{ all -> 0x00ea }
        L_0x00ea:
            r14 = move-exception
            r9.close()     // Catch:{ all -> 0x00ef }
            throw r14     // Catch:{ all -> 0x00ef }
        L_0x00ef:
            r14 = move-exception
            r12.delete()     // Catch:{ IOException -> 0x0081 }
            throw r14     // Catch:{ IOException -> 0x0081 }
        */ throw new UnsupportedOperationException ( "Method not decompiled: com.google.appinventor.components.runtime.NxtDirectCommands.DownloadFile(java.lang.String, java.lang.String):void" ) ; }
JADX WARNING: Removed duplicated region for block: B:29:0x00aa
JADX WARNING : Removed duplicated region for block : B : 29 : 0x00aa