IHost Interface Documentation

The IHost interface provides plugins with access to Melon's core services and functionalities. It acts as a gateway to interact with various aspects of the application.

Interface Definition


        public interface IHost
        {
            string Version { get; }
            IMelonAPI MelonAPI { get; }
            IStorageAPI Storage { get; }
            IMelonScanner MelonScanner { get; }
            IStateManager StateManager { get; }
            IDisplayManager DisplayManager { get; }
            IMelonUI MelonUI { get; }
            ISettingsUI SettingsUI { get; }
        }
        

Properties and Sub-Interfaces

Version

IMelonAPI

Provides access to database functionalities. Limited, and will likely include track/album/artist search soon.

IMelonAPI Interface


        public interface IMelonAPI
        {
            List<Track> ShuffleTracks(List<Track> tracks, string UserId, ShuffleType type, bool fullRandom = false, bool enableTrackLinks = true);
        }
        

IStorageAPI

Interface for loading and saving configuration files.

IStorageAPI Interface


        public interface IStorageAPI
        {
            T LoadConfigFile<T>(string filename, string[] protectedProperties, out bool converted);
            void SaveConfigFile<T>(string filename, T config, string[] protectedProperties);
        }
        

IMelonScanner

Access to the media library scanner.

IMelonScanner Interface


        public interface IMelonScanner
        {
            string CurrentFolder { get; set; }
            string CurrentFile { get; set; }
            string CurrentStatus { get; set; }
            double ScannedFiles { get; set; }
            double FoundFiles { get; set; }
            long averageMilliseconds { get; set; }
            bool Indexed { get; set; }
            bool endDisplay { get; set; }
            bool Scanning { get; set; }
            void StartScan(bool skip);
            void UpdateCollections();
            void ResetDB();
        }
        

IStateManager

Access to application state and settings.

IStateManager Interface


        public interface IStateManager
        {
            string melonPath { get; }
            ShortSettings MelonSettings { get; }
            Flags MelonFlags { get; }
            ResourceManager StringsManager { get; }
            List<IPlugin> Plugins { get; }
            Dictionary<string, string> LaunchArgs { get; }
            byte[] GetDefaultImage();
        }
        

IDisplayManager

Manage UI elements and menu options.

IDisplayManager Interface


        public interface IDisplayManager
        {
            OrderedDictionary MenuOptions { get; set; }
            OrderedDictionary UIExtensions { get; set; }
        }
        

IMelonUI

Access to UI components like input methods and display functions.

IMelonUI Interface


        public interface IMelonUI
        {
            void BreadCrumbBar(List<string> list);
            void ClearConsole();
            void ClearConsole(int left, int top, int width, int height);
            Color ColorPicker(Color CurColor);
            string HiddenInput();
            void DisplayProgressBar(double count, double max, char foreground, char background);
            void ShowIndeterminateProgress();
            void HideIndeterminateProgress();
            string OptionPicker(List<string> Choices);
            string StringInput(bool UsePred, bool AutoCorrect, bool FreeInput, bool ShowChoices, List<string> Choices = null);
            void ChecklistDisplayToggle();
            void SetChecklistItems(string[] list);
            void InsertInChecklist(string item, int place, bool check);
            void UpdateChecklist(int place, bool check);
        }
        

ISettingsUI

Manage settings menu options.

ISettingsUI Interface


        public interface ISettingsUI
        {
            OrderedDictionary MenuOptions { get; set; }
        }