Beispiel #1
0
        protected override void DidActivate(bool firstActivation, ActivationType activationType)
        {
            if (activationType == ActivationType.AddedToHierarchy)
            {
                //Set up UI
                title          = "Server Selection Screen";
                showBackButton = true;

                //Load server list from config
                var servers = new List <CoreServer>(Plugin.config.GetServers());
                if (servers.Count <= 0)
                {
                    servers.Add(
                        new CoreServer()
                    {
                        Name    = "Moon's Server",
                        Address = "beatsaber.networkauditor.org",
                        Port    = 10156
                    }
                        );

                    Plugin.config.SaveServers(servers.ToArray());
                }

                _serverSelectionViewController = BeatSaberUI.CreateViewController <ServerSelection>();
                _serverSelectionViewController.SetServers(new List <CoreServer>(servers));
                _serverSelectionViewController.ServerSelected += serverSelectionViewController_selectedServer;

                ProvideInitialViewControllers(_serverSelectionViewController);
            }
        }
Beispiel #2
0
 protected override void OnInfoScraped()
 {
     _serverSelectionViewController = BeatSaberUI.CreateViewController <ServerSelection>();
     _serverSelectionViewController.ServerSelected += serverSelectionViewController_selectedServer;
     _serverSelectionViewController.SetServers(ScrapedInfo.Keys.Union(ScrapedInfo.Values.Where(x => x.KnownHosts != null).SelectMany(x => x.KnownHosts)).ToList());
     PresentViewController(_serverSelectionViewController);
 }
Beispiel #3
0
        /// <summary>
        /// Возвращает список всех активных серверов на машине.
        /// </summary>
        /// <returns>Список активных серверов на машине</returns>
        private ServerSelection GetAllServers()
        {
            ServerSelection       selection    = new ServerSelection();
            List <SelectListItem> ddlInstances = new List <SelectListItem>();

            if (GlobalVariables.DdlInstances == null)
            {
                DataTable dt = SqlDataSourceEnumerator.Instance.GetDataSources();
                foreach (DataRow dr in dt.Rows)
                {
                    string value = string.Concat(dr["ServerName"], "\\", dr["InstanceName"]);
                    ddlInstances.Add(new SelectListItem()
                    {
                        Text = value, Value = value
                    });
                }
                GlobalVariables.DdlInstances = ddlInstances;
            }
            else
            {
                ddlInstances = GlobalVariables.DdlInstances;
            }

            selection.ListValue = new SelectList(ddlInstances, "Text", "Value");
            ViewBag.Servers     = ddlInstances;
            return(selection);
        }
Beispiel #4
0
        public ActionResult Helper()
        {
            //Получение всех sql server
            ServerSelection selection = GetAllServers();

            return(View(selection));
        }
Beispiel #5
0
        public ActionResult Helper(ServerSelection obj)
        {
            GlobalVariables.SqlServer = obj.SelectedValue;
            //Получение всех sql server
            ServerSelection selection = GetAllServers();

            return(View(selection));
        }
Beispiel #6
0
        public async void AfterServerConfirmed(X509Certificate2 clientCert, ServerInfo info, String address, String password, String userName)
        {
            MainPage = new Loading("Client is being registred...");
            try
            {
                await Task.Run(() =>
                {
                    ConnectionUtils.Register(out connection, out settings, logger, Log, address, clientCert, config, userName, settingsLoader, info);
                });

                Init();
            }
            catch (Exception ex)
            {
                logger.LogException(this, ex);
                MainPage = new ServerSelection(this, clientCert, address, password, userName, ex.Message);
            }
        }
Beispiel #7
0
        public async void AfterServerSelected(X509Certificate2 clientCert, String address, String password, String userName)
        {
            MainPage = new Loading("Server informations are downloading...");
            try
            {
                InfoConnection infoConnection = new InfoConnection(address, logger);
                ServerInfo     info           = null;

                await Task.Run(() =>
                {
                    info = infoConnection.DownloadInfo();
                });

                MainPage = new ServerVerification(this, info, clientCert, address, password, userName);
            }
            catch (Exception ex)
            {
                MainPage = new ServerSelection(this, clientCert, address, password, userName, ex.Message);
            }
        }
Beispiel #8
0
        public async Task <dynamic> PostAsync([FromBody] ServerSelection value)
        {
            IPAddress ip;
            var       address = Dns.GetHostAddresses(value.Ip).FirstOrDefault().ToString();
            bool      valid   = IPAddress.TryParse(address, out ip);

            if (valid)
            {
                AggregatorService service = new AggregatorService(HttpHelper.client);
                ServerSelection   server  = value;
                server.Ip = ip.ToString();
                dynamic results = await service.GetAllIpInfo(server);

                return(Ok(results));
            }
            else
            {
                return(BadRequest());
            }
        }
Beispiel #9
0
        public async Task <IpInfoModel> GetAllIpInfo(ServerSelection servers)
        {
            Task <GeolocationModel> geolocationTask = Task.Factory.StartNew <GeolocationModel>(() => {
                if (servers.Servers == null || servers.Servers.Contains("geolocation"))
                {
                    GeoIpService geoService = new GeoIpService(_client);
                    return(geoService.RequestGeoInfoAsync(servers.Ip).Result);
                }
                else
                {
                    return(null);
                }
            });

            Task <VirusTotalModel> virusTotalTask = Task.Factory.StartNew <VirusTotalModel>(() => {
                if (servers.Servers == null || servers.Servers.Contains("virustotal"))
                {
                    VirusTotalService virusTotalService = new VirusTotalService(_client);
                    return(virusTotalService.RequestVirusInfoAsync(servers.Ip).Result);
                }
                else
                {
                    return(null);
                }
            });


            await Task.WhenAll(geolocationTask, virusTotalTask);

            IpInfoModel results = new IpInfoModel();

            results.LocationInfo = await geolocationTask;

            results.VirusTotal = await virusTotalTask;

            return(results);
        }
Beispiel #10
0
 public void AfterCertificateSelected(X509Certificate2 cert)
 {
     MainPage = new ServerSelection(this, cert);
 }
Beispiel #11
0
        public MainViewModel(
            Profile profile,
            Server server,
            ViewStart viewStart,
            ViewTroupList viewTroupList,
            RankingPlayerView viewRankingPlayer,
            RankingAllyView viewRankingAlly,
            ConquerView viewConquer,
            ViewPlaner viewPlaner,
            ServerSelection serverSelection)
        {
            _profile = profile;
            _server  = server;

            var MenuItems = new[]
            {
                new MainMenuItem()
                {
                    Group   = "Start",
                    Title   = "Start",
                    Image   = "",
                    Content = viewStart
                },
                new MainMenuItem()
                {
                    Group   = "Start",
                    Title   = "Server Auswahl",
                    Image   = "",
                    Content = serverSelection
                },
                new MainMenuItem()
                {
                    Group   = "Allgemein",
                    Title   = "Karte",
                    Image   = "/Venom;component/Assets/Images/map2.png",
                    Content = null
                },
                new MainMenuItem()
                {
                    Group   = "Allgemein",
                    Title   = "Truppenliste",
                    Image   = "",
                    Content = viewTroupList
                },
                new MainMenuItem()
                {
                    Group   = "Ranglisten",
                    Title   = "Rangliste Spieler",
                    Image   = "",
                    Content = viewRankingPlayer
                },
                new MainMenuItem()
                {
                    Group   = "Ranglisten",
                    Title   = "Rangliste Stämme",
                    Image   = "",
                    Content = viewRankingAlly
                },
                new MainMenuItem()
                {
                    Group   = "Ranglisten",
                    Title   = "Eroberungen",
                    Image   = "/Venom;component/Assets/Images/unit_snob.png",
                    Content = viewConquer
                },
                new MainMenuItem()
                {
                    Group   = "Planer",
                    Title   = "Angriffsplaner",
                    Image   = "/Venom;component/Assets/Images/unit_axe.png",
                    Content = viewPlaner
                }
            };

            MenuCollection = CollectionViewSource.GetDefaultView(MenuItems);
            MenuCollection.GroupDescriptions.Add(new PropertyGroupDescription("Group"));
        }