Example #1
0
        protected void Register()
        {
            ServiceInfo = new HostedService();

            ServiceInfo.IDKey = HostedService.GenerateKey();

            ServiceInfo.Name       = StartupInfo.Name;
            ServiceInfo.Port       = StartupInfo.Port;
            ServiceInfo.WANAddress = StartupInfo.ServerWANHost;
            ServiceInfo.LANAddress = StartupInfo.ServerLANAddress;
            ServiceInfo.Secured    = StartupInfo.Password != string.Empty;

            ServiceInfo.Properties.Add(new Tuple <string, string>("FTL", StartupInfo.FTL.ToString()));
            ServiceInfo.Properties.Add(new Tuple <string, string>("SensorRange", StartupInfo.SensorRange.ToString()));
            ServiceInfo.Properties.Add(new Tuple <string, string>("TacticalRadarMSD", StartupInfo.TacticalRadarMSD.ToString()));
            ServiceInfo.Properties.Add(new Tuple <string, string>("LongRangeRadarMSD", StartupInfo.LongRangeRadarMSD.ToString()));
            ServiceInfo.Properties.Add(new Tuple <string, string>("Scans", StartupInfo.Scans.ToString()));
            ServiceInfo.Properties.Add(new Tuple <string, string>("UseWeaponFrequencies", StartupInfo.UseWeaponFrequencies.ToString()));
            ServiceInfo.Properties.Add(new Tuple <string, string>("UseSystemDamage", StartupInfo.UseSystemDamage.ToString()));

            if (StartupInfo.SelectedScenario != null)
            {
                ServiceInfo.Properties.Add(new Tuple <string, string>("ScenarioName", StartupInfo.SelectedScenario.Name));
                ServiceInfo.Properties.Add(new Tuple <string, string>("ScenarioDescription", StartupInfo.SelectedScenario.Description));
                ServiceInfo.Properties.Add(new Tuple <string, string>("ScenarioAuthor", StartupInfo.SelectedScenario.Author));
                ServiceInfo.Properties.Add(new Tuple <string, string>("ScenarioIconImage", StartupInfo.SelectedScenario.IconImage));
                ServiceInfo.Properties.Add(new Tuple <string, string>("ScenarioType", StartupInfo.SelectedScenario.Type));
                if (StartupInfo.SelectedVariation != null)
                {
                    ServiceInfo.Properties.Add(new Tuple <string, string>("ScenarioVariationName", StartupInfo.SelectedVariation.DisplayName));
                    ServiceInfo.Properties.Add(new Tuple <string, string>("ScenarioVariationDescription", StartupInfo.SelectedVariation.Description));
                }
            }

            else
            {
                ServiceInfo.Properties.Add(new Tuple <string, string>("ScenarioName", "NONE"));
            }

            ServiceList.RegisterLocalService(ServiceInfo, StartupInfo.Public);

            LANDiscoveryHost.Startup();
        }