コード例 #1
0
ファイル: ServersController.cs プロジェクト: shine11/Kontur
        public string Get_endpoint(string endpoint)
        {
            bool EndpointExist = false;

            EndpointExist = Other_methods.The_existence_check(EndpointExist, endpoint);
            if (EndpointExist)
            {
                Models.Info   info1     = new Models.Info();
                List <string> gameModes = WorkSQL.Select_gameModes(endpoint);
                int           i         = 0;
                info1.gameModes = new string[gameModes.Count];
                foreach (var a in gameModes)
                {
                    info1.gameModes[i] = a;
                    i++;
                }
                info1.name = WorkSQL.Select_name(endpoint)[0];
                string serilized = JsonConvert.SerializeObject(info1);
                return(serilized);
            }
            else
            {
                return("404 Not Found");
            }
        }
コード例 #2
0
ファイル: ServersController.cs プロジェクト: shine11/Kontur
        public string Get_info()
        {
            List <Models.All_Info> servers_info = new List <Models.All_Info>();

            foreach (var e in WorkSQL.Select_Endpoint())
            {
                {
                    List <string> gameModes          = WorkSQL.Select_gameModes(e);
                    int           i                  = 0;
                    string[]      endpoint_gameModes = new string[gameModes.Count];
                    foreach (var a in gameModes)
                    {
                        endpoint_gameModes[i] = a;
                        i++;
                    }
                    servers_info.Add(new Models.All_Info()
                    {
                        endpoint = e, name = WorkSQL.Select_name(e)[0], gameModes = endpoint_gameModes
                    });
                }
            }
            return(JsonConvert.SerializeObject(servers_info));
        }