MacroInterface.cs
上传用户:szltgg
上传日期:2019-05-16
资源大小:604k
文件大小:21k
- /*
- * Copyright (c) 2005 Poderosa Project, All Rights Reserved.
- * $Id: MacroInterface.cs,v 1.2 2005/04/20 08:45:45 okajima Exp $
- */
- using System;
- using System.Collections;
- using Poderosa.ConnectionParam;
- #if !MACRODOC
- using Poderosa.Config;
- #endif
- using Poderosa.Toolkit;
- namespace Poderosa.Macro {
- /// <summary>
- /// <ja>儅僋儘婡擻偺儖乕僩偵側傞僋儔僗偱偡丅</ja>
- /// <en>This class is the root of the macro functionality.</en>
- /// </summary>
- /// <remarks>
- /// <ja>儅僋儘偐傜偙偺僋儔僗偺僀儞僗僞儞僗傪嶌惉偟偰丄奺僾儘僷僥傿丒儊僜僢僪偵傾僋僙僗偟偰偔偩偝偄丅</ja>
- /// <en>Use properties and methods after the macro creates an instance of this class. </en>
- /// </remarks>
- public sealed class Environment : MarshalByRefObject {
- /// <summary>
- /// <ja><see cref="ConnectionList"/>僆僽僕僃僋僩傪庢摼偟傑偡丅</ja>
- /// <en>Gets the <see cref="ConnectionList"/> object.</en>
- /// </summary>
- public ConnectionList Connections {
- get {
- return _connectionList;
- }
- }
- /// <summary>
- /// <ja><see cref="Util"/>僆僽僕僃僋僩傪庢摼偟傑偡丅</ja>
- /// <en>Gets the <see cref="Util"/> object.</en>
- /// </summary>
- public Util Util {
- get {
- return _util;
- }
- }
- /// <summary>
- /// <ja><see cref="Frame"/>僆僽僕僃僋僩傪庢摼偟傑偡丅</ja>
- /// <en>Gets the <see cref="Frame"/> object.</en>
- /// </summary>
- public Frame Frame {
- get {
- return _frame;
- }
- }
- /// <summary>
- /// <ja>儅僋儘偺僨僶僢僌傪曗彆偡傞偨傔偺<see cref="DebugService"/>僆僽僕僃僋僩傪庢摼偟傑偡丅</ja>
- /// <en>Gets the <see cref="DebugService"/> object for debugging the macro.</en>
- /// </summary>
- public DebugService Debug {
- get {
- return _debugService;
- }
- }
- /// <summary>
- /// <ja>Poderosa偺僀儞僗僩乕儖偝傟偨僨傿儗僋僩儕柤傪庢摼偟傑偡丅枛旜偵偼 偑偮偄偰偄傑偡丅</ja>
- /// <en>Gets the directory the Poderosa is installed. The tail of the string is a ''.</en>
- /// </summary>
- public string InstalledDir {
- get {
- return _guevaraDir;
- }
- }
- /// <summary>
- /// <ja>Poderosa娐嫬曄悢傪庢摼偟傑偡丅</ja>
- /// <en>Gets the Poderosa environment variable.</en>
- /// </summary>
- /// <remarks>
- /// <ja>
- /// <para>丂Poderosa娐嫬曄悢偼丄儐乕僓偺娐嫬偵埶懚偡傞晹暘傪儅僋儘偐傜暘棧偡傞偨傔偵梡堄偝傟偨婡擻偱偡丅
- /// 娐嫬曄悢偺掕媊偼丄儊僯儏乕偐傜僣乕儖 - 儅僋儘 - 娐嫬愝掕傪慖傃丄偦偺拞偱娐嫬曄悢儃僞儞偵傛偭偰妋擣偲曇廤偑偱偒傑偡丅</para>
- /// <para>丂偨偲偊偽丄僥僉僗僩僄僨傿僞偺僷僗傪偙偙偵搊榐偝偣偰偍偄偰丄儅僋儘偐傜婲摦偡傞偙偲偑偱偒傑偡丅</para>
- /// <para>丂側偍丄Poderosa娐嫬曄悢偼OS偺娐嫬曄悢偲偼娭學偁傝傑偣傫丅</para>
- /// </ja>
- /// <en>
- /// <para> The Poderosa environment variable feature intends to separate configurations which depend on the environment of users from the macro.</para>
- /// <para> The user can edit Poderosa envrionment variables from the Tools - Macro - Configure Environment menu. For example, the user registers the text editor as an environment variable and the macro launchs the editor. </para>
- /// <para> Note that the environment variable has no relation to the environment variables of Windows. </para>
- /// </en>
- /// </remarks>
- /// <example>
- /// <code>
- /// import Poderosa.Macro;
- /// var env = new Environment();
- ///
- /// var filename = "C:temp...
- /// env.Util.Exec(env.GetVariable("tools.texteditor") + " " + filename);
- /// </code>
- /// </example>
- /// <param name="key"><ja>娐嫬曄悢偺柤慜</ja><en>the name of varialbe</en></param>
- /// <returns><ja>娐嫬曄悢偑掕媊偝傟偰偄傟偽偦偺抣丄掕媊偝傟偰偄側偗傟偽null</ja><en>If the variable is defined, returns the value. Otherwise, returns null.</en></returns>
- public string GetVariable(string key) {
- #if MACRODOC
- return null;
- #else
- return GApp.MacroManager.GetVariable(key, null);
- #endif
- }
- /// <summary>
- /// <ja>Poderosa娐嫬曄悢傪庢摼偟傑偡丅</ja>
- /// <en>Gets a Poderosa environment variable.</en>
- /// </summary>
- /// <param name="key"><ja>娐嫬曄悢偺柤慜</ja><en>the name of varialbe</en></param>
- /// <param name="def"><ja>尒偮偐傜側偐偭偨偲偒偵曉偡僨僼僅儖僩抣</ja><en>the default value in case that the key is not found</en></param>
- /// <returns><ja>娐嫬曄悢偑掕媊偝傟偰偄傟偽偦偺抣丄掕媊偝傟偰偄側偗傟偽def偺抣</ja><en>If the variable is defined, returns the value. Otherwise, returns the value of def.</en></returns>
- public string GetVariable(string key, string def) {
- #if MACRODOC
- return null;
- #else
- return GApp.MacroManager.GetVariable(key, def);
- #endif
- }
- private static Version _version;
- private static ConnectionList _connectionList;
- private static Util _util;
- private static DebugService _debugService;
- private static string _guevaraDir;
- private static Frame _frame;
- internal static void Init(ConnectionList cl, Util ui, Frame fr, DebugService ds) {
- _version = new Version(1,0);
- _connectionList = cl;
- _util = ui;
- _frame = fr;
- _debugService = ds;
- _guevaraDir = AppDomain.CurrentDomain.BaseDirectory;
- }
- }
- /// <summary>
- /// <ja><see cref="Connection"/>僆僽僕僃僋僩偺僐儗僋僔儑儞偱偡丅</ja>
- /// <en>A collection of <see cref="Connection"/> objects.</en>
- /// </summary>
- public abstract class ConnectionList : MarshalByRefObject, IEnumerable {
- /// <summary>
- /// <ja>僐僱僋僔儑儞偺悢偱偡丅</ja>
- /// <en>Gets the number of connections.</en>
- /// </summary>
- public abstract int Count { get; }
- /// <summary>
- /// <ja><see cref="Connection"/>僆僽僕僃僋僩傪楍嫇偟傑偡丅</ja>
- /// <en>Enumerates each <see cref="Connection"/> objects.</en>
- /// </summary>
- public abstract IEnumerator GetEnumerator();
- /// <summary>
- /// <ja>傾僾儕働乕僔儑儞偱傾僋僥傿僽偵側偭偰偄傞愙懕傪曉偟傑偡丅</ja>
- /// <en>Returns the active connection of Poderosa.</en>
- /// <ja>傾僋僥傿僽側愙懕偑側偄偲偒偼null傪曉偟傑偡丅</ja>
- /// <en>If there are no active connections, returns null.</en>
- /// </summary>
- public abstract Connection ActiveConnection { get; }
- /// <summary>
- /// <ja>怴偟偄愙懕傪奐偒傑偡丅</ja>
- /// <en>Opens a new connection.</en>
- /// </summary>
- /// <remarks>
- /// <ja>幐攕偟偨偲偒偼儊僢僙乕僕儃僢僋僗偱捠抦傪偟偨忋偱null偑曉傝傑偡丅</ja>
- /// <en>If the connection fails, Poderosa shows an error message box and returns null to the macro.</en>
- /// </remarks>
- /// <seealso cref="TerminalParam"/>
- /// <seealso cref="TCPTerminalParam"/>
- /// <seealso cref="TelnetTerminalParam"/>
- /// <seealso cref="SSHTerminalParam"/>
- /// <seealso cref="SerialTerminalParam"/>
- /// <param name="param"><ja>愙懕偵昁梫側僷儔儊乕僞傪廂榐偟偨<see cref="TerminalParam"/>僆僽僕僃僋僩</ja><en>The <see cref="TerminalParam"/> object that contains parameters for the connection.</en></param>
- /// <returns><ja>怴偟偔奐偐傟偨<see cref="Connection"/>僆僽僕僃僋僩</ja><en>A <see cref="Connection"/> object that describes the new connection.</en></returns>
- public abstract Connection Open(TerminalParam param);
- /// <summary>
- /// <ja>僔儑乕僩僇僢僩僼傽僀儖傪奐偒傑偡</ja>
- /// <en>Opens a shortcut file</en>
- /// </summary>
- /// <remarks>
- /// <ja>愙懕偑幐攕偟偨傝丄儐乕僓偑僉儍儞僙儖偡傞偲null偑曉傝傑偡丅</ja>
- /// <en>If the connection is failed or the user cancelled, this method returns null.</en>
- /// </remarks>
- /// <param name="filename"><ja>愙懕偵昁梫側僷儔儊乕僞傪廂榐偟偨僔儑乕僩僇僢僩僼傽僀儖柤</ja><en>A shortcut file that contains parameters for the connection.</en></param>
- /// <returns><ja>怴偟偔奐偐傟偨<see cref="Connection"/>僆僽僕僃僋僩</ja><en>A <see cref="Connection"/> object that describes the new connection.</en></returns>
- public abstract Connection OpenShortcutFile(string filename);
- }
-
- /// <summary>
- /// <ja>侾杮偺愙懕傪昞偟傑偡丅</ja>
- /// <en>Describes a connection.</en>
- /// </summary>
- public abstract class Connection : MarshalByRefObject {
- /// <summary>
- /// <ja>偙偺愙懕偵愝掕偝傟偨夋柺偺暆傪暥帤扨埵偱庢摼偟傑偡丅</ja>
- /// <en>Gets the width of the console in characters.</en>
- /// </summary>
- public abstract int TerminalWidth { get; }
- /// <summary>
- /// <ja>偙偺愙懕偵愝掕偝傟偨夋柺偺崅偝傪暥帤扨埵偱庢摼偟傑偡丅</ja>
- /// <en>Gets the height of the console in characters.</en>
- /// </summary>
- public abstract int TerminalHeight { get; }
- /// <summary>
- /// <ja>偙偺愙懕傪傾僋僥傿僽偵偟丄嵟慜柺偵帩偭偰偄偒傑偡丅</ja>
- /// <en>Activates this connection and brings to the front of application.</en>
- /// </summary>
- public abstract void Activate();
- #if !MACRODOC
- /// <summary>
- /// 偙偺愙懕傪傾僋僥傿僽偵偟丄嵟慜柺偵帩偭偰偄偒傑偡丅堷悢偱儁僀儞偺埵抲傪巜掕偱偒傑偡丅
- /// </summary>
- /// <param name="pos">儁僀儞偺埵抲傪巜掕偟傑偡丅偙偺堷悢偼僼儗乕儉偑忋壓傑偨偼嵍塃偵暘妱偝傟偰偄傞偲偒偺傒堄枴傪帩偪傑偡丅</param>
- public abstract void Activate(PanePosition pos);
- #endif
- /// <summary>
- /// <ja>愙懕傪暵偠傑偡丅</ja>
- /// <en>Closes this connection.</en>
- /// </summary>
- public abstract void Close();
- /// <summary>
- /// <ja>僨乕僞傪憲怣偟傑偡丅</ja>
- /// <en>Transmits data.</en>
- /// <ja>暥帤楍偼偙偺愙懕偵愝掕偝傟偨僄儞僐乕僨傿儞僌偵廬偭偰僶僀僩楍偵僄儞僐乕僪偝傟傑偡丅</ja>
- /// <en>The string is encoded in accord with the encoding of this connection.</en>
- /// </summary>
- /// <example>
- /// <code>
- /// import Poderosa.Macro;
- /// var env = new Environment();
- ///
- /// var connection = env.Connections.ActiveConnection;
- /// connection.Transmit("ls");
- /// connection.TransmitLn("-la");
- /// </code>
- /// </example>
- /// <param name="data">憲怣偟偨偄暥帤楍</param>
- public abstract void Transmit(string data);
- /// <summary>
- /// <ja>僨乕僞偵偮偯偗偰夵峴傪憲怣偟傑偡丅</ja>
- /// <en>Transmits data followed by new line character.</en>
- /// </summary>
- /// <remarks>
- /// <ja>暥帤楍偼偙偺愙懕偵愝掕偝傟偨僄儞僐乕僨傿儞僌偵廬偭偰僶僀僩楍偵僄儞僐乕僪偝傟傑偡丅</ja>
- /// <en>The string is encoded in accord with the encoding of this connection.</en>
- /// <ja>偙偺儊僜僢僪偼暥帤楍偺擖椡偵偮偯偄偰Enter僉乕傪墴偡偺偲摨偠岠壥偑偁傝傑偡丅</ja>
- /// <en>This method has the same effect as pressing the Enter key following the input of the string.</en>
- /// </remarks>
- /// <example>
- /// <code>
- /// import Poderosa.Macro;
- ///
- /// var connection = Environment.Connections.ActiveConnection;
- /// connection.Transmit("ls");
- /// connection.TransmitLn("-la");
- /// </code>
- /// </example>
- /// <param name="data"><ja>擖椡僨乕僞</ja><en>The input data</en></param>
- public abstract void TransmitLn(string data);
- /// <summary>
- /// <ja>偙偺愙懕偵懳偟偰Break怣崋傪憲傝傑偡丅</ja>
- /// <en>Send a break signal to this connection.</en>
- /// </summary>
- /// <remarks>
- /// <ja>SSH1偱偼Break怣崋傪憲傞偙偲偼偱偒傑偣傫丅</ja>
- /// <en>SSH1 does not support the break signal.</en>
- /// </remarks>
- public abstract void SendBreak();
- /// <summary>
- /// <ja>侾峴偺僨乕僞傪庴怣偟傑偡丅</ja>
- /// <en>Receives a line from the connection.</en>
- /// </summary>
- /// <remarks>
- /// <para><ja>丂儂僗僩偐傜僨乕僞偑枹摓拝偩偭偨傝峴偑廔傢偭偰偄側偄偲偒偼丄侾峴偺廔椆偑妋擣偱偒傞傑偱儊僜僢僪偼僽儘僢僋偟傑偡丅</ja>
- /// <en> When no data is available or the new line characters are not sent, the execution of this method is blocked.</en></para>
- /// <para><ja>丂摿偵僾儘儞僾僩暥帤楍偼夵峴傪娷傑側偄偺偱丄僾儘儞僾僩傪懸偮偨傔偵偙偺儊僜僢僪傪巊傢側偄傛偆偵偟偰偔偩偝偄丅僾儘儞僾僩偺敾掕傪偡傞傛偆側応崌偵偼偐傢傝偵<see cref="ReceiveData"/>儊僜僢僪傪巊偭偰偔偩偝偄丅</ja>
- /// <en> Especially note that this method could not be used to wait a prompt string since it does not contain new line characters. To wait a prompt, use the <see cref="ReceiveData"/> method instead of ReceiveLine method.</en>
- /// </para>
- /// <para><ja>丂傑偨丄儂僗僩偐傜棃傞僨乕僞偺偆偪丄CR偲NUL偼柍帇偝傟傑偡丅</ja>
- /// <en> Additionally, CR and NUL are ignored in the data from the host.</en></para>
- /// <seealso cref="ReceiveData"/>
- /// </remarks>
- /// <example>
- /// <code>
- /// import Poderosa.Macro;
- /// import System.IO;
- /// var env = new Environment();
- ///
- /// var output = new StreamWriter("...
- /// var connection = env.Connections.ActiveConnection;
- /// var line = connection.ReceiveLine();
- /// while(line!="end") { //wait for "end"
- /// output.WriteLine(line);
- /// line = connection.ReceiveLine();
- /// }
- /// output.Close();
- ///
- /// </code>
- /// </example>
- /// <returns><ja>庴怣偟偨暥帤楍偱偡丅夵峴暥帤偼娷傒傑偣傫丅</ja><en>The received line without new line characters.</en></returns>
- public abstract string ReceiveLine();
- /// <summary>
- /// <ja>僨乕僞傪庴怣偟傑偡丅</ja>
- /// <en>Receives data from the connection.</en>
- /// </summary>
- /// <remarks>
- /// <para><ja>丂儂僗僩偐傜僨乕僞偑枹摓拝偺偲偒偼丄摓拝偡傞傑偱儅僋儘偺幚峴偼僽儘僢僋偟傑偡丅</ja>
- /// <en> When no data is available, the execution of this method is blocked.</en>
- /// </para>
- /// <para><ja>丂僨乕僞偑摓拝嵪傒偺偲偒偼丄慜夞偺ReceiveData偺屇傃弌偟埲崀偵棃偨僨乕僞傪堦妵偟偰庢摼偟傑偡丅峴偵愗傝暘偗傞嶌嬈偼儅僋儘懁偱峴偆昁梫偑偁傝傑偡偑丄夵峴偱廔傢偭偰偄側偄僨乕僞傕庢摼偱偒傞棙揰偑偁傝傑偡丅 <see cref="ReceiveLine"/>偲巊偄暘偗偰偔偩偝偄丅</ja>
- /// <en> This method returns the whole data from the previous call of the ReceiveData method. Though this method can obtain the data even if it does not contain new line characters, the split into lines is responsible for the macro. Please compare to the <see cref="ReceiveLine"/> method.</en>
- /// </para>
- /// <para><ja>丂傑偨丄儂僗僩偐傜棃傞僨乕僞偺偆偪丄CR偲NUL偼柍帇偝傟傑偡丅夵峴偼LF偵傛偭偰敾暿偟傑偡丅</ja>
- /// <en> CR and NUL are ignored in the data from the host. The line breaks are determined by LF.</en></para>
- /// <seealso cref="ReceiveLine"/>
- /// </remarks>
- /// <example>
- /// <code>
- /// import Poderosa.Macro;
- /// import System.IO;
- /// var env = new Environment();
- ///
- /// var connection = env.Connections.ActiveConnection;
- /// var data = connection.ReceiveData();
- /// if(data.EndsWith("login: ") {
- /// ...
- /// </code>
- /// </example>
- /// <returns><ja>庴怣偟偨暥帤楍偱偡丅</ja><en>The received data.</en></returns>
- public abstract string ReceiveData();
- /// <summary>
- /// <ja>儘僌偵僐儊儞僩傪彂偒傑偡丅愙懕偑儘僌傪庢傞傛偆偵愝掕偝傟偰偄側偄応崌偼壗傕偟傑偣傫丅</ja>
- /// <en>Writes a comment to the log. If the connection is not set to record the log, this method does nothing.</en>
- /// </summary>
- /// <example>
- /// <code>
- /// import Poderosa.Macro;
- /// var env = new Environment();
- ///
- /// var connection = env.Connections.ActiveConnection;
- /// connection.WriteComment("starting macro...");
- /// </code>
- /// </example>
- /// <param name="comment"><ja>僐儊儞僩暥帤楍</ja><en>The comment string</en></param>
- public abstract void WriteComment(string comment);
- }
- /// <summary>
- /// <ja>傾僾儕働乕僔儑儞偺奜娤傪惂屼偡傞偨傔偺僆僽僕僃僋僩偱偡丅</ja>
- /// <en>Implements the appearances of the application.</en>
- /// </summary>
- public abstract class Frame : MarshalByRefObject {
- #if !MACRODOC
- /// <summary>
- /// <ja>暘妱曽幃傪庢摼丒愝掕偟傑偡丅</ja>
- /// <en>Gets or sets the division style.</en>
- /// </summary>
- public abstract GFrameStyle FrameStyle { get; set; }
- #endif
- /// <summary>
- /// <ja>僼儗乕儉傪僔儞僌儖僗僞僀儖偵僙僢僩偡傞偲偲傕偵丄抂枛傪儕僒僀僘偟傑偡丅</ja>
- /// <en>Changes the frame style to be single and resizes the terminal.</en>
- /// </summary>
- /// <param name="width"><ja>僞乕儈僫儖偺暆傪暥帤扨埵偱巜掕偟傑偡丅</ja><en>The terminal width in characters</en></param>
- /// <param name="height"><ja>僞乕儈僫儖偺崅偝傪暥帤扨埵偱巜掕偟傑偡丅</ja><en>The terminal height in characters</en></param>
- public abstract void SetStyleS(int width, int height);
- /// <summary>
- /// <ja>僼儗乕儉傪忋壓俀暘妱僗僞僀儖偵僙僢僩偡傞偲偲傕偵丄抂枛傪儕僒僀僘偟傑偡丅</ja>
- /// <en>Changes the frame style to be divided horizontally and resizes the terminal.</en>
- /// </summary>
- /// <param name="width"><ja>僞乕儈僫儖偺暆傪暥帤扨埵偱巜掕偟傑偡丅偙傟偼忋壓俀偮偺儁僀儞偱嫟桳偝傟傑偡丅</ja><en>The terminal width in characters. This is common to the two panes.</en></param>
- /// <param name="height1"><ja>忋偺儁僀儞偺崅偝傪暥帤扨埵偱巜掕偟傑偡丅</ja><en>The terminal height of the upper pane in characters.</en></param>
- /// <param name="height2"><ja>壓偺儁僀儞偺崅偝傪暥帤扨埵偱巜掕偟傑偡丅</ja><en>The terminal height of the lower pane in characters.</en></param>
- public abstract void SetStyleH(int width, int height1, int height2);
- /// <summary>
- /// <ja>僼儗乕儉傪嵍塃俀暘妱僗僞僀儖偵僙僢僩偡傞偲偲傕偵丄僼儗乕儉傪儕僒僀僘偟傑偡丅</ja>
- /// <en>Changes the frame style to be divided vertically and resizes the terminal.</en>
- /// </summary>
- /// <param name="width1"><ja>嵍偺儁僀儞偺暆傪暥帤扨埵偱巜掕偟傑偡丅</ja><en>The terminal width of the left pane in characters.</en></param>
- /// <param name="width2"><ja>塃偺儁僀儞偺暆傪暥帤扨埵偱巜掕偟傑偡丅</ja><en>The terminal width of the right pane in characters.</en></param>
- /// <param name="height"><ja>僞乕儈僫儖偺崅偝傪暥帤扨埵偱巜掕偟傑偡丅偙傟偼嵍塃俀偮偺儁僀儞偱嫟桳偝傟傑偡丅</ja><en>The terminal height in characters. This is common to the two panes.</en></param>
- public abstract void SetStyleV(int width1, int width2, int height);
- }
- /// <summary>
- /// <ja>儅僋儘偐傜屇傃弌偡偨傔偺丄斾妑揑傛偔巊偄偦偆側婡擻傪廂榐偟偨僆僽僕僃僋僩偱偡丅</ja>
- /// <en>Implements several utility functions for macros.</en>
- /// </summary>
- public abstract class Util : MarshalByRefObject {
- /// <summary>
- /// <ja>儊僢僙乕僕儃僢僋僗傪昞帵偟傑偡丅</ja>
- /// <en>Shows a message box.</en>
- /// </summary>
- /// <example>
- /// <code>
- /// import Poderosa.Macro;
- /// var env = new Environment();
- ///
- /// env.Util.MessageBox(String.Format("This file is {0}", env.MacroFileName));
- /// </code>
- /// </example>
- /// <param name="msg"><ja>昞帵偟偨偄儊僢僙乕僕</ja><en>The message to be shown.</en></param>
- public abstract void MessageBox(string msg);
- /// <summary>
- /// <ja>僼傽僀儖傪奐偔丄報嶞偡傞偲偄偭偨憖嶌傪偟傑偡丅</ja>
- /// <en>Performs actions to the file such as open or print.</en>
- /// </summary>
- /// <remarks>
- /// <ja>
- /// 棫偪忋偑傞傾僾儕働乕僔儑儞偼僼傽僀儖偺奼挘巕偲verb堷悢偵傛偭偰寛傑傝傑偡丅
- /// 偨偲偊偽奼挘巕偑txt偱偁傟偽僥僉僗僩僄僨傿僞偑婲摦偟傑偡丅
- /// 撪晹揑偵偼丄偙偺儊僜僢僪偼Win32偺ShellExecute API傪屇傃弌偟傑偡丅
- /// </ja>
- /// <en>
- /// The application is decided by the extension and the verb argument.
- /// For exapmle, a text editor starts if the extension is .txt.
- /// This method calls the ShellExecute API of Win32 internally.
- /// </en>
- /// </remarks>
- /// <example>
- /// <code>
- /// import Poderosa.Macro;
- /// import System.IO;
- /// var env = new Environment();
- ///
- /// string filename = Path.GetTempFileName() + ".txt";
- /// ... (write some text to this file)
- ///
- /// env.Util.ShellExecute("open", filename);
- /// </code>
- /// </example>
- /// <param name="verb"><ja>僼傽僀儖偵懳偟偰峴偆摦嶌偱偡丅"open","print"側偳偱偡丅</ja><en>The action to the file such as "open" or "print".</en></param>
- /// <param name="filename"><ja>奐偔僼傽僀儖傪僼儖僷僗偱巜掕偟傑偡丅</ja><en>The full path of the file name.</en></param>
- public abstract void ShellExecute(string verb, string filename);
- /// <summary>
- /// <ja>擟堄偺傾僾儕働乕僔儑儞傪婲摦偟傑偡丅</ja>
- /// <en>Starts other applications.</en>
- /// </summary>
- /// <remarks>
- /// <ja>撪晹揑偵偼丄偙偺儊僜僢僪偼Win32偺WinExec API傪屇傃弌偟傑偡丅</ja>
- /// <en>This method calls WinExec API of Win32 internally.</en>
- /// </remarks>
- /// <example>
- /// <code>
- /// import Poderosa.Macro;
- /// var env = new Environment();
- ///
- /// env.Util.Exec("notepad.exe");
- /// </code>
- /// </example>
- /// <param name="command"><ja>婲摦偟偨偄傾僾儕働乕僔儑儞偺柤慜偱偡丅昁梫偱偁傟偽堷悢傪偮偗傞偙偲傕偱偒傑偡丅</ja><en>The name of the application to be started. Arguments are allowed if necessary.</en></param>
- public abstract void Exec(string command);
- }
- /// <summary>
- /// <ja>儅僋儘偺僥僗僩偲僨僶僢僌偵昁梫側婡擻傪採嫙偟傑偡丅</ja>
- /// <en>Implements features for testing and debugging the macro.</en>
- /// </summary>
- /// <remarks>
- /// <para><ja>丂儅僋儘偺僾儘僷僥傿夋柺偵偍偄偰丄乽僩儗乕僗僂傿儞僪僂傪昞帵偡傞乿僆僾僔儑儞傪偮偗偰偍偔偲丄偦偺儅僋儘傪婲摦偡傞偲偒偵僩儗乕僗僂傿儞僪僂偑巊偊傞傛偆偵側傝傑偡丅</ja>
- /// <en> The macro trace window is displayed when the "shows trace window" option is checked in the dialog box of the macro property.</en>
- /// </para>
- /// </remarks>
- public abstract class DebugService : MarshalByRefObject {
- /// <summary>
- /// <ja>僩儗乕僗僂傿儞僪僂偵侾峴偺僨乕僞傪昞帵偟傑偡丅</ja>
- /// <en>Outputs a line to the trace window.</en>
- /// </summary>
- /// <example>
- /// <code>
- /// import Poderosa.Macro;
- /// var env = new Environment();
- ///
- /// var i = 123;
- /// env.Debug.Trace(String.Format("i={0}", i));
- /// </code>
- /// </example>
- /// <param name="msg"><ja>昞帵偟偨偄僨乕僞</ja><en>The data to be displayed.</en></param>
- public abstract void Trace(string msg);
- /// <summary>
- /// <ja>屇傃弌偟偨帪揰偱偺僗僞僢僋僩儗乕僗傪昞帵偟傑偡丅</ja>
- /// <en>Outputs the stack trace to the trace window.</en>
- /// </summary>
- public abstract void PrintStackTrace();
- }
- }