Genesis2000用c#开发外挂
先上官方的说明
gateway is a command line utility for sending messages and commands to Genesis processes. The gateway command works between all systems that are connected to the same gnd server (in a client-server mode).
This command allows you send messages or run commands or scripts on any genesis process currently running without having to interfere with the GUI on that station.
Running gateway does not require any additional licenses. The program itself is located in $GENESIS_DIR/exx/misc where xx is the version number (eg. e72)
gateway may be called in one of the following modes:
gateway
Sends a message to an address
gateway ’WHO ’
Returns matching address
gateway ’PID ’
Returns process IDs of matching adress
gateway
Opens an interactive session
is formed as @., where is the Genesis login name, is the name of the computer, and is the name of the X Display that is displaying the “get” process.
As from v7.1, can also be formed as @computer.display, where is the process id of the get process, is the name of the computer, and is the name of the X Display that is displaying the “get” process. This can be important if there are two get’s running on the same computer/display
A star symbol (“*”) may be used for globbing any part of an address.
may be any of the following:
WHO
This message returns a space separated list of all addresses matching the
PID
This message returns a space separated list of the Process IDs of all addresses matching the .
COM
This message send a Genesis line mode command to all Genesis processes matching the specified address, unless the operator has specified, “DON’T accept messages” in the clipboard. This message returns zero if the command completed properly. Otherwise it returns a status code.
MSG
This will cause all Genesis processes matching the specified address to receive a message and display it to the operator, unless the operator has specified “DON’T accept messages” in the clipboard.
ERR
This returns the display string of the error code.
COMANS
This returns the COMANS of the last COM command
When working in an interactive session, any of the above messages may be sent.
A period “.” on a line by itself causes the gateway to exit. When you wish to close the session, the command must be used, since even ifgateway has finished reading its standard input, it continues polling for more
messages.
# Print a list of all Genesis users
% gateway ’WHO *’
# Print a list of all the instances that “ben” is logged in on Genesis
% gateway ’WHO ben@*’
# Print the process IDs of all the instances of “ben” logged in on jupiter.
% gateway ’PID ben@jupiter.jupiter’
# Open a job on a specific Genesis process.
% gateway ben@jupiter.jupiter ’COM open_job,job=1745’
# An interactive session
% gateway ben@jupiter.jupiter
COM script_run,name=/my_scripts/run_analysis,params=pcb
.
Note “get” may be run with the “-x” option and without a script. This puts Genesis into a mode where it will respond to gateway COMmessages but will operate without a user interface.
Note This feature first appeared in Genesis Version 6.0c.
In Genesis v7.1, Gateway recognizes addresses of the following form:
% gateway @computer.display
To open a session with a get process with pid 17777 use:
% gateway %17777@pluto.pluto
(The % notation was chosen since a username could also be numeric.)
Also, in Genesis v7.1, the new command COMANS has been added. This command returns the COMANS of the last COM command. Here is a sample session:
% gateway ben@pluto.pluto
COM open_job,job=0.01745
0
COM open_entity,job=0.01745,type=step,name=pcb
0
0
COM filter_area_xy,x=1,y=1
0
COM filter_area_xy,x=0,y=0
0
COM filter_area_end
0
COMANS
7
好吧这么多英文我看着也头疼,总之外挂需要用到gateway程序,c#程序就是通过process类进行输入和输出,如下代码
核心的代码就是sendcommand函数,由于genesis有多个特殊指令,这里我只写了COM指令;还有获取用户地址的时候打开系统的任务管理器看一下是否有多个gnd或gateway运行,如果存在多个gnd程序就会崩溃,gateway最好只留一个
接着队代码进行进行测试,新建一个winform程序,添加两个 richTextBox一个用来输入指令,一个接收返回值
发送指令事件代码
编译好程序打开genesis队程序进行测试,发送指令前如图:
发送指令后
程序测试完成并能接收到结果0;