@@ -2,7 +2,6 @@ import * as vscode from 'vscode';
22import * as path from 'path' ;
33import * as WebSocket from 'ws' ;
44import { Event } from './utils/events' ;
5- import './utils/extensions' ;
65
76var socket : WebSocket ;
87
@@ -15,13 +14,17 @@ function getCurrentDocument(): string {
1514 return vscode . window . activeTextEditor ?. document . uri . fsPath as string ;
1615}
1716
17+ function toBuffer ( obj : Object ) : Buffer {
18+ return Buffer . from ( JSON . stringify ( obj ) ) ;
19+ }
20+
1821function executeScriptInIDA ( ) {
1922 const currentDocument = getCurrentDocument ( ) ;
2023 const name = path . parse ( currentDocument ) . base ;
21- socket . send ( {
24+ socket . send ( toBuffer ( {
2225 event : Event . ExecuteScript ,
2326 path : currentDocument
24- } . toBuffer ( ) ) ;
27+ } ) ) ;
2528 vscode . window . showInformationMessage ( `Sent ${ name } to IDA` ) ;
2629}
2730
@@ -47,10 +50,10 @@ function connectToIDA() {
4750 prompt : 'Enter the path to the folder containing the script' ,
4851 value : currentFolder
4952 } ) ;
50- socket . send ( {
53+ socket . send ( toBuffer ( {
5154 event : Event . SetWorkspace ,
5255 path : workspaceFolder
53- } . toBuffer ( ) ) ;
56+ } ) ) ;
5457 vscode . window . showInformationMessage ( `Set workspace folder to ${ workspaceFolder } ` ) ;
5558 resolve ( ) ;
5659 } ) ;
@@ -81,9 +84,9 @@ function connectToIDA() {
8184}
8285
8386function attachToIDA ( ) {
84- socket . send ( {
87+ socket . send ( toBuffer ( {
8588 event : Event . AttachDebugger
86- } . toBuffer ( ) ) ;
89+ } ) ) ;
8790}
8891
8992function connectAndAttachToIDA ( ) {
0 commit comments