You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
49 lines
1.6 KiB
49 lines
1.6 KiB
using System.IO;
|
|
using System.Xml;
|
|
using MediaBrowser.Controller.Configuration;
|
|
using MediaBrowser.Controller.Entities;
|
|
using MediaBrowser.Controller.Library;
|
|
using MediaBrowser.Model.IO;
|
|
using MediaBrowser.Model.Xml;
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
namespace MediaBrowser.LocalMetadata.Savers
|
|
{
|
|
public class GameSystemXmlSaver : BaseXmlSaver
|
|
{
|
|
public GameSystemXmlSaver(IFileSystem fileSystem, IServerConfigurationManager configurationManager, ILibraryManager libraryManager, IUserManager userManager, IUserDataManager userDataManager, ILogger logger, IXmlReaderSettingsFactory xmlReaderSettingsFactory) : base(fileSystem, configurationManager, libraryManager, userManager, userDataManager, logger, xmlReaderSettingsFactory)
|
|
{
|
|
}
|
|
|
|
public override bool IsEnabledFor(BaseItem item, ItemUpdateType updateType)
|
|
{
|
|
if (!item.SupportsLocalMetadata)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
return item is GameSystem && updateType >= ItemUpdateType.MetadataDownload;
|
|
}
|
|
|
|
protected override void WriteCustomElements(BaseItem item, XmlWriter writer)
|
|
{
|
|
var gameSystem = (GameSystem)item;
|
|
|
|
if (!string.IsNullOrEmpty(gameSystem.GameSystemName))
|
|
{
|
|
writer.WriteElementString("GameSystem", gameSystem.GameSystemName);
|
|
}
|
|
}
|
|
|
|
protected override string GetLocalSavePath(BaseItem item)
|
|
{
|
|
return Path.Combine(item.Path, "gamesystem.xml");
|
|
}
|
|
|
|
protected override string GetRootElementName(BaseItem item)
|
|
{
|
|
return "Item";
|
|
}
|
|
}
|
|
}
|