Files
tgstation-server/_server_service_8cs_source.html

210 lines
34 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.9.8"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>tgstation-server: src/Tgstation.Server.Host.Service/ServerService.cs Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr id="projectrow">
<td id="projectalign">
<div id="projectname">tgstation-server<span id="projectnumber">&#160;6.19.3</span>
</div>
<div id="projectbrief">The /tg/station 13 server suite</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.8 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search/",'.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(document).ready(function() { init_codefold(0); });
/* @license-end */
</script>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<div id="MSearchResults">
<div class="SRPage">
<div id="SRIndex">
<div id="SRResults"></div>
<div class="SRStatus" id="Loading">Loading...</div>
<div class="SRStatus" id="Searching">Searching...</div>
<div class="SRStatus" id="NoMatches">No Matches</div>
</div>
</div>
</div>
</div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li><li class="navelem"><a class="el" href="dir_a01d946a2e1b048dc542232ffcdcf572.html">Tgstation.Server.Host.Service</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="headertitle"><div class="title">ServerService.cs</div></div>
</div><!--header-->
<div class="contents">
<a href="_server_service_8cs.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a id="l00001" name="l00001"></a><span class="lineno"> 1</span><span class="keyword">using </span>System;</div>
<div class="line"><a id="l00002" name="l00002"></a><span class="lineno"> 2</span><span class="keyword">using </span>System.Collections.Generic;</div>
<div class="line"><a id="l00003" name="l00003"></a><span class="lineno"> 3</span><span class="keyword">using </span>System.Diagnostics;</div>
<div class="line"><a id="l00004" name="l00004"></a><span class="lineno"> 4</span><span class="keyword">using </span>System.Runtime.Versioning;</div>
<div class="line"><a id="l00005" name="l00005"></a><span class="lineno"> 5</span><span class="keyword">using </span>System.ServiceProcess;</div>
<div class="line"><a id="l00006" name="l00006"></a><span class="lineno"> 6</span><span class="keyword">using </span>System.Threading;</div>
<div class="line"><a id="l00007" name="l00007"></a><span class="lineno"> 7</span> </div>
<div class="line"><a id="l00008" name="l00008"></a><span class="lineno"> 8</span><span class="keyword">using </span>Microsoft.Extensions.Logging;</div>
<div class="line"><a id="l00009" name="l00009"></a><span class="lineno"> 9</span><span class="keyword">using </span>Microsoft.Extensions.Logging.EventLog;</div>
<div class="line"><a id="l00010" name="l00010"></a><span class="lineno"> 10</span> </div>
<div class="line"><a id="l00011" name="l00011"></a><span class="lineno"> 11</span><span class="keyword">using </span><a class="code hl_namespace" href="namespace_tgstation_1_1_server_1_1_common.html">Tgstation.Server.Common</a>;</div>
<div class="line"><a id="l00012" name="l00012"></a><span class="lineno"> 12</span><span class="keyword">using </span><a class="code hl_namespace" href="namespace_tgstation_1_1_server_1_1_host_1_1_watchdog.html">Tgstation.Server.Host.Watchdog</a>;</div>
<div class="line"><a id="l00013" name="l00013"></a><span class="lineno"> 13</span> </div>
<div class="line"><a id="l00014" name="l00014"></a><span class="lineno"> 14</span><span class="keyword">namespace </span><a class="code hl_namespace" href="namespace_tgstation_1_1_server_1_1_host_1_1_service.html">Tgstation.Server.Host.Service</a></div>
<div class="line"><a id="l00015" name="l00015"></a><span class="lineno"> 15</span>{</div>
<div class="line"><a id="l00019" name="l00019"></a><span class="lineno"> 19</span> [SupportedOSPlatform(<span class="stringliteral">&quot;windows&quot;</span>)]</div>
<div class="foldopen" id="foldopen00020" data-start="{" data-end="};">
<div class="line"><a id="l00020" name="l00020"></a><span class="lineno"><a class="line" href="class_tgstation_1_1_server_1_1_host_1_1_service_1_1_server_service.html"> 20</a></span> <span class="keyword">sealed</span> <span class="keyword">class </span><a class="code hl_class" href="class_tgstation_1_1_server_1_1_host_1_1_service_1_1_server_service.html">ServerService</a> : <a class="code hl_class" href="class_service_base.html">ServiceBase</a></div>
<div class="line"><a id="l00021" name="l00021"></a><span class="lineno"> 21</span> {</div>
<div class="line"><a id="l00025" name="l00025"></a><span class="lineno"><a class="line" href="class_tgstation_1_1_server_1_1_host_1_1_service_1_1_server_service.html#a82a1c35bb13819cd1003592351251fc1"> 25</a></span> <span class="keyword">public</span> <span class="keyword">const</span> <span class="keywordtype">string</span> <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_service_1_1_server_service.html#a82a1c35bb13819cd1003592351251fc1">Name</a> = <a class="code hl_class" href="class_tgstation_1_1_server_1_1_common_1_1_constants.html">Constants</a>.<a class="code hl_variable" href="class_tgstation_1_1_server_1_1_common_1_1_constants.html#a3cb26946dbba9ee3e5136e164af07f3e">CanonicalPackageName</a>;</div>
<div class="line"><a id="l00026" name="l00026"></a><span class="lineno"> 26</span> </div>
<div class="line"><a id="l00030" name="l00030"></a><span class="lineno"><a class="line" href="class_tgstation_1_1_server_1_1_host_1_1_service_1_1_server_service.html#a5ed96035a5f77935306a218fc08a1465"> 30</a></span> readonly <a class="code hl_interface" href="interface_tgstation_1_1_server_1_1_host_1_1_watchdog_1_1_i_watchdog_factory.html">IWatchdogFactory</a> <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_service_1_1_server_service.html#a5ed96035a5f77935306a218fc08a1465">watchdogFactory</a>;</div>
<div class="line"><a id="l00031" name="l00031"></a><span class="lineno"> 31</span> </div>
<div class="line"><a id="l00035" name="l00035"></a><span class="lineno"><a class="line" href="class_tgstation_1_1_server_1_1_host_1_1_service_1_1_server_service.html#a6ebb4a0cdeeeda178ce21c5c2dbd9b13"> 35</a></span> readonly Lazy&lt;ILoggerFactory&gt; <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_service_1_1_server_service.html#a6ebb4a0cdeeeda178ce21c5c2dbd9b13">loggerFactory</a>;</div>
<div class="line"><a id="l00036" name="l00036"></a><span class="lineno"> 36</span> </div>
<div class="line"><a id="l00040" name="l00040"></a><span class="lineno"><a class="line" href="class_tgstation_1_1_server_1_1_host_1_1_service_1_1_server_service.html#ada2140ad4e7bbe188ba30c227bb5a9cf"> 40</a></span> readonly <span class="keywordtype">string</span>[] <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_service_1_1_server_service.html#ada2140ad4e7bbe188ba30c227bb5a9cf">commandLineArguments</a>;</div>
<div class="line"><a id="l00041" name="l00041"></a><span class="lineno"> 41</span> </div>
<div class="line"><a id="l00045" name="l00045"></a><span class="lineno"> 45</span><span class="preprocessor">#pragma warning disable CA2213 </span><span class="comment">// Disposable fields should be disposed</span></div>
<div class="line"><a id="l00046" name="l00046"></a><span class="lineno"><a class="line" href="class_tgstation_1_1_server_1_1_host_1_1_service_1_1_server_service.html#a3e27383887f66f707ce2721514f6211e"> 46</a></span> <span class="keyword">volatile</span> <a class="code hl_class" href="class_tgstation_1_1_server_1_1_host_1_1_service_1_1_service_lifetime.html">ServiceLifetime</a>? <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_service_1_1_server_service.html#a3e27383887f66f707ce2721514f6211e">serviceLifetime</a>;</div>
<div class="line"><a id="l00047" name="l00047"></a><span class="lineno"> 47</span><span class="preprocessor">#pragma warning restore CA2213 </span><span class="comment">// Disposable fields should be disposed</span></div>
<div class="line"><a id="l00048" name="l00048"></a><span class="lineno"> 48</span> </div>
<div class="foldopen" id="foldopen00055" data-start="{" data-end="}">
<div class="line"><a id="l00055" name="l00055"></a><span class="lineno"><a class="line" href="class_tgstation_1_1_server_1_1_host_1_1_service_1_1_server_service.html#aad7bf501e826f60c08c082150e741d34"> 55</a></span> <span class="keyword">public</span> <a class="code hl_function" href="class_tgstation_1_1_server_1_1_host_1_1_service_1_1_server_service.html#aad7bf501e826f60c08c082150e741d34">ServerService</a>(<a class="code hl_interface" href="interface_tgstation_1_1_server_1_1_host_1_1_watchdog_1_1_i_watchdog_factory.html">IWatchdogFactory</a> <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_service_1_1_server_service.html#a5ed96035a5f77935306a218fc08a1465">watchdogFactory</a>, <span class="keywordtype">string</span>[] <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_service_1_1_server_service.html#ada2140ad4e7bbe188ba30c227bb5a9cf">commandLineArguments</a>, LogLevel minimumLogLevel)</div>
<div class="line"><a id="l00056" name="l00056"></a><span class="lineno"> 56</span> {</div>
<div class="line"><a id="l00057" name="l00057"></a><span class="lineno"> 57</span> this.watchdogFactory = <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_service_1_1_server_service.html#a5ed96035a5f77935306a218fc08a1465">watchdogFactory</a> ?? <span class="keywordflow">throw</span> <span class="keyword">new</span> ArgumentNullException(nameof(<a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_service_1_1_server_service.html#a5ed96035a5f77935306a218fc08a1465">watchdogFactory</a>));</div>
<div class="line"><a id="l00058" name="l00058"></a><span class="lineno"> 58</span> this.commandLineArguments = <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_service_1_1_server_service.html#ada2140ad4e7bbe188ba30c227bb5a9cf">commandLineArguments</a> ?? <span class="keywordflow">throw</span> <span class="keyword">new</span> ArgumentNullException(nameof(<a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_service_1_1_server_service.html#ada2140ad4e7bbe188ba30c227bb5a9cf">commandLineArguments</a>));</div>
<div class="line"><a id="l00059" name="l00059"></a><span class="lineno"> 59</span> </div>
<div class="line"><a id="l00060" name="l00060"></a><span class="lineno"> 60</span> ServiceName = <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_service_1_1_server_service.html#a82a1c35bb13819cd1003592351251fc1">Name</a>;</div>
<div class="line"><a id="l00061" name="l00061"></a><span class="lineno"> 61</span> <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_service_1_1_server_service.html#a6ebb4a0cdeeeda178ce21c5c2dbd9b13">loggerFactory</a> = <span class="keyword">new</span> Lazy&lt;ILoggerFactory&gt;(() =&gt; LoggerFactory.Create(builder =&gt; builder.AddEventLog(<span class="keyword">new</span> EventLogSettings</div>
<div class="line"><a id="l00062" name="l00062"></a><span class="lineno"> 62</span> {</div>
<div class="line"><a id="l00063" name="l00063"></a><span class="lineno"> 63</span> LogName = EventLog.Log,</div>
<div class="line"><a id="l00064" name="l00064"></a><span class="lineno"> 64</span> MachineName = EventLog.MachineName,</div>
<div class="line"><a id="l00065" name="l00065"></a><span class="lineno"> 65</span> SourceName = EventLog.Source,</div>
<div class="line"><a id="l00066" name="l00066"></a><span class="lineno"> 66</span> Filter = (message, logLevel) =&gt; logLevel &gt;= minimumLogLevel,</div>
<div class="line"><a id="l00067" name="l00067"></a><span class="lineno"> 67</span> })));</div>
<div class="line"><a id="l00068" name="l00068"></a><span class="lineno"> 68</span> }</div>
</div>
<div class="line"><a id="l00069" name="l00069"></a><span class="lineno"> 69</span> </div>
<div class="line"><a id="l00073" name="l00073"></a><span class="lineno"><a class="line" href="class_tgstation_1_1_server_1_1_host_1_1_service_1_1_server_service.html#aeffa916c03ec7eb9dd6a25ee6d736034"> 73</a></span> <span class="keyword">public</span> <span class="keywordtype">void</span> <a class="code hl_function" href="class_tgstation_1_1_server_1_1_host_1_1_service_1_1_server_service.html#aeffa916c03ec7eb9dd6a25ee6d736034">Run</a>() =&gt; <a class="code hl_function" href="class_tgstation_1_1_server_1_1_host_1_1_service_1_1_server_service.html#aeffa916c03ec7eb9dd6a25ee6d736034">Run</a>(<span class="keyword">this</span>);</div>
<div class="line"><a id="l00074" name="l00074"></a><span class="lineno"> 74</span> </div>
<div class="foldopen" id="foldopen00076" data-start="{" data-end="}">
<div class="line"><a id="l00076" name="l00076"></a><span class="lineno"><a class="line" href="class_tgstation_1_1_server_1_1_host_1_1_service_1_1_server_service.html#a75ee7501b3cb59e3e34c05f382380292"> 76</a></span> <span class="keyword">protected</span> <span class="keyword">override</span> <span class="keywordtype">void</span> <a class="code hl_function" href="class_tgstation_1_1_server_1_1_host_1_1_service_1_1_server_service.html#a75ee7501b3cb59e3e34c05f382380292">Dispose</a>(<span class="keywordtype">bool</span> disposing)</div>
<div class="line"><a id="l00077" name="l00077"></a><span class="lineno"> 77</span> {</div>
<div class="line"><a id="l00078" name="l00078"></a><span class="lineno"> 78</span> <span class="keywordflow">if</span> (disposing)</div>
<div class="line"><a id="l00079" name="l00079"></a><span class="lineno"> 79</span> {</div>
<div class="line"><a id="l00080" name="l00080"></a><span class="lineno"> 80</span> <a class="code hl_function" href="class_tgstation_1_1_server_1_1_host_1_1_service_1_1_server_service.html#a6e54a00e5d8fc3f0629277f2bb7274ba">OnStop</a>();</div>
<div class="line"><a id="l00081" name="l00081"></a><span class="lineno"> 81</span> </div>
<div class="line"><a id="l00082" name="l00082"></a><span class="lineno"> 82</span> <span class="keywordflow">if</span> (<a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_service_1_1_server_service.html#a6ebb4a0cdeeeda178ce21c5c2dbd9b13">loggerFactory</a>.IsValueCreated)</div>
<div class="line"><a id="l00083" name="l00083"></a><span class="lineno"> 83</span> <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_service_1_1_server_service.html#a6ebb4a0cdeeeda178ce21c5c2dbd9b13">loggerFactory</a>.Value.Dispose();</div>
<div class="line"><a id="l00084" name="l00084"></a><span class="lineno"> 84</span> }</div>
<div class="line"><a id="l00085" name="l00085"></a><span class="lineno"> 85</span> </div>
<div class="line"><a id="l00086" name="l00086"></a><span class="lineno"> 86</span> base.Dispose(disposing);</div>
<div class="line"><a id="l00087" name="l00087"></a><span class="lineno"> 87</span> }</div>
</div>
<div class="line"><a id="l00088" name="l00088"></a><span class="lineno"> 88</span> </div>
<div class="line"><a id="l00090" name="l00090"></a><span class="lineno"><a class="line" href="class_tgstation_1_1_server_1_1_host_1_1_service_1_1_server_service.html#a2f03be0a11f20dffb543831b00498454"> 90</a></span> <span class="keyword">protected</span> <span class="keyword">override</span> <span class="keywordtype">void</span> <a class="code hl_function" href="class_tgstation_1_1_server_1_1_host_1_1_service_1_1_server_service.html#a2f03be0a11f20dffb543831b00498454">OnCustomCommand</a>(<span class="keywordtype">int</span> command) =&gt; <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_service_1_1_server_service.html#a3e27383887f66f707ce2721514f6211e">serviceLifetime</a>!.<a class="code hl_function" href="class_tgstation_1_1_server_1_1_host_1_1_service_1_1_service_lifetime.html#a1e2ad4a0782322f57acc5b988a771fb0">HandleCustomCommand</a>(command);</div>
<div class="line"><a id="l00091" name="l00091"></a><span class="lineno"> 91</span> </div>
<div class="foldopen" id="foldopen00093" data-start="{" data-end="}">
<div class="line"><a id="l00093" name="l00093"></a><span class="lineno"><a class="line" href="class_tgstation_1_1_server_1_1_host_1_1_service_1_1_server_service.html#a40bef17d85eb30f2cbad7ed81ef9c774"> 93</a></span> <span class="keyword">protected</span> <span class="keyword">override</span> <span class="keywordtype">void</span> <a class="code hl_function" href="class_tgstation_1_1_server_1_1_host_1_1_service_1_1_server_service.html#a40bef17d85eb30f2cbad7ed81ef9c774">OnStart</a>(<span class="keywordtype">string</span>[] args)</div>
<div class="line"><a id="l00094" name="l00094"></a><span class="lineno"> 94</span> {</div>
<div class="line"><a id="l00095" name="l00095"></a><span class="lineno"> 95</span> var newArgs = <span class="keyword">new</span> List&lt;string&gt;(<a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_service_1_1_server_service.html#ada2140ad4e7bbe188ba30c227bb5a9cf">commandLineArguments</a>.Length + args.Length + 1)</div>
<div class="line"><a id="l00096" name="l00096"></a><span class="lineno"> 96</span> {</div>
<div class="line"><a id="l00097" name="l00097"></a><span class="lineno"> 97</span> <span class="stringliteral">&quot;--General:SetupWizardMode=Never&quot;</span>,</div>
<div class="line"><a id="l00098" name="l00098"></a><span class="lineno"> 98</span> };</div>
<div class="line"><a id="l00099" name="l00099"></a><span class="lineno"> 99</span> </div>
<div class="line"><a id="l00100" name="l00100"></a><span class="lineno"> 100</span> newArgs.AddRange(<a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_service_1_1_server_service.html#ada2140ad4e7bbe188ba30c227bb5a9cf">commandLineArguments</a>);</div>
<div class="line"><a id="l00101" name="l00101"></a><span class="lineno"> 101</span> newArgs.AddRange(args);</div>
<div class="line"><a id="l00102" name="l00102"></a><span class="lineno"> 102</span> </div>
<div class="line"><a id="l00103" name="l00103"></a><span class="lineno"> 103</span> <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_service_1_1_server_service.html#a3e27383887f66f707ce2721514f6211e">serviceLifetime</a> = <span class="keyword">new</span> <a class="code hl_class" href="class_tgstation_1_1_server_1_1_host_1_1_service_1_1_service_lifetime.html">ServiceLifetime</a>(</div>
<div class="line"><a id="l00104" name="l00104"></a><span class="lineno"> 104</span> Stop,</div>
<div class="line"><a id="l00105" name="l00105"></a><span class="lineno"> 105</span> signalChecker =&gt; <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_service_1_1_server_service.html#a5ed96035a5f77935306a218fc08a1465">watchdogFactory</a>.<a class="code hl_function" href="interface_tgstation_1_1_server_1_1_host_1_1_watchdog_1_1_i_watchdog_factory.html#ab2d9fab6dfb0b258003ee1cff20694af">CreateWatchdog</a>(signalChecker, <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_service_1_1_server_service.html#a6ebb4a0cdeeeda178ce21c5c2dbd9b13">loggerFactory</a>.Value),</div>
<div class="line"><a id="l00106" name="l00106"></a><span class="lineno"> 106</span> <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_service_1_1_server_service.html#a6ebb4a0cdeeeda178ce21c5c2dbd9b13">loggerFactory</a>.Value.CreateLogger&lt;<a class="code hl_class" href="class_tgstation_1_1_server_1_1_host_1_1_service_1_1_service_lifetime.html">ServiceLifetime</a>&gt;(),</div>
<div class="line"><a id="l00107" name="l00107"></a><span class="lineno"> 107</span> newArgs.ToArray());</div>
<div class="line"><a id="l00108" name="l00108"></a><span class="lineno"> 108</span> }</div>
</div>
<div class="line"><a id="l00109" name="l00109"></a><span class="lineno"> 109</span> </div>
<div class="foldopen" id="foldopen00111" data-start="{" data-end="}">
<div class="line"><a id="l00111" name="l00111"></a><span class="lineno"><a class="line" href="class_tgstation_1_1_server_1_1_host_1_1_service_1_1_server_service.html#a6e54a00e5d8fc3f0629277f2bb7274ba"> 111</a></span> <span class="keyword">protected</span> <span class="keyword">override</span> <span class="keywordtype">void</span> <a class="code hl_function" href="class_tgstation_1_1_server_1_1_host_1_1_service_1_1_server_service.html#a6e54a00e5d8fc3f0629277f2bb7274ba">OnStop</a>()</div>
<div class="line"><a id="l00112" name="l00112"></a><span class="lineno"> 112</span> {</div>
<div class="line"><a id="l00113" name="l00113"></a><span class="lineno"> 113</span> var oldLifetime = Interlocked.Exchange(ref <a class="code hl_variable" href="class_tgstation_1_1_server_1_1_host_1_1_service_1_1_server_service.html#a3e27383887f66f707ce2721514f6211e">serviceLifetime</a>, <span class="keyword">null</span>);</div>
<div class="line"><a id="l00114" name="l00114"></a><span class="lineno"> 114</span> oldLifetime?.DisposeAsync().GetAwaiter().GetResult();</div>
<div class="line"><a id="l00115" name="l00115"></a><span class="lineno"> 115</span> }</div>
</div>
<div class="line"><a id="l00116" name="l00116"></a><span class="lineno"> 116</span> }</div>
</div>
<div class="line"><a id="l00117" name="l00117"></a><span class="lineno"> 117</span>}</div>
<div class="ttc" id="aclass_service_base_html"><div class="ttname"><a href="class_service_base.html">ServiceBase</a></div></div>
<div class="ttc" id="aclass_tgstation_1_1_server_1_1_common_1_1_constants_html"><div class="ttname"><a href="class_tgstation_1_1_server_1_1_common_1_1_constants.html">Tgstation.Server.Common.Constants</a></div><div class="ttdoc">Constant values.</div><div class="ttdef"><b>Definition</b> <a href="_constants_8cs_source.html#l00006">Constants.cs:7</a></div></div>
<div class="ttc" id="aclass_tgstation_1_1_server_1_1_common_1_1_constants_html_a3cb26946dbba9ee3e5136e164af07f3e"><div class="ttname"><a href="class_tgstation_1_1_server_1_1_common_1_1_constants.html#a3cb26946dbba9ee3e5136e164af07f3e">Tgstation.Server.Common.Constants.CanonicalPackageName</a></div><div class="ttdeci">const string CanonicalPackageName</div><div class="ttdoc">The name of the project.</div><div class="ttdef"><b>Definition</b> <a href="_constants_8cs_source.html#l00011">Constants.cs:11</a></div></div>
<div class="ttc" id="aclass_tgstation_1_1_server_1_1_host_1_1_service_1_1_server_service_html"><div class="ttname"><a href="class_tgstation_1_1_server_1_1_host_1_1_service_1_1_server_service.html">Tgstation.Server.Host.Service.ServerService</a></div><div class="ttdoc">Represents a IWatchdog as a ServiceBase.</div><div class="ttdef"><b>Definition</b> <a href="_server_service_8cs_source.html#l00020">ServerService.cs:21</a></div></div>
<div class="ttc" id="aclass_tgstation_1_1_server_1_1_host_1_1_service_1_1_server_service_html_a2f03be0a11f20dffb543831b00498454"><div class="ttname"><a href="class_tgstation_1_1_server_1_1_host_1_1_service_1_1_server_service.html#a2f03be0a11f20dffb543831b00498454">Tgstation.Server.Host.Service.ServerService.OnCustomCommand</a></div><div class="ttdeci">override void OnCustomCommand(int command)</div></div>
<div class="ttc" id="aclass_tgstation_1_1_server_1_1_host_1_1_service_1_1_server_service_html_a3e27383887f66f707ce2721514f6211e"><div class="ttname"><a href="class_tgstation_1_1_server_1_1_host_1_1_service_1_1_server_service.html#a3e27383887f66f707ce2721514f6211e">Tgstation.Server.Host.Service.ServerService.serviceLifetime</a></div><div class="ttdeci">volatile? ServiceLifetime serviceLifetime</div><div class="ttdoc">The active ServiceLifetime.</div><div class="ttdef"><b>Definition</b> <a href="_server_service_8cs_source.html#l00046">ServerService.cs:46</a></div></div>
<div class="ttc" id="aclass_tgstation_1_1_server_1_1_host_1_1_service_1_1_server_service_html_a40bef17d85eb30f2cbad7ed81ef9c774"><div class="ttname"><a href="class_tgstation_1_1_server_1_1_host_1_1_service_1_1_server_service.html#a40bef17d85eb30f2cbad7ed81ef9c774">Tgstation.Server.Host.Service.ServerService.OnStart</a></div><div class="ttdeci">override void OnStart(string[] args)</div><div class="ttdef"><b>Definition</b> <a href="_server_service_8cs_source.html#l00093">ServerService.cs:93</a></div></div>
<div class="ttc" id="aclass_tgstation_1_1_server_1_1_host_1_1_service_1_1_server_service_html_a5ed96035a5f77935306a218fc08a1465"><div class="ttname"><a href="class_tgstation_1_1_server_1_1_host_1_1_service_1_1_server_service.html#a5ed96035a5f77935306a218fc08a1465">Tgstation.Server.Host.Service.ServerService.watchdogFactory</a></div><div class="ttdeci">readonly IWatchdogFactory watchdogFactory</div><div class="ttdoc">The IWatchdog for the ServerService.</div><div class="ttdef"><b>Definition</b> <a href="_server_service_8cs_source.html#l00030">ServerService.cs:30</a></div></div>
<div class="ttc" id="aclass_tgstation_1_1_server_1_1_host_1_1_service_1_1_server_service_html_a6e54a00e5d8fc3f0629277f2bb7274ba"><div class="ttname"><a href="class_tgstation_1_1_server_1_1_host_1_1_service_1_1_server_service.html#a6e54a00e5d8fc3f0629277f2bb7274ba">Tgstation.Server.Host.Service.ServerService.OnStop</a></div><div class="ttdeci">override void OnStop()</div><div class="ttdef"><b>Definition</b> <a href="_server_service_8cs_source.html#l00111">ServerService.cs:111</a></div></div>
<div class="ttc" id="aclass_tgstation_1_1_server_1_1_host_1_1_service_1_1_server_service_html_a6ebb4a0cdeeeda178ce21c5c2dbd9b13"><div class="ttname"><a href="class_tgstation_1_1_server_1_1_host_1_1_service_1_1_server_service.html#a6ebb4a0cdeeeda178ce21c5c2dbd9b13">Tgstation.Server.Host.Service.ServerService.loggerFactory</a></div><div class="ttdeci">readonly Lazy&lt; ILoggerFactory &gt; loggerFactory</div><div class="ttdoc">The Lazy&lt;T&gt; ILoggerFactory used by the ServerService.</div><div class="ttdef"><b>Definition</b> <a href="_server_service_8cs_source.html#l00035">ServerService.cs:35</a></div></div>
<div class="ttc" id="aclass_tgstation_1_1_server_1_1_host_1_1_service_1_1_server_service_html_a75ee7501b3cb59e3e34c05f382380292"><div class="ttname"><a href="class_tgstation_1_1_server_1_1_host_1_1_service_1_1_server_service.html#a75ee7501b3cb59e3e34c05f382380292">Tgstation.Server.Host.Service.ServerService.Dispose</a></div><div class="ttdeci">override void Dispose(bool disposing)</div><div class="ttdef"><b>Definition</b> <a href="_server_service_8cs_source.html#l00076">ServerService.cs:76</a></div></div>
<div class="ttc" id="aclass_tgstation_1_1_server_1_1_host_1_1_service_1_1_server_service_html_a82a1c35bb13819cd1003592351251fc1"><div class="ttname"><a href="class_tgstation_1_1_server_1_1_host_1_1_service_1_1_server_service.html#a82a1c35bb13819cd1003592351251fc1">Tgstation.Server.Host.Service.ServerService.Name</a></div><div class="ttdeci">const string Name</div><div class="ttdoc">The canonical windows service name.</div><div class="ttdef"><b>Definition</b> <a href="_server_service_8cs_source.html#l00025">ServerService.cs:25</a></div></div>
<div class="ttc" id="aclass_tgstation_1_1_server_1_1_host_1_1_service_1_1_server_service_html_aad7bf501e826f60c08c082150e741d34"><div class="ttname"><a href="class_tgstation_1_1_server_1_1_host_1_1_service_1_1_server_service.html#aad7bf501e826f60c08c082150e741d34">Tgstation.Server.Host.Service.ServerService.ServerService</a></div><div class="ttdeci">ServerService(IWatchdogFactory watchdogFactory, string[] commandLineArguments, LogLevel minimumLogLevel)</div><div class="ttdoc">Initializes a new instance of the ServerService class.</div><div class="ttdef"><b>Definition</b> <a href="_server_service_8cs_source.html#l00055">ServerService.cs:55</a></div></div>
<div class="ttc" id="aclass_tgstation_1_1_server_1_1_host_1_1_service_1_1_server_service_html_ada2140ad4e7bbe188ba30c227bb5a9cf"><div class="ttname"><a href="class_tgstation_1_1_server_1_1_host_1_1_service_1_1_server_service.html#ada2140ad4e7bbe188ba30c227bb5a9cf">Tgstation.Server.Host.Service.ServerService.commandLineArguments</a></div><div class="ttdeci">readonly string[] commandLineArguments</div><div class="ttdoc">The Array of command line arguments the service was invoked with.</div><div class="ttdef"><b>Definition</b> <a href="_server_service_8cs_source.html#l00040">ServerService.cs:40</a></div></div>
<div class="ttc" id="aclass_tgstation_1_1_server_1_1_host_1_1_service_1_1_server_service_html_aeffa916c03ec7eb9dd6a25ee6d736034"><div class="ttname"><a href="class_tgstation_1_1_server_1_1_host_1_1_service_1_1_server_service.html#aeffa916c03ec7eb9dd6a25ee6d736034">Tgstation.Server.Host.Service.ServerService.Run</a></div><div class="ttdeci">void Run()</div><div class="ttdoc">Executes the ServerService.</div></div>
<div class="ttc" id="aclass_tgstation_1_1_server_1_1_host_1_1_service_1_1_service_lifetime_html"><div class="ttname"><a href="class_tgstation_1_1_server_1_1_host_1_1_service_1_1_service_lifetime.html">Tgstation.Server.Host.Service.ServiceLifetime</a></div><div class="ttdoc">Represents the lifetime of the service.</div><div class="ttdef"><b>Definition</b> <a href="_service_lifetime_8cs_source.html#l00019">ServiceLifetime.cs:20</a></div></div>
<div class="ttc" id="aclass_tgstation_1_1_server_1_1_host_1_1_service_1_1_service_lifetime_html_a1e2ad4a0782322f57acc5b988a771fb0"><div class="ttname"><a href="class_tgstation_1_1_server_1_1_host_1_1_service_1_1_service_lifetime.html#a1e2ad4a0782322f57acc5b988a771fb0">Tgstation.Server.Host.Service.ServiceLifetime.HandleCustomCommand</a></div><div class="ttdeci">void HandleCustomCommand(int command)</div><div class="ttdoc">Handle a custom service command .</div><div class="ttdef"><b>Definition</b> <a href="_service_lifetime_8cs_source.html#l00109">ServiceLifetime.cs:109</a></div></div>
<div class="ttc" id="ainterface_tgstation_1_1_server_1_1_host_1_1_watchdog_1_1_i_watchdog_factory_html"><div class="ttname"><a href="interface_tgstation_1_1_server_1_1_host_1_1_watchdog_1_1_i_watchdog_factory.html">Tgstation.Server.Host.Watchdog.IWatchdogFactory</a></div><div class="ttdoc">Factory for creating IWatchdogs.</div><div class="ttdef"><b>Definition</b> <a href="_tgstation_8_server_8_host_8_watchdog_2_i_watchdog_factory_8cs_source.html#l00008">IWatchdogFactory.cs:9</a></div></div>
<div class="ttc" id="ainterface_tgstation_1_1_server_1_1_host_1_1_watchdog_1_1_i_watchdog_factory_html_ab2d9fab6dfb0b258003ee1cff20694af"><div class="ttname"><a href="interface_tgstation_1_1_server_1_1_host_1_1_watchdog_1_1_i_watchdog_factory.html#ab2d9fab6dfb0b258003ee1cff20694af">Tgstation.Server.Host.Watchdog.IWatchdogFactory.CreateWatchdog</a></div><div class="ttdeci">IWatchdog CreateWatchdog(ISignalChecker signalChecker, ILoggerFactory loggerFactory)</div><div class="ttdoc">Create a IWatchdog.</div></div>
<div class="ttc" id="anamespace_tgstation_1_1_server_1_1_common_html"><div class="ttname"><a href="namespace_tgstation_1_1_server_1_1_common.html">Tgstation.Server.Common</a></div><div class="ttdef"><b>Definition</b> <a href="_constants_8cs_source.html#l00001">Constants.cs:2</a></div></div>
<div class="ttc" id="anamespace_tgstation_1_1_server_1_1_host_1_1_service_html"><div class="ttname"><a href="namespace_tgstation_1_1_server_1_1_host_1_1_service.html">Tgstation.Server.Host.Service</a></div><div class="ttdef"><b>Definition</b> <a href="_installation_extensions_8cs_source.html#l00001">InstallationExtensions.cs:2</a></div></div>
<div class="ttc" id="anamespace_tgstation_1_1_server_1_1_host_1_1_watchdog_html"><div class="ttname"><a href="namespace_tgstation_1_1_server_1_1_host_1_1_watchdog.html">Tgstation.Server.Host.Watchdog</a></div><div class="ttdef"><b>Definition</b> <a href="_bootstrap_settings_8cs_source.html#l00006">BootstrapSettings.cs:7</a></div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by&#160;<a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.8
</small></address>
</body>
</html>