Commit 52c4a305a5601462144b5240c7e0231e53e2ba4e

Authored by Perry Werneck
1 parent 988a2a56
Exists in master

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

Makefile.in
... ... @@ -94,6 +94,7 @@ tn3270-sharp-@PACKAGE_VERSION@.@host@.zip: \
94 94 @zip -9 -j $@ \
95 95 $(BINRLS)/$(GLUELIB) \
96 96 $(BINRLS)/$(LIBNAME) \
  97 + $(BINRLS)/*.xml \
97 98 testprograms/sample.cs \
98 99 src/tn3270-sharp/tn3270-sharp.cs \
99 100 $(BINRLS)/sample.exe
... ...
src/tn3270-sharp/Makefile.in
... ... @@ -80,6 +80,6 @@ $(BINRLS)/$(LIBNAME): \
80 80 $(SOURCES)
81 81  
82 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 36  
37 37 namespace tn3270 {
38 38  
  39 + /// <summary>
  40 + /// Session with 3270 HOST.
  41 + /// </summary>
39 42 public class Session {
40 43  
  44 + /// <summary>
  45 + /// lib3270 session handle
  46 + /// </summary>
41 47 private IntPtr hSession;
42 48  
43 49 [DllImport ("lib3270-mono")]
... ... @@ -109,34 +115,82 @@ namespace tn3270 {
109 115 [DllImport ("lib3270-mono")]
110 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 124 public Session(string name) {
113 125 hSession = tn3270_create_session(name);
114 126 }
115 127  
  128 + /// <summary>
  129 + /// Disconnect from host, destroy session.
  130 + /// </summary>
  131 + ///
116 132 ~Session() {
117 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 144 public string GetVersion() {
121 145 StringBuilder str = new StringBuilder(10);
122 146 tn3270_get_version(hSession, str, 10);
123 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 158 public string GetRevision() {
127 159 StringBuilder str = new StringBuilder(10);
128 160 tn3270_get_revision(hSession, str, 10);
129 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 174 public int Connect(string host, int wait) {
133 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 186 public bool IsConnected() {
137 187 return tn3270_is_connected(hSession) != 0;
138 188 }
139 189  
  190 + /// <summary>
  191 + /// Disconnect from 3270 host.
  192 + /// </summary>
  193 + ///
140 194 public int Disconnect() {
141 195 return tn3270_disconnect(hSession);
142 196 }
... ...