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).

1  
static class Injection {
2  
  int vmPort;
3  
  S injectionID;
4  
}
5  
6  
static Injection injectTo(int vmPort, S progID) {
7  
  ret injectTo(String.valueOf(vmPort), progID);
8  
}
9  
10  
static Injection injectTo(S vmName, S progID) {
11  
  S line = format3("Please inject program *.", progID);
12  
  
13  
  temp DialogIO injectionPoint = findBot(isInteger(vmName) ? vmName : "This is a JavaX VM. " + vmName);
14  
  if (injectionPoint == null) null;
15  
  injectionPoint.readLine();
16  
  S answer = injectionPoint.askLoudly(line);
17  
  new Matches m;
18  
  if (match3("OK. Injection ID: *", answer, m)) {
19  
    new Injection i;
20  
    i.vmPort = injectionPoint.getSocket().getPort();
21  
    i.injectionID = m.unq(0);
22  
    ret i;
23  
  }
24  
  throw fail(answer);
25  
}

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: 733 / 2430
Version history: 1 change(s)
Referenced in: [show references]