Genesis2000 using C # to develop plug-ins

Source: Internet
Author: User

First, the official instructions.

Gateway is a command line utility for sending messages and commands to Genesis processes. The Gateway command works between all systems, that is connected to the same GND server (in a client-server mode).

This command allows your send messages or run commands or scripts on any Genesis process currently running without have t o interfere with the GUI on this station.

Running Gateway does not require any additional licenses. The program itself are located in $GENESIS _dir/exx/misc where xx is the version number (eg. e72)

Gateway May is 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> I s the name of the X Display is displaying the "get" process.

    • As from v7.1, <address> can also is formed as <pid> @computer. Display, where <pid> is the process ID of the A Get process, <computer> is the name of the computer, and <displa Y> is the name of the X Display, which is displaying the "get" process. This can is important if there is both get' s running on the same computer/display

    • A star Symbol ("*") may is used for globbing any part of an address.

    • <message> May is 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 Have 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 would 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 a interactive session, any of the above messages could be sent.

A period "." On a line by itself causes the gateway to exit. When you wish to close the session, the command must is used, since even if Gateway have finished reading its Stan Dard input, it continues polling for more

Messages.

Examples

# Print A list of all Genesis users

% Gateway ' who * '

# Print A list of all the instances this "Ben" is logged in on Genesis

% Gateway ' who [email protected]* '

# Print The process IDs of all the instances of ' Ben ' logged in on Jupiter.

% Gateway ' PID [email protected] '

# Open a job on a specific Genesis process.

% gateway [email protected] ' COM open_job,job=1745 '

# an interactive session

% gateway [email protected]

COM open_job,job=1745

COM SCRIPT_RUN,NAME=/MY_SCRIPTS/RUN_ANALYSIS,PARAMS=PCB

.

Note "Get" May is run with the "-X" option and without a script. This puts Genesis into a mode where it'll respond to the gateway COM messages but would operate without a user inter Face.

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%[email protected]

(The % notation was chosen since a username could also is numeric.)

Also, in Genesis v7.1, the new command Comans have been added. This command returns the Comans of the last COM command. Here is a sample session:

% gateway [email protected]

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

  OK so much English I look also headache, in short plug need to use the gateway program, C # program is through the process class input and output, the following code

Using system;using system.collections.generic;using system.diagnostics;using system.io;using System.Linq;using System.text;namespace windowsformsapplication4{public class Genesis {//gateway Run command color this way the gateway <addres        S> <message>//address for data on Genesis: User name @ machine name. Machine name//Here I only take the first user name for the script execution Place///<summary>        The corresponding user address of the program run///</summary> private string Address {get; set;} <summary>///From the system environment variable get GENESIS root directory///</summary> string Genesis_dir {get {return En Vironment. GetEnvironmentVariable ("Genesis_dir");} }///<summary>///Get GENESIS's program directory from the System environment variable///</summary> string Genesis_edir {get {return environment.getenvironmentvariable ("Genesis_edir");} }///<summary>///Send instruction to Genesis///</summary>/<param name= "Cmdtext" ></p aram>//<returns></returns> public GeNesis () {///return the result with the user with \ r \ n separated to replace for, then packet 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";            return error Prompt P.startinfo.redirectstandarderror = true;            can send instruction p.startinfo.redirectstandardinput = true;            The result can be executed with the accept instruction p.startinfo.redirectstandardoutput = true;            Execute command does not show window P.startinfo.createnowindow = true;           Execution instruction p.startinfo.arguments = Cmdtext;            P.startinfo.useshellexecute = false;            P.start ();           Receive instruction execution result StreamReader read = P.standardoutput; string s = read.         ReadLine ();   End Process P.close ();       return s; public string COM (string cmdtext) {return SendCommand (string).       Format (address+ "\" COM {0}\ "", Cmdtext)); }    }}

The core code is the SendCommand function, because Genesis has a number of special instructions, here I only write the COM instructions, as well as get the user address when the Task Manager to open the system to see if there are multiple GND or gateway to run, if there is more than one GND program will crash, Gateway had better leave only one

Follow the team code to test, create a new WinForm program, add two RichTextBox one to enter the instruction, one to receive the return value

Send instruction event code

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));        }

Compile the program to open the Genesis team program to test, before sending instructions

After sending instructions

The program test is completed and can receive the result 0;

Genesis2000 using C # to develop plug-ins

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.