phlaange Posted April 26, 2020 Share Posted April 26, 2020 (edited) 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?). 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 April 26, 2020 by phlaange Quote Link to comment Share on other sites More sharing options...
phlaange Posted April 26, 2020 Author Share Posted April 26, 2020 Disregard, I figured it out. https://www.nuget.org/packages/System.Drawing.Common/ Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.