Commit 52c4a305a5601462144b5240c7e0231e53e2ba4e

Authored by Perry Werneck
1 parent 988a2a56
Exists in master

Incluindo documentação no formato C#, ajustando Makefile para criar o xml.

@@ -94,6 +94,7 @@ tn3270-sharp-@PACKAGE_VERSION@.@host@.zip: \ @@ -94,6 +94,7 @@ tn3270-sharp-@PACKAGE_VERSION@.@host@.zip: \
94 @zip -9 -j $@ \ 94 @zip -9 -j $@ \
95 $(BINRLS)/$(GLUELIB) \ 95 $(BINRLS)/$(GLUELIB) \
96 $(BINRLS)/$(LIBNAME) \ 96 $(BINRLS)/$(LIBNAME) \
  97 + $(BINRLS)/*.xml \
97 testprograms/sample.cs \ 98 testprograms/sample.cs \
98 src/tn3270-sharp/tn3270-sharp.cs \ 99 src/tn3270-sharp/tn3270-sharp.cs \
99 $(BINRLS)/sample.exe 100 $(BINRLS)/sample.exe
src/tn3270-sharp/Makefile.in
@@ -80,6 +80,6 @@ $(BINRLS)/$(LIBNAME): \ @@ -80,6 +80,6 @@ $(BINRLS)/$(LIBNAME): \
80 $(SOURCES) 80 $(SOURCES)
81 81
82 @$(MKDIR) `dirname $@` 82 @$(MKDIR) `dirname $@`
83 - @$(MCS) -target:library -out:$@ $< 83 + @$(MCS) -doc:$(basename $@).xml -target:library -out:$@ $<
84 84
85 85
src/tn3270-sharp/tn3270-sharp.cs
@@ -36,8 +36,14 @@ using System.Runtime.InteropServices; @@ -36,8 +36,14 @@ using System.Runtime.InteropServices;
36 36
37 namespace tn3270 { 37 namespace tn3270 {
38 38
  39 + /// <summary>
  40 + /// Session with 3270 HOST.
  41 + /// </summary>
39 public class Session { 42 public class Session {
40 43
  44 + /// <summary>
  45 + /// lib3270 session handle
  46 + /// </summary>
41 private IntPtr hSession; 47 private IntPtr hSession;
42 48
43 [DllImport ("lib3270-mono")] 49 [DllImport ("lib3270-mono")]
@@ -109,34 +115,82 @@ namespace tn3270 { @@ -109,34 +115,82 @@ namespace tn3270 {
109 [DllImport ("lib3270-mono")] 115 [DllImport ("lib3270-mono")]
110 extern static int tn3270_pakey(IntPtr Session, int key); 116 extern static int tn3270_pakey(IntPtr Session, int key);
111 117
  118 + /// <summary>
  119 + /// Create a new session with lib3270/pw3270
  120 + /// </summary>
  121 + ///
  122 + /// <param name="name">Session name or empty string for a hidden session</param>
  123 + ///
112 public Session(string name) { 124 public Session(string name) {
113 hSession = tn3270_create_session(name); 125 hSession = tn3270_create_session(name);
114 } 126 }
115 127
  128 + /// <summary>
  129 + /// Disconnect from host, destroy session.
  130 + /// </summary>
  131 + ///
116 ~Session() { 132 ~Session() {
117 tn3270_destroy_session(hSession); 133 tn3270_destroy_session(hSession);
118 } 134 }
119 135
  136 + /// <summary>
  137 + /// Get lib3270/pw3270 Version identifier
  138 + /// </summary>
  139 + ///
  140 + /// <returns>
  141 + /// The version of the active instance.
  142 + /// </returns>
  143 + ///
120 public string GetVersion() { 144 public string GetVersion() {
121 StringBuilder str = new StringBuilder(10); 145 StringBuilder str = new StringBuilder(10);
122 tn3270_get_version(hSession, str, 10); 146 tn3270_get_version(hSession, str, 10);
123 return str.ToString(); 147 return str.ToString();
124 } 148 }
125 149
  150 + /// <summary>
  151 + /// Get lib3270/pw3270 Revision number
  152 + /// </summary>
  153 + ///
  154 + /// <returns>
  155 + /// The revision of the active instance.
  156 + /// </returns>
  157 + ///
126 public string GetRevision() { 158 public string GetRevision() {
127 StringBuilder str = new StringBuilder(10); 159 StringBuilder str = new StringBuilder(10);
128 tn3270_get_revision(hSession, str, 10); 160 tn3270_get_revision(hSession, str, 10);
129 return str.ToString(); 161 return str.ToString();
130 } 162 }
131 163
  164 + /// <summary>
  165 + /// Connect to 3270 host.
  166 + /// </summary>
  167 + ///
  168 + /// <param name="host">URL of the target host (tn3270://hostname:port)</param>
  169 + /// <param name="wait">How many seconds should the call wait for the connection becomes ready</param>
  170 + ///
  171 + /// <returns>
  172 + /// </returns>
  173 + ///
132 public int Connect(string host, int wait) { 174 public int Connect(string host, int wait) {
133 return tn3270_connect(hSession, host, wait); 175 return tn3270_connect(hSession, host, wait);
134 } 176 }
135 177
  178 + /// <summary>
  179 + /// Get connection statue
  180 + /// </summary>
  181 + ///
  182 + /// <returns>
  183 + /// true if the session is connected to a remote host.
  184 + /// </returns>
  185 + ///
136 public bool IsConnected() { 186 public bool IsConnected() {
137 return tn3270_is_connected(hSession) != 0; 187 return tn3270_is_connected(hSession) != 0;
138 } 188 }
139 189
  190 + /// <summary>
  191 + /// Disconnect from 3270 host.
  192 + /// </summary>
  193 + ///
140 public int Disconnect() { 194 public int Disconnect() {
141 return tn3270_disconnect(hSession); 195 return tn3270_disconnect(hSession);
142 } 196 }