コード例 #1
0
 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;
 }
コード例 #2
0
 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();
     }
 }
コード例 #3
0
 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);
 }
コード例 #4
0
        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);
        }