Modified: websites/staging/thrift/trunk/content/tutorial/csharp.html ============================================================================== --- websites/staging/thrift/trunk/content/tutorial/csharp.html (original) +++ websites/staging/thrift/trunk/content/tutorial/csharp.html Fri Nov 20 17:19:21 2020 @@ -115,78 +115,43 @@ h2:hover > .headerlink, h3:hover > .head } h2:hover > .headerlink, h3:hover > .headerlink, h1:hover > .headerlink, h6:hover > .headerlink, h4:hover > .headerlink, h5:hover > .headerlink, dt:hover > .elementid-permalink { visibility: visible }</style> -<div class="codehilite"><pre><span class="k">using</span> <span class="n">System</span><span class="p">;</span> -<span class="k">using</span> <span class="n">Thrift</span><span class="p">;</span> -<span class="k">using</span> <span class="n">Thrift</span><span class="p">.</span><span class="n">Protocol</span><span class="p">;</span> -<span class="k">using</span> <span class="n">Thrift</span><span class="p">.</span><span class="n">Server</span><span class="p">;</span> -<span class="k">using</span> <span class="n">Thrift</span><span class="p">.</span><span class="n">Transport</span><span class="p">;</span> - -<span class="k">namespace</span> <span class="n">CSharpTutorial</span> -<span class="p">{</span> - <span class="k">public</span> <span class="k">class</span> <span class="nc">CSharpClient</span> - <span class="p">{</span> - <span class="k">public</span> <span class="k">static</span> <span class="kt">void</span> <span class="n">Main</span><span class="p">()</span> - <span class="p">{</span> - <span class="k">try</span> - <span class="p">{</span> - <span class="n">TTransport</span> <span class="n">transport</span> <span class="o">=</span> <span class="k">new</span> <span class="n">TSocket</span><span class="p">(</span><span class="s">"localhost"</span><span class="p">,</span> <span class="mi">9090</span><span class="p">);</span> - <span class="n">TProtocol</span> <span class="n">protocol</span> <span class="o">=</span> <span class="k">new</span> <span class="n">TBinaryProtocol</span><span class="p">(</span><span class="n">transport</span><span class="p">);</span> - <span class="n">Calculator</span><span class="p">.</span><span class="n">Client</span> <span class="n">client</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Calculator</span><span class="p">.</span><span class="n">Client</span><span class="p">(</span><span class="n">protocol</span><span class="p">);</span> - - <span class="n">transport</span><span class="p">.</span><span class="n">Open</span><span class="p">();</span> - <span class="k">try</span> - <span class="p">{</span> - <span class="n">client</span><span class="p">.</span><span class="n">ping</span><span class="p">();</span> - <span class="n">Console</span><span class="p">.</span><span class="n">WriteLine</span><span class="p">(</span><span class="s">"ping()"</span><span class="p">);</span> - - <span class="kt">int</span> <span class="n">sum</span> <span class="o">=</span> <span class="n">client</span><span class="p">.</span><span class="n">add</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">);</span> - <span class="n">Console</span><span class="p">.</span><span class="n">WriteLine</span><span class="p">(</span><span class="s">"1+1={0}"</span><span class="p">,</span> <span class="n">sum</span><span class="p">);</span> - - <span class="n">Work</span> <span class="n">work</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Work</span><span class="p">();</span> - - <span class="n">work</span><span class="p">.</span><span class="n">Op</span> <span class="o">=</span> <span class="n">Operation</span><span class="p">.</span><span class="n">DIVIDE</span><span class="p">;</span> - <span class="n">work</span><span class="p">.</span><span class="n">Num1</span> <span class="o">=</span> <span class="mi">1</span><span class="p">;</span> - <span class="n">work</span><span class="p">.</span><span class="n">Num2</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> - <span class="k">try</span> - <span class="p">{</span> - <span class="kt">int</span> <span class="n">quotient</span> <span class="o">=</span> <span class="n">client</span><span class="p">.</span><span class="n">calculate</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="n">work</span><span class="p">);</span> - <span class="n">Console</span><span class="p">.</span><span class="n">WriteLine</span><span class="p">(</span><span class="s">"Whoa we can divide by 0"</span><span class="p">);</span> - <span class="p">}</span> - <span class="k">catch</span> <span class="p">(</span><span class="n">InvalidOperation</span> <span class="n">io</span><span class="p">)</span> - <span class="p">{</span> - <span class="n">Console</span><span class="p">.</span><span class="n">WriteLine</span><span class="p">(</span><span class="s">"Invalid operation: "</span> <span class="o">+</span> <span class="n">io</span><span class="p">.</span><span class="n">Why</span><span class="p">);</span> - <span class="p">}</span> - - <span class="n">work</span><span class="p">.</span><span class="n">Op</span> <span class="o">=</span> <span class="n">Operation</span><span class="p">.</span><span class="n">SUBTRACT</span><span class="p">;</span> - <span class="n">work</span><span class="p">.</span><span class="n">Num1</span> <span class="o">=</span> <span class="mi">15</span><span class="p">;</span> - <span class="n">work</span><span class="p">.</span><span class="n">Num2</span> <span class="o">=</span> <span class="mi">10</span><span class="p">;</span> - <span class="k">try</span> - <span class="p">{</span> - <span class="kt">int</span> <span class="n">diff</span> <span class="o">=</span> <span class="n">client</span><span class="p">.</span><span class="n">calculate</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="n">work</span><span class="p">);</span> - <span class="n">Console</span><span class="p">.</span><span class="n">WriteLine</span><span class="p">(</span><span class="s">"15-10={0}"</span><span class="p">,</span> <span class="n">diff</span><span class="p">);</span> - <span class="p">}</span> - <span class="k">catch</span> <span class="p">(</span><span class="n">InvalidOperation</span> <span class="n">io</span><span class="p">)</span> - <span class="p">{</span> - <span class="n">Console</span><span class="p">.</span><span class="n">WriteLine</span><span class="p">(</span><span class="s">"Invalid operation: "</span> <span class="o">+</span> <span class="n">io</span><span class="p">.</span><span class="n">Why</span><span class="p">);</span> - <span class="p">}</span> - - <span class="n">SharedStruct</span> <span class="n">log</span> <span class="o">=</span> <span class="n">client</span><span class="p">.</span><span class="n">getStruct</span><span class="p">(</span><span class="mi">1</span><span class="p">);</span> - <span class="n">Console</span><span class="p">.</span><span class="n">WriteLine</span><span class="p">(</span><span class="s">"Check log: {0}"</span><span class="p">,</span> <span class="n">log</span><span class="p">.</span><span class="n">Value</span><span class="p">);</span> - - <span class="p">}</span> - <span class="n">finally</span> - <span class="p">{</span> - <span class="n">transport</span><span class="p">.</span><span class="n">Close</span><span class="p">();</span> - <span class="p">}</span> - <span class="p">}</span> - <span class="k">catch</span> <span class="p">(</span><span class="n">TApplicationException</span> <span class="n">x</span><span class="p">)</span> - <span class="p">{</span> - <span class="n">Console</span><span class="p">.</span><span class="n">WriteLine</span><span class="p">(</span><span class="n">x</span><span class="p">.</span><span class="n">StackTrace</span><span class="p">);</span> - <span class="p">}</span> - - <span class="p">}</span> - <span class="p">}</span> -<span class="p">}</span> +<div class="codehilite"><pre><span class="o"><</span><span class="n">input</span> <span class="n">name</span><span class="o">=</span><span class="s">"a"</span> <span class="n">type</span><span class="o">=</span><span class="s">"hidden"</span> <span class="n">value</span><span class="o">=</span><span class="s">"search"</span> <span class="o">/></span> +<span class="o"><</span><span class="n">input</span> <span class="n">name</span><span class="o">=</span><span class="s">"h"</span> <span class="n">type</span><span class="o">=</span><span class="s">"hidden"</span> <span class="n">value</span><span class="o">=</span><span class="s">"HEAD"</span> <span class="o">/></span> +<span class="o"><</span><span class="n">select</span> <span class="n">name</span><span class="o">=</span><span class="s">"st"</span> <span class="o">></span> +<span class="o"><</span><span class="n">option</span> <span class="n">selected</span><span class="o">=</span><span class="s">"selected"</span> <span class="n">value</span><span class="o">=</span><span class="s">"commit"</span><span class="o">></span><span class="n">commit</span><span class="o"></</span><span class="n">option</span><span class="o">></span> +<span class="o"><</span><span class="n">option</span> <span class="n">value</span><span class="o">=</span><span class="s">"grep"</span><span class="o">></span><span class="n">grep</span><span class="o"></</span><span class="n">option</span><span class="o">></span> +<span class="o"><</span><span class="n">option</span> <span class="n">value</span><span class="o">=</span><span class="s">"author"</span><span class="o">></span><span class="n">author</span><span class="o"></</span><span class="n">option</span><span class="o">></span> +<span class="o"><</span><span class="n">option</span> <span class="n">value</span><span class="o">=</span><span class="s">"committer"</span><span class="o">></span><span class="n">committer</span><span class="o"></</span><span class="n">option</span><span class="o">></span> +<span class="o"><</span><span class="n">option</span> <span class="n">value</span><span class="o">=</span><span class="s">"pickaxe"</span><span class="o">></span><span class="n">pickaxe</span><span class="o"></</span><span class="n">option</span><span class="o">></span> +<span class="o"></</span><span class="n">select</span><span class="o">></span> <span class="o"><</span><span class="n">a</span> <span class="n">href</span><span class="o">=</span><span class="s">"/repos/asf?p=thrift.git;a=search_help"</span> <span class="n">title</span><span class="o">=</span><span class="s">"search help"</span><span class="o">>?</</span><span class="n">a</span><span class="o">></span> <span class="nl">search:</span> +<span class="o"><</span><span class="n">input</span> <span class="n">type</span><span class="o">=</span><span class="s">"text"</span> <span class="n">name</span><span class="o">=</span><span class="s">"s"</span> <span class="o">/></span> +<span class="o"><</span><span class="n">span</span> <span class="n">title</span><span class="o">=</span><span class="s">"Extended regular expression"</span><span class="o">><</span><span class="n">label</span><span class="o">><</span><span class="n">input</span> <span class="n">type</span><span class="o">=</span><span class="s">"checkbox"</span> <span class="n">name</span><span class="o">=</span><span class="s">"sr"</span> <span class="n">value</span><span class="o">=</span><span class="s">"1"</span> <span class="o">/></span><span class="n">re</span><span class="o"></</span><span class="n">label</span><span class="o">></</span><span class="n">span</span><span class="o">></</span><span class="n">div</span><span class="o">></span> +<span class="o"></</span><span class="n">form</span><span class="o">></span> +<span class="o"><</span><span class="n">div</span> <span class="n">class</span><span class="o">=</span><span class="s">"page_body"</span><span class="o">></span> +<span class="o"><</span><span class="n">br</span> <span class="o">/><</span><span class="n">br</span> <span class="o">/></span> +<span class="mi">404</span> <span class="o">-</span> <span class="n">Cannot</span> <span class="n">find</span> <span class="n">file</span> +<span class="o"><</span><span class="n">br</span> <span class="o">/></span> +<span class="o"></</span><span class="n">div</span><span class="o">></span> +<span class="o"><</span><span class="n">div</span> <span class="n">class</span><span class="o">=</span><span class="s">"page_footer"</span><span class="o">></span> +<span class="o"><</span><span class="n">div</span> <span class="n">class</span><span class="o">=</span><span class="s">"page_footer_text"</span><span class="o">></span><span class="n">Apache</span> <span class="n">Thrift</span><span class="o"></</span><span class="n">div</span><span class="o">></span> +<span class="o"><</span><span class="n">a</span> <span class="n">class</span><span class="o">=</span><span class="s">"rss_logo"</span> <span class="n">href</span><span class="o">=</span><span class="s">"/repos/asf?p=thrift.git;a=rss;f=tutorial/csharp/CsharpClient/CsharpClient.cs"</span> <span class="n">title</span><span class="o">=</span><span class="s">"history of tutorial/csharp/CsharpClient/CsharpClient.cs RSS feed"</span><span class="o">></span><span class="n">RSS</span><span class="o"></</span><span class="n">a</span><span class="o">></span> +<span class="o"><</span><span class="n">a</span> <span class="n">class</span><span class="o">=</span><span class="s">"rss_logo"</span> <span class="n">href</span><span class="o">=</span><span class="s">"/repos/asf?p=thrift.git;a=atom;f=tutorial/csharp/CsharpClient/CsharpClient.cs"</span> <span class="n">title</span><span class="o">=</span><span class="s">"history of tutorial/csharp/CsharpClient/CsharpClient.cs Atom feed"</span><span class="o">></span><span class="n">Atom</span><span class="o"></</span><span class="n">a</span><span class="o">></span> +<span class="o"></</span><span class="n">div</span><span class="o">></span> +<span class="o"><</span><span class="n">script</span> <span class="n">type</span><span class="o">=</span><span class="s">"text/javascript"</span> <span class="n">src</span><span class="o">=</span><span class="s">"/static/gitweb.js"</span><span class="o">></</span><span class="n">script</span><span class="o">></span> +<span class="o"><</span><span class="n">script</span> <span class="n">type</span><span class="o">=</span><span class="s">"text/javascript"</span><span class="o">></span> +<span class="n">window</span><span class="p">.</span><span class="n">onload</span> <span class="o">=</span> <span class="n">function</span> <span class="p">()</span> <span class="p">{</span> + <span class="n">var</span> <span class="n">tz_cookie</span> <span class="o">=</span> <span class="p">{</span> <span class="nl">name:</span> <span class="err">'</span><span class="n">gitweb_tz</span><span class="err">'</span><span class="p">,</span> <span class="nl">expires:</span> <span class="mi">14</span><span class="p">,</span> <span class="nl">path:</span> <span class="sc">'/'</span> <span class="p">};</span> + <span class="n">onloadTZSetup</span><span class="p">(</span><span class="err">'</span><span class="n">local</span><span class="err">'</span><span class="p">,</span> <span class="n">tz_cookie</span><span class="p">,</span> <span class="err">'</span><span class="n">datetime</span><span class="err">'</span><span class="p">);</span> +<span class="p">};</span> +<span class="o"></</span><span class="n">script</span><span class="o">></span> +<span class="o"></</span><span class="n">body</span><span class="o">></span> +<span class="o"></</span><span class="n">html</span><span class="o">><!</span><span class="n">DOCTYPE</span> <span class="n">HTML</span> <span class="n">PUBLIC</span> <span class="s">"-//IETF//DTD HTML 2.0//EN"</span><span class="o">></span> +<span class="o"><</span><span class="n">html</span><span class="o">><</span><span class="n">head</span><span class="o">></span> +<span class="o"><</span><span class="n">title</span><span class="o">></span><span class="mi">404</span> <span class="n">Not</span> <span class="n">Found</span><span class="o"></</span><span class="n">title</span><span class="o">></span> +<span class="o"></</span><span class="n">head</span><span class="o">><</span><span class="n">body</span><span class="o">></span> +<span class="o"><</span><span class="n">h1</span><span class="o">></span><span class="n">Not</span> <span class="n">Found</span><span class="o"></</span><span class="n">h1</span><span class="o">></span> +<span class="o"><</span><span class="n">p</span><span class="o">></span><span class="n">The</span> <span class="n">requested</span> <span class="n">URL</span> <span class="n">was</span> <span class="n">not</span> <span class="n">found</span> <span class="n">on</span> <span class="k">this</span> <span class="n">server</span><span class="p">.</span><span class="o"></</span><span class="n">p</span><span class="o">></span> +<span class="o"></</span><span class="n">body</span><span class="o">></</span><span class="n">html</span><span class="o">></span> </pre></div> <p class='snippet_footer'> @@ -207,116 +172,43 @@ h2:hover > .headerlink, h3:hover > .head } h2:hover > .headerlink, h3:hover > .headerlink, h1:hover > .headerlink, h6:hover > .headerlink, h4:hover > .headerlink, h5:hover > .headerlink, dt:hover > .elementid-permalink { visibility: visible }</style> -<div class="codehilite"><pre><span class="k">using</span> <span class="n">System</span><span class="p">;</span> -<span class="k">using</span> <span class="n">System</span><span class="p">.</span><span class="n">Collections</span><span class="p">.</span><span class="n">Generic</span><span class="p">;</span> -<span class="k">using</span> <span class="n">Thrift</span><span class="p">.</span><span class="n">Server</span><span class="p">;</span> -<span class="k">using</span> <span class="n">Thrift</span><span class="p">.</span><span class="n">Transport</span><span class="p">;</span> - -<span class="k">namespace</span> <span class="n">CSharpTutorial</span> -<span class="p">{</span> - <span class="k">public</span> <span class="k">class</span> <span class="nc">CalculatorHandler</span> <span class="o">:</span> <span class="n">Calculator</span><span class="p">.</span><span class="n">Iface</span> - <span class="p">{</span> - <span class="n">Dictionary</span><span class="o"><</span><span class="kt">int</span><span class="p">,</span> <span class="n">SharedStruct</span><span class="o">></span> <span class="n">log</span><span class="p">;</span> - - <span class="k">public</span> <span class="n">CalculatorHandler</span><span class="p">()</span> - <span class="p">{</span> - <span class="n">log</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Dictionary</span><span class="o"><</span><span class="kt">int</span><span class="p">,</span> <span class="n">SharedStruct</span><span class="o">></span><span class="p">();</span> - <span class="p">}</span> - - <span class="k">public</span> <span class="kt">void</span> <span class="n">ping</span><span class="p">()</span> - <span class="p">{</span> - <span class="n">Console</span><span class="p">.</span><span class="n">WriteLine</span><span class="p">(</span><span class="s">"ping()"</span><span class="p">);</span> - <span class="p">}</span> - - <span class="k">public</span> <span class="kt">int</span> <span class="n">add</span><span class="p">(</span><span class="kt">int</span> <span class="n">n1</span><span class="p">,</span> <span class="kt">int</span> <span class="n">n2</span><span class="p">)</span> - <span class="p">{</span> - <span class="n">Console</span><span class="p">.</span><span class="n">WriteLine</span><span class="p">(</span><span class="s">"add({0},{1})"</span><span class="p">,</span> <span class="n">n1</span><span class="p">,</span> <span class="n">n2</span><span class="p">);</span> - <span class="k">return</span> <span class="n">n1</span> <span class="o">+</span> <span class="n">n2</span><span class="p">;</span> - <span class="p">}</span> - - <span class="k">public</span> <span class="kt">int</span> <span class="n">calculate</span><span class="p">(</span><span class="kt">int</span> <span class="n">logid</span><span class="p">,</span> <span class="n">Work</span> <span class="n">work</span><span class="p">)</span> - <span class="p">{</span> - <span class="n">Console</span><span class="p">.</span><span class="n">WriteLine</span><span class="p">(</span><span class="s">"calculate({0}, [{1},{2},{3}])"</span><span class="p">,</span> <span class="n">logid</span><span class="p">,</span> <span class="n">work</span><span class="p">.</span><span class="n">Op</span><span class="p">,</span> <span class="n">work</span><span class="p">.</span><span class="n">Num1</span><span class="p">,</span> <span class="n">work</span><span class="p">.</span><span class="n">Num2</span><span class="p">);</span> - <span class="kt">int</span> <span class="n">val</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> - <span class="k">switch</span> <span class="p">(</span><span class="n">work</span><span class="p">.</span><span class="n">Op</span><span class="p">)</span> - <span class="p">{</span> - <span class="k">case</span> <span class="n">Operation</span><span class="p">.</span><span class="nl">ADD:</span> - <span class="n">val</span> <span class="o">=</span> <span class="n">work</span><span class="p">.</span><span class="n">Num1</span> <span class="o">+</span> <span class="n">work</span><span class="p">.</span><span class="n">Num2</span><span class="p">;</span> - <span class="k">break</span><span class="p">;</span> - - <span class="k">case</span> <span class="n">Operation</span><span class="p">.</span><span class="nl">SUBTRACT:</span> - <span class="n">val</span> <span class="o">=</span> <span class="n">work</span><span class="p">.</span><span class="n">Num1</span> <span class="o">-</span> <span class="n">work</span><span class="p">.</span><span class="n">Num2</span><span class="p">;</span> - <span class="k">break</span><span class="p">;</span> - - <span class="k">case</span> <span class="n">Operation</span><span class="p">.</span><span class="nl">MULTIPLY:</span> - <span class="n">val</span> <span class="o">=</span> <span class="n">work</span><span class="p">.</span><span class="n">Num1</span> <span class="o">*</span> <span class="n">work</span><span class="p">.</span><span class="n">Num2</span><span class="p">;</span> - <span class="k">break</span><span class="p">;</span> - - <span class="k">case</span> <span class="n">Operation</span><span class="p">.</span><span class="nl">DIVIDE:</span> - <span class="k">if</span> <span class="p">(</span><span class="n">work</span><span class="p">.</span><span class="n">Num2</span> <span class="o">==</span> <span class="mi">0</span><span class="p">)</span> - <span class="p">{</span> - <span class="n">InvalidOperation</span> <span class="n">io</span> <span class="o">=</span> <span class="k">new</span> <span class="n">InvalidOperation</span><span class="p">();</span> - <span class="n">io</span><span class="p">.</span><span class="n">WhatOp</span> <span class="o">=</span> <span class="p">(</span><span class="kt">int</span><span class="p">)</span><span class="n">work</span><span class="p">.</span><span class="n">Op</span><span class="p">;</span> - <span class="n">io</span><span class="p">.</span><span class="n">Why</span> <span class="o">=</span> <span class="s">"Cannot divide by 0"</span><span class="p">;</span> - <span class="k">throw</span> <span class="n">io</span><span class="p">;</span> - <span class="p">}</span> - <span class="n">val</span> <span class="o">=</span> <span class="n">work</span><span class="p">.</span><span class="n">Num1</span> <span class="o">/</span> <span class="n">work</span><span class="p">.</span><span class="n">Num2</span><span class="p">;</span> - <span class="k">break</span><span class="p">;</span> - - <span class="k">default</span><span class="o">:</span> - <span class="p">{</span> - <span class="n">InvalidOperation</span> <span class="n">io</span> <span class="o">=</span> <span class="k">new</span> <span class="n">InvalidOperation</span><span class="p">();</span> - <span class="n">io</span><span class="p">.</span><span class="n">WhatOp</span> <span class="o">=</span> <span class="p">(</span><span class="kt">int</span><span class="p">)</span><span class="n">work</span><span class="p">.</span><span class="n">Op</span><span class="p">;</span> - <span class="n">io</span><span class="p">.</span><span class="n">Why</span> <span class="o">=</span> <span class="s">"Unknown operation"</span><span class="p">;</span> - <span class="k">throw</span> <span class="n">io</span><span class="p">;</span> - <span class="p">}</span> - <span class="p">}</span> - - <span class="n">SharedStruct</span> <span class="n">entry</span> <span class="o">=</span> <span class="k">new</span> <span class="n">SharedStruct</span><span class="p">();</span> - <span class="n">entry</span><span class="p">.</span><span class="n">Key</span> <span class="o">=</span> <span class="n">logid</span><span class="p">;</span> - <span class="n">entry</span><span class="p">.</span><span class="n">Value</span> <span class="o">=</span> <span class="n">val</span><span class="p">.</span><span class="n">ToString</span><span class="p">();</span> - <span class="n">log</span><span class="p">[</span><span class="n">logid</span><span class="p">]</span> <span class="o">=</span> <span class="n">entry</span><span class="p">;</span> - - <span class="k">return</span> <span class="n">val</span><span class="p">;</span> - <span class="p">}</span> - - <span class="k">public</span> <span class="n">SharedStruct</span> <span class="n">getStruct</span><span class="p">(</span><span class="kt">int</span> <span class="n">key</span><span class="p">)</span> - <span class="p">{</span> - <span class="n">Console</span><span class="p">.</span><span class="n">WriteLine</span><span class="p">(</span><span class="s">"getStruct({0})"</span><span class="p">,</span> <span class="n">key</span><span class="p">);</span> - <span class="k">return</span> <span class="n">log</span><span class="p">[</span><span class="n">key</span><span class="p">];</span> - <span class="p">}</span> - - <span class="k">public</span> <span class="kt">void</span> <span class="n">zip</span><span class="p">()</span> - <span class="p">{</span> - <span class="n">Console</span><span class="p">.</span><span class="n">WriteLine</span><span class="p">(</span><span class="s">"zip()"</span><span class="p">);</span> - <span class="p">}</span> - <span class="p">}</span> - - <span class="k">public</span> <span class="k">class</span> <span class="nc">CSharpServer</span> - <span class="p">{</span> - <span class="k">public</span> <span class="k">static</span> <span class="kt">void</span> <span class="n">Main</span><span class="p">()</span> - <span class="p">{</span> - <span class="k">try</span> - <span class="p">{</span> - <span class="n">CalculatorHandler</span> <span class="n">handler</span> <span class="o">=</span> <span class="k">new</span> <span class="n">CalculatorHandler</span><span class="p">();</span> - <span class="n">Calculator</span><span class="p">.</span><span class="n">Processor</span> <span class="n">processor</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Calculator</span><span class="p">.</span><span class="n">Processor</span><span class="p">(</span><span class="n">handler</span><span class="p">);</span> - <span class="n">TServerTransport</span> <span class="n">serverTransport</span> <span class="o">=</span> <span class="k">new</span> <span class="n">TServerSocket</span><span class="p">(</span><span class="mi">9090</span><span class="p">);</span> - <span class="n">TServer</span> <span class="n">server</span> <span class="o">=</span> <span class="k">new</span> <span class="n">TSimpleServer</span><span class="p">(</span><span class="n">processor</span><span class="p">,</span> <span class="n">serverTransport</span><span class="p">);</span> - - <span class="c1">// Use this for a multithreaded server</span> - <span class="c1">// server = new TThreadPoolServer(processor, serverTransport);</span> - - <span class="n">Console</span><span class="p">.</span><span class="n">WriteLine</span><span class="p">(</span><span class="s">"Starting the server..."</span><span class="p">);</span> - <span class="n">server</span><span class="p">.</span><span class="n">Serve</span><span class="p">();</span> - <span class="p">}</span> - <span class="k">catch</span> <span class="p">(</span><span class="n">Exception</span> <span class="n">x</span><span class="p">)</span> - <span class="p">{</span> - <span class="n">Console</span><span class="p">.</span><span class="n">WriteLine</span><span class="p">(</span><span class="n">x</span><span class="p">.</span><span class="n">StackTrace</span><span class="p">);</span> - <span class="p">}</span> - <span class="n">Console</span><span class="p">.</span><span class="n">WriteLine</span><span class="p">(</span><span class="s">"done."</span><span class="p">);</span> - <span class="p">}</span> - <span class="p">}</span> -<span class="p">}</span> +<div class="codehilite"><pre><span class="o"><</span><span class="n">input</span> <span class="n">name</span><span class="o">=</span><span class="s">"a"</span> <span class="n">type</span><span class="o">=</span><span class="s">"hidden"</span> <span class="n">value</span><span class="o">=</span><span class="s">"search"</span> <span class="o">/></span> +<span class="o"><</span><span class="n">input</span> <span class="n">name</span><span class="o">=</span><span class="s">"h"</span> <span class="n">type</span><span class="o">=</span><span class="s">"hidden"</span> <span class="n">value</span><span class="o">=</span><span class="s">"HEAD"</span> <span class="o">/></span> +<span class="o"><</span><span class="n">select</span> <span class="n">name</span><span class="o">=</span><span class="s">"st"</span> <span class="o">></span> +<span class="o"><</span><span class="n">option</span> <span class="n">selected</span><span class="o">=</span><span class="s">"selected"</span> <span class="n">value</span><span class="o">=</span><span class="s">"commit"</span><span class="o">></span><span class="n">commit</span><span class="o"></</span><span class="n">option</span><span class="o">></span> +<span class="o"><</span><span class="n">option</span> <span class="n">value</span><span class="o">=</span><span class="s">"grep"</span><span class="o">></span><span class="n">grep</span><span class="o"></</span><span class="n">option</span><span class="o">></span> +<span class="o"><</span><span class="n">option</span> <span class="n">value</span><span class="o">=</span><span class="s">"author"</span><span class="o">></span><span class="n">author</span><span class="o"></</span><span class="n">option</span><span class="o">></span> +<span class="o"><</span><span class="n">option</span> <span class="n">value</span><span class="o">=</span><span class="s">"committer"</span><span class="o">></span><span class="n">committer</span><span class="o"></</span><span class="n">option</span><span class="o">></span> +<span class="o"><</span><span class="n">option</span> <span class="n">value</span><span class="o">=</span><span class="s">"pickaxe"</span><span class="o">></span><span class="n">pickaxe</span><span class="o"></</span><span class="n">option</span><span class="o">></span> +<span class="o"></</span><span class="n">select</span><span class="o">></span> <span class="o"><</span><span class="n">a</span> <span class="n">href</span><span class="o">=</span><span class="s">"/repos/asf?p=thrift.git;a=search_help"</span> <span class="n">title</span><span class="o">=</span><span class="s">"search help"</span><span class="o">>?</</span><span class="n">a</span><span class="o">></span> <span class="nl">search:</span> +<span class="o"><</span><span class="n">input</span> <span class="n">type</span><span class="o">=</span><span class="s">"text"</span> <span class="n">name</span><span class="o">=</span><span class="s">"s"</span> <span class="o">/></span> +<span class="o"><</span><span class="n">span</span> <span class="n">title</span><span class="o">=</span><span class="s">"Extended regular expression"</span><span class="o">><</span><span class="n">label</span><span class="o">><</span><span class="n">input</span> <span class="n">type</span><span class="o">=</span><span class="s">"checkbox"</span> <span class="n">name</span><span class="o">=</span><span class="s">"sr"</span> <span class="n">value</span><span class="o">=</span><span class="s">"1"</span> <span class="o">/></span><span class="n">re</span><span class="o"></</span><span class="n">label</span><span class="o">></</span><span class="n">span</span><span class="o">></</span><span class="n">div</span><span class="o">></span> +<span class="o"></</span><span class="n">form</span><span class="o">></span> +<span class="o"><</span><span class="n">div</span> <span class="n">class</span><span class="o">=</span><span class="s">"page_body"</span><span class="o">></span> +<span class="o"><</span><span class="n">br</span> <span class="o">/><</span><span class="n">br</span> <span class="o">/></span> +<span class="mi">404</span> <span class="o">-</span> <span class="n">Cannot</span> <span class="n">find</span> <span class="n">file</span> +<span class="o"><</span><span class="n">br</span> <span class="o">/></span> +<span class="o"></</span><span class="n">div</span><span class="o">></span> +<span class="o"><</span><span class="n">div</span> <span class="n">class</span><span class="o">=</span><span class="s">"page_footer"</span><span class="o">></span> +<span class="o"><</span><span class="n">div</span> <span class="n">class</span><span class="o">=</span><span class="s">"page_footer_text"</span><span class="o">></span><span class="n">Apache</span> <span class="n">Thrift</span><span class="o"></</span><span class="n">div</span><span class="o">></span> +<span class="o"><</span><span class="n">a</span> <span class="n">class</span><span class="o">=</span><span class="s">"rss_logo"</span> <span class="n">href</span><span class="o">=</span><span class="s">"/repos/asf?p=thrift.git;a=rss;f=tutorial/csharp/CsharpServer/CsharpServer.cs"</span> <span class="n">title</span><span class="o">=</span><span class="s">"history of tutorial/csharp/CsharpServer/CsharpServer.cs RSS feed"</span><span class="o">></span><span class="n">RSS</span><span class="o"></</span><span class="n">a</span><span class="o">></span> +<span class="o"><</span><span class="n">a</span> <span class="n">class</span><span class="o">=</span><span class="s">"rss_logo"</span> <span class="n">href</span><span class="o">=</span><span class="s">"/repos/asf?p=thrift.git;a=atom;f=tutorial/csharp/CsharpServer/CsharpServer.cs"</span> <span class="n">title</span><span class="o">=</span><span class="s">"history of tutorial/csharp/CsharpServer/CsharpServer.cs Atom feed"</span><span class="o">></span><span class="n">Atom</span><span class="o"></</span><span class="n">a</span><span class="o">></span> +<span class="o"></</span><span class="n">div</span><span class="o">></span> +<span class="o"><</span><span class="n">script</span> <span class="n">type</span><span class="o">=</span><span class="s">"text/javascript"</span> <span class="n">src</span><span class="o">=</span><span class="s">"/static/gitweb.js"</span><span class="o">></</span><span class="n">script</span><span class="o">></span> +<span class="o"><</span><span class="n">script</span> <span class="n">type</span><span class="o">=</span><span class="s">"text/javascript"</span><span class="o">></span> +<span class="n">window</span><span class="p">.</span><span class="n">onload</span> <span class="o">=</span> <span class="n">function</span> <span class="p">()</span> <span class="p">{</span> + <span class="n">var</span> <span class="n">tz_cookie</span> <span class="o">=</span> <span class="p">{</span> <span class="nl">name:</span> <span class="err">'</span><span class="n">gitweb_tz</span><span class="err">'</span><span class="p">,</span> <span class="nl">expires:</span> <span class="mi">14</span><span class="p">,</span> <span class="nl">path:</span> <span class="sc">'/'</span> <span class="p">};</span> + <span class="n">onloadTZSetup</span><span class="p">(</span><span class="err">'</span><span class="n">local</span><span class="err">'</span><span class="p">,</span> <span class="n">tz_cookie</span><span class="p">,</span> <span class="err">'</span><span class="n">datetime</span><span class="err">'</span><span class="p">);</span> +<span class="p">};</span> +<span class="o"></</span><span class="n">script</span><span class="o">></span> +<span class="o"></</span><span class="n">body</span><span class="o">></span> +<span class="o"></</span><span class="n">html</span><span class="o">><!</span><span class="n">DOCTYPE</span> <span class="n">HTML</span> <span class="n">PUBLIC</span> <span class="s">"-//IETF//DTD HTML 2.0//EN"</span><span class="o">></span> +<span class="o"><</span><span class="n">html</span><span class="o">><</span><span class="n">head</span><span class="o">></span> +<span class="o"><</span><span class="n">title</span><span class="o">></span><span class="mi">404</span> <span class="n">Not</span> <span class="n">Found</span><span class="o"></</span><span class="n">title</span><span class="o">></span> +<span class="o"></</span><span class="n">head</span><span class="o">><</span><span class="n">body</span><span class="o">></span> +<span class="o"><</span><span class="n">h1</span><span class="o">></span><span class="n">Not</span> <span class="n">Found</span><span class="o"></</span><span class="n">h1</span><span class="o">></span> +<span class="o"><</span><span class="n">p</span><span class="o">></span><span class="n">The</span> <span class="n">requested</span> <span class="n">URL</span> <span class="n">was</span> <span class="n">not</span> <span class="n">found</span> <span class="n">on</span> <span class="k">this</span> <span class="n">server</span><span class="p">.</span><span class="o"></</span><span class="n">p</span><span class="o">></span> +<span class="o"></</span><span class="n">body</span><span class="o">></</span><span class="n">html</span><span class="o">></span> </pre></div> <p class='snippet_footer'>
Modified: websites/staging/thrift/trunk/content/tutorial/delphi.html ============================================================================== --- websites/staging/thrift/trunk/content/tutorial/delphi.html (original) +++ websites/staging/thrift/trunk/content/tutorial/delphi.html Fri Nov 20 17:19:21 2020 @@ -128,6 +128,7 @@ h2:hover > .headerlink, h3:hover > .head <span class="n">Generics</span><span class="o">.</span><span class="n">Collections</span><span class="o">,</span> <span class="n">Thrift</span> <span class="k">in</span> <span class="s">'..\..\..\lib\delphi\src\Thrift.pas'</span><span class="o">,</span> <span class="n">Thrift</span><span class="o">.</span><span class="n">Collections</span> <span class="k">in</span> <span class="s">'..\..\..\lib\delphi\src\Thrift.Collections.pas'</span><span class="o">,</span> + <span class="n">Thrift</span><span class="o">.</span><span class="n">Configuration</span> <span class="k">in</span> <span class="s">'..\..\..\lib\delphi\src\Thrift.Configuration.pas'</span><span class="o">,</span> <span class="n">Thrift</span><span class="o">.</span><span class="n">Exception</span> <span class="k">in</span> <span class="s">'..\..\..\lib\delphi\src\Thrift.Exception.pas'</span><span class="o">,</span> <span class="n">Thrift</span><span class="o">.</span><span class="n">Utils</span> <span class="k">in</span> <span class="s">'..\..\..\lib\delphi\src\Thrift.Utils.pas'</span><span class="o">,</span> <span class="n">Thrift</span><span class="o">.</span><span class="n">Stream</span> <span class="k">in</span> <span class="s">'..\..\..\lib\delphi\src\Thrift.Stream.pas'</span><span class="o">,</span> @@ -213,7 +214,6 @@ h2:hover > .headerlink, h3:hover > .head <span class="k">try</span> <span class="n">DelphiTutorialClient</span><span class="o">.</span><span class="n">Main</span><span class="o">;</span> <span class="k">except</span> - <span class="k">on</span> <span class="n">E</span><span class="o">:</span> <span class="n">Exception</span> <span class="k">do</span> </pre></div> <p class='snippet_footer'> @@ -246,6 +246,7 @@ h2:hover > .headerlink, h3:hover > .head <span class="n">Generics</span><span class="o">.</span><span class="n">Collections</span><span class="o">,</span> <span class="n">Thrift</span> <span class="k">in</span> <span class="s">'..\..\..\lib\delphi\src\Thrift.pas'</span><span class="o">,</span> <span class="n">Thrift</span><span class="o">.</span><span class="n">Collections</span> <span class="k">in</span> <span class="s">'..\..\..\lib\delphi\src\Thrift.Collections.pas'</span><span class="o">,</span> + <span class="n">Thrift</span><span class="o">.</span><span class="n">Configuration</span> <span class="k">in</span> <span class="s">'..\..\..\lib\delphi\src\Thrift.Configuration.pas'</span><span class="o">,</span> <span class="n">Thrift</span><span class="o">.</span><span class="n">Exception</span> <span class="k">in</span> <span class="s">'..\..\..\lib\delphi\src\Thrift.Exception.pas'</span><span class="o">,</span> <span class="n">Thrift</span><span class="o">.</span><span class="n">Utils</span> <span class="k">in</span> <span class="s">'..\..\..\lib\delphi\src\Thrift.Utils.pas'</span><span class="o">,</span> <span class="n">Thrift</span><span class="o">.</span><span class="n">Stream</span> <span class="k">in</span> <span class="s">'..\..\..\lib\delphi\src\Thrift.Stream.pas'</span><span class="o">,</span> @@ -388,7 +389,6 @@ h2:hover > .headerlink, h3:hover > .head <span class="k">except</span> <span class="k">on</span> <span class="n">E</span><span class="o">:</span> <span class="n">Exception</span> <span class="k">do</span> <span class="nb">Writeln</span><span class="p">(</span><span class="n">E</span><span class="o">.</span><span class="n">ClassName</span><span class="o">,</span> <span class="s">': '</span><span class="o">,</span> <span class="n">E</span><span class="o">.</span><span class="n">Message</span><span class="p">)</span><span class="o">;</span> - <span class="k">end</span><span class="o">;</span> </pre></div> <p class='snippet_footer'> Modified: websites/staging/thrift/trunk/content/tutorial/go.html ============================================================================== --- websites/staging/thrift/trunk/content/tutorial/go.html (original) +++ websites/staging/thrift/trunk/content/tutorial/go.html Fri Nov 20 17:19:21 2020 @@ -151,7 +151,6 @@ h2:hover > .headerlink, h3:hover > .head <span class="k">default</span><span class="o">:</span> <span class="n">fmt</span><span class="p">.</span><span class="n">Println</span><span class="p">(</span><span class="s">"Error during operation:"</span><span class="p">,</span> <span class="n">err</span><span class="p">)</span> <span class="p">}</span> - <span class="k">return</span> <span class="n">err</span> <span class="p">}</span> <span class="k">else</span> <span class="p">{</span> <span class="n">fmt</span><span class="p">.</span><span class="n">Println</span><span class="p">(</span><span class="s">"Whoa we can divide by 0 with new value:"</span><span class="p">,</span> <span class="n">quotient</span><span class="p">)</span> <span class="p">}</span> @@ -199,6 +198,7 @@ h2:hover > .headerlink, h3:hover > .head <span class="n">transport</span><span class="p">,</span> <span class="n">err</span> <span class="o">=</span> <span class="n">transportFactory</span><span class="p">.</span><span class="n">GetTransport</span><span class="p">(</span><span class="n">transport</span><span class="p">)</span> <span class="k">if</span> <span class="n">err</span> <span class="o">!=</span> <span class="n">nil</span> <span class="p">{</span> <span class="k">return</span> <span class="n">err</span> + <span class="p">}</span> </pre></div> <p class='snippet_footer'> Modified: websites/staging/thrift/trunk/content/tutorial/hs.html ============================================================================== --- websites/staging/thrift/trunk/content/tutorial/hs.html (original) +++ websites/staging/thrift/trunk/content/tutorial/hs.html Fri Nov 20 17:19:21 2020 @@ -146,7 +146,7 @@ h2:hover > .headerlink, h3:hover > .head <span class="n">printf</span> <span class="s">"1+1=%d</span><span class="se">\n</span><span class="s">"</span> <span class="n">sum</span> - <span class="n">let</span> <span class="n">work</span> <span class="o">=</span> <span class="n">Work</span> <span class="p">{</span> <span class="n">work_op</span> <span class="o">=</span> <span class="n">DIVIDE</span><span class="p">,</span> + <span class="n">let</span> <span class="n">work</span> <span class="o">=</span> <span class="n">Work</span> <span class="p">{</span> <span class="n">work_op</span> <span class="o">=</span> <span class="n">Operation_DIVIDE</span><span class="p">,</span> <span class="n">work_num1</span> <span class="o">=</span> <span class="mi">1</span><span class="p">,</span> <span class="n">work_num2</span> <span class="o">=</span> <span class="mi">0</span><span class="p">,</span> <span class="n">work_comment</span> <span class="o">=</span> <span class="n">Nothing</span> @@ -156,7 +156,7 @@ h2:hover > .headerlink, h3:hover > .head <span class="p">(</span><span class="err">\</span><span class="n">e</span> <span class="o">-></span> <span class="n">printf</span> <span class="s">"InvalidOperation %s</span><span class="se">\n</span><span class="s">"</span> <span class="p">(</span><span class="n">show</span> <span class="p">(</span><span class="n">e</span> <span class="o">::</span> <span class="n">InvalidOperation</span><span class="p">)))</span> - <span class="n">let</span> <span class="n">work</span> <span class="o">=</span> <span class="n">Work</span> <span class="p">{</span> <span class="n">work_op</span> <span class="o">=</span> <span class="n">SUBTRACT</span><span class="p">,</span> + <span class="n">let</span> <span class="n">work</span> <span class="o">=</span> <span class="n">Work</span> <span class="p">{</span> <span class="n">work_op</span> <span class="o">=</span> <span class="n">Operation_SUBTRACT</span><span class="p">,</span> <span class="n">work_num1</span> <span class="o">=</span> <span class="mi">15</span><span class="p">,</span> <span class="n">work_num2</span> <span class="o">=</span> <span class="mi">10</span><span class="p">,</span> <span class="n">work_comment</span> <span class="o">=</span> <span class="n">Nothing</span> @@ -236,13 +236,13 @@ h2:hover > .headerlink, h3:hover > .head <span class="n">printf</span> <span class="s">"calculate(%d, %s)</span><span class="se">\n</span><span class="s">"</span> <span class="n">logid</span> <span class="p">(</span><span class="n">show</span> <span class="n">work</span><span class="p">)</span> <span class="n">let</span> <span class="n">val</span> <span class="o">=</span> <span class="k">case</span> <span class="n">op</span> <span class="n">work</span> <span class="n">of</span> - <span class="n">ADD</span> <span class="o">-></span> + <span class="n">Operation_ADD</span> <span class="o">-></span> <span class="n">num1</span> <span class="n">work</span> <span class="o">+</span> <span class="n">num2</span> <span class="n">work</span> - <span class="n">SUBTRACT</span> <span class="o">-></span> + <span class="n">Operation_SUBTRACT</span> <span class="o">-></span> <span class="n">num1</span> <span class="n">work</span> <span class="o">-</span> <span class="n">num2</span> <span class="n">work</span> - <span class="n">MULTIPLY</span> <span class="o">-></span> + <span class="n">Operation_MULTIPLY</span> <span class="o">-></span> <span class="n">num1</span> <span class="n">work</span> <span class="o">*</span> <span class="n">num2</span> <span class="n">work</span> - <span class="n">DIVIDE</span> <span class="o">-></span> + <span class="n">Operation_DIVIDE</span> <span class="o">-></span> <span class="k">if</span> <span class="n">num2</span> <span class="n">work</span> <span class="o">==</span> <span class="mi">0</span> <span class="n">then</span> <span class="k">throw</span> <span class="err">$</span> <span class="n">InvalidOperation</span> <span class="p">{</span> Modified: websites/staging/thrift/trunk/content/tutorial/netstd.html ============================================================================== --- websites/staging/thrift/trunk/content/tutorial/netstd.html (original) +++ websites/staging/thrift/trunk/content/tutorial/netstd.html Fri Nov 20 17:19:21 2020 @@ -117,6 +117,7 @@ h2:hover > .headerlink, h3:hover > .head <div class="codehilite"><pre><span class="k">using</span> <span class="n">System</span><span class="p">;</span> <span class="k">using</span> <span class="n">System</span><span class="p">.</span><span class="n">Collections</span><span class="p">.</span><span class="n">Generic</span><span class="p">;</span> +<span class="k">using</span> <span class="n">System</span><span class="p">.</span><span class="n">Diagnostics</span><span class="p">;</span> <span class="k">using</span> <span class="n">System</span><span class="p">.</span><span class="n">IO</span><span class="p">;</span> <span class="k">using</span> <span class="n">System</span><span class="p">.</span><span class="n">Linq</span><span class="p">;</span> <span class="k">using</span> <span class="n">System</span><span class="p">.</span><span class="n">Net</span><span class="p">;</span> @@ -125,14 +126,13 @@ h2:hover > .headerlink, h3:hover > .head <span class="k">using</span> <span class="n">System</span><span class="p">.</span><span class="n">Threading</span><span class="p">;</span> <span class="k">using</span> <span class="n">System</span><span class="p">.</span><span class="n">Threading</span><span class="p">.</span><span class="n">Tasks</span><span class="p">;</span> <span class="k">using</span> <span class="n">Microsoft</span><span class="p">.</span><span class="n">Extensions</span><span class="p">.</span><span class="n">Logging</span><span class="p">;</span> +<span class="k">using</span> <span class="n">Microsoft</span><span class="p">.</span><span class="n">Extensions</span><span class="p">.</span><span class="n">DependencyInjection</span><span class="p">;</span> <span class="k">using</span> <span class="n">Thrift</span><span class="p">;</span> <span class="k">using</span> <span class="n">Thrift</span><span class="p">.</span><span class="n">Protocol</span><span class="p">;</span> <span class="k">using</span> <span class="n">Thrift</span><span class="p">.</span><span class="n">Transport</span><span class="p">;</span> <span class="k">using</span> <span class="n">Thrift</span><span class="p">.</span><span class="n">Transport</span><span class="p">.</span><span class="n">Client</span><span class="p">;</span> <span class="k">using</span> <span class="n">tutorial</span><span class="p">;</span> <span class="k">using</span> <span class="n">shared</span><span class="p">;</span> -<span class="k">using</span> <span class="n">Microsoft</span><span class="p">.</span><span class="n">Extensions</span><span class="p">.</span><span class="n">DependencyInjection</span><span class="p">;</span> -<span class="k">using</span> <span class="n">System</span><span class="p">.</span><span class="n">Diagnostics</span><span class="p">;</span> <span class="k">namespace</span> <span class="n">Client</span> <span class="p">{</span> @@ -140,15 +140,16 @@ h2:hover > .headerlink, h3:hover > .head <span class="p">{</span> <span class="k">private</span> <span class="k">static</span> <span class="n">ServiceCollection</span> <span class="n">ServiceCollection</span> <span class="o">=</span> <span class="k">new</span> <span class="n">ServiceCollection</span><span class="p">();</span> <span class="k">private</span> <span class="k">static</span> <span class="n">ILogger</span> <span class="n">Logger</span><span class="p">;</span> + <span class="k">private</span> <span class="k">static</span> <span class="n">readonly</span> <span class="n">TConfiguration</span> <span class="n">Configuration</span> <span class="o">=</span> <span class="n">null</span><span class="p">;</span> <span class="c1">// new TConfiguration() if needed</span> <span class="k">private</span> <span class="k">static</span> <span class="kt">void</span> <span class="n">DisplayHelp</span><span class="p">()</span> <span class="p">{</span> <span class="n">Logger</span><span class="p">.</span><span class="n">LogInformation</span><span class="p">(</span><span class="err">@</span><span class="s">"</span> <span class="nl">Usage:</span> - <span class="n">Client</span><span class="p">.</span><span class="n">exe</span> <span class="o">-</span><span class="n">help</span> + <span class="n">Client</span> <span class="o">-</span><span class="n">help</span> <span class="n">will</span> <span class="n">diplay</span> <span class="n">help</span> <span class="n">information</span> - <span class="n">Client</span><span class="p">.</span><span class="n">exe</span> <span class="o">-</span><span class="nl">tr:</span><span class="o"><</span><span class="n">transport</span><span class="o">></span> <span class="o">-</span><span class="nl">bf:</span><span class="o"><</span><span class="n">buffering</span><span class="o">></span> <span class="o">-</span><span class="nl">pr:</span><span class="o"><</span><span class="n">protocol</span><span class="o">></span> <span class="o">-</span><span class="nl">mc:</span><span class="o"><</span><span class="n">numClients</span><span class="o">></span> + <span class="n">Client</span> <span class="o">-</span><span class="nl">tr:</span><span class="o"><</span><span class="n">transport</span><span class="o">></span> <span class="o">-</span><span class="nl">bf:</span><span class="o"><</span><span class="n">buffering</span><span class="o">></span> <span class="o">-</span><span class="nl">pr:</span><span class="o"><</span><span class="n">protocol</span><span class="o">></span> <span class="o">-</span><span class="nl">mc:</span><span class="o"><</span><span class="n">numClients</span><span class="o">></span> <span class="n">will</span> <span class="n">run</span> <span class="n">client</span> <span class="n">with</span> <span class="n">specified</span> <span class="n">arguments</span> <span class="p">(</span><span class="n">tcp</span> <span class="n">transport</span> <span class="n">and</span> <span class="n">binary</span> <span class="n">protocol</span> <span class="n">by</span> <span class="k">default</span><span class="p">)</span> <span class="n">and</span> <span class="n">with</span> <span class="mi">1</span> <span class="n">client</span> <span class="nl">Options:</span> @@ -173,7 +174,7 @@ h2:hover > .headerlink, h3:hover > .head <span class="o"><</span><span class="n">numClients</span><span class="o">></span> <span class="o">-</span> <span class="n">number</span> <span class="n">of</span> <span class="n">multiple</span> <span class="n">clients</span> <span class="n">to</span> <span class="n">connect</span> <span class="n">to</span> <span class="n">server</span> <span class="p">(</span><span class="n">max</span> <span class="mi">100</span><span class="p">,</span> <span class="k">default</span> <span class="mi">1</span><span class="p">)</span> <span class="nl">Sample:</span> - <span class="n">Client</span><span class="p">.</span><span class="n">exe</span> <span class="o">-</span><span class="nl">tr:</span><span class="n">tcp</span> <span class="o">-</span><span class="nl">p:</span><span class="n">binary</span> + <span class="n">Client</span> <span class="o">-</span><span class="nl">tr:</span><span class="n">tcp</span> <span class="o">-</span><span class="nl">pr:</span><span class="n">binary</span> <span class="s">");</span> <span class="p">}</span> @@ -182,19 +183,22 @@ h2:hover > .headerlink, h3:hover > .head <span class="n">args</span> <span class="o">=</span> <span class="n">args</span> <span class="o">??</span> <span class="k">new</span> <span class="n">string</span><span class="p">[</span><span class="mi">0</span><span class="p">];</span> <span class="n">ServiceCollection</span><span class="p">.</span><span class="n">AddLogging</span><span class="p">(</span><span class="n">logging</span> <span class="o">=></span> <span class="n">ConfigureLogging</span><span class="p">(</span><span class="n">logging</span><span class="p">));</span> - <span class="n">Logger</span> <span class="o">=</span> <span class="n">ServiceCollection</span><span class="p">.</span><span class="n">BuildServiceProvider</span><span class="p">().</span><span class="n">GetService</span><span class="o"><</span><span class="n">ILoggerFactory</span><span class="o">></span><span class="p">().</span><span class="n">CreateLogger</span><span class="p">(</span><span class="n">nameof</span><span class="p">(</span><span class="n">Client</span><span class="p">));</span> - - <span class="k">if</span> <span class="p">(</span><span class="n">args</span><span class="p">.</span><span class="n">Any</span><span class="p">(</span><span class="n">x</span> <span class="o">=></span> <span class="n">x</span><span class="p">.</span><span class="n">StartsWith</span><span class="p">(</span><span class="s">"-help"</span><span class="p">,</span> <span class="n">StringComparison</span><span class="p">.</span><span class="n">OrdinalIgnoreCase</span><span class="p">)))</span> + <span class="k">using</span> <span class="p">(</span><span class="n">var</span> <span class="n">serviceProvider</span> <span class="o">=</span> <span class="n">ServiceCollection</span><span class="p">.</span><span class="n">BuildServiceProvider</span><span class="p">())</span> <span class="p">{</span> - <span class="n">DisplayHelp</span><span class="p">();</span> - <span class="k">return</span><span class="p">;</span> - <span class="p">}</span> + <span class="n">Logger</span> <span class="o">=</span> <span class="n">serviceProvider</span><span class="p">.</span><span class="n">GetService</span><span class="o"><</span><span class="n">ILoggerFactory</span><span class="o">></span><span class="p">().</span><span class="n">CreateLogger</span><span class="p">(</span><span class="n">nameof</span><span class="p">(</span><span class="n">Client</span><span class="p">));</span> - <span class="n">Logger</span><span class="p">.</span><span class="n">LogInformation</span><span class="p">(</span><span class="s">"Starting client..."</span><span class="p">);</span> + <span class="k">if</span> <span class="p">(</span><span class="n">args</span><span class="p">.</span><span class="n">Any</span><span class="p">(</span><span class="n">x</span> <span class="o">=></span> <span class="n">x</span><span class="p">.</span><span class="n">StartsWith</span><span class="p">(</span><span class="s">"-help"</span><span class="p">,</span> <span class="n">StringComparison</span><span class="p">.</span><span class="n">OrdinalIgnoreCase</span><span class="p">)))</span> + <span class="p">{</span> + <span class="n">DisplayHelp</span><span class="p">();</span> + <span class="k">return</span><span class="p">;</span> + <span class="p">}</span> - <span class="k">using</span> <span class="p">(</span><span class="n">var</span> <span class="n">source</span> <span class="o">=</span> <span class="k">new</span> <span class="n">CancellationTokenSource</span><span class="p">())</span> - <span class="p">{</span> - <span class="n">RunAsync</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="n">source</span><span class="p">.</span><span class="n">Token</span><span class="p">).</span><span class="n">GetAwaiter</span><span class="p">().</span><span class="n">GetResult</span><span class="p">();</span> + <span class="n">Logger</span><span class="p">.</span><span class="n">LogInformation</span><span class="p">(</span><span class="s">"Starting client..."</span><span class="p">);</span> + + <span class="k">using</span> <span class="p">(</span><span class="n">var</span> <span class="n">source</span> <span class="o">=</span> <span class="k">new</span> <span class="n">CancellationTokenSource</span><span class="p">())</span> + <span class="p">{</span> + <span class="n">RunAsync</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="n">source</span><span class="p">.</span><span class="n">Token</span><span class="p">).</span><span class="n">GetAwaiter</span><span class="p">().</span><span class="n">GetResult</span><span class="p">();</span> + <span class="p">}</span> <span class="p">}</span> <span class="p">}</span> @@ -243,7 +247,7 @@ h2:hover > .headerlink, h3:hover > .head <span class="k">private</span> <span class="k">static</span> <span class="n">TTransport</span> <span class="n">GetTransport</span><span class="p">(</span><span class="n">string</span><span class="p">[]</span> <span class="n">args</span><span class="p">)</span> <span class="p">{</span> - <span class="n">TTransport</span> <span class="n">transport</span> <span class="o">=</span> <span class="k">new</span> <span class="n">TSocketTransport</span><span class="p">(</span><span class="n">IPAddress</span><span class="p">.</span><span class="n">Loopback</span><span class="p">,</span> <span class="mi">9090</span><span class="p">);</span> + <span class="n">TTransport</span> <span class="n">transport</span> <span class="o">=</span> <span class="k">new</span> <span class="n">TSocketTransport</span><span class="p">(</span><span class="n">IPAddress</span><span class="p">.</span><span class="n">Loopback</span><span class="p">,</span> <span class="mi">9090</span><span class="p">,</span> <span class="n">Configuration</span><span class="p">);</span> <span class="c1">// construct endpoint transport</span> <span class="n">var</span> <span class="n">transportArg</span> <span class="o">=</span> <span class="n">args</span><span class="p">.</span><span class="n">FirstOrDefault</span><span class="p">(</span><span class="n">x</span> <span class="o">=></span> <span class="n">x</span><span class="p">.</span><span class="n">StartsWith</span><span class="p">(</span><span class="s">"-tr"</span><span class="p">))</span><span class="o">?</span><span class="p">.</span><span class="n">Split</span><span class="p">(</span><span class="sc">':'</span><span class="p">)</span><span class="o">?</span><span class="p">[</span><span class="mi">1</span><span class="p">];</span> @@ -252,19 +256,20 @@ h2:hover > .headerlink, h3:hover > .head <span class="k">switch</span> <span class="p">(</span><span class="n">selectedTransport</span><span class="p">)</span> <span class="p">{</span> <span class="k">case</span> <span class="n">Transport</span><span class="p">.</span><span class="nl">Tcp:</span> - <span class="n">transport</span> <span class="o">=</span> <span class="k">new</span> <span class="n">TSocketTransport</span><span class="p">(</span><span class="n">IPAddress</span><span class="p">.</span><span class="n">Loopback</span><span class="p">,</span> <span class="mi">9090</span><span class="p">);</span> + <span class="n">transport</span> <span class="o">=</span> <span class="k">new</span> <span class="n">TSocketTransport</span><span class="p">(</span><span class="n">IPAddress</span><span class="p">.</span><span class="n">Loopback</span><span class="p">,</span> <span class="mi">9090</span><span class="p">,</span> <span class="n">Configuration</span><span class="p">);</span> <span class="k">break</span><span class="p">;</span> <span class="k">case</span> <span class="n">Transport</span><span class="p">.</span><span class="nl">NamedPipe:</span> - <span class="n">transport</span> <span class="o">=</span> <span class="k">new</span> <span class="n">TNamedPipeTransport</span><span class="p">(</span><span class="s">".test"</span><span class="p">);</span> + <span class="n">transport</span> <span class="o">=</span> <span class="k">new</span> <span class="n">TNamedPipeTransport</span><span class="p">(</span><span class="s">".test"</span><span class="p">,</span> <span class="n">Configuration</span><span class="p">);</span> <span class="k">break</span><span class="p">;</span> <span class="k">case</span> <span class="n">Transport</span><span class="p">.</span><span class="nl">Http:</span> - <span class="n">transport</span> <span class="o">=</span> <span class="k">new</span> <span class="n">THttpTransport</span><span class="p">(</span><span class="k">new</span> <span class="n">Uri</span><span class="p">(</span><span class="s">"http://localhost:9090"</span><span class="p">),</span> <span class="n">null</span><span class="p">);</span> + <span class="n">transport</span> <span class="o">=</span> <span class="k">new</span> <span class="n">THttpTransport</span><span class="p">(</span><span class="k">new</span> <span class="n">Uri</span><span class="p">(</span><span class="s">"http://localhost:9090"</span><span class="p">),</span> <span class="n">Configuration</span><span class="p">);</span> <span class="k">break</span><span class="p">;</span> <span class="k">case</span> <span class="n">Transport</span><span class="p">.</span><span class="nl">TcpTls:</span> - <span class="n">transport</span> <span class="o">=</span> <span class="k">new</span> <span class="n">TTlsSocketTransport</span><span class="p">(</span><span class="n">IPAddress</span><span class="p">.</span><span class="n">Loopback</span><span class="p">,</span> <span class="mi">9090</span><span class="p">,</span> <span class="n">GetCertificate</span><span class="p">(),</span> <span class="n">CertValidator</span><span class="p">,</span> <span class="n">LocalCertificateSelectionCallback</span><span class="p">);</span> + <span class="n">transport</span> <span class="o">=</span> <span class="k">new</span> <span class="n">TTlsSocketTransport</span><span class="p">(</span><span class="n">IPAddress</span><span class="p">.</span><span class="n">Loopback</span><span class="p">,</span> <span class="mi">9090</span><span class="p">,</span> <span class="n">Configuration</span><span class="p">,</span> + <span class="n">GetCertificate</span><span class="p">(),</span> <span class="n">CertValidator</span><span class="p">,</span> <span class="n">LocalCertificateSelectionCallback</span><span class="p">);</span> <span class="k">break</span><span class="p">;</span> <span class="k">default</span><span class="o">:</span> @@ -449,11 +454,6 @@ h2:hover > .headerlink, h3:hover > .head <span class="n">work</span><span class="p">.</span><span class="n">Op</span> <span class="o">=</span> <span class="n">Operation</span><span class="p">.</span><span class="n">SUBTRACT</span><span class="p">;</span> <span class="n">work</span><span class="p">.</span><span class="n">Num1</span> <span class="o">=</span> <span class="mi">15</span><span class="p">;</span> - <span class="n">work</span><span class="p">.</span><span class="n">Num2</span> <span class="o">=</span> <span class="mi">10</span><span class="p">;</span> - - <span class="k">try</span> - <span class="p">{</span> - <span class="n">Logger</span><span class="p">.</span><span class="n">LogInformation</span><span class="p">(</span><span class="err">$</span><span class="s">"{client.ClientId} CalculateAsync(1)"</span><span class="p">);</span> </pre></div> <p class='snippet_footer'> @@ -503,32 +503,35 @@ h2:hover > .headerlink, h3:hover > .head <span class="p">{</span> <span class="k">private</span> <span class="k">static</span> <span class="n">ServiceCollection</span> <span class="n">ServiceCollection</span> <span class="o">=</span> <span class="k">new</span> <span class="n">ServiceCollection</span><span class="p">();</span> <span class="k">private</span> <span class="k">static</span> <span class="n">ILogger</span> <span class="n">Logger</span><span class="p">;</span> + <span class="k">private</span> <span class="k">static</span> <span class="n">readonly</span> <span class="n">TConfiguration</span> <span class="n">Configuration</span> <span class="o">=</span> <span class="n">null</span><span class="p">;</span> <span class="c1">// new TConfiguration() if needed</span> <span class="k">public</span> <span class="k">static</span> <span class="kt">void</span> <span class="n">Main</span><span class="p">(</span><span class="n">string</span><span class="p">[]</span> <span class="n">args</span><span class="p">)</span> <span class="p">{</span> <span class="n">args</span> <span class="o">=</span> <span class="n">args</span> <span class="o">??</span> <span class="k">new</span> <span class="n">string</span><span class="p">[</span><span class="mi">0</span><span class="p">];</span> <span class="n">ServiceCollection</span><span class="p">.</span><span class="n">AddLogging</span><span class="p">(</span><span class="n">logging</span> <span class="o">=></span> <span class="n">ConfigureLogging</span><span class="p">(</span><span class="n">logging</span><span class="p">));</span> - <span class="n">Logger</span> <span class="o">=</span> <span class="n">ServiceCollection</span><span class="p">.</span><span class="n">BuildServiceProvider</span><span class="p">().</span><span class="n">GetService</span><span class="o"><</span><span class="n">ILoggerFactory</span><span class="o">></span><span class="p">().</span><span class="n">CreateLogger</span><span class="p">(</span><span class="n">nameof</span><span class="p">(</span><span class="n">Server</span><span class="p">));</span> + <span class="k">using</span> <span class="p">(</span><span class="n">var</span> <span class="n">serviceProvider</span> <span class="o">=</span> <span class="n">ServiceCollection</span><span class="p">.</span><span class="n">BuildServiceProvider</span><span class="p">())</span> + <span class="p">{</span> + <span class="n">Logger</span> <span class="o">=</span> <span class="n">serviceProvider</span><span class="p">.</span><span class="n">GetService</span><span class="o"><</span><span class="n">ILoggerFactory</span><span class="o">></span><span class="p">().</span><span class="n">CreateLogger</span><span class="p">(</span><span class="n">nameof</span><span class="p">(</span><span class="n">Server</span><span class="p">));</span> + <span class="k">if</span> <span class="p">(</span><span class="n">args</span><span class="p">.</span><span class="n">Any</span><span class="p">(</span><span class="n">x</span> <span class="o">=></span> <span class="n">x</span><span class="p">.</span><span class="n">StartsWith</span><span class="p">(</span><span class="s">"-help"</span><span class="p">,</span> <span class="n">StringComparison</span><span class="p">.</span><span class="n">OrdinalIgnoreCase</span><span class="p">)))</span> + <span class="p">{</span> + <span class="n">DisplayHelp</span><span class="p">();</span> + <span class="k">return</span><span class="p">;</span> + <span class="p">}</span> - <span class="k">if</span> <span class="p">(</span><span class="n">args</span><span class="p">.</span><span class="n">Any</span><span class="p">(</span><span class="n">x</span> <span class="o">=></span> <span class="n">x</span><span class="p">.</span><span class="n">StartsWith</span><span class="p">(</span><span class="s">"-help"</span><span class="p">,</span> <span class="n">StringComparison</span><span class="p">.</span><span class="n">OrdinalIgnoreCase</span><span class="p">)))</span> - <span class="p">{</span> - <span class="n">DisplayHelp</span><span class="p">();</span> - <span class="k">return</span><span class="p">;</span> - <span class="p">}</span> + <span class="k">using</span> <span class="p">(</span><span class="n">var</span> <span class="n">source</span> <span class="o">=</span> <span class="k">new</span> <span class="n">CancellationTokenSource</span><span class="p">())</span> + <span class="p">{</span> + <span class="n">RunAsync</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="n">source</span><span class="p">.</span><span class="n">Token</span><span class="p">).</span><span class="n">GetAwaiter</span><span class="p">().</span><span class="n">GetResult</span><span class="p">();</span> - <span class="k">using</span> <span class="p">(</span><span class="n">var</span> <span class="n">source</span> <span class="o">=</span> <span class="k">new</span> <span class="n">CancellationTokenSource</span><span class="p">())</span> - <span class="p">{</span> - <span class="n">RunAsync</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="n">source</span><span class="p">.</span><span class="n">Token</span><span class="p">).</span><span class="n">GetAwaiter</span><span class="p">().</span><span class="n">GetResult</span><span class="p">();</span> + <span class="n">Logger</span><span class="p">.</span><span class="n">LogInformation</span><span class="p">(</span><span class="s">"Press any key to stop..."</span><span class="p">);</span> - <span class="n">Logger</span><span class="p">.</span><span class="n">LogInformation</span><span class="p">(</span><span class="s">"Press any key to stop..."</span><span class="p">);</span> + <span class="n">Console</span><span class="p">.</span><span class="n">ReadLine</span><span class="p">();</span> + <span class="n">source</span><span class="p">.</span><span class="n">Cancel</span><span class="p">();</span> + <span class="p">}</span> - <span class="n">Console</span><span class="p">.</span><span class="n">ReadLine</span><span class="p">();</span> - <span class="n">source</span><span class="p">.</span><span class="n">Cancel</span><span class="p">();</span> + <span class="n">Logger</span><span class="p">.</span><span class="n">LogInformation</span><span class="p">(</span><span class="s">"Server stopped"</span><span class="p">);</span> <span class="p">}</span> - - <span class="n">Logger</span><span class="p">.</span><span class="n">LogInformation</span><span class="p">(</span><span class="s">"Server stopped"</span><span class="p">);</span> <span class="p">}</span> <span class="k">private</span> <span class="k">static</span> <span class="kt">void</span> <span class="n">ConfigureLogging</span><span class="p">(</span><span class="n">ILoggingBuilder</span> <span class="n">logging</span><span class="p">)</span> @@ -542,10 +545,10 @@ h2:hover > .headerlink, h3:hover > .head <span class="p">{</span> <span class="n">Logger</span><span class="p">.</span><span class="n">LogInformation</span><span class="p">(</span><span class="err">@</span><span class="s">"</span> <span class="nl">Usage:</span> - <span class="n">Server</span><span class="p">.</span><span class="n">exe</span> <span class="o">-</span><span class="n">help</span> + <span class="n">Server</span> <span class="o">-</span><span class="n">help</span> <span class="n">will</span> <span class="n">diplay</span> <span class="n">help</span> <span class="n">information</span> - <span class="n">Server</span><span class="p">.</span><span class="n">exe</span> <span class="o">-</span><span class="nl">tr:</span><span class="o"><</span><span class="n">transport</span><span class="o">></span> <span class="o">-</span><span class="nl">bf:</span><span class="o"><</span><span class="n">buffering</span><span class="o">></span> <span class="o">-</span><span class="nl">pr:</span><span class="o"><</span><span class="n">protocol</span><span class="o">></span> + <span class="n">Server</span> <span class="o">-</span><span class="nl">tr:</span><span class="o"><</span><span class="n">transport</span><span class="o">></span> <span class="o">-</span><span class="nl">bf:</span><span class="o"><</span><span class="n">buffering</span><span class="o">></span> <span class="o">-</span><span class="nl">pr:</span><span class="o"><</span><span class="n">protocol</span><span class="o">></span> <span class="n">will</span> <span class="n">run</span> <span class="n">server</span> <span class="n">with</span> <span class="n">specified</span> <span class="n">arguments</span> <span class="p">(</span><span class="n">tcp</span> <span class="n">transport</span><span class="p">,</span> <span class="n">no</span> <span class="n">buffering</span><span class="p">,</span> <span class="n">and</span> <span class="n">binary</span> <span class="n">protocol</span> <span class="n">by</span> <span class="k">default</span><span class="p">)</span> <span class="nl">Options:</span> @@ -567,7 +570,7 @@ h2:hover > .headerlink, h3:hover > .head <span class="n">multiplexed</span> <span class="o">-</span> <span class="n">multiplexed</span> <span class="n">protocol</span> <span class="n">will</span> <span class="n">be</span> <span class="n">used</span> <span class="nl">Sample:</span> - <span class="n">Server</span><span class="p">.</span><span class="n">exe</span> <span class="o">-</span><span class="nl">tr:</span><span class="n">tcp</span> + <span class="n">Server</span> <span class="o">-</span><span class="nl">tr:</span><span class="n">tcp</span> <span class="s">");</span> <span class="p">}</span> @@ -622,13 +625,14 @@ h2:hover > .headerlink, h3:hover > .head <span class="k">switch</span> <span class="p">(</span><span class="n">transport</span><span class="p">)</span> <span class="p">{</span> <span class="k">case</span> <span class="n">Transport</span><span class="p">.</span><span class="nl">Tcp:</span> - <span class="n">serverTransport</span> <span class="o">=</span> <span class="k">new</span> <span class="n">TServerSocketTransport</span><span class="p">(</span><span class="mi">9090</span><span class="p">);</span> + <span class="n">serverTransport</span> <span class="o">=</span> <span class="k">new</span> <span class="n">TServerSocketTransport</span><span class="p">(</span><span class="mi">9090</span><span class="p">,</span> <span class="n">Configuration</span><span class="p">);</span> <span class="k">break</span><span class="p">;</span> <span class="k">case</span> <span class="n">Transport</span><span class="p">.</span><span class="nl">NamedPipe:</span> - <span class="n">serverTransport</span> <span class="o">=</span> <span class="k">new</span> <span class="n">TNamedPipeServerTransport</span><span class="p">(</span><span class="s">".test"</span><span class="p">);</span> + <span class="n">serverTransport</span> <span class="o">=</span> <span class="k">new</span> <span class="n">TNamedPipeServerTransport</span><span class="p">(</span><span class="s">".test"</span><span class="p">,</span> <span class="n">Configuration</span><span class="p">);</span> <span class="k">break</span><span class="p">;</span> <span class="k">case</span> <span class="n">Transport</span><span class="p">.</span><span class="nl">TcpTls:</span> - <span class="n">serverTransport</span> <span class="o">=</span> <span class="k">new</span> <span class="n">TTlsServerSocketTransport</span><span class="p">(</span><span class="mi">9090</span><span class="p">,</span> <span class="n">GetCertificate</span><span class="p">(),</span> <span class="n">ClientCertValidator</span><span class="p">,</span> <span class="n">LocalCertificateSelectionCallback</span><span class="p">);</span> + <span class="n">serverTransport</span> <span class="o">=</span> <span class="k">new</span> <span class="n">TTlsServerSocketTransport</span><span class="p">(</span><span class="mi">9090</span><span class="p">,</span> <span class="n">Configuration</span><span class="p">,</span> + <span class="n">GetCertificate</span><span class="p">(),</span> <span class="n">ClientCertValidator</span><span class="p">,</span> <span class="n">LocalCertificateSelectionCallback</span><span class="p">);</span> <span class="k">break</span><span class="p">;</span> <span class="p">}</span> @@ -805,7 +809,7 @@ h2:hover > .headerlink, h3:hover > .head <span class="k">public</span> <span class="k">class</span> <span class="nc">Startup</span> <span class="p">{</span> - <span class="k">public</span> <span class="n">Startup</span><span class="p">(</span><span class="n">IHostingEnvironment</span> <span class="n">env</span><span class="p">)</span> + <span class="k">public</span> <span class="n">Startup</span><span class="p">(</span><span class="n">IWebHostEnvironment</span> <span class="n">env</span><span class="p">)</span> <span class="p">{</span> <span class="n">var</span> <span class="n">builder</span> <span class="o">=</span> <span class="k">new</span> <span class="n">ConfigurationBuilder</span><span class="p">()</span> <span class="p">.</span><span class="n">SetBasePath</span><span class="p">(</span><span class="n">env</span><span class="p">.</span><span class="n">ContentRootPath</span><span class="p">)</span> @@ -825,7 +829,7 @@ h2:hover > .headerlink, h3:hover > .head <span class="p">}</span> <span class="c1">// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.</span> - <span class="k">public</span> <span class="kt">void</span> <span class="n">Configure</span><span class="p">(</span><span class="n">IApplicationBuilder</span> <span class="n">app</span><span class="p">,</span> <span class="n">IHostingEnvironment</span> <span class="n">env</span><span class="p">,</span> <span class="n">ILoggerFactory</span> <span class="n">loggerFactory</span><span class="p">)</span> + <span class="k">public</span> <span class="kt">void</span> <span class="n">Configure</span><span class="p">(</span><span class="n">IApplicationBuilder</span> <span class="n">app</span><span class="p">,</span> <span class="n">IWebHostEnvironment</span> <span class="n">env</span><span class="p">,</span> <span class="n">ILoggerFactory</span> <span class="n">loggerFactory</span><span class="p">)</span> <span class="p">{</span> <span class="n">app</span><span class="p">.</span><span class="n">UseMiddleware</span><span class="o"><</span><span class="n">THttpServerTransport</span><span class="o">></span><span class="p">();</span> <span class="p">}</span> @@ -883,9 +887,6 @@ h2:hover > .headerlink, h3:hover > .head <span class="p">{</span> <span class="n">var</span> <span class="n">io</span> <span class="o">=</span> <span class="k">new</span> <span class="n">InvalidOperation</span> <span class="p">{</span> - <span class="n">WhatOp</span> <span class="o">=</span> <span class="p">(</span><span class="kt">int</span><span class="p">)</span> <span class="n">w</span><span class="p">.</span><span class="n">Op</span><span class="p">,</span> - <span class="n">Why</span> <span class="o">=</span> <span class="s">"Cannot divide by 0"</span> - <span class="p">};</span> </pre></div> <p class='snippet_footer'>