(string[] args)
| 85 | } |
| 86 | |
| 87 | static void Main(string[] args) |
| 88 | { |
| 89 | try |
| 90 | { |
| 91 | if (args != null && args.Length > 0) |
| 92 | { |
| 93 | _cmdArgs = string.Join(" ", args); |
| 94 | } |
| 95 | |
| 96 | GameserverSDK.Start(true); |
| 97 | GameserverSDK.RegisterShutdownCallback(OnShutdown); |
| 98 | GameserverSDK.RegisterHealthCallback(GetGameHealth); |
| 99 | //GameserverSDK.RegisterMaintenanceCallback(OnMaintenanceScheduled); |
| 100 | GameserverSDK.RegisterMaintenanceV2Callback(OnMaintenanceV2Scheduled); |
| 101 | |
| 102 | IDictionary<string, string> gsdkConfiguration = GameserverSDK.getConfigSettings(); |
| 103 | if (gsdkConfiguration.TryGetValue("RealPort", out string listeningPortString)) |
| 104 | { |
| 105 | _listeningPort = int.Parse(listeningPortString); |
| 106 | } |
| 107 | |
| 108 | string address = $"http://*:{_listeningPort}/"; |
| 109 | _listener.Prefixes.Add(address); |
| 110 | _listener.Start(); |
| 111 | |
| 112 | string applicationDirectory = AppContext.BaseDirectory; |
| 113 | if (File.Exists(Path.Combine(applicationDirectory, AssetFilePath))) |
| 114 | { |
| 115 | _assetFileText = File.ReadAllText(Path.Combine(applicationDirectory, AssetFilePath)); |
| 116 | } |
| 117 | |
| 118 | // See if we have a configured timeout in the App.config, this was |
| 119 | // used in our initial round of stress tests to make sure sessions ended |
| 120 | string timeoutstr = ConfigurationManager.AppSettings.Get(SessionTimeoutInSecondsName); |
| 121 | if (!string.IsNullOrEmpty(timeoutstr)) |
| 122 | { |
| 123 | // failure to convert is intentionally unhandled |
| 124 | long timeoutint = Convert.ToInt64(timeoutstr.Trim()); |
| 125 | |
| 126 | _sessionTimeoutTimestamp = DateTimeOffset.Now.AddSeconds(timeoutint); |
| 127 | } |
| 128 | |
| 129 | IDictionary<string, string> initialConfig = GameserverSDK.getConfigSettings(); |
| 130 | if (initialConfig?.ContainsKey("winRunnerTestCert") == true) |
| 131 | { |
| 132 | string expectedThumbprint = initialConfig["winRunnerTestCert"]; |
| 133 | X509Store store = new X509Store(StoreName.My, StoreLocation.LocalMachine); |
| 134 | store.Open(OpenFlags.ReadOnly); |
| 135 | X509Certificate2Collection certificateCollection = store.Certificates.Find(X509FindType.FindByThumbprint, expectedThumbprint, false); |
| 136 | |
| 137 | if (certificateCollection.Count > 0) |
| 138 | { |
| 139 | _installedCertThumbprint = certificateCollection[0].Thumbprint; |
| 140 | } |
| 141 | else |
| 142 | { |
| 143 | LogMessage("Could not find installed game cert in LocalMachine\\My. Expected thumbprint is: " + expectedThumbprint); |
| 144 | } |
nothing calls this directly
no test coverage detected