Jump to content
LaunchBox Community Forums

[SOLVED] Missing references in demo plugin tutorial


Recommended Posts

Hi all,

I'm attempting the "Let's Build Some Plugins" tutorial but am unable to build the solution and I'm not sure what I've missed.

I've added references to Unbroken.LaunchBox.Plugins and System.Drawing but am getting errors:

Error	CS0012
The type 'Image' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Drawing.Common, Version=4.0.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'.	LiveStreamPluginDemo
C:\Users\phlaange\Documents\Development\Source\LiveStreamPluginDemo\LiveStreamPluginDemo\DemoGameMenuItemPlugin.cs	15	Active

I'm using Visual Studio Community 2017. I've installed .NET Framework 4.6.2 Developer Pack (do I need to install the runtime?).

image.thumb.png.579e0e412d371b8b723a845bb1bb5139.png

Code:

using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Unbroken.LaunchBox.Plugins;
using Unbroken.LaunchBox.Plugins.Data;

namespace LiveStreamPluginDemo
{

    public class DemoGameMenuItemPlugin : IGameMenuItemPlugin
    {
        public DemoGameMenuItemPlugin()
        {
        }

        public bool SupportsMultipleGames
        {
            get { return true;  }

        }

        public string Caption
        {
            get { return "Demo Menu Item"; }
        }

        public System.Drawing.Image IconImage
        {
            get { return null; }
        }

        public bool ShowInLaunchBox
        {
            get { return true; }

        }

        public bool ShowInBigBox
        {
            get { return true; }

        }

        public bool GetIsValidForGame(IGame selectedGame)
        {
            /* Choose this based on what you want the criteria to be */
            return !string.IsNullOrEmpty(selectedGame.Version);
        }

        public bool GetIsValidForGames(IGame[] selectedGames)
        {
            return selectedGames.Any(g => !string.IsNullOrEmpty(g.Version));
        }

        public void OnSelected(IGame selectedGame)
        {
            MessageBox.Show(selectedGame.Title);
        }

        void IGameMenuItemPlugin.OnSelected(IGame[] selectedGames)
        {
            foreach (var game in selectedGames)
            {
                if (string.IsNullOrEmpty(game.Version))
                {
                    continue;
                }

                MessageBox.Show(game.Title);
            }
        }
    }
}

 

Edit: found some typos and fixed.

Edited by phlaange
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...