Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

25
LINES

< > BotCompany Repo | #1001711 // injectTo - inject code to one VM

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (6252L/41K).

static class Injection {
  int vmPort;
  S injectionID;
}

static Injection injectTo(int vmPort, S progID) {
  ret injectTo(String.valueOf(vmPort), progID);
}

static Injection injectTo(S vmName, S progID) {
  S line = format3("Please inject program *.", progID);
  
  temp DialogIO injectionPoint = findBot(isInteger(vmName) ? vmName : "This is a JavaX VM. " + vmName);
  if (injectionPoint == null) null;
  injectionPoint.readLine();
  S answer = injectionPoint.askLoudly(line);
  new Matches m;
  if (match3("OK. Injection ID: *", answer, m)) {
    new Injection i;
    i.vmPort = injectionPoint.getSocket().getPort();
    i.injectionID = m.unq(0);
    ret i;
  }
  throw fail(answer);
}

Author comment

Began life as a copy of #1001632

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1001711
Snippet name: injectTo - inject code to one VM
Eternal ID of this version: #1001711/2
Text MD5: 5fb9733250acc8510a5fe8ea5efe3d2e
Transpilation MD5: 25a579770da1b49861e603a94c15fdce
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-07-13 22:37:07
Source code size: 714 bytes / 25 lines
Pitched / IR pitched: No / No
Views / Downloads: 731 / 2426
Version history: 1 change(s)
Referenced in: [show references]