public World(PassObject RESETWORLD, int LEVELID, PassObject CHANGEGAMESTATE) { stop = 0; levelId = LEVELID; ResetWorld = RESETWORLD; ChangeWorldTwo = RESETWORLD; ChangeGameState = CHANGEGAMESTATE; levelDrawManager = new LevelDrawManager(); GameGlobals.PassProjectile = AddProjectile; GameGlobals.PassEffect = AddEffect; GameGlobals.PassMob = AddMob; GameGlobals.PassBuilding = AddBuilding; GameGlobals.PassSpawnPoint = AddSpawnPoint; GameGlobals.CheckScroll = CheckScroll; GameGlobals.PassGold = AddGold; GameGlobals.paused = false; offset = new Vector2(0, 0); LoadData(levelId); ui = new UI(ResetWorld); bkg = new TileBkg2d("2D\\UI\\Backgrounds\\KafelekPodloga", new Vector2(-100, -100), new Vector2(120, 100), new Vector2(grid.totalPhysicalDims.X, grid.totalPhysicalDims.Y)); }
public object AfterReceiveRequest(ref Message request, IClientChannel channel, InstanceContext instanceContext) { PassObject p = new PassObject(); p.CompressionType = CompressionType.None; p.ContentType = "application/xml"; object propObj; if (request.Properties.TryGetValue(HttpRequestMessageProperty.Name, out propObj)) { var prop = (HttpRequestMessageProperty)propObj; var accept = prop.Headers[HttpRequestHeader.Accept]; if (accept != null) { if (jsonContentTypes.IsMatch(accept)) { p.ContentType = "application/json"; } else if (protoContentTypes.IsMatch(accept)) { p.ContentType = "application/x-protobuff"; } } var acceptEncoding = prop.Headers[HttpRequestHeader.AcceptEncoding]; if (acceptEncoding != null) { if (acceptEncoding.Contains("gzip")) { p.CompressionType = CompressionType.Gzip; } } } return(p); }
//Searches for any services with the inputted text private void SearchButton_Click(object sender, RoutedEventArgs e) { try { SearchDel search; AsyncCallback callback; //Clearing children to only show results in current search sp.Children.Clear(); PassObject <string> pass = new PassObject <string>(); pass.Token = DataSingleton.Instance.token; pass.Pass = SearchText.Text; string URL = "https://localhost:44358/"; RestClient client = new RestClient(URL); RestRequest request = new RestRequest("api/search"); request.AddJsonBody(pass); search = this.SearchService; callback = this.OnSearchCompletion; search.BeginInvoke(client, request, callback, null); WaitingBar.Visibility = Visibility.Visible; WaitingBar.IsIndeterminate = true; WaitingLabel.Visibility = Visibility.Visible; } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public World(PassObject RESETWORLD) { ResetWorld = RESETWORLD; offset = new Vector2(0, 0); Global.gamefont = Global.content.Load <SpriteFont>("FONT"); bg = new Backgrounds("Background", new Vector2(0, 0), new Vector2(4000, 4000)); Ship = new Hero("Ship", new Vector2(bg.dims.X / 2, bg.dims.Y / 2), new Vector2(28, 44)); GameGlobal.PassProjectiles = Addprojectile; GameGlobal.PassMob = AddMob; istimeofboss = false; delayspawnboss = 300; GameGlobal.triggerNuclear = TriggerNuclearBomb; GameGlobal.GunnerPassProjectiles = GunnerProjectiles; GameGlobal.FatboizPassProjectiles = FatboizProjectiles; GameGlobal.FatboizPassMob = FatboizSummon; GameGlobal.BlitzHook = BlitzHook; GameGlobal.BlitzHookEffect = BlitzHookEffect; healthbar = new Bar("HB", new Vector2(600, 35)); manabar = new Bar("MB", new Vector2(500, 15)); bosshealthbar = new Bar("BossHP", new Vector2(800, 55)); scoreimg = new Basic2d("Score", new Vector2(0, 0), new Vector2(150, 75)); spawnPoints.Add(new SpawnPoint("UFO3", new Vector2(100, 100), new Vector2(200, 200))); spawnPoints.Add(new SpawnPoint("UFO3", new Vector2(3800, 100), new Vector2(200, 200))); spawnPoints.Add(new SpawnPoint("UFO3", new Vector2(100, 3800), new Vector2(200, 200))); spawnPoints.Add(new SpawnPoint("UFO3", new Vector2(3800, 3800), new Vector2(200, 200))); orbspawn = false; orbspawntimer = 100; iceworldtimer = 300; lbltrigger = 50; timescore = 0; imagePause = new Basic2d("pause2", new Vector2(Ship.pos.X, Ship.pos.Y), new Vector2(500, 500)); imageGameOver = new Basic2d("gameover4", new Vector2(Ship.pos.X, Ship.pos.Y), new Vector2(836, 183)); }
public World(PassObject RESETWORLD) { resetWorld = RESETWORLD; numKilled = 0; hero = new Hero("2d\\Hero", new Vector2(300, 300), new Vector2(40, 40)); GameGlobals.PassProjectile = AddProjectile; GameGlobals.PassMob = AddMob; GameGlobals.CheckScroll = CheckScroll; offset = new Vector2(0, 0); spawnPoints.Add(new SpawnPoint("2d\\Misc\\Circle", new Vector2(50, 50), new Vector2(35, 35))); spawnPoints.Add(new SpawnPoint("2d\\Misc\\Circle", new Vector2(Globals.screenWidth / 2, 50), new Vector2(35, 35))); spawnPoints[spawnPoints.Count - 1].spawnTimer.AddToTimer(500); spawnPoints.Add(new SpawnPoint("2d\\Misc\\Circle", new Vector2(Globals.screenWidth - 50, 50), new Vector2(35, 35))); spawnPoints[spawnPoints.Count - 1].spawnTimer.AddToTimer(1000); ui = new UI(); }
private void OnSliderChanged(PassObject obj) { float value = obj.GetObject <float>(); string sliderValue = $"Slider Value: {value}"; EventManager.TriggerEvent(UIValueUpdateEvents.OnUpdateSliderText, new PassObject(sliderValue)); }
public Mainmenu() { //Mainmenu1 needs to be added to the project bkg = Globals.Content.Load <Texture2D>("Sprites/Misc/Mainmenu1"); NewRunObject = NewGame; NewRun = new Button(Button.ButtonState.Selected, NewRunObject, null, new Vector2(380, 220)); buttons.Add(NewRun); ContinueObject = ContinueGame; Continue = new Button(Button.ButtonState.Unselected, ContinueObject, null, new Vector2(380, 330)); buttons.Add(Continue); ChallengesObject = SwitchToChallenges; Challenges = new Button(Button.ButtonState.Unselected, ChallengesObject, null, new Vector2(380, 410)); buttons.Add(Challenges); StatsObject = SwitchToStats; Stats = new Button(Button.ButtonState.Unselected, StatsObject, null, new Vector2(380, 470)); buttons.Add(Stats); OptionsObject = SwitchToOptions; Options = new Button(Button.ButtonState.Unselected, OptionsObject, null, new Vector2(380, 550)); buttons.Add(Options); xmlPlayer = Globals.save.GetFile("xml\\stats.xml"); }
public object AfterReceiveRequest(ref Message request, IClientChannel channel, InstanceContext instanceContext) { PassObject p=new PassObject(); p.CompressionType=CompressionType.None; p.ContentType = "application/xml"; object propObj; if (request.Properties.TryGetValue(HttpRequestMessageProperty.Name, out propObj)) { var prop = (HttpRequestMessageProperty)propObj; var accept = prop.Headers[HttpRequestHeader.Accept]; if (accept != null) { if (jsonContentTypes.IsMatch(accept)) { p.ContentType = "application/json"; } else if (protoContentTypes.IsMatch(accept)) { p.ContentType = "application/x-protobuff"; } } var acceptEncoding = prop.Headers[HttpRequestHeader.AcceptEncoding]; if (acceptEncoding != null) { if (acceptEncoding.Contains("gzip")) p.CompressionType = CompressionType.Gzip; } } return p; }
public World(PassObject RESETWORLD) { ResetWorld = RESETWORLD; numKilled = 0; nave = new Nave("nave", new Vector2(400, 300), new Vector2(48, 48)); //Inicializacion de mundo y cordeenadas GameGlobals.PassProjectile = AddProjectile; //funcion para activar pasar proyectil como objeto por medio de global (Delegade) GameGlobals.PassMob = AddMob; //funcion para activar pasar mob como objeto por medio de global (Delegade) offset = new Vector2(0, 0); spawnPoints.Add(new SpawnPoint("NaveMala", new Vector2(50, 50), new Vector2(30, 35))); //spawn de naves enemigas spawnPoints.Add(new SpawnPoint("NaveMala", new Vector2(Globals.screenWidth / 2, 50), new Vector2(30, 35))); spawnPoints[spawnPoints.Count - 1].spawnTimer.AddToTimer(500); spawnPoints.Add(new SpawnPoint("NaveMala", new Vector2(Globals.screenWidth - 50, 50), new Vector2(30, 35))); spawnPoints[spawnPoints.Count - 1].spawnTimer.AddToTimer(1000); spawnPoints.Add(new SpawnPoint("NaveMala", new Vector2(Globals.screenWidth - 50, 200), new Vector2(30, 35))); spawnPoints[spawnPoints.Count - 1].spawnTimer.AddToTimer(1500); spawnPoints.Add(new SpawnPoint("NaveMala", new Vector2(55, 200), new Vector2(30, 35))); spawnPoints[spawnPoints.Count - 1].spawnTimer.AddToTimer(2000); spawnPoints.Add(new SpawnPoint("NaveMala", new Vector2(Globals.screenWidth - 50, 350), new Vector2(30, 35))); spawnPoints[spawnPoints.Count - 1].spawnTimer.AddToTimer(3500); spawnPoints.Add(new SpawnPoint("NaveMala", new Vector2(55, 350), new Vector2(30, 35))); spawnPoints[spawnPoints.Count - 1].spawnTimer.AddToTimer(3000); spawnPoints.Add(new SpawnPoint("NaveMala", new Vector2(Globals.screenWidth / 2, 410), new Vector2(30, 35))); // spawnPoints[spawnPoints.Count - 1].spawnTimer.AddToTimer(500); ui = new UI(); }
public ReturnObject <string> Post([FromBody] PassObject <int[]> pass) { string prime = "This is not a prime"; ReturnObject <string> ret = new ReturnObject <string>(); int id = pass.Pass[0]; var tcp = new NetTcpBinding(); var URL = "net.tcp://localhost:8101/AuthenticationService"; var authFactory = new ChannelFactory <AuthenticatorInterface>(tcp, URL); var auth = authFactory.CreateChannel(); if (!auth.Validate(pass.Token).Equals("validated")) { ret.Status = "Denied"; ret.Reason = "Authentication failed"; return(ret); } if (pass.Pass.Length != 1) { ret.Status = "Denied"; ret.Reason = "Input was invalid"; return(ret); } if (id % 2 != 0 && id % 3 != 0 && id % 5 != 0 && id % 7 != 0 && id > 1) { prime = "This is a prime"; } ret.Returned = prime; return(ret); }
public WinScreen(PassObject ChangeGameState) { changeGameState = ChangeGameState; bkg = new Basic2D("2D/Menu/YouWin", new Vector2(Globals.screenWidth / 2, Globals.screenHeight / 2), new Vector2(Globals.screenWidth, Globals.screenHeight)); menuButton = new Button2D("2D/Menu/Button", new Vector2(0, 0), new Vector2(180, 60), "Fonts/Arial12", "Menu", changeGameState, 0); }
public GamePlay(PassObject CHANGE_GAME_STATE) { playState = 0; ChangeGameState = CHANGE_GAME_STATE; ResetWorld(null); }
public static void Unpublish() { string URL = "https://localhost:44358/"; RestClient client = new RestClient(URL); RestRequest asrequest = new RestRequest("api/allservices/"); PassObject <string> pass = new PassObject <string>(); pass.Token = DataSingleton.Instance.token; asrequest.AddJsonBody(pass); IRestResponse serviceret = client.Post(asrequest); ReturnObject <List <ServiceModel> > services = JsonConvert.DeserializeObject <ReturnObject <List <ServiceModel> > >(serviceret.Content); string[] endpoints = new string[services.Returned.Count]; bool cont = true; do { int count = 0; Console.WriteLine("Please select which of the following services you would like to remove (or enter 0 to return to the menu): "); foreach (ServiceModel service in services.Returned) { endpoints[count] = service.API_Endpoint; Console.WriteLine((count + 1).ToString() + ") " + service.Name); count++; } Console.WriteLine("0) Return to menu"); string entry = Console.ReadLine(); bool isNum = int.TryParse(entry, out int selection); if (!isNum || selection < 0 || selection > count - 1) { Console.WriteLine("Please enter a valid input"); } else { if (selection == 0) { break; } else { cont = false; string endpoint = endpoints[selection - 1]; ServicePublisher servicePublisher = new ServicePublisher(); servicePublisher.Unpublish(endpoint); Console.WriteLine("Service unpublished"); } } }while(cont); }
public GamePlay(PassObject CHANGEGAMESTATE) { playState = 1; ChangeGameState = CHANGEGAMESTATE; ResetWorld(null); worldMap = new WorldMap(ChangePlayState); }
public Button(ButtonState ButtonState, PassObject ButtonActivated, object info, Vector2 relativePosition) { Info = info; RelativePosition = relativePosition; buttonState = ButtonState; buttonActivated = ButtonActivated; activated = Globals.Content.Load <Texture2D>("Sprites/Misc/Arrowbutton"); }
public WorldMap(PassObject CHANGEGAMESTATE) { ChangeGameState = CHANGEGAMESTATE; bkg = new Basic2D("2D\\UI\\Backgrounds\\WordMapBackground", new Vector2(Globals.screenWidth / 2, Globals.screenHeight / 2), new Vector2(Globals.screenWidth, Globals.screenHeight)); LoadData(); }
public MainMenu(PassObject PlayClick, PassObject ExitClick) { playClick = PlayClick; exitClick = ExitClick; bkg = new Basic2D("2D/Menu/Background", new Vector2(Globals.screenWidth / 2, Globals.screenHeight / 2), new Vector2(Globals.screenWidth, Globals.screenHeight)); buttons.Add(new Button2D("2D/Menu/Button", new Vector2(0, 0), new Vector2(120, 30), "Fonts/Arial12", "Play", playClick, 1)); buttons.Add(new Button2D("2D/Menu/Button", new Vector2(0, 0), new Vector2(120, 30), "Fonts/Arial12", "Exit", exitClick, 0)); }
public UI() { heart = Globals.Content.Load <Texture2D>("Sprites/Items/Heart"); bomb = Globals.Content.Load <Texture2D>("Sprites/Pickups/Bomb"); key = Globals.Content.Load <Texture2D>("Sprites/Pickups/Key"); coin = Globals.Content.Load <Texture2D>("Sprites/Pickups/Coin"); resetObject = ResetWorld; restartButton = new Button(Button.ButtonState.Selected, ResetWorld, null, new Vector2((int)Camera.Position.X + Globals.Graphics.PreferredBackBufferWidth / 2 - 130, (int)Camera.Position.Y + Globals.Graphics.PreferredBackBufferHeight / 2)); }
public UI(PassObject RESET) { pauseOverlay = new Basic2D("2D\\Misc\\pause_icon", new Vector2(Globals.screenWidth / 2, Globals.screenHeight / 2), new Vector2(200, 200)); font = Globals.content.Load <SpriteFont>("Fonts\\Arial16"); resetBtn = new Button2d("2D\\Misc\\button1", new Vector2(0, 0), new Vector2(96, 32), "Fonts\\Arial16", "Reset", RESET, null); healthBar = new QuantityDisplayBar(new Vector2(104, 16), 2, Color.Red); }
public MainMenu(PassObject PLAY_CLICK_DELETE, PassObject EXIT_CLICK_DELETE) { PlayClickDelete = PLAY_CLICK_DELETE; ExitClickDelete = EXIT_CLICK_DELETE; background = new Basic2d("2d/UI/Backgrounds/MainMenuBkg", new Vector2(Globals.screenWidth / 2, Globals.screenHeight / 2), new Vector2(Globals.screenWidth, Globals.screenHeight)); buttons.Add(new Button2d("2d/misc/SimpleBtn", new Vector2(0, 0), new Vector2(96, 32), "2d/Fonts/Arial16", "Play", PlayClickDelete, 1));; buttons.Add(new Button2d("2d/misc/SimpleBtn", new Vector2(0, 0), new Vector2(96, 32), "2d/Fonts/Arial16", "Exit", ExitClickDelete, null));; }
public UI(PassObject a_resetWorld, PassObject a_changeGameState) { _font = Globals.MyContent.Load <SpriteFont>("Fonts\\Arial16"); _pauseOverlay = new Asset2D("Assets\\UI\\pause_overlay", new Vector2(Globals.ScreenWidth / 2, Globals.ScreenHeight / 2), new Vector2(300, 300)); _resetButton = new Button("Assets\\UI\\simple_button", new Vector2(0, 0), new Vector2(96, 32), "Fonts\\Arial16", "Restart", a_resetWorld, null); _mainMenuButton = new Button("Assets\\UI\\simple_button", new Vector2(0, 0), new Vector2(96, 32), "Fonts\\Arial16", "Main menu", a_changeGameState, null); _healthBar = new Engine.Output.DisplayBar(new Vector2(154, 20), 3, Color.Red); _staminaBar = new Engine.Output.DisplayBar(new Vector2(154, 20), 3, Color.Yellow); }
public UI(PassObject RESET_WORLD) { pauseOverlay = new Basic2d("2d/misc/PauseOverlay", new Vector2(Globals.screenWidth / 2, Globals.screenHeight / 2), new Vector2(300, 300)); font = Globals.content.Load <SpriteFont>("2d/Fonts/Arial16"); resetButton = new Button2d("2d/misc/SimpleBtn", new Vector2(0, 0), new Vector2(96, 32), "2d/Fonts/Arial16", "Reset", RESET_WORLD, null); // total width including the background of the bar healthBar = new QuantityDisplayBar(new Vector2(104, 16), 2, Color.Red); }
public World(PassObject ResetWorld, PassObject ChangeGameState) { resetWorld = ResetWorld; changeGameState = ChangeGameState; collectedItem = true; hero = new Hero("2D/Player", new Vector2(664, 384), new Vector2(64, 64)); ui = new UI(); map = new Map(); Globals.CheckScroll = CheckScroll; }
public MainMenu(PassObject PLAYCLICKDEL, PassObject EXITCLICKDEL, PassObject CHANGEGAMESTATE) { PlayClickDel = PLAYCLICKDEL; ExitClickDel = EXITCLICKDEL; ChangeGameState = CHANGEGAMESTATE; bkg = new Basic2D("2D\\UI\\Backgrounds\\MenuBackground", new Vector2(Globals.screenWidth / 2, Globals.screenHeight / 2), new Vector2(Globals.screenWidth, Globals.screenHeight)); buttons.Add(new Button2d("2D\\Misc\\button", new Vector2(0, 0), new Vector2(126, 42), "Fonts\\Arial16", "Play", PlayClickDel, 1)); buttons.Add(new Button2d("2D\\Misc\\button", new Vector2(0, 0), new Vector2(126, 42), "Fonts\\Arial16", "Exit", ExitClickDel, null)); }
public ReturnObject <List <ServiceModel> > Post([FromBody] PassObject <string> pass) { if (!File.Exists(PublishController.SERVICE_DESCRIPTIONS)) { StreamWriter sw = File.CreateText(PublishController.SERVICE_DESCRIPTIONS); sw.Close(); } List <ServiceModel> matches = new List <ServiceModel>(); string value = pass.Pass; ReturnObject <List <ServiceModel> > ret = new ReturnObject <List <ServiceModel> >(); var tcp = new NetTcpBinding(); var URL = "net.tcp://localhost:8101/AuthenticationService"; var authFactory = new ChannelFactory <AuthenticatorInterface>(tcp, URL); var auth = authFactory.CreateChannel(); //Denies user of not logged in if (!auth.Validate(pass.Token).Equals("validated")) { ret.Status = "Denied"; ret.Reason = "Authentication failed"; return(ret); } using (StreamReader sr = File.OpenText(PublishController.SERVICE_DESCRIPTIONS)) { JsonSerializer serializer = new JsonSerializer(); List <ServiceModel> services = (List <ServiceModel>)serializer.Deserialize(sr, typeof(List <ServiceModel>)); if (services != null) { foreach (ServiceModel service in services) { //Matches if service name contains the search string ignoring case if (service.Name.ToUpper().Contains(value.ToUpper())) { matches.Add(service); } } } else { ret.Status = "Denied"; ret.Reason = "No services have been published"; } sr.Close(); } ret.Returned = matches; return(ret); }
public Button2D(string Path, Vector2 Pos, Vector2 Dems, string FontPath, string Text, PassObject ButtonClicked, object Info) : base(Path, Pos, Dems) { info = Info; text = Text; buttonClicked = ButtonClicked; if (FontPath != "") { font = Globals.content.Load <SpriteFont>(FontPath); } isPressed = false; }
public ReturnObject <string> Post([FromBody] PassObject <int[]> pass) { string primes = " "; ReturnObject <string> ret = new ReturnObject <string>(); int id = pass.Pass[0]; var tcp = new NetTcpBinding(); var URL = "net.tcp://localhost:8101/AuthenticationService"; var authFactory = new ChannelFactory <AuthenticatorInterface>(tcp, URL); var auth = authFactory.CreateChannel(); if (!auth.Validate(pass.Token).Equals("validated")) { ret.Status = "Denied"; ret.Reason = "Authentication failed"; return(ret); } if (pass.Pass.Length != 1) { ret.Status = "Denied"; ret.Reason = "Input was invalid"; return(ret); } if (id < 0) { ret.Status = "Denied"; ret.Reason = "There are no negative prime numbers"; return(ret); } for (int ii = 1; ii <= id; ii++) { if (ii % 2 != 0 && ii % 3 != 0 && ii % 5 != 0 && ii % 7 != 0 && ii > 1) { primes += ii.ToString() + ", "; } } if (primes.Equals(" ")) { ret.Returned = "There were no primes in this range"; return(ret); } primes = primes.Remove(primes.Length - 2); ret.Returned = primes; return(ret); }
public void Publish(ServiceModel sm) { PassObject <ServiceModel> pass = new PassObject <ServiceModel>(); pass.Pass = sm; pass.Token = DataSingleton.Instance.token; string URL = "https://localhost:44358/"; RestClient client = new RestClient(URL); RestRequest request = new RestRequest("api/publish/"); request.AddJsonBody(pass); client.Post(request); }
public Victoryscreen() { bkg = Globals.Content.Load <Texture2D>("Sprites/Misc/Victoryscreen"); mainObject = ToMainmenu; mainButton = new Button(Button.ButtonState.Selected, mainObject, null, new Vector2((int)Camera.Position.X + Globals.Graphics.PreferredBackBufferWidth / 2 - 375, (int)Camera.Position.Y + Globals.Graphics.PreferredBackBufferHeight / 2 + 10)); buttons.Add(mainButton); restartObject = Restart; restartButton = new Button(Button.ButtonState.Unselected, restartObject, null, new Vector2((int)Camera.Position.X + Globals.Graphics.PreferredBackBufferWidth / 2 - 75, (int)Camera.Position.Y + Globals.Graphics.PreferredBackBufferHeight / 2 + 10)); buttons.Add(restartButton); }
public void Unpublish(string api_endpoint) { PassObject <string> pass = new PassObject <string>(); pass.Pass = api_endpoint; pass.Token = DataSingleton.Instance.token; string URL = "https://localhost:44358/"; RestClient client = new RestClient(URL); RestRequest request = new RestRequest("api/unpublish/"); request.AddJsonBody(pass); client.Post(request); }
public ReturnObject <List <ServiceModel> > Post([FromBody] PassObject <string> pass) { if (!File.Exists(PublishController.SERVICE_DESCRIPTIONS)) { StreamWriter sw = File.CreateText(PublishController.SERVICE_DESCRIPTIONS); sw.Close(); } List <ServiceModel> matches = new List <ServiceModel>(); ReturnObject <List <ServiceModel> > ret = new ReturnObject <List <ServiceModel> >(); var tcp = new NetTcpBinding(); var URL = "net.tcp://localhost:8101/AuthenticationService"; var authFactory = new ChannelFactory <AuthenticatorInterface>(tcp, URL); var auth = authFactory.CreateChannel(); string valid = auth.Validate(pass.Token); //If return was not valid ie. no token return denied if (!valid.Equals("validated")) { ret.Status = "Denied"; ret.Reason = "Authentication failed"; return(ret); } using (StreamReader sr = File.OpenText(PublishController.SERVICE_DESCRIPTIONS)) { JsonSerializer serializer = new JsonSerializer(); List <ServiceModel> services = (List <ServiceModel>)serializer.Deserialize(sr, typeof(List <ServiceModel>)); if (services != null) { //Adds all services to matches foreach (ServiceModel service in services) { matches.Add(service); } sr.Close(); } else { ret.Status = "Denied"; ret.Reason = "No services have been published"; } } ret.Returned = matches; return(ret); }