public GamePanel(Game gameLibrary) { this.game = gameLibrary; Margin = new Padding(10); Size = new Size(80,120); imageSize = new Size(80, 100); SetLabel(); SetImage(); BorderStyle = BorderStyle.FixedSingle; }
private void ManualAddBtn_Click(object sender, EventArgs e) { BrowseForGames.Filter = "Executables|*.exe"; DialogResult result = BrowseForGames.ShowDialog(); if (result.Equals(DialogResult.OK)) { Game game = new Game(BrowseForGames.FileName, Path.GetFileNameWithoutExtension(BrowseForGames.FileName), GetFileSizeSumFromDirectory(BrowseForGames.FileName), ""); gameLibraryController.AddGame(game); galleryLibraryForm.AddGameToLibraryFlowPanel(game); Close(); } }
public void AddGame(Game game) { Program.libraryXML.Element(Program.RootXMLName).Add( new XElement(Program.GameElement, new XAttribute(Program.GameID, game.id), new XElement(Program.GamePath, game.path), new XElement(Program.GameName, game.gameName), new XElement(Program.GameSize, game.size), new XElement(Program.CoverArtPath, game.coverArtPath) ) ); Program.libraryXML.Element(Program.RootXMLName).Attribute(Program.IDSize).SetValue(game.id); Program.libraryXML.Save(Program.XMLFileName); }
public void UpdateGame(Game game) { var target = Program.libraryXML .Element(Program.RootXMLName) .Elements(Program.GameElement) .Where(e => e.Attribute(Program.GameID).Value.Equals(game.id.ToString())) .Single(); target.Element(Program.GameName).Value = game.gameName; target.Element(Program.GamePath).Value = game.path; target.Element(Program.GameSize).Value = game.size.ToString(); target.Element(Program.CoverArtPath).Value = game.coverArtPath; Program.libraryXML.Save(Program.XMLFileName); }