Commit dbf68604d34db028bb8cf4915fbf0a64a004a324

Authored by Perry Werneck
1 parent b8dbd42c
Exists in master

Incluindo novos métodos na API .NET

@@ -26,7 +26,7 @@ @@ -26,7 +26,7 @@
26 26
27 GLUELIB=lib3270-mono@DLLEXT@ 27 GLUELIB=lib3270-mono@DLLEXT@
28 LIBNAME=pw3270-sharp.dll 28 LIBNAME=pw3270-sharp.dll
29 -TESTPROGRAM?=vbsample 29 +TESTPROGRAM?=sample
30 30
31 #---[ Configuration values ]------------------------------------------------------------- 31 #---[ Configuration values ]-------------------------------------------------------------
32 32
src/native/get.cc
@@ -61,3 +61,15 @@ @@ -61,3 +61,15 @@
61 int tn3270_get_secure(h3270::session *ses) { 61 int tn3270_get_secure(h3270::session *ses) {
62 return (int) ses->get_secure(); 62 return (int) ses->get_secure();
63 } 63 }
  64 +
  65 + int tn3270_get_width(h3270::session *ses) {
  66 + return (int) ses->get_width();
  67 + }
  68 +
  69 + int tn3270_get_height(h3270::session *ses) {
  70 + return (int) ses->get_height();
  71 + }
  72 +
  73 + int tn3270_get_length(h3270::session *ses) {
  74 + return (int) ses->get_length();
  75 +}
src/native/private.h
@@ -112,6 +112,9 @@ @@ -112,6 +112,9 @@
112 DLL_PUBLIC int tn3270_pfkey(h3270::session *ses, int key); 112 DLL_PUBLIC int tn3270_pfkey(h3270::session *ses, int key);
113 DLL_PUBLIC int tn3270_pakey(h3270::session *ses, int key); 113 DLL_PUBLIC int tn3270_pakey(h3270::session *ses, int key);
114 114
  115 + DLL_PUBLIC int tn3270_get_width(h3270::session *ses);
  116 + DLL_PUBLIC int tn3270_get_height(h3270::session *ses);
  117 + DLL_PUBLIC int tn3270_get_length(h3270::session *ses);
115 } 118 }
116 119
117 120
src/pw3270-sharp/pw3270-sharp.cs
@@ -66,6 +66,9 @@ namespace pw3270 { @@ -66,6 +66,9 @@ namespace pw3270 {
66 extern static int tn3270_is_connected(IntPtr Session); 66 extern static int tn3270_is_connected(IntPtr Session);
67 67
68 [DllImport ("lib3270-mono",CallingConvention=CallingConvention.Cdecl)] 68 [DllImport ("lib3270-mono",CallingConvention=CallingConvention.Cdecl)]
  69 + extern static int tn3270_is_ready(IntPtr Session);
  70 +
  71 + [DllImport ("lib3270-mono",CallingConvention=CallingConvention.Cdecl)]
69 extern static int tn3270_disconnect(IntPtr Session); 72 extern static int tn3270_disconnect(IntPtr Session);
70 73
71 [DllImport ("lib3270-mono",CallingConvention=CallingConvention.Cdecl)] 74 [DllImport ("lib3270-mono",CallingConvention=CallingConvention.Cdecl)]
@@ -116,6 +119,15 @@ namespace pw3270 { @@ -116,6 +119,15 @@ namespace pw3270 {
116 [DllImport ("lib3270-mono",CallingConvention=CallingConvention.Cdecl)] 119 [DllImport ("lib3270-mono",CallingConvention=CallingConvention.Cdecl)]
117 extern static int tn3270_pakey(IntPtr Session, int key); 120 extern static int tn3270_pakey(IntPtr Session, int key);
118 121
  122 + [DllImport ("lib3270-mono",CallingConvention=CallingConvention.Cdecl)]
  123 + extern static int tn3270_get_width(IntPtr Session);
  124 +
  125 + [DllImport ("lib3270-mono",CallingConvention=CallingConvention.Cdecl)]
  126 + extern static int tn3270_get_height(IntPtr Session);
  127 +
  128 + [DllImport ("lib3270-mono",CallingConvention=CallingConvention.Cdecl)]
  129 + extern static int tn3270_get_length(IntPtr Session);
  130 +
119 /// <summary> 131 /// <summary>
120 /// Create a new session with lib3270/pw3270 132 /// Create a new session with lib3270/pw3270
121 /// </summary> 133 /// </summary>
@@ -148,6 +160,12 @@ namespace pw3270 { @@ -148,6 +160,12 @@ namespace pw3270 {
148 return str.ToString(); 160 return str.ToString();
149 } 161 }
150 162
  163 + public string Version {
  164 + get {
  165 + return GetVersion();
  166 + }
  167 + }
  168 +
151 /// <summary> 169 /// <summary>
152 /// Get lib3270/pw3270 Revision number 170 /// Get lib3270/pw3270 Revision number
153 /// </summary> 171 /// </summary>
@@ -162,6 +180,12 @@ namespace pw3270 { @@ -162,6 +180,12 @@ namespace pw3270 {
162 return str.ToString(); 180 return str.ToString();
163 } 181 }
164 182
  183 + public string Revision {
  184 + get {
  185 + return GetRevision();
  186 + }
  187 + }
  188 +
165 /// <summary> 189 /// <summary>
166 /// Connect to 3270 host. 190 /// Connect to 3270 host.
167 /// </summary> 191 /// </summary>
@@ -188,6 +212,22 @@ namespace pw3270 { @@ -188,6 +212,22 @@ namespace pw3270 {
188 return tn3270_is_connected(hSession) != 0; 212 return tn3270_is_connected(hSession) != 0;
189 } 213 }
190 214
  215 + public bool Connected {
  216 + get {
  217 + return tn3270_is_connected(hSession) != 0;
  218 + }
  219 + }
  220 +
  221 + public bool IsReady() {
  222 + return tn3270_is_ready(hSession) != 0;
  223 + }
  224 +
  225 + public bool Ready {
  226 + get {
  227 + return tn3270_is_ready(hSession) != 0;
  228 + }
  229 + }
  230 +
191 /// <summary> 231 /// <summary>
192 /// Disconnect from 3270 host. 232 /// Disconnect from 3270 host.
193 /// </summary> 233 /// </summary>
@@ -365,7 +405,36 @@ namespace pw3270 { @@ -365,7 +405,36 @@ namespace pw3270 {
365 return tn3270_pakey(hSession, key); 405 return tn3270_pakey(hSession, key);
366 } 406 }
367 407
  408 + public int GetWidth() {
  409 + return tn3270_get_width(hSession);
  410 + }
  411 +
  412 + public int Width {
  413 + get {
  414 + return tn3270_get_width(hSession);
  415 + }
  416 + }
  417 +
  418 + public int GetHeight() {
  419 + return tn3270_get_height(hSession);
  420 + }
  421 +
  422 + public int Height {
  423 + get {
  424 + return tn3270_get_height(hSession);
  425 + }
  426 + }
368 427
  428 + public int GetLength() {
  429 + return tn3270_get_length(hSession);
  430 + }
  431 +
  432 + public int Length {
  433 + get {
  434 + return tn3270_get_length(hSession);
  435 + }
  436 + }
  437 +
369 } 438 }
370 439
371 } 440 }
testprograms/sample.cs
@@ -35,11 +35,12 @@ class sample { @@ -35,11 +35,12 @@ class sample {
35 35
36 pw3270.Session host = new pw3270.Session(""); 36 pw3270.Session host = new pw3270.Session("");
37 37
38 - System.Console.WriteLine("Using pw3270 version " + host.GetVersion() + " revision " + host.GetRevision()); 38 + System.Console.WriteLine("Using pw3270 version " + host.Version + " revision " + host.Revision);
  39 + System.Console.WriteLine("Screen size is " + host.Width + "x" + host.Height + " (" + host.Length + ")");
39 40
40 host.Connect("tn3270://zos.efglobe.com:telnet",10); 41 host.Connect("tn3270://zos.efglobe.com:telnet",10);
41 42
42 - if(host.IsConnected()) { 43 + if(host.Connected) {
43 44
44 System.Console.WriteLine("Connected to host"); 45 System.Console.WriteLine("Connected to host");
45 46
testprograms/vbsample.vb
@@ -37,6 +37,7 @@ Public Module modmain @@ -37,6 +37,7 @@ Public Module modmain
37 dim host as new pw3270.Session("") 37 dim host as new pw3270.Session("")
38 38
39 Console.WriteLine("Using pw3270 version " + host.getVersion() + " revision " + host.GetRevision()) 39 Console.WriteLine("Using pw3270 version " + host.getVersion() + " revision " + host.GetRevision())
  40 + Console.WriteLine("Screen size is " + host.GetWidth() + "x" + host.GetHeigth())
40 41
41 host.Connect("tn3270://zos.efglobe.com:telnet",10) 42 host.Connect("tn3270://zos.efglobe.com:telnet",10)
42 43