MacroInterface.cs
上传用户:szltgg
上传日期:2019-05-16
资源大小:604k
文件大小:21k
源码类别:

Telnet服务器

开发平台:

C#

  1. /*
  2. * Copyright (c) 2005 Poderosa Project, All Rights Reserved.
  3. * $Id: MacroInterface.cs,v 1.2 2005/04/20 08:45:45 okajima Exp $
  4. */
  5. using System;
  6. using System.Collections;
  7. using Poderosa.ConnectionParam;
  8. #if !MACRODOC
  9. using Poderosa.Config;
  10. #endif
  11. using Poderosa.Toolkit;
  12. namespace Poderosa.Macro {
  13. /// <summary>
  14. /// <ja>儅僋儘婡擻偺儖乕僩偵側傞僋儔僗偱偡丅</ja>
  15. /// <en>This class is the root of the macro functionality.</en>
  16. /// </summary>
  17. /// <remarks>
  18. /// <ja>儅僋儘偐傜偙偺僋儔僗偺僀儞僗僞儞僗傪嶌惉偟偰丄奺僾儘僷僥傿丒儊僜僢僪偵傾僋僙僗偟偰偔偩偝偄丅</ja>
  19. /// <en>Use properties and methods after the macro creates an instance of this class. </en>
  20. /// </remarks>
  21. public sealed class Environment : MarshalByRefObject {
  22. /// <summary>
  23. /// <ja><see cref="ConnectionList"/>僆僽僕僃僋僩傪庢摼偟傑偡丅</ja>
  24. /// <en>Gets the <see cref="ConnectionList"/> object.</en>
  25. /// </summary>
  26. public ConnectionList Connections {
  27. get {
  28. return _connectionList;
  29. }
  30. }
  31. /// <summary>
  32. /// <ja><see cref="Util"/>僆僽僕僃僋僩傪庢摼偟傑偡丅</ja>
  33. /// <en>Gets the <see cref="Util"/> object.</en>
  34. /// </summary>
  35. public Util Util {
  36. get {
  37. return _util;
  38. }
  39. }
  40. /// <summary>
  41. /// <ja><see cref="Frame"/>僆僽僕僃僋僩傪庢摼偟傑偡丅</ja>
  42. /// <en>Gets the <see cref="Frame"/> object.</en>
  43. /// </summary>
  44. public Frame Frame {
  45. get {
  46. return _frame;
  47. }
  48. }
  49. /// <summary>
  50. /// <ja>儅僋儘偺僨僶僢僌傪曗彆偡傞偨傔偺<see cref="DebugService"/>僆僽僕僃僋僩傪庢摼偟傑偡丅</ja>
  51. /// <en>Gets the <see cref="DebugService"/> object for debugging the macro.</en>
  52. /// </summary>
  53. public DebugService Debug {
  54. get {
  55. return _debugService;
  56. }
  57. }
  58. /// <summary>
  59. /// <ja>Poderosa偺僀儞僗僩乕儖偝傟偨僨傿儗僋僩儕柤傪庢摼偟傑偡丅枛旜偵偼  偑偮偄偰偄傑偡丅</ja>
  60. /// <en>Gets the directory the Poderosa is installed. The tail of the string is a ''.</en>
  61. /// </summary>
  62. public string InstalledDir {
  63. get {
  64. return _guevaraDir;
  65. }
  66. }
  67. /// <summary>
  68. /// <ja>Poderosa娐嫬曄悢傪庢摼偟傑偡丅</ja>
  69. /// <en>Gets the Poderosa environment variable.</en>
  70. /// </summary>
  71. /// <remarks>
  72. /// <ja>
  73. /// <para>丂Poderosa娐嫬曄悢偼丄儐乕僓偺娐嫬偵埶懚偡傞晹暘傪儅僋儘偐傜暘棧偡傞偨傔偵梡堄偝傟偨婡擻偱偡丅
  74. /// 娐嫬曄悢偺掕媊偼丄儊僯儏乕偐傜僣乕儖 - 儅僋儘 - 娐嫬愝掕傪慖傃丄偦偺拞偱娐嫬曄悢儃僞儞偵傛偭偰妋擣偲曇廤偑偱偒傑偡丅</para>
  75. /// <para>丂偨偲偊偽丄僥僉僗僩僄僨傿僞偺僷僗傪偙偙偵搊榐偝偣偰偍偄偰丄儅僋儘偐傜婲摦偡傞偙偲偑偱偒傑偡丅</para>
  76. /// <para>丂側偍丄Poderosa娐嫬曄悢偼OS偺娐嫬曄悢偲偼娭學偁傝傑偣傫丅</para>
  77. /// </ja>
  78. /// <en>
  79. /// <para> The Poderosa environment variable feature intends to separate configurations which depend on the environment of users from the macro.</para>
  80. /// <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>
  81. /// <para> Note that the environment variable has no relation to the environment variables of Windows. </para>
  82. /// </en>
  83. /// </remarks>
  84. /// <example>
  85. /// <code>
  86. /// import Poderosa.Macro;
  87. /// var env = new Environment();
  88. /// 
  89. /// var filename = "C:temp...
  90. /// env.Util.Exec(env.GetVariable("tools.texteditor") + " " + filename);
  91. /// </code>
  92. /// </example>
  93. /// <param name="key"><ja>娐嫬曄悢偺柤慜</ja><en>the name of varialbe</en></param>
  94. /// <returns><ja>娐嫬曄悢偑掕媊偝傟偰偄傟偽偦偺抣丄掕媊偝傟偰偄側偗傟偽null</ja><en>If the variable is defined, returns the value. Otherwise, returns null.</en></returns>
  95. public string GetVariable(string key) {
  96. #if MACRODOC
  97. return null;
  98. #else
  99. return GApp.MacroManager.GetVariable(key, null);
  100. #endif
  101. }
  102. /// <summary>
  103. /// <ja>Poderosa娐嫬曄悢傪庢摼偟傑偡丅</ja>
  104. /// <en>Gets a Poderosa environment variable.</en>
  105. /// </summary>
  106. /// <param name="key"><ja>娐嫬曄悢偺柤慜</ja><en>the name of varialbe</en></param>
  107. /// <param name="def"><ja>尒偮偐傜側偐偭偨偲偒偵曉偡僨僼僅儖僩抣</ja><en>the default value in case that the key is not found</en></param>
  108. /// <returns><ja>娐嫬曄悢偑掕媊偝傟偰偄傟偽偦偺抣丄掕媊偝傟偰偄側偗傟偽def偺抣</ja><en>If the variable is defined, returns the value. Otherwise, returns the value of def.</en></returns>
  109. public string GetVariable(string key, string def) {
  110. #if MACRODOC
  111. return null;
  112. #else
  113. return GApp.MacroManager.GetVariable(key, def);
  114. #endif
  115. }
  116. private static Version _version;
  117. private static ConnectionList _connectionList;
  118. private static Util _util;
  119. private static DebugService _debugService; 
  120. private static string _guevaraDir;
  121. private static Frame _frame;
  122. internal static void Init(ConnectionList cl, Util ui, Frame fr, DebugService ds) {
  123. _version = new Version(1,0);
  124. _connectionList = cl;
  125. _util = ui;
  126. _frame = fr;
  127. _debugService = ds;
  128. _guevaraDir = AppDomain.CurrentDomain.BaseDirectory;
  129. }
  130. }
  131. /// <summary>
  132. /// <ja><see cref="Connection"/>僆僽僕僃僋僩偺僐儗僋僔儑儞偱偡丅</ja>
  133. /// <en>A collection of <see cref="Connection"/> objects.</en>
  134. /// </summary>
  135. public abstract class ConnectionList : MarshalByRefObject, IEnumerable {
  136. /// <summary>
  137. /// <ja>僐僱僋僔儑儞偺悢偱偡丅</ja>
  138. /// <en>Gets the number of connections.</en>
  139. /// </summary>
  140. public abstract int Count { get; }
  141. /// <summary>
  142. /// <ja><see cref="Connection"/>僆僽僕僃僋僩傪楍嫇偟傑偡丅</ja>
  143. /// <en>Enumerates each <see cref="Connection"/> objects.</en>
  144. /// </summary>
  145. public abstract IEnumerator GetEnumerator();
  146. /// <summary>
  147. /// <ja>傾僾儕働乕僔儑儞偱傾僋僥傿僽偵側偭偰偄傞愙懕傪曉偟傑偡丅</ja>
  148. /// <en>Returns the active connection of Poderosa.</en>
  149. /// <ja>傾僋僥傿僽側愙懕偑側偄偲偒偼null傪曉偟傑偡丅</ja>
  150. /// <en>If there are no active connections, returns null.</en>
  151. /// </summary>
  152. public abstract Connection ActiveConnection { get; }
  153. /// <summary>
  154. /// <ja>怴偟偄愙懕傪奐偒傑偡丅</ja>
  155. /// <en>Opens a new connection.</en>
  156. /// </summary>
  157. /// <remarks>
  158. /// <ja>幐攕偟偨偲偒偼儊僢僙乕僕儃僢僋僗偱捠抦傪偟偨忋偱null偑曉傝傑偡丅</ja>
  159. /// <en>If the connection fails, Poderosa shows an error message box and returns null to the macro.</en>
  160. /// </remarks>
  161. /// <seealso cref="TerminalParam"/>
  162. /// <seealso cref="TCPTerminalParam"/>
  163. /// <seealso cref="TelnetTerminalParam"/>
  164. /// <seealso cref="SSHTerminalParam"/>
  165. /// <seealso cref="SerialTerminalParam"/>
  166. /// <param name="param"><ja>愙懕偵昁梫側僷儔儊乕僞傪廂榐偟偨<see cref="TerminalParam"/>僆僽僕僃僋僩</ja><en>The <see cref="TerminalParam"/> object that contains parameters for the connection.</en></param>
  167. /// <returns><ja>怴偟偔奐偐傟偨<see cref="Connection"/>僆僽僕僃僋僩</ja><en>A <see cref="Connection"/> object that describes the new connection.</en></returns>
  168. public abstract Connection Open(TerminalParam param);
  169. /// <summary>
  170. /// <ja>僔儑乕僩僇僢僩僼傽僀儖傪奐偒傑偡</ja>
  171. /// <en>Opens a shortcut file</en>
  172. /// </summary>
  173. /// <remarks>
  174. /// <ja>愙懕偑幐攕偟偨傝丄儐乕僓偑僉儍儞僙儖偡傞偲null偑曉傝傑偡丅</ja>
  175. /// <en>If the connection is failed or the user cancelled, this method returns null.</en>
  176. /// </remarks>
  177. /// <param name="filename"><ja>愙懕偵昁梫側僷儔儊乕僞傪廂榐偟偨僔儑乕僩僇僢僩僼傽僀儖柤</ja><en>A shortcut file that contains parameters for the connection.</en></param>
  178. /// <returns><ja>怴偟偔奐偐傟偨<see cref="Connection"/>僆僽僕僃僋僩</ja><en>A <see cref="Connection"/> object that describes the new connection.</en></returns>
  179. public abstract Connection OpenShortcutFile(string filename);
  180. }
  181. /// <summary>
  182. /// <ja>侾杮偺愙懕傪昞偟傑偡丅</ja>
  183. /// <en>Describes a connection.</en>
  184. /// </summary>
  185. public abstract class Connection  : MarshalByRefObject {
  186. /// <summary>
  187. /// <ja>偙偺愙懕偵愝掕偝傟偨夋柺偺暆傪暥帤扨埵偱庢摼偟傑偡丅</ja>
  188. /// <en>Gets the width of the console in characters.</en>
  189. /// </summary>
  190. public abstract int TerminalWidth { get; }
  191. /// <summary>
  192. /// <ja>偙偺愙懕偵愝掕偝傟偨夋柺偺崅偝傪暥帤扨埵偱庢摼偟傑偡丅</ja>
  193. /// <en>Gets the height of the console in characters.</en>
  194. /// </summary>
  195. public abstract int TerminalHeight { get; }
  196. /// <summary>
  197. /// <ja>偙偺愙懕傪傾僋僥傿僽偵偟丄嵟慜柺偵帩偭偰偄偒傑偡丅</ja>
  198. /// <en>Activates this connection and brings to the front of application.</en>
  199. /// </summary>
  200. public abstract void Activate();
  201. #if !MACRODOC
  202. /// <summary>
  203. /// 偙偺愙懕傪傾僋僥傿僽偵偟丄嵟慜柺偵帩偭偰偄偒傑偡丅堷悢偱儁僀儞偺埵抲傪巜掕偱偒傑偡丅
  204. /// </summary>
  205. /// <param name="pos">儁僀儞偺埵抲傪巜掕偟傑偡丅偙偺堷悢偼僼儗乕儉偑忋壓傑偨偼嵍塃偵暘妱偝傟偰偄傞偲偒偺傒堄枴傪帩偪傑偡丅</param>
  206. public abstract void Activate(PanePosition pos);
  207. #endif
  208. /// <summary>
  209. /// <ja>愙懕傪暵偠傑偡丅</ja>
  210. /// <en>Closes this connection.</en>
  211. /// </summary>
  212. public abstract void Close();
  213. /// <summary>
  214. /// <ja>僨乕僞傪憲怣偟傑偡丅</ja>
  215. /// <en>Transmits data.</en>
  216. /// <ja>暥帤楍偼偙偺愙懕偵愝掕偝傟偨僄儞僐乕僨傿儞僌偵廬偭偰僶僀僩楍偵僄儞僐乕僪偝傟傑偡丅</ja>
  217. /// <en>The string is encoded in accord with the encoding of this connection.</en>
  218. /// </summary>
  219. /// <example>
  220. /// <code>
  221. /// import Poderosa.Macro;
  222. /// var env = new Environment();
  223. /// 
  224. /// var connection = env.Connections.ActiveConnection;
  225. /// connection.Transmit("ls");
  226. /// connection.TransmitLn("-la");
  227. /// </code>
  228. /// </example>
  229. /// <param name="data">憲怣偟偨偄暥帤楍</param>
  230. public abstract void Transmit(string data);
  231. /// <summary>
  232. /// <ja>僨乕僞偵偮偯偗偰夵峴傪憲怣偟傑偡丅</ja>
  233. /// <en>Transmits data followed by new line character.</en>
  234. /// </summary>
  235. /// <remarks>
  236. /// <ja>暥帤楍偼偙偺愙懕偵愝掕偝傟偨僄儞僐乕僨傿儞僌偵廬偭偰僶僀僩楍偵僄儞僐乕僪偝傟傑偡丅</ja>
  237. /// <en>The string is encoded in accord with the encoding of this connection.</en>
  238. /// <ja>偙偺儊僜僢僪偼暥帤楍偺擖椡偵偮偯偄偰Enter僉乕傪墴偡偺偲摨偠岠壥偑偁傝傑偡丅</ja>
  239. /// <en>This method has the same effect as pressing the Enter key following the input of the string.</en>
  240. /// </remarks>
  241. /// <example>
  242. /// <code>
  243. /// import Poderosa.Macro;
  244. /// 
  245. /// var connection = Environment.Connections.ActiveConnection;
  246. /// connection.Transmit("ls");
  247. /// connection.TransmitLn("-la");
  248. /// </code>
  249. /// </example>
  250. /// <param name="data"><ja>擖椡僨乕僞</ja><en>The input data</en></param>
  251. public abstract void TransmitLn(string data);
  252. /// <summary>
  253. /// <ja>偙偺愙懕偵懳偟偰Break怣崋傪憲傝傑偡丅</ja>
  254. /// <en>Send a break signal to this connection.</en>
  255. /// </summary>
  256. /// <remarks>
  257. /// <ja>SSH1偱偼Break怣崋傪憲傞偙偲偼偱偒傑偣傫丅</ja>
  258. /// <en>SSH1 does not support the break signal.</en>
  259. /// </remarks>
  260. public abstract void SendBreak();
  261. /// <summary>
  262. /// <ja>侾峴偺僨乕僞傪庴怣偟傑偡丅</ja>
  263. /// <en>Receives a line from the connection.</en>
  264. /// </summary>
  265. /// <remarks>
  266. /// <para><ja>丂儂僗僩偐傜僨乕僞偑枹摓拝偩偭偨傝峴偑廔傢偭偰偄側偄偲偒偼丄侾峴偺廔椆偑妋擣偱偒傞傑偱儊僜僢僪偼僽儘僢僋偟傑偡丅</ja>
  267. /// <en> When no data is available or the new line characters are not sent, the execution of this method is blocked.</en></para>
  268. /// <para><ja>丂摿偵僾儘儞僾僩暥帤楍偼夵峴傪娷傑側偄偺偱丄僾儘儞僾僩傪懸偮偨傔偵偙偺儊僜僢僪傪巊傢側偄傛偆偵偟偰偔偩偝偄丅僾儘儞僾僩偺敾掕傪偡傞傛偆側応崌偵偼偐傢傝偵<see cref="ReceiveData"/>儊僜僢僪傪巊偭偰偔偩偝偄丅</ja>
  269. /// <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>
  270. /// </para>
  271. /// <para><ja>丂傑偨丄儂僗僩偐傜棃傞僨乕僞偺偆偪丄CR偲NUL偼柍帇偝傟傑偡丅</ja>
  272. /// <en> Additionally, CR and NUL are ignored in the data from the host.</en></para>
  273. /// <seealso cref="ReceiveData"/>
  274. /// </remarks>
  275. /// <example>
  276. /// <code>
  277. /// import Poderosa.Macro;
  278. /// import System.IO;
  279. /// var env = new Environment();
  280. /// 
  281. /// var output = new StreamWriter("...
  282. /// var connection = env.Connections.ActiveConnection;
  283. /// var line = connection.ReceiveLine();
  284. /// while(line!="end") { //wait for "end"
  285. ///   output.WriteLine(line);
  286. ///   line = connection.ReceiveLine();
  287. /// }
  288. /// output.Close();
  289. /// 
  290. /// </code>
  291. /// </example>
  292. /// <returns><ja>庴怣偟偨暥帤楍偱偡丅夵峴暥帤偼娷傒傑偣傫丅</ja><en>The received line without new line characters.</en></returns>
  293. public abstract string ReceiveLine();
  294. /// <summary>
  295. /// <ja>僨乕僞傪庴怣偟傑偡丅</ja>
  296. /// <en>Receives data from the connection.</en>
  297. /// </summary>
  298. /// <remarks>
  299. /// <para><ja>丂儂僗僩偐傜僨乕僞偑枹摓拝偺偲偒偼丄摓拝偡傞傑偱儅僋儘偺幚峴偼僽儘僢僋偟傑偡丅</ja>
  300. /// <en>  When no data is available, the execution of this method is blocked.</en>
  301. /// </para>
  302. /// <para><ja>丂僨乕僞偑摓拝嵪傒偺偲偒偼丄慜夞偺ReceiveData偺屇傃弌偟埲崀偵棃偨僨乕僞傪堦妵偟偰庢摼偟傑偡丅峴偵愗傝暘偗傞嶌嬈偼儅僋儘懁偱峴偆昁梫偑偁傝傑偡偑丄夵峴偱廔傢偭偰偄側偄僨乕僞傕庢摼偱偒傞棙揰偑偁傝傑偡丅 <see cref="ReceiveLine"/>偲巊偄暘偗偰偔偩偝偄丅</ja>
  303. /// <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>
  304. /// </para>
  305. /// <para><ja>丂傑偨丄儂僗僩偐傜棃傞僨乕僞偺偆偪丄CR偲NUL偼柍帇偝傟傑偡丅夵峴偼LF偵傛偭偰敾暿偟傑偡丅</ja>
  306. /// <en> CR and NUL are ignored in the data from the host. The line breaks are determined by LF.</en></para>
  307. /// <seealso cref="ReceiveLine"/>
  308. /// </remarks>
  309. /// <example>
  310. /// <code>
  311. /// import Poderosa.Macro;
  312. /// import System.IO;
  313. /// var env = new Environment();
  314. /// 
  315. /// var connection = env.Connections.ActiveConnection;
  316. /// var data = connection.ReceiveData();
  317. /// if(data.EndsWith("login: ") {
  318. ///   ...
  319. /// </code>
  320. /// </example>
  321. /// <returns><ja>庴怣偟偨暥帤楍偱偡丅</ja><en>The received data.</en></returns>
  322. public abstract string ReceiveData();
  323. /// <summary>
  324. /// <ja>儘僌偵僐儊儞僩傪彂偒傑偡丅愙懕偑儘僌傪庢傞傛偆偵愝掕偝傟偰偄側偄応崌偼壗傕偟傑偣傫丅</ja>
  325. /// <en>Writes a comment to the log. If the connection is not set to record the log, this method does nothing.</en>
  326. /// </summary>
  327. /// <example>
  328. /// <code>
  329. /// import Poderosa.Macro;
  330. /// var env = new Environment();
  331. /// 
  332. /// var connection = env.Connections.ActiveConnection;
  333. /// connection.WriteComment("starting macro...");
  334. /// </code>
  335. /// </example>
  336. /// <param name="comment"><ja>僐儊儞僩暥帤楍</ja><en>The comment string</en></param>
  337. public abstract void WriteComment(string comment);
  338. }
  339. /// <summary>
  340. /// <ja>傾僾儕働乕僔儑儞偺奜娤傪惂屼偡傞偨傔偺僆僽僕僃僋僩偱偡丅</ja>
  341. /// <en>Implements the appearances of the application.</en>
  342. /// </summary>
  343. public abstract class Frame : MarshalByRefObject {
  344. #if !MACRODOC
  345. /// <summary>
  346. /// <ja>暘妱曽幃傪庢摼丒愝掕偟傑偡丅</ja>
  347. /// <en>Gets or sets the division style.</en>
  348. /// </summary>
  349. public abstract GFrameStyle FrameStyle { get; set; }
  350. #endif
  351. /// <summary>
  352. /// <ja>僼儗乕儉傪僔儞僌儖僗僞僀儖偵僙僢僩偡傞偲偲傕偵丄抂枛傪儕僒僀僘偟傑偡丅</ja>
  353. /// <en>Changes the frame style to be single and resizes the terminal.</en>
  354. /// </summary>
  355. /// <param name="width"><ja>僞乕儈僫儖偺暆傪暥帤扨埵偱巜掕偟傑偡丅</ja><en>The terminal width in characters</en></param>
  356. /// <param name="height"><ja>僞乕儈僫儖偺崅偝傪暥帤扨埵偱巜掕偟傑偡丅</ja><en>The terminal height in characters</en></param>
  357. public abstract void SetStyleS(int width, int height);
  358. /// <summary>
  359. /// <ja>僼儗乕儉傪忋壓俀暘妱僗僞僀儖偵僙僢僩偡傞偲偲傕偵丄抂枛傪儕僒僀僘偟傑偡丅</ja>
  360. /// <en>Changes the frame style to be divided horizontally and resizes the terminal.</en>
  361. /// </summary>
  362. /// <param name="width"><ja>僞乕儈僫儖偺暆傪暥帤扨埵偱巜掕偟傑偡丅偙傟偼忋壓俀偮偺儁僀儞偱嫟桳偝傟傑偡丅</ja><en>The terminal width in characters. This is common to the two panes.</en></param>
  363. /// <param name="height1"><ja>忋偺儁僀儞偺崅偝傪暥帤扨埵偱巜掕偟傑偡丅</ja><en>The terminal height of the upper pane in characters.</en></param>
  364. /// <param name="height2"><ja>壓偺儁僀儞偺崅偝傪暥帤扨埵偱巜掕偟傑偡丅</ja><en>The terminal height of the lower pane in characters.</en></param>
  365. public abstract void SetStyleH(int width, int height1, int height2);
  366. /// <summary>
  367. /// <ja>僼儗乕儉傪嵍塃俀暘妱僗僞僀儖偵僙僢僩偡傞偲偲傕偵丄僼儗乕儉傪儕僒僀僘偟傑偡丅</ja>
  368. /// <en>Changes the frame style to be divided vertically and resizes the terminal.</en>
  369. /// </summary>
  370. /// <param name="width1"><ja>嵍偺儁僀儞偺暆傪暥帤扨埵偱巜掕偟傑偡丅</ja><en>The terminal width of the left pane in characters.</en></param>
  371. /// <param name="width2"><ja>塃偺儁僀儞偺暆傪暥帤扨埵偱巜掕偟傑偡丅</ja><en>The terminal width of the right pane in characters.</en></param>
  372. /// <param name="height"><ja>僞乕儈僫儖偺崅偝傪暥帤扨埵偱巜掕偟傑偡丅偙傟偼嵍塃俀偮偺儁僀儞偱嫟桳偝傟傑偡丅</ja><en>The terminal height in characters. This is common to the two panes.</en></param>
  373. public abstract void SetStyleV(int width1, int width2, int height);
  374. }
  375. /// <summary>
  376. /// <ja>儅僋儘偐傜屇傃弌偡偨傔偺丄斾妑揑傛偔巊偄偦偆側婡擻傪廂榐偟偨僆僽僕僃僋僩偱偡丅</ja>
  377. /// <en>Implements several utility functions for macros.</en>
  378. /// </summary>
  379. public abstract class Util : MarshalByRefObject {
  380. /// <summary>
  381. /// <ja>儊僢僙乕僕儃僢僋僗傪昞帵偟傑偡丅</ja>
  382. /// <en>Shows a message box.</en>
  383. /// </summary>
  384. /// <example>
  385. /// <code>
  386. /// import Poderosa.Macro;
  387. /// var env = new Environment();
  388. /// 
  389. /// env.Util.MessageBox(String.Format("This file is {0}", env.MacroFileName));
  390. /// </code>
  391. /// </example>
  392. /// <param name="msg"><ja>昞帵偟偨偄儊僢僙乕僕</ja><en>The message to be shown.</en></param>
  393. public abstract void MessageBox(string msg);
  394. /// <summary>
  395. /// <ja>僼傽僀儖傪奐偔丄報嶞偡傞偲偄偭偨憖嶌傪偟傑偡丅</ja>
  396. /// <en>Performs actions to the file such as open or print.</en>
  397. /// </summary>
  398. /// <remarks>
  399. /// <ja>
  400. /// 棫偪忋偑傞傾僾儕働乕僔儑儞偼僼傽僀儖偺奼挘巕偲verb堷悢偵傛偭偰寛傑傝傑偡丅
  401. /// 偨偲偊偽奼挘巕偑txt偱偁傟偽僥僉僗僩僄僨傿僞偑婲摦偟傑偡丅
  402. /// 撪晹揑偵偼丄偙偺儊僜僢僪偼Win32偺ShellExecute API傪屇傃弌偟傑偡丅
  403. /// </ja>
  404. /// <en>
  405. /// The application is decided by the extension and the verb argument.
  406. /// For exapmle, a text editor starts if the extension is .txt.
  407. /// This method calls the ShellExecute API of Win32 internally.
  408. /// </en>
  409. /// </remarks>
  410. /// <example>
  411. /// <code>
  412. /// import Poderosa.Macro;
  413. /// import System.IO;
  414. /// var env = new Environment();
  415. /// 
  416. /// string filename = Path.GetTempFileName() + ".txt";
  417. /// ... (write some text to this file)
  418. /// 
  419. /// env.Util.ShellExecute("open", filename);
  420. /// </code>
  421. /// </example>
  422. /// <param name="verb"><ja>僼傽僀儖偵懳偟偰峴偆摦嶌偱偡丅"open","print"側偳偱偡丅</ja><en>The action to the file such as "open" or "print".</en></param>
  423. /// <param name="filename"><ja>奐偔僼傽僀儖傪僼儖僷僗偱巜掕偟傑偡丅</ja><en>The full path of the file name.</en></param>
  424. public abstract void ShellExecute(string verb, string filename);
  425. /// <summary>
  426. /// <ja>擟堄偺傾僾儕働乕僔儑儞傪婲摦偟傑偡丅</ja>
  427. /// <en>Starts other applications.</en>
  428. /// </summary>
  429. /// <remarks>
  430. /// <ja>撪晹揑偵偼丄偙偺儊僜僢僪偼Win32偺WinExec API傪屇傃弌偟傑偡丅</ja>
  431. /// <en>This method calls WinExec API of Win32 internally.</en>
  432. /// </remarks>
  433. /// <example>
  434. /// <code>
  435. /// import Poderosa.Macro;
  436. /// var env = new Environment();
  437. /// 
  438. /// env.Util.Exec("notepad.exe");
  439. /// </code>
  440. /// </example>
  441. /// <param name="command"><ja>婲摦偟偨偄傾僾儕働乕僔儑儞偺柤慜偱偡丅昁梫偱偁傟偽堷悢傪偮偗傞偙偲傕偱偒傑偡丅</ja><en>The name of the application to be started. Arguments are allowed if necessary.</en></param>
  442. public abstract void Exec(string command);
  443. }
  444. /// <summary>
  445. /// <ja>儅僋儘偺僥僗僩偲僨僶僢僌偵昁梫側婡擻傪採嫙偟傑偡丅</ja>
  446. /// <en>Implements features for testing and debugging the macro.</en>
  447. /// </summary>
  448. /// <remarks>
  449. /// <para><ja>丂儅僋儘偺僾儘僷僥傿夋柺偵偍偄偰丄乽僩儗乕僗僂傿儞僪僂傪昞帵偡傞乿僆僾僔儑儞傪偮偗偰偍偔偲丄偦偺儅僋儘傪婲摦偡傞偲偒偵僩儗乕僗僂傿儞僪僂偑巊偊傞傛偆偵側傝傑偡丅</ja>
  450. /// <en> The macro trace window is displayed when the "shows trace window" option is checked in the dialog box of the macro property.</en>
  451. /// </para>
  452. /// </remarks>
  453. public abstract class DebugService : MarshalByRefObject {
  454. /// <summary>
  455. /// <ja>僩儗乕僗僂傿儞僪僂偵侾峴偺僨乕僞傪昞帵偟傑偡丅</ja>
  456. /// <en>Outputs a line to the trace window.</en>
  457. /// </summary>
  458. /// <example>
  459. /// <code>
  460. /// import Poderosa.Macro;
  461. /// var env = new Environment();
  462. /// 
  463. /// var i = 123;
  464. /// env.Debug.Trace(String.Format("i={0}", i));
  465. /// </code>
  466. /// </example>
  467. /// <param name="msg"><ja>昞帵偟偨偄僨乕僞</ja><en>The data to be displayed.</en></param>
  468. public abstract void Trace(string msg);
  469. /// <summary>
  470. /// <ja>屇傃弌偟偨帪揰偱偺僗僞僢僋僩儗乕僗傪昞帵偟傑偡丅</ja>
  471. /// <en>Outputs the stack trace to the trace window.</en>
  472. /// </summary>
  473. public abstract void PrintStackTrace();
  474. }
  475. }