public async Task <object> GetTargetInstance(string id) { var response = new InstanceInfoResponse(); if (!Guid.TryParse(id, out var guid)) { response.FailedReason = "invalid guid"; return(response); } var instances = await MasterServer.GetAllInstancesAsync(); var instance = instances.FirstOrDefault(i => i.Id == guid); if (instance == default) { response.FailedReason = "not found"; return(response); } response.Success = true; response.Hosting = instance.MasterApi == MasterServer.ApiPort; response.Info = instance; return(response); }
public async Task <object> GetBasicInstance(string typeString) { var response = new InstanceInfoResponse(); if (!int.TryParse(typeString, out var type)) { response.FailedReason = "invalid type"; return(response); } var instances = await MasterServer.GetAllInstancesAsync(); var instance = instances.FirstOrDefault(i => i.Type == type); if (instance == default) { response.FailedReason = "not found"; return(response); } response.Success = true; response.Hosting = instance.MasterApi == MasterServer.ApiPort; response.Info = instance; return(response); }