先上官方的说明

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 <address> <message>

Sends a message to an address

gateway ’WHO <address>’

Returns matching address

gateway ’PID <address>’

Returns process IDs of matching adress

gateway <address>

Opens an interactive session

 

  • <address> is formed as <user>@<computer>.<display name>, where <user> is the Genesis login name, <computer> is the name of the computer, and <display> is the name of the X Display that is displaying the “get” process.
  • As from v7.1, <address> can also be formed as <pid>@computer.display, where <pid> is the process id of the get process, <computer> is the name of the computer, and <display> 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.

 

  • <message> may be any of the following:

 

WHO <address>

This message returns a space separated list of all addresses matching the <address>

 

PID <address>

This message returns a space separated list of the Process IDs of all addresses matching the <address>.

COM <genesis line mode command>

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 <message text>

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 <error code>

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 if gateway has finished reading its standard input, it continues polling for more

messages.

Examples

# 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 open_job,job=1745

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 COM messages 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 <pid>@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

COM filter_area_start

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类进行输入和输出,如下代码

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text; namespace WindowsFormsApplication4
{
public class Genesis
{
//gateway的运行命令色这个样子的 gateway <address> <message>
//address为genesis上的数据: 用户名@机器名.机器名
//这里我只取第一个用户名为脚本执行的地方
/// <summary>
/// 程序运行的对应用户地址
/// </summary>
private string address { get; set; } /// <summary>
///从系统环境变量获取GENESIS的根目录
/// </summary>
string GENESIS_DIR { get { return Environment.GetEnvironmentVariable("GENESIS_DIR");} }
/// <summary>
///从系统环境变量获取GENESIS的程序目录
/// </summary>
string GENESIS_EDIR { get { return Environment.GetEnvironmentVariable("GENESIS_EDIR"); } } /// <summary>
/// 发送指令给genesis
/// </summary>
/// <param name="cmdText"></param>
/// <returns></returns>
public Genesis()
{
//返回结果以的用户以\r\n隔开要替换掉为,再分组
string s = SendCommand("\"WHO\"");
string[] users = s.Trim().Replace(' ',',').Split(',');
if (users.Count()>0)
{
address = users[users.Count()-1];
}
}
private string SendCommand(string cmdText)
{
Process p=new Process();
p.StartInfo.FileName = GENESIS_EDIR + @"\misc\gateway.exe";
//返回错误提示
p.StartInfo.RedirectStandardError = true;
//可以发送指令
p.StartInfo.RedirectStandardInput = true;
//可以用接受指令执行结果
p.StartInfo.RedirectStandardOutput = true;
//执行命令不显示窗口
p.StartInfo.CreateNoWindow = true;
///执行指令
p.StartInfo.Arguments = cmdText;
p.StartInfo.UseShellExecute = false;
//
p.Start();
//接收指令执行结果
StreamReader read = p.StandardOutput;
string s = read.ReadLine();
//结束进程
p.Close();
return s;
} public string COM(string cmdText)
{
return SendCommand(string.Format(address+ " \"COM {0}\"",cmdText));
}
}
}

  核心的代码就是sendcommand函数,由于genesis有多个特殊指令,这里我只写了COM指令;还有获取用户地址的时候打开系统的任务管理器看一下是否有多个gnd或gateway运行,如果存在多个gnd程序就会崩溃,gateway最好只留一个

接着队代码进行进行测试,新建一个winform程序,添加两个 richTextBox一个用来输入指令,一个接收返回值

发送指令事件代码

 private void button1_Click(object sender, EventArgs e)
{ Genesis gen=new Genesis();
//richTextBox2.AppendText(gen.COM("clipb_open_job,job=test,update_clipboard=view_job"));
 richTextBox2.AppendText(gen.COM(  richTextBox1.Text));
}

  编译好程序打开genesis队程序进行测试,发送指令前如图:

发送指令后

程序测试完成并能接收到结果0;

Genesis2000用c#开发外挂的更多相关文章

  1. Genesis2000使用c#开发脚本

    这是我自学程序以来在博客园的第一篇博客,如有不好的地方请大家指正,谢谢! 这边文章的目的是给予那些在PCB使用Genesis2000程序脚本开发的人员提供.net平台下的开发方法. 目前genesis ...

  2. Android手游外挂入侵----寓攻于守,方能破敌

    欢迎访问网易云社区,了解更多网易技术产品运营经验. 手游外挂入侵 随着各种爆款手游的风靡,目前手机游戏的占比用户已经形成一个巨大的市场,市场上你争我夺,有将PC版本移植到手机中,也有新模式手游的推出. ...

  3. Java SE学习【二】——面向对象

    面向对象的学习也进行了一段时间,这段时间学了,类和对象:属性:方法:封装:继承:多态:接口.也算是有一些自己的理解,不愧是贴近人类思维的思想,老师讲时我常常会想到以前的一些事物和其交相印证,其中最常想 ...

  4. 手把手教你玩微信小程序跳一跳

    最近微信小程序火的半边天都红了,虽然不会写,但是至少也可以仿照网上大神开发外挂吧!下面手把手教妹纸们(汉纸们请自觉的眼观耳听)怎么愉快的在微信小游戏中获得高分. 废话不多说,咱们这就发车了!呸!咱们这 ...

  5. 【视频教程】使用UIAutomation开发软件外挂

    UIAutomation是.Net 3.5之后提供的“界面自动化测试”技术,本来是给测试人员用的,不过UIAutomation由于也是界面自动操作的技术,比直接使用keybd_event.GetWin ...

  6. 关于炒股软件——金魔方炒股软件的Dll外挂开发

    2015-01-19 14:40:04 金魔方平台是由飞狐交易师原创团队集多年研发经验,依靠和讯财经网强大资源,吸取国际专家思路而推出的十年巨作.目前新出的这个2.0版,这一版在数据存储方面作很大的改 ...

  7. C#外挂QQ找茬辅助源码,早期开发

    这是一款几年前开发的工具,当年作为一民IT纯屌,为了当年自己心目中的一位女神熬夜开发完成.女神使用后找茬等级瞬间从眼明手快升级为三只眼...每次看到这个就会想起那段屌丝与女神的回忆.今天特地把代码更新 ...

  8. Delphi外挂开发网站

    http://cheatengine.org/http://wenku.baidu.com/view/2d5de818964bcf84b9d57b15.html   [delphi外G]http:// ...

  9. WMS二开:外挂页面开发培训

    springboot:MAVEN结构前后台都是MVC架构基于模板引擎thymeleafapplication.yml文件里面配置了一个DEV\TEST\PROD,用于自动选择配置文件applicati ...

随机推荐

  1. 一个App完成入门篇-终结篇(八)- 应用收官

    经过以上几步的学习,我们终于来到最后一个步骤了,应用APP也接近尾声. 通过之前的几节教程,不知道您对使用DeviceOne开发一个应用是不是已经得心应手了,本节教程将教会大家如何在开发完成之后通过D ...

  2. 大白话讲解Promise(二)理解Promise规范

    上一篇我们讲解了ES6中Promise的用法,但是知道了用法还远远不够,作为一名专业的前端工程师,还必须通晓原理.所以,为了补全我们关于Promise的知识树,有必要理解Promise/A+规范,理解 ...

  3. 使用vbs脚本进行批量编码转换

    使用vbs脚本进行批量编码转换 最近需要使用SourceInsight查看分析在Linux系统下开发的项目代码,我们知道Linux系统中文本文件默认编码格式是UTF-8,而Windows中文系统中的默 ...

  4. 《Entity Framework 6 Recipes》中文翻译系列 (28) ------ 第五章 加载实体和导航属性之测试实体是否加载与显式加载关联实体

    翻译的初衷以及为什么选择<Entity Framework 6 Recipes>来学习,请看本系列开篇 5-11  测试实体引用或实体集合是否加载 问题 你想测试关联实体或实体集合是否已经 ...

  5. 详解 JavaScript的 call() 和 apply()

    定义 ECMAScript规范为所有函数都包含两个方法(这两个方法非继承而来), call 和 apply .这两个函数都是在特定的作用域中调用函数,能改变函数的作用域,实际上是改变函数体内 this ...

  6. Cookie与Session

    再说Cookie与Session之前,先要了解一下http协议. 何为http协议: http协议即超文本传输协议,一种基于浏览器请求与服务器响应的协议,该协议主要的特点就是它是一种无状态的协议(只针 ...

  7. IOS 消息机制(NSNotificationCenter)

    消息机制 NSNotificationCenter 一直都在频繁使用,但是却对其原理不是十分了解.今天就花些时间,把消息机制原理重头到尾好好过一遍. iOS 提供了一种 "同步的" ...

  8. C#设计模式系列:职责链模式(Chain of Responsibility)

    1.职责链模式简介 1.1>.定义 职责链模式是一种行为模式,为解除请求的发送者和接收者之间的耦合,而使多个对象都有机会处理这个请求.将这些对象连接成一条链,并沿着这条链传递该请求,直到有一个对 ...

  9. WPF 子窗体关闭时显示父窗体

    这个问题纠结了两天,今天在一个朋友的帮助下,解决了,其实很简单,但是可能作为新手,接触WPF时间还是短,因此作为一个问题困扰了我. 父窗体部分代码 private void EditInformati ...

  10. 《HTML重构》读书笔记&思维导图

    最近读了<HTML重构>这本书,以下做出自己的总结归纳,大家可以一起学习交流. 什么是重构?重构是在不改变程序行为的基础上进行小的改动是代码基本逐渐完善的过程,通常需要一些自动化工具的帮助 ...