Jump to content
LaunchBox Community Forums

Recommended Posts

Hi there,

i want to reload the (playlist).xmls by a plugin

i found the "ReloadIfNeeded()" Method, but how do i use it? 
can anyone give me an example?

here's my code so far. the message box is shown, but the xml isn't reloaded (i changed the xml-file manually before)

using System;
using System.Collections.Generic;
using Unbroken.LaunchBox.Plugins;
using Unbroken.LaunchBox.Plugins.Data;
using System.Windows.Forms;

namespace ReloadXML
{
    public class Relxml : IGameLaunchingPlugin, IDataManager
    {
        public void OnGameExited()
        {
            // here the reloading should happen...
	    ReloadIfNeeded()
            MessageBox.Show("Reloaded!");
        }

        public void ReloadIfNeeded()
        {
        }

        public void ForceReload()
        {
            throw new NotImplementedException();
        }

        public IEmulator AddNewEmulator()
        {
            throw new NotImplementedException();
        }

        public IGame AddNewGame(string title)
        {
            throw new NotImplementedException();
        }

        public IPlatform AddNewPlatform(string name)
        {
            throw new NotImplementedException();
        }

        public IPlatformCategory AddNewPlatformCategory(string name)
        {
            throw new NotImplementedException();
        }

        public IPlaylist AddNewPlaylist(string name)
        {
            throw new NotImplementedException();
        }

        public void BackgroundReloadSave(Action changes)
        {
            throw new NotImplementedException();
        }

        public IEmulator[] GetAllEmulators()
        {
            throw new NotImplementedException();
        }

        public IGame[] GetAllGames()
        {
            throw new NotImplementedException();
        }

        public IParent[] GetAllParents()
        {
            throw new NotImplementedException();
        }

        public IPlatformCategory[] GetAllPlatformCategories()
        {
            throw new NotImplementedException();
        }

        public IPlatform[] GetAllPlatforms()
        {
            throw new NotImplementedException();
        }

        public IPlaylist[] GetAllPlaylists()
        {
            throw new NotImplementedException();
        }

        public IEmulator GetEmulatorById(string id)
        {
            throw new NotImplementedException();
        }

        public IGame GetGameById(string id)
        {
            throw new NotImplementedException();
        }

        public IPlatform GetPlatformByName(string name)
        {
            throw new NotImplementedException();
        }

        public IPlatformCategory GetPlatformCategoryByName(string name)
        {
            throw new NotImplementedException();
        }

        public IPlaylist GetPlaylistById(string id)
        {
            throw new NotImplementedException();
        }

        public IList<IPlatform> GetRootPlatformsCategoriesPlaylists()
        {
            throw new NotImplementedException();
        }

        public void OnAfterGameLaunched(IGame game, IAdditionalApplication app, IEmulator emulator)
        {
            return;
        }

        public void OnBeforeGameLaunching(IGame game, IAdditionalApplication app, IEmulator emulator)
        {
            return;
        }

        public void Save(bool wait = false)
        {
            throw new NotImplementedException();
        }

        public bool TryRemoveEmulator(IEmulator emulator)
        {
            throw new NotImplementedException();
        }

        public bool TryRemoveGame(IGame game)
        {
            throw new NotImplementedException();
        }

        public bool TryRemovePlatform(IPlatform platform)
        {
            throw new NotImplementedException();
        }

        public bool TryRemovePlatformCategory(IPlatformCategory platformCategory)
        {
            throw new NotImplementedException();
        }

        public bool TryRemovePlaylist(IPlaylist playlist)
        {
            throw new NotImplementedException();
        }
    }
}

 

thx in advance

Timber

Edited by TimberlAndRE
Link to comment
Share on other sites

Im guessing @TimberlAndRE is trying to make changes to the xml file outside of LB and then reload the files. I dont think RefreshData() will work. I havent really used the reload methods but if I remember correctly you want to be careful with it. I think if the user makes any changes to their collection without saving (closing LB), them changes will be lost when calling reload. Maybe you can call a save method before reload but im not expert, not sure if its wise to do it.

Edited by jayjay
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...