Make list compatible with 10.8 (maybe)

This commit is contained in:
TwistedUmbrellaX 2024-10-12 11:27:11 -04:00
parent c0513b1f22
commit 2678c69e38

View File

@ -1,6 +1,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using ConfusedPolarBear.Plugin.IntroSkipper.Configuration; using ConfusedPolarBear.Plugin.IntroSkipper.Configuration;
using MediaBrowser.Common.Configuration; using MediaBrowser.Common.Configuration;
@ -402,16 +403,16 @@ public class Plugin : BasePlugin<PluginConfiguration>, IHasWebPages
{ {
try try
{ {
List<string> oldRepos = List<string> oldRepos = new List<string>
[ {
"https://raw.githubusercontent.com/intro-skipper/intro-skipper/master/manifest.json", "https://raw.githubusercontent.com/intro-skipper/intro-skipper/master/manifest.json",
"https://raw.githubusercontent.com/jumoog/intro-skipper/master/manifest.json" "https://raw.githubusercontent.com/jumoog/intro-skipper/master/manifest.json"
]; };
// Access the current server configuration // Access the current server configuration
var config = serverConfiguration.Configuration; var config = serverConfiguration.Configuration;
// Get the list of current plugin repositories // Get the list of current plugin repositories
var pluginRepositories = config.PluginRepositories?.ToList() ?? []; var pluginRepositories = config.PluginRepositories?.ToList() ?? new List<RepositoryInfo>();
// check if old plugins exits // check if old plugins exits
if (pluginRepositories.Exists(repo => repo != null && repo.Url != null && oldRepos.Contains(repo.Url))) if (pluginRepositories.Exists(repo => repo != null && repo.Url != null && oldRepos.Contains(repo.Url)))
@ -432,7 +433,7 @@ public class Plugin : BasePlugin<PluginConfiguration>, IHasWebPages
} }
// Update the configuration with the new repository list // Update the configuration with the new repository list
config.PluginRepositories = [.. pluginRepositories]; config.PluginRepositories = pluginRepositories.ToList();
// Save the updated configuration // Save the updated configuration
serverConfiguration.SaveConfiguration(); serverConfiguration.SaveConfiguration();