private fun saveMacro(): Boolean { if (firstTime) { try { Thread.sleep(firstTimeSleep) } catch (e: InterruptedException) { e.printStackTrace() } } firstTime = false val macroAccy = ByteArray(macroSize) var index = 0 var accyNum = 0 accyNum = getAccyRow(macroAccy, index, textAccy1, accyTextField1, cmdButton1) if (accyNum < 0) { return false } if (accyNum > 0) { index += 2 } accyNum = getAccyRow(macroAccy, index, textAccy2, accyTextField2, cmdButton2) if (accyNum < 0) { return false } if (accyNum > 0) { index += 2 } accyNum getAccyRow(macroAccy, index, textAccy3, accyTextField3, cmdButton3) if (accyNum < 0) { return false } if (accyNum > 0) { index += 2 } accyNum = getAccyRow(macroAccy, index, textAccy4, accyTextField4, cmdButton4) if (accyNum < 0) { return false } if (accyNum > 0) { index += 2 } accyNum = getAccyRow(macroAccy, index, textAccy5, accyTextField5, cmdButton5) if (accyNum < 0) { return false } if (accyNum > 0) { index += 2 } accyNum = getAccyRow(macroAccy, index, textAccy6, accyTextField6, cmdButton6) if (accyNum < 0) { return false } if (accyNum > 0) { index += 2 } accyNum = getAccyRow(macroAccy, index, textAccy7, accyTextField7, cmdButton7) if (accyNum < 0) { return false } if (accyNum > 0) { index += 2 } if (!isUsb) { accyNum = getAccyRow(macroAccy, index, textAccy8, accyTextField8, cmdButton8) if (accyNum < 0) { return false } if (accyNum > 0) { index += 2 } accyNum = getAccyRow(macroAccy, index, textAccy9, accyTextField9, cmdButton9) if (accyNum < 0) { return false } if (accyNum > 0) { index += 2 } } accyNum = getAccyRow(macroAccy, index, textAccy10, accyTextField10, cmdButton10) if (accyNum < 0) { javax.swing.JOptionPane.showMessageDialog( this, rb.getString("EnterMacroNumberLine10"), rb.getString("NceMacro"), javax.swing.JOptionPane.ERROR_MESSAGE ) return false } processMemory(false, true, macroNum, macroAccy) return true }
Writes all bytes to NCE CS memory as long as there are no user input errors