diff --git a/Common/KNARZhelper/Log.cs b/Common/KNARZhelper/Log.cs
index a78dbe91f..a3c5801ab 100644
--- a/Common/KNARZhelper/Log.cs
+++ b/Common/KNARZhelper/Log.cs
@@ -14,7 +14,7 @@ public static class Log
///
/// Logger instance from playnite
///
- private static readonly ILogger logger = LogManager.GetLogger();
+ private static readonly ILogger _logger = LogManager.GetLogger();
///
/// Logs an error message.
@@ -33,7 +33,7 @@ public static void Error(Exception ex, string Message = "", bool showDialog = fa
Message += $"|{traceInfos.FileName}|{traceInfos.LineNumber}";
- logger.Error(ex, $"{Message}");
+ _logger.Error(ex, $"{Message}");
if (showDialog)
{
@@ -48,7 +48,7 @@ public static void Error(Exception ex, string Message = "", bool showDialog = fa
/// Additionally shows the error message as a dialog if set to true.
public static void Info(string Message, bool showDialog = false)
{
- logger.Info($"{Message}");
+ _logger.Info($"{Message}");
if (showDialog)
{
@@ -60,7 +60,7 @@ public static void Info(string Message, bool showDialog = false)
/// Logs a debug message.
///
/// The Message to log
- public static void Debug(string Message) => logger.Debug($"{Message}");
+ public static void Debug(string Message) => _logger.Debug($"{Message}");
}
///
diff --git a/Common/KNARZhelper/PlatformHelper.cs b/Common/KNARZhelper/PlatformHelper.cs
index 078208562..23145e16a 100644
--- a/Common/KNARZhelper/PlatformHelper.cs
+++ b/Common/KNARZhelper/PlatformHelper.cs
@@ -12,43 +12,43 @@ namespace KNARZhelper
///
public class PlatformHelper
{
- private readonly Dictionary platformSpecNameByNormalName;
- private readonly Regex TrimCompanyName = new Regex(@"^(atari|bandai|coleco|commodore|mattel|nec|nintendo|sega|sinclair|snk|sony|microsoft)?\s+", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant | RegexOptions.Compiled);
- private readonly Regex TrimInput = new Regex(@"^(pal|jpn?|usa?|ntsc)\s+|[™®©]", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant | RegexOptions.Compiled);
+ private readonly Dictionary _platformSpecNameByNormalName;
+ private readonly Regex _trimCompanyName = new Regex(@"^(atari|bandai|coleco|commodore|mattel|nec|nintendo|sega|sinclair|snk|sony|microsoft)?\s+", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant | RegexOptions.Compiled);
+ private readonly Regex _trimInput = new Regex(@"^(pal|jpn?|usa?|ntsc)\s+|[™®©]", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant | RegexOptions.Compiled);
public PlatformHelper(List platforms)
{
- platformSpecNameByNormalName = new Dictionary(StringComparer.InvariantCultureIgnoreCase);
+ _platformSpecNameByNormalName = new Dictionary(StringComparer.InvariantCultureIgnoreCase);
foreach (Platform platform in platforms.Where(p => p.SpecificationId != null))
{
- platformSpecNameByNormalName.Add(platform.Name, new[] { platform.SpecificationId });
+ _platformSpecNameByNormalName.Add(platform.Name, new[] { platform.SpecificationId });
- string nameWithoutCompany = TrimCompanyName.Replace(platform.Name, string.Empty);
+ string nameWithoutCompany = _trimCompanyName.Replace(platform.Name, string.Empty);
- if (!platformSpecNameByNormalName.ContainsKey(nameWithoutCompany))
+ if (!_platformSpecNameByNormalName.ContainsKey(nameWithoutCompany))
{
- platformSpecNameByNormalName.Add(nameWithoutCompany, new[] { platform.SpecificationId });
+ _platformSpecNameByNormalName.Add(nameWithoutCompany, new[] { platform.SpecificationId });
}
}
- TryAddPlatformByName(platformSpecNameByNormalName, "3DO", "3do");
- TryAddPlatformByName(platformSpecNameByNormalName, new[] { "Microsoft Windows", "Windows", "PC", "PC CD-ROM", "PC DVD", "PC DVD-ROM", "Windows 95" }, new[] { "pc_windows" });
- TryAddPlatformByName(platformSpecNameByNormalName, new[] { "DOS", "MS-DOS" }, new[] { "pc_dos" });
- TryAddPlatformByName(platformSpecNameByNormalName, "Linux", "pc_linux");
- TryAddPlatformByName(platformSpecNameByNormalName, new[] { "Mac", "OSX", "OS X", "MacOS", "Mac OS", "Mac OS X" }, new[] { "macintosh" });
- TryAddPlatformByName(platformSpecNameByNormalName, new[] { "Microsoft Xbox Series X", "Microsoft Xbox Series S", "Xbox Series X", "Xbox Series S", "Microsoft Xbox Series X/S", "Microsoft Xbox Series S/X", "Xbox Series X/S", "Xbox Series S/X", "Xbox Series X|S", }, new[] { "xbox_series" });
- TryAddPlatformByName(platformSpecNameByNormalName, new[] { "PS", "PS1", "PSX" }, new[] { "sony_playstation" });
- TryAddPlatformByName(platformSpecNameByNormalName, "PS2", "sony_playstation2");
- TryAddPlatformByName(platformSpecNameByNormalName, "PS3", "sony_playstation3");
- TryAddPlatformByName(platformSpecNameByNormalName, "PS4", "sony_playstation4");
- TryAddPlatformByName(platformSpecNameByNormalName, "PS5", "sony_playstation5");
- TryAddPlatformByName(platformSpecNameByNormalName, "PSP", "sony_psp");
- TryAddPlatformByName(platformSpecNameByNormalName, "Vita", "sony_vita");
- TryAddPlatformByName(platformSpecNameByNormalName, "PS4/5", new[] { "sony_playstation4", "sony_playstation5" });
- TryAddPlatformByName(platformSpecNameByNormalName, "Playstation 4/5", new[] { "sony_playstation4", "sony_playstation5" });
- TryAddPlatformByName(platformSpecNameByNormalName, new[] { "Sega Mega Drive", "Mega Drive", "Mega Drive/Genesis" }, new[] { "sega_genesis" });
- TryAddPlatformByName(platformSpecNameByNormalName, new[] { "Super NES", "Super Nintendo Entertainment System" }, new[] { "nintendo_super_nes" });
- TryAddPlatformByName(platformSpecNameByNormalName, new[] { "SNK Neo Geo MVS", "Neo Geo MVS", "SNK Neo Geo AES", "Neo Geo AES" }, new[] { "snk_neogeo_aes" });
+ TryAddPlatformByName(_platformSpecNameByNormalName, "3DO", "3do");
+ TryAddPlatformByName(_platformSpecNameByNormalName, new[] { "Microsoft Windows", "Windows", "PC", "PC CD-ROM", "PC DVD", "PC DVD-ROM", "Windows 95" }, new[] { "pc_windows" });
+ TryAddPlatformByName(_platformSpecNameByNormalName, new[] { "DOS", "MS-DOS" }, new[] { "pc_dos" });
+ TryAddPlatformByName(_platformSpecNameByNormalName, "Linux", "pc_linux");
+ TryAddPlatformByName(_platformSpecNameByNormalName, new[] { "Mac", "OSX", "OS X", "MacOS", "Mac OS", "Mac OS X" }, new[] { "macintosh" });
+ TryAddPlatformByName(_platformSpecNameByNormalName, new[] { "Microsoft Xbox Series X", "Microsoft Xbox Series S", "Xbox Series X", "Xbox Series S", "Microsoft Xbox Series X/S", "Microsoft Xbox Series S/X", "Xbox Series X/S", "Xbox Series S/X", "Xbox Series X|S", }, new[] { "xbox_series" });
+ TryAddPlatformByName(_platformSpecNameByNormalName, new[] { "PS", "PS1", "PSX" }, new[] { "sony_playstation" });
+ TryAddPlatformByName(_platformSpecNameByNormalName, "PS2", "sony_playstation2");
+ TryAddPlatformByName(_platformSpecNameByNormalName, "PS3", "sony_playstation3");
+ TryAddPlatformByName(_platformSpecNameByNormalName, "PS4", "sony_playstation4");
+ TryAddPlatformByName(_platformSpecNameByNormalName, "PS5", "sony_playstation5");
+ TryAddPlatformByName(_platformSpecNameByNormalName, "PSP", "sony_psp");
+ TryAddPlatformByName(_platformSpecNameByNormalName, "Vita", "sony_vita");
+ TryAddPlatformByName(_platformSpecNameByNormalName, "PS4/5", new[] { "sony_playstation4", "sony_playstation5" });
+ TryAddPlatformByName(_platformSpecNameByNormalName, "Playstation 4/5", new[] { "sony_playstation4", "sony_playstation5" });
+ TryAddPlatformByName(_platformSpecNameByNormalName, new[] { "Sega Mega Drive", "Mega Drive", "Mega Drive/Genesis" }, new[] { "sega_genesis" });
+ TryAddPlatformByName(_platformSpecNameByNormalName, new[] { "Super NES", "Super Nintendo Entertainment System" }, new[] { "nintendo_super_nes" });
+ TryAddPlatformByName(_platformSpecNameByNormalName, new[] { "SNK Neo Geo MVS", "Neo Geo MVS", "SNK Neo Geo AES", "Neo Geo AES" }, new[] { "snk_neogeo_aes" });
}
private bool TryAddPlatformByName(Dictionary dict, string platformName, params string[] platformSpecNames)
{
@@ -94,9 +94,9 @@ public IEnumerable GetPlatforms(string platformName, bool stri
return new List();
}
- string sanitizedPlatformName = TrimInput.Replace(platformName, string.Empty);
+ string sanitizedPlatformName = _trimInput.Replace(platformName, string.Empty);
- if (platformSpecNameByNormalName.TryGetValue(sanitizedPlatformName, out string[] specIds))
+ if (_platformSpecNameByNormalName.TryGetValue(sanitizedPlatformName, out string[] specIds))
{
return specIds.Select(s => new MetadataSpecProperty(s)).ToList();
}
diff --git a/Generic/CompanyCompanion/CompanyCompanion.cs b/Generic/CompanyCompanion/CompanyCompanion.cs
index 2b00ab9d1..f121843ca 100644
--- a/Generic/CompanyCompanion/CompanyCompanion.cs
+++ b/Generic/CompanyCompanion/CompanyCompanion.cs
@@ -27,9 +27,9 @@ public CompanyCompanion(IPlayniteAPI api) : base(api)
}
///
- /// Shows the merge companies window.
+ /// Shows the _merge companies window.
///
- public void ShowMergeView()
+ private void ShowMergeView()
{
try
{
diff --git a/Generic/CompanyCompanion/CompanyCompanionSettings.cs b/Generic/CompanyCompanion/CompanyCompanionSettings.cs
index 515b16cf7..e25180696 100644
--- a/Generic/CompanyCompanion/CompanyCompanionSettings.cs
+++ b/Generic/CompanyCompanion/CompanyCompanionSettings.cs
@@ -8,22 +8,22 @@ namespace CompanyCompanion
{
public class CompanyCompanionSettings : ObservableObject
{
- private bool showGroupKey = false;
- private ObservableCollection businessEntityDescriptors;
- private ObservableCollection ignoreWords;
+ private bool _showGroupKey = false;
+ private ObservableCollection _businessEntityDescriptors;
+ private ObservableCollection _ignoreWords;
///
- /// Defines, if the group key will be shown in the merge companies window.
+ /// Defines, if the group key will be shown in the _merge companies window.
///
- public bool ShowGroupKey { get => showGroupKey; set => SetValue(ref showGroupKey, value); }
+ public bool ShowGroupKey { get => _showGroupKey; set => SetValue(ref _showGroupKey, value); }
///
/// List of words that will be removed from the games as business entity descriptors.
///
- public ObservableCollection BusinessEntityDescriptors { get => businessEntityDescriptors; set => SetValue(ref businessEntityDescriptors, value); }
+ public ObservableCollection BusinessEntityDescriptors { get => _businessEntityDescriptors; set => SetValue(ref _businessEntityDescriptors, value); }
///
/// List of words than will be ignored when searching for similar companies.
///
- public ObservableCollection IgnoreWords { get => ignoreWords; set => SetValue(ref ignoreWords, value); }
+ public ObservableCollection IgnoreWords { get => _ignoreWords; set => SetValue(ref _ignoreWords, value); }
}
public class CompanyCompanionSettingsViewModel : ObservableObject, ISettings
@@ -89,7 +89,7 @@ public CompanyCompanionSettings Settings
public CompanyCompanionSettingsViewModel(CompanyCompanion plugin)
{
- // Injecting your plugin instance is required for Save/Load method because Playnite saves data to a location based on what plugin requested the operation.
+ // Injecting your _plugin instance is required for Save/Load method because Playnite saves data to a location based on what _plugin requested the operation.
this.plugin = plugin;
// Load saved Settings.
diff --git a/Generic/CompanyCompanion/ViewModels/MergeCompanies.cs b/Generic/CompanyCompanion/ViewModels/MergeCompanies.cs
index e2040497b..d42818872 100644
--- a/Generic/CompanyCompanion/ViewModels/MergeCompanies.cs
+++ b/Generic/CompanyCompanion/ViewModels/MergeCompanies.cs
@@ -9,48 +9,48 @@
namespace CompanyCompanion
{
///
- /// Class to handle finding of company groups and merging them.
+ /// Class to handle finding of company _groups and merging them.
///
public class MergeCompanies : ViewModelBase
{
- private ObservableCollection mergeList;
+ private ObservableCollection _mergeList;
- private readonly CompanyCompanion plugin;
+ private readonly CompanyCompanion _plugin;
- private List gameList;
+ private List _gameList;
- private ObservableCollection groups;
+ private ObservableCollection _groups;
- private int gameCount = 0;
+ private int _gameCount = 0;
///
/// List of business entity descriptors with special characters removed.
///
- private readonly List cleanBusinessEntityDescriptors;
+ private readonly List _cleanBusinessEntityDescriptors;
///
/// Contains all companies that can be merged.
///
public ObservableCollection MergeList
{
- get => mergeList;
+ get => _mergeList;
set
{
- mergeList = value;
+ _mergeList = value;
OnPropertyChanged("MergeList");
}
}
///
- /// Initializes the merge class.
+ /// Initializes the _merge class.
///
- /// The plugin itself to have access to the settings etc.
+ /// The _plugin itself to have access to the settings etc.
public MergeCompanies(CompanyCompanion plugin)
{
MergeList = new ObservableCollection();
- this.plugin = plugin;
+ this._plugin = plugin;
- cleanBusinessEntityDescriptors = plugin.Settings.Settings.BusinessEntityDescriptors.Select(w => w.RemoveSpecialChars().Replace("-", "")).ToList();
+ _cleanBusinessEntityDescriptors = plugin.Settings.Settings.BusinessEntityDescriptors.Select(w => w.RemoveSpecialChars().Replace("-", "")).ToList();
}
///
@@ -59,7 +59,7 @@ public MergeCompanies(CompanyCompanion plugin)
/// Name to clean.
/// List of words to remove.
/// Name with the words removed
- internal string RemoveWords(string name, List wordList)
+ private string RemoveWords(string name, List wordList)
{
if (name != null)
{
@@ -77,9 +77,9 @@ internal string RemoveWords(string name, List wordList)
///
/// Name of the company
/// cleaned up name
- public string CleanUpCompanyName(string name)
+ private string CleanUpCompanyName(string name)
{
- name = RemoveWords(name, cleanBusinessEntityDescriptors).CollapseWhitespaces().Trim();
+ name = RemoveWords(name, _cleanBusinessEntityDescriptors).CollapseWhitespaces().Trim();
if (name.EndsWith(","))
{
@@ -90,7 +90,7 @@ public string CleanUpCompanyName(string name)
}
///
- /// Creates the list of companies to merge.
+ /// Creates the list of companies to _merge.
///
/// True, if the company names should be cleaned up.
/// True, if also similar companies will be searched, where only words in the ignore list differ.
@@ -116,7 +116,7 @@ public void GetMergeList(bool cleanUpName = false, bool findSimilar = false)
Id = c.Id,
Name = c.Name,
CleanedUpName = (cleanUpName) ? CleanUpCompanyName(c.Name) : c.Name,
- GroupName = (findSimilar) ? RemoveWords(CleanUpCompanyName(c.Name), plugin.Settings.Settings.IgnoreWords.ToList())
+ GroupName = (findSimilar) ? RemoveWords(CleanUpCompanyName(c.Name), _plugin.Settings.Settings.IgnoreWords.ToList())
.RemoveDiacritics()
.RemoveSpecialChars()
.ToLower()
@@ -146,7 +146,7 @@ public void GetMergeList(bool cleanUpName = false, bool findSimilar = false)
mergeList = mergeGroups.Select(g => new MergeGroup
{
- Plugin = plugin,
+ Plugin = _plugin,
Owner = this,
Key = g.Key,
CompanyName = g.OrderByDescending(c => c.GamesAsDeveloper.Games.Count() + c.GamesAsPublisher.Games.Count()).ThenBy(c => c.CleanedUpName).First().CleanedUpName,
@@ -173,16 +173,16 @@ public void GetMergeList(bool cleanUpName = false, bool findSimilar = false)
}
///
- /// Merges the selected groups - used as a progress bar action.
+ /// Merges the selected _groups - used as a progress bar action.
///
/// Arguments of the progress bar
- internal void ProcessGroups(GlobalProgressActionArgs progressArgs)
+ private void ProcessGroups(GlobalProgressActionArgs progressArgs)
{
try
{
- progressArgs.ProgressMaxValue = gameList.Count;
+ progressArgs.ProgressMaxValue = _gameList.Count;
- foreach (Game game in gameList)
+ foreach (Game game in _gameList)
{
if (progressArgs.CancelToken.IsCancellationRequested)
{
@@ -192,7 +192,7 @@ internal void ProcessGroups(GlobalProgressActionArgs progressArgs)
bool mustUpdateGame = false;
- foreach (MergeGroup group in groups)
+ foreach (MergeGroup group in _groups)
{
mustUpdateGame = group.UpdateGame(game) || mustUpdateGame;
}
@@ -202,17 +202,17 @@ internal void ProcessGroups(GlobalProgressActionArgs progressArgs)
{
API.Instance.Database.Games.Update(game);
- gameCount++;
+ _gameCount++;
}
progressArgs.CurrentProgressValue++;
}
progressArgs.CurrentProgressValue = 0;
- progressArgs.ProgressMaxValue = groups.Count;
+ progressArgs.ProgressMaxValue = _groups.Count;
progressArgs.Text = $"{ResourceProvider.GetString("LOCCompanyCompanionName")} - {ResourceProvider.GetString("LOCCompanyCompanionProgressMerging")}";
- foreach (MergeGroup group in groups)
+ foreach (MergeGroup group in _groups)
{
group.CleanUpCompanies();
}
@@ -224,20 +224,20 @@ internal void ProcessGroups(GlobalProgressActionArgs progressArgs)
}
///
- /// Merges the companies of a merge group.
+ /// Merges the companies of a _merge group.
///
- /// Group to merge
+ /// Group to _merge
public void Merge(MergeGroup mergeGroup = null)
{
- gameCount = 0;
+ _gameCount = 0;
if (mergeGroup is null)
{
- gameList = API.Instance.Database.Games.ToList();
+ _gameList = API.Instance.Database.Games.ToList();
}
else
{
- gameList = API.Instance.Database.Games
+ _gameList = API.Instance.Database.Games
.Where(g =>
(
g.DeveloperIds != null &&
@@ -252,14 +252,14 @@ public void Merge(MergeGroup mergeGroup = null)
if (mergeGroup is null)
{
- groups = MergeList;
+ _groups = MergeList;
}
else
{
- groups = new ObservableCollection { mergeGroup };
+ _groups = new ObservableCollection { mergeGroup };
}
- if (groups.Count > 0)
+ if (_groups.Count > 0)
{
GlobalProgressOptions globalProgressOptions = new GlobalProgressOptions(
$"{ResourceProvider.GetString("LOCCompanyCompanionName")} - {ResourceProvider.GetString("LOCCompanyCompanionProgressUpdating")}",
@@ -273,10 +273,10 @@ public void Merge(MergeGroup mergeGroup = null)
}
API.Instance.Dialogs.ShowMessage(string.Format(ResourceProvider.GetString("LOCCompanyCompanionDialogUpdated"),
- gameCount,
- groups.Select(g => g.Companies.Where(c => c.Merge).ToList().Count).Sum()));
+ _gameCount,
+ _groups.Select(g => g.Companies.Where(c => c.Merge).ToList().Count).Sum()));
- groups = null;
+ _groups = null;
if (mergeGroup != null)
{
@@ -287,7 +287,7 @@ public void Merge(MergeGroup mergeGroup = null)
///
/// Merges all simple duplicates.
///
- /// The plugin itself to have access to the settings etc.
+ /// The _plugin itself to have access to the settings etc.
public static void MergeDuplicates(CompanyCompanion plugin)
{
MergeCompanies merger = new MergeCompanies(plugin);
@@ -307,7 +307,7 @@ public static void MergeDuplicates(CompanyCompanion plugin)
///
/// Removes business entity descriptor from all companies.
///
- /// The plugin itself to have access to the settings etc.
+ /// The _plugin itself to have access to the settings etc.
public static void RemoveBusinessEntityDescriptors(CompanyCompanion plugin)
{
MergeCompanies merger = new MergeCompanies(plugin);
diff --git a/Generic/CompanyCompanion/ViewModels/MergeCompaniesViewModel.cs b/Generic/CompanyCompanion/ViewModels/MergeCompaniesViewModel.cs
index b753e442e..cb50c0988 100644
--- a/Generic/CompanyCompanion/ViewModels/MergeCompaniesViewModel.cs
+++ b/Generic/CompanyCompanion/ViewModels/MergeCompaniesViewModel.cs
@@ -3,45 +3,45 @@
namespace CompanyCompanion
{
///
- /// View model for the merge companies window
+ /// View model for the _merge companies window
///
public class MergeCompaniesViewModel : ViewModelBase
{
- private MergeCompanies mergeCompanies;
- private bool cleanUpNames = true;
- private bool findSimilar = true;
+ private MergeCompanies _mergeCompanies;
+ private bool _cleanUpNames = true;
+ private bool _findSimilar = true;
public CompanyCompanion Plugin { set => InitializeView(value); }
public MergeCompanies MergeCompanies
{
- get => mergeCompanies;
+ get => _mergeCompanies;
set
{
- mergeCompanies = value;
+ _mergeCompanies = value;
OnPropertyChanged("MergeCompanies");
}
}
- public void InitializeView(CompanyCompanion plugin)
+ private void InitializeView(CompanyCompanion plugin)
{
MergeCompanies = new MergeCompanies(plugin);
}
public bool CleanUpNames
{
- get => cleanUpNames;
+ get => _cleanUpNames;
set
{
- cleanUpNames = value;
+ _cleanUpNames = value;
OnPropertyChanged("CleanUpNames");
}
}
public bool FindSimilar
{
- get => findSimilar;
+ get => _findSimilar;
set
{
- findSimilar = value;
+ _findSimilar = value;
OnPropertyChanged("FindSimilar");
}
}
@@ -50,7 +50,7 @@ public MergeCompaniesViewModel()
}
public RelayCommand FindCompaniesCommand
{
- get => new RelayCommand(() => MergeCompanies.GetMergeList(cleanUpNames, findSimilar));
+ get => new RelayCommand(() => MergeCompanies.GetMergeList(_cleanUpNames, _findSimilar));
}
}
}
diff --git a/Generic/CompanyCompanion/ViewModels/MergeGroup.cs b/Generic/CompanyCompanion/ViewModels/MergeGroup.cs
index dc78462ae..c185f9a40 100644
--- a/Generic/CompanyCompanion/ViewModels/MergeGroup.cs
+++ b/Generic/CompanyCompanion/ViewModels/MergeGroup.cs
@@ -7,19 +7,19 @@
namespace CompanyCompanion
{
///
- /// Contains all relevant data to merge similar companies to one.
+ /// Contains all relevant data to _merge similar companies to one.
///
public class MergeGroup : ViewModelBase
{
- private string companyName = string.Empty;
- private Guid companyId = Guid.Empty;
+ private string _companyName = string.Empty;
+ private Guid _companyId = Guid.Empty;
///
- /// Company Companion plugin. Used to access settings etc.
+ /// Company Companion _plugin. Used to access settings etc.
///
public CompanyCompanion Plugin { get; set; }
///
- /// Owner of the group. Used to merge one group.
+ /// Owner of the group. Used to _merge one group.
///
public MergeCompanies Owner { get; set; }
///
@@ -31,10 +31,10 @@ public class MergeGroup : ViewModelBase
///
public string CompanyName
{
- get => companyName;
+ get => _companyName;
set
{
- companyName = value;
+ _companyName = value;
OnPropertyChanged("CompanyName");
}
}
@@ -60,10 +60,10 @@ public string DisplayName
///
public Guid CompanyId
{
- get => companyId;
+ get => _companyId;
set
{
- companyId = value;
+ _companyId = value;
OnPropertyChanged("CompanyId");
}
}
@@ -73,7 +73,7 @@ public Guid CompanyId
public List Companies { get; set; }
///
- /// Switches the companies of the merge group in a game to the master company.
+ /// Switches the companies of the _merge group in a game to the master company.
///
/// game to process
///
@@ -112,7 +112,7 @@ public bool UpdateGame(Game game)
}
///
- /// Cleans up all companies of the merge group.
+ /// Cleans up all companies of the _merge group.
///
public void CleanUpCompanies()
{
diff --git a/Generic/CompanyCompanion/ViewModels/MergeItem.cs b/Generic/CompanyCompanion/ViewModels/MergeItem.cs
index 80c71ff72..1ed49616d 100644
--- a/Generic/CompanyCompanion/ViewModels/MergeItem.cs
+++ b/Generic/CompanyCompanion/ViewModels/MergeItem.cs
@@ -5,11 +5,11 @@
namespace CompanyCompanion
{
///
- /// Contains all relevant data to merge similar companies to one.
+ /// Contains all relevant data to _merge similar companies to one.
///
public class MergeItem : ViewModelBase
{
- private bool merge = true;
+ private bool _merge = true;
///
/// Owner of the company. Used to set group name.
@@ -51,10 +51,10 @@ public string DisplayName
///
public bool Merge
{
- get => merge;
+ get => _merge;
set
{
- merge = value;
+ _merge = value;
OnPropertyChanged("Merge");
}
}
diff --git a/Generic/LinkUtilities/Helper/LinkHelper.cs b/Generic/LinkUtilities/Helper/LinkHelper.cs
index 37d422adb..18f4c9e66 100644
--- a/Generic/LinkUtilities/Helper/LinkHelper.cs
+++ b/Generic/LinkUtilities/Helper/LinkHelper.cs
@@ -17,6 +17,8 @@ namespace LinkUtilities
///
internal static class LinkHelper
{
+ private static bool _allowRedirects = true;
+
///
/// Adds a link to the specified URL to a game.
///
@@ -26,7 +28,7 @@ internal static class LinkHelper
///
/// True, if a link could be added. Returns false, if a link with that name was already present or couldn't be added.
///
- public static bool AddLink(Game game, string linkName, string linkUrl, LinkUtilities plugin, bool ignoreExisting = true)
+ internal static bool AddLink(Game game, string linkName, string linkUrl, LinkUtilities plugin, bool ignoreExisting = true)
{
Link link = new Link(linkName, linkUrl);
bool mustUpdate = false;
@@ -111,14 +113,14 @@ public static bool AddLink(Game game, string linkName, string linkUrl, LinkUtili
/// Game for which the Links will be checked
/// Name of the link
/// True, if a link with that name exists
- public static bool LinkExists(Game game, string linkName) => !(game.Links is null) && game.Links.Count(x => x.Name == linkName) > 0;
+ internal static bool LinkExists(Game game, string linkName) => !(game.Links is null) && game.Links.Count(x => x.Name == linkName) > 0;
///
/// Sorts the Links of a game alphabetically by the link name.
///
/// Game in which the links will be sorted.
/// True, if the links could be sorted
- public static bool SortLinks(Game game)
+ internal static bool SortLinks(Game game)
{
if (game.Links != null && game.Links.Count > 0)
{
@@ -138,7 +140,7 @@ public static bool SortLinks(Game game)
/// Game in which the links will be sorted.
/// Dictionary that contains the sort order.
/// True, if the links could be sorted
- public static bool SortLinks(Game game, Dictionary sortOrder)
+ internal static bool SortLinks(Game game, Dictionary sortOrder)
{
if (game.Links != null && game.Links.Count > 0)
{
@@ -158,7 +160,7 @@ public static bool SortLinks(Game game, Dictionary sortOrder)
/// Game in which the duplicates will be removed.
/// Specifies, if the duplicates will be identified by name, URL or both..
/// True, if duplicates were removed. Returns false if there weren't duplicates to begin with.
- public static bool RemoveDuplicateLinks(Game game, DuplicateTypes duplicateType)
+ internal static bool RemoveDuplicateLinks(Game game, DuplicateTypes duplicateType)
{
if (game.Links != null && game.Links.Count > 0)
{
@@ -199,7 +201,7 @@ public static bool RemoveDuplicateLinks(Game game, DuplicateTypes duplicateType)
///
/// URL to clean up
/// cleaned up URL
- public static string CleanUpUrl(string url)
+ private static string CleanUpUrl(string url)
{
try
{
@@ -237,20 +239,18 @@ public static string CleanUpUrl(string url)
/// True, if the request can be executed.
private static bool OnPreRequest(HttpWebRequest request)
{
- request.AllowAutoRedirect = AllowRedirects;
+ request.AllowAutoRedirect = _allowRedirects;
return true;
}
- private static bool AllowRedirects = true;
-
///
/// Checks if an URL is reachable and returns OK
///
/// URL to check
/// True, if the URL is reachable
- public static bool CheckUrl(string url, bool allowRedirects = true)
+ internal static bool CheckUrl(string url, bool allowRedirects = true)
{
- AllowRedirects = allowRedirects;
+ _allowRedirects = allowRedirects;
try
{
diff --git a/Generic/LinkUtilities/Helper/ParseHelper.cs b/Generic/LinkUtilities/Helper/ParseHelper.cs
index 926148b8f..909b4adff 100644
--- a/Generic/LinkUtilities/Helper/ParseHelper.cs
+++ b/Generic/LinkUtilities/Helper/ParseHelper.cs
@@ -23,7 +23,7 @@ internal static class ParseHelper
///
/// String to convert
/// Stream from the string
- public static Stream ToStream(this string @this)
+ internal static Stream ToStream(this string @this)
{
MemoryStream stream = new MemoryStream();
StreamWriter writer = new StreamWriter(stream);
@@ -39,7 +39,7 @@ public static Stream ToStream(this string @this)
/// Object the XML will be deserialized to.
/// XML string
/// The deserialized XML
- public static T ParseXML(this string @this) where T : class
+ internal static T ParseXML(this string @this) where T : class
{
XmlReader reader = XmlReader.Create(@this.Trim().ToStream(), new XmlReaderSettings() { ConformanceLevel = ConformanceLevel.Document });
return new XmlSerializer(typeof(T)).Deserialize(reader) as T;
@@ -54,7 +54,7 @@ public static T ParseXML(this string @this) where T : class
/// Name of the site for the error message
/// Minimum of slashes in the relative URL to indicate, if it's a subpage
/// Search results for the search dialogs. Will be an empty list in case of an error.
- public static List GetMediaWikiResultsFromHtml(string searchUrl, string searchTerm, string websiteUrl, string linkName, int slashCount = 3)
+ internal static List GetMediaWikiResultsFromHtml(string searchUrl, string searchTerm, string websiteUrl, string linkName, int slashCount = 3)
{
List result = new List();
@@ -112,7 +112,7 @@ public static List GetMediaWikiResultsFromHtml(string searchUrl, s
/// Term to search for. Will be encoded in the function!
/// Name of the site for the error message
/// Search results for the search dialogs. Will be an empty list in case of an error.
- public static List GetMediaWikiResultsFromApi(string searchUrl, string searchTerm, string linkName)
+ internal static List GetMediaWikiResultsFromApi(string searchUrl, string searchTerm, string linkName)
{
List result = new List();
@@ -152,6 +152,6 @@ public static List GetMediaWikiResultsFromApi(string searchUrl, st
///
/// Pattern to convert
/// The resulting regular expression
- public static string WildCardToRegular(string value) => "^" + Regex.Escape(value).Replace("\\?", ".").Replace("\\*", ".*") + "$";
+ internal static string WildCardToRegular(string value) => "^" + Regex.Escape(value).Replace("\\?", ".").Replace("\\*", ".*") + "$";
}
}
diff --git a/Generic/LinkUtilities/LinkActions/AddLibraryLinks.cs b/Generic/LinkUtilities/LinkActions/AddLibraryLinks.cs
index d1b210079..2332c709c 100644
--- a/Generic/LinkUtilities/LinkActions/AddLibraryLinks.cs
+++ b/Generic/LinkUtilities/LinkActions/AddLibraryLinks.cs
@@ -6,19 +6,19 @@ namespace LinkUtilities.LinkActions
///
/// Adds a link to the game store page of the library (e.g. steam or gog) the game is part of.
///
- public class AddLibraryLinks : LinkAction
+ internal class AddLibraryLinks : LinkAction
{
///
- /// contains all game libraries that have a link to a store page that can be added.
+ /// contains all game _libraries that have a link to a store page that can be added.
///
- private readonly Libraries libraries;
+ private readonly Libraries _libraries;
public override string ProgressMessage { get; } = "LOCLinkUtilitiesProgressLibraryLink";
public override string ResultMessage { get; } = "LOCLinkUtilitiesDialogAddedMessage";
public AddLibraryLinks(LinkUtilities plugin) : base(plugin)
{
- libraries = new Libraries(Plugin);
+ _libraries = new Libraries(Plugin);
}
public override bool Execute(Game game, ActionModifierTypes actionModifier = ActionModifierTypes.None, bool isBulkAction = true)
@@ -27,7 +27,7 @@ public override bool Execute(Game game, ActionModifierTypes actionModifier = Act
bool result = false;
// Find the library of the game and add a link, if possible.
- library = libraries.Find(x => x.LibraryId == game.PluginId);
+ library = _libraries.Find(x => x.LibraryId == game.PluginId);
if (library is object)
{
diff --git a/Generic/LinkUtilities/LinkActions/AddWebsiteLinks.cs b/Generic/LinkUtilities/LinkActions/AddWebsiteLinks.cs
index 121af552d..9fd224673 100644
--- a/Generic/LinkUtilities/LinkActions/AddWebsiteLinks.cs
+++ b/Generic/LinkUtilities/LinkActions/AddWebsiteLinks.cs
@@ -11,7 +11,7 @@ namespace LinkUtilities.LinkActions
///
/// Class to add a link to all available websites in the Links list, if a definitive link was found.
///
- public class AddWebsiteLinks : LinkAction
+ internal class AddWebsiteLinks : LinkAction
{
///
/// contains all website Links that can be added.
@@ -26,7 +26,7 @@ public AddWebsiteLinks(LinkUtilities plugin) : base(plugin)
Links = new Links(Plugin);
}
- public bool AddLink(Game game, Linker.Link link, ActionModifierTypes actionModifier)
+ private bool AddLink(Game game, Linker.Link link, ActionModifierTypes actionModifier)
{
switch (actionModifier)
{
diff --git a/Generic/LinkUtilities/LinkActions/DoAfterChange.cs b/Generic/LinkUtilities/LinkActions/DoAfterChange.cs
index 6b7e5501b..85e8630fb 100644
--- a/Generic/LinkUtilities/LinkActions/DoAfterChange.cs
+++ b/Generic/LinkUtilities/LinkActions/DoAfterChange.cs
@@ -5,9 +5,9 @@ namespace LinkUtilities.LinkActions
///
/// Sorts the Links of a game.
///
- public class DoAfterChange : LinkAction
+ internal class DoAfterChange : LinkAction
{
- public DoAfterChange(LinkUtilities plugin) : base(plugin)
+ internal DoAfterChange(LinkUtilities plugin) : base(plugin)
{
}
diff --git a/Generic/LinkUtilities/LinkActions/HandleUriActions.cs b/Generic/LinkUtilities/LinkActions/HandleUriActions.cs
index a04c944e8..f7b981027 100644
--- a/Generic/LinkUtilities/LinkActions/HandleUriActions.cs
+++ b/Generic/LinkUtilities/LinkActions/HandleUriActions.cs
@@ -11,7 +11,7 @@ namespace LinkUtilities.LinkActions
/// Class to handle the actions received from the UriHandler. At the moment only adding links to the active URL in the
/// web browser.
///
- public class HandleUriActions : LinkAction
+ internal class HandleUriActions : LinkAction
{
public override string ProgressMessage { get; } = "LOCLinkUtilitiesProgressWebsiteLink";
diff --git a/Generic/LinkUtilities/LinkActions/ILinkAction.cs b/Generic/LinkUtilities/LinkActions/ILinkAction.cs
index 1569facec..24bde26de 100644
--- a/Generic/LinkUtilities/LinkActions/ILinkAction.cs
+++ b/Generic/LinkUtilities/LinkActions/ILinkAction.cs
@@ -8,7 +8,7 @@ public enum ActionModifierTypes { None, Add, Search, Name, SortOrder }
/// Interface for classes, that can be used as a link action. Contains texts for the progress bar, result dialog and the action to
/// execute.
///
- public interface ILinkAction
+ internal interface ILinkAction
{
///
/// Resource for the localized text in the progress bar
diff --git a/Generic/LinkUtilities/LinkActions/LinkAction.cs b/Generic/LinkUtilities/LinkActions/LinkAction.cs
index 5a7a9de20..75fe6c360 100644
--- a/Generic/LinkUtilities/LinkActions/LinkAction.cs
+++ b/Generic/LinkUtilities/LinkActions/LinkAction.cs
@@ -2,20 +2,20 @@
namespace LinkUtilities.LinkActions
{
- public abstract class LinkAction : ILinkAction
+ internal abstract class LinkAction : ILinkAction
{
public abstract string ProgressMessage { get; }
public abstract string ResultMessage { get; }
- private readonly LinkUtilities plugin;
- public LinkUtilities Plugin { get { return plugin; } }
+ private readonly LinkUtilities _plugin;
+ public LinkUtilities Plugin { get { return _plugin; } }
public abstract bool Execute(Game game, ActionModifierTypes actionModifier = ActionModifierTypes.None, bool isBulkAction = true);
public LinkAction(LinkUtilities plugin)
{
- this.plugin = plugin;
+ _plugin = plugin;
}
}
}
diff --git a/Generic/LinkUtilities/LinkActions/RemoveDuplicates.cs b/Generic/LinkUtilities/LinkActions/RemoveDuplicates.cs
index 04dbc055c..b20bbe2c5 100644
--- a/Generic/LinkUtilities/LinkActions/RemoveDuplicates.cs
+++ b/Generic/LinkUtilities/LinkActions/RemoveDuplicates.cs
@@ -5,7 +5,7 @@ namespace LinkUtilities.LinkActions
///
/// Class to remove duplicate links.
///
- public class RemoveDuplicates : LinkAction
+ internal class RemoveDuplicates : LinkAction
{
public override string ProgressMessage { get; } = "LOCLinkUtilitiesProgressRemoveDuplicates";
diff --git a/Generic/LinkUtilities/LinkActions/RemoveLinks.cs b/Generic/LinkUtilities/LinkActions/RemoveLinks.cs
index 767e8608e..b1bba4920 100644
--- a/Generic/LinkUtilities/LinkActions/RemoveLinks.cs
+++ b/Generic/LinkUtilities/LinkActions/RemoveLinks.cs
@@ -9,7 +9,7 @@ namespace LinkUtilities.LinkActions
///
/// Class to remove unwanted links based on patterns.
///
- public class RemoveLinks : LinkAction
+ internal class RemoveLinks : LinkAction
{
public override string ProgressMessage { get; } = "LOCLinkUtilitiesProgressRemoveLinks";
diff --git a/Generic/LinkUtilities/LinkActions/RenameLinks.cs b/Generic/LinkUtilities/LinkActions/RenameLinks.cs
index 730a31c05..b827e92f3 100644
--- a/Generic/LinkUtilities/LinkActions/RenameLinks.cs
+++ b/Generic/LinkUtilities/LinkActions/RenameLinks.cs
@@ -7,7 +7,7 @@ namespace LinkUtilities.LinkActions
///
/// Class to rename links based on patterns.
///
- public class RenameLinks : LinkAction
+ internal class RenameLinks : LinkAction
{
public override string ProgressMessage { get; } = "LOCLinkUtilitiesProgressRenameLinks";
@@ -22,7 +22,7 @@ public RenameLinks(LinkUtilities plugin) : base(plugin)
{
}
- public bool Rename(Game game, bool updateDB = true)
+ private bool Rename(Game game, bool updateDB = true)
{
bool mustUpdate = false;
diff --git a/Generic/LinkUtilities/LinkActions/SortLinks.cs b/Generic/LinkUtilities/LinkActions/SortLinks.cs
index dea9bdef9..ca778f219 100644
--- a/Generic/LinkUtilities/LinkActions/SortLinks.cs
+++ b/Generic/LinkUtilities/LinkActions/SortLinks.cs
@@ -6,7 +6,7 @@ namespace LinkUtilities.LinkActions
///
/// Sorts the Links of a game.
///
- public class SortLinks : LinkAction
+ internal class SortLinks : LinkAction
{
public SortLinks(LinkUtilities plugin) : base(plugin)
{
diff --git a/Generic/LinkUtilities/LinkActions/TagMissingLinks.cs b/Generic/LinkUtilities/LinkActions/TagMissingLinks.cs
index 0848f6839..338a759ec 100644
--- a/Generic/LinkUtilities/LinkActions/TagMissingLinks.cs
+++ b/Generic/LinkUtilities/LinkActions/TagMissingLinks.cs
@@ -11,7 +11,7 @@ namespace LinkUtilities.LinkActions
///
/// Class to add tags to games for missing links based on patterns.
///
- public class TagMissingLinks : LinkAction
+ internal class TagMissingLinks : LinkAction
{
public override string ProgressMessage { get; } = "LOCLinkUtilitiesProgressTagMissingLinks";
@@ -25,7 +25,7 @@ public class TagMissingLinks : LinkAction
///
/// Cache for the tags so they don't have to be retrieved from the database every time.
///
- public Dictionary TagsCache = new Dictionary();
+ public Dictionary TagsCache { get; set; } = new Dictionary();
public TagMissingLinks(LinkUtilities plugin) : base(plugin)
{
@@ -76,7 +76,7 @@ private bool AddTagToGame(Game game, Tag tag)
return false;
}
- public bool Tag(Game game)
+ private bool Tag(Game game)
{
bool mustUpdate = false;
diff --git a/Generic/LinkUtilities/LinkUtilities.cs b/Generic/LinkUtilities/LinkUtilities.cs
index 910867e6c..900c3051a 100644
--- a/Generic/LinkUtilities/LinkUtilities.cs
+++ b/Generic/LinkUtilities/LinkUtilities.cs
@@ -53,52 +53,52 @@ public LinkUtilities(IPlayniteAPI api) : base(api)
///
/// Class to execute specific actions after the meta data of a game changes
///
- public DoAfterChange DoAfterChange { get; }
+ internal DoAfterChange DoAfterChange { get; }
///
/// Class to sort the Links of a game
///
- public SortLinks SortLinks { get; }
+ internal SortLinks SortLinks { get; }
///
/// Class to add a link to the store page in the library of a game
///
- public AddLibraryLinks AddLibraryLinks { get; }
+ internal AddLibraryLinks AddLibraryLinks { get; }
///
/// Class to add a link to all available websites in the Links list, if a definitive link was found.
///
- public AddWebsiteLinks AddWebsiteLinks { get; }
+ internal AddWebsiteLinks AddWebsiteLinks { get; }
///
/// Class to remove duplicate links.
///
- public RemoveDuplicates RemoveDuplicates { get; }
+ internal RemoveDuplicates RemoveDuplicates { get; }
///
/// Class to remove unwanted links.
///
- public RemoveLinks RemoveLinks { get; }
+ internal RemoveLinks RemoveLinks { get; }
///
/// Class to rename links.
///
- public RenameLinks RenameLinks { get; }
+ internal RenameLinks RenameLinks { get; }
///
/// Class to tag missing links.
///
- public TagMissingLinks TagMissingLinks { get; }
+ internal TagMissingLinks TagMissingLinks { get; }
///
/// Handles UriHandler actions.
///
- public HandleUriActions HandleUriActions { get; }
+ internal HandleUriActions HandleUriActions { get; }
///
/// Is set to true, while the library is updated via the sortLinks function. Is used to avoid an endless loop in the function.
///
- public bool IsUpdating { get; set; }
+ internal bool IsUpdating { get; set; }
///
/// Executes a specific action for all games in a list. Shows a progress bar and result dialog and uses buffered update mode if the
diff --git a/Generic/LinkUtilities/LinkUtilities.csproj b/Generic/LinkUtilities/LinkUtilities.csproj
index 89a34160e..df8986c9f 100644
--- a/Generic/LinkUtilities/LinkUtilities.csproj
+++ b/Generic/LinkUtilities/LinkUtilities.csproj
@@ -91,7 +91,7 @@
-
+
diff --git a/Generic/LinkUtilities/Linker/IGameLibrary.cs b/Generic/LinkUtilities/Linker/IGameLibrary.cs
index 9f6cba82d..84b63b723 100644
--- a/Generic/LinkUtilities/Linker/IGameLibrary.cs
+++ b/Generic/LinkUtilities/Linker/IGameLibrary.cs
@@ -6,7 +6,7 @@ namespace LinkUtilities.Linker
///
/// Interface with properties needed for a game library
///
- interface IGameLibrary
+ internal interface IGameLibrary
{
///
/// ID of the game library (e.g. steam or gog) the link is part of. Is only used to add library Links as of now.
diff --git a/Generic/LinkUtilities/Linker/ILink.cs b/Generic/LinkUtilities/Linker/ILink.cs
index 89d26aef4..657a063a6 100644
--- a/Generic/LinkUtilities/Linker/ILink.cs
+++ b/Generic/LinkUtilities/Linker/ILink.cs
@@ -13,7 +13,7 @@ public enum LinkAddTypes { None, SingleSearchResult, UrlMatch }
///
/// Interface for all the websites a link can be added to
///
- interface ILink
+ internal interface ILink
{
///
/// Name the link will have in the games link collection
diff --git a/Generic/LinkUtilities/Linker/Libraries.cs b/Generic/LinkUtilities/Linker/Libraries.cs
index 40b498170..d1123ef27 100644
--- a/Generic/LinkUtilities/Linker/Libraries.cs
+++ b/Generic/LinkUtilities/Linker/Libraries.cs
@@ -5,7 +5,7 @@ namespace LinkUtilities.Linker
///
/// List of all game library link associations. Is used to get the specific library of the game via the GUID using the find method.
///
- class Libraries : List
+ internal class Libraries : List
{
public Libraries(LinkUtilities plugin)
{
diff --git a/Generic/LinkUtilities/Linker/Libraries/LibraryLinkGog.cs b/Generic/LinkUtilities/Linker/Libraries/LibraryLinkGog.cs
index 5172b0c6d..77170707f 100644
--- a/Generic/LinkUtilities/Linker/Libraries/LibraryLinkGog.cs
+++ b/Generic/LinkUtilities/Linker/Libraries/LibraryLinkGog.cs
@@ -13,7 +13,7 @@ namespace LinkUtilities.Linker
///
/// Adds a link to GOG.
///
- class LibraryLinkGog : LibraryLink
+ internal class LibraryLinkGog : LibraryLink
{
public override Guid LibraryId { get; } = Guid.Parse("aebe8b7c-6dc3-4a66-af31-e7375c6b5e9e");
public override string LinkName { get; } = "GOG";
diff --git a/Generic/LinkUtilities/Linker/Libraries/LibraryLinkItch.cs b/Generic/LinkUtilities/Linker/Libraries/LibraryLinkItch.cs
index 312498834..35f425f22 100644
--- a/Generic/LinkUtilities/Linker/Libraries/LibraryLinkItch.cs
+++ b/Generic/LinkUtilities/Linker/Libraries/LibraryLinkItch.cs
@@ -13,13 +13,14 @@ namespace LinkUtilities.Linker
///
/// Adds a link to itch.io.
///
- class LibraryLinkItch : LibraryLink
+ internal class LibraryLinkItch : LibraryLink
{
+ private readonly string _libraryUrl = "https://itch.io/api/1/{0}/game/{1}";
+
public override Guid LibraryId { get; } = Guid.Parse("00000001-ebb2-4eec-abcb-7c89937a42bb");
public override string LinkName { get; } = "Itch";
public override LinkAddTypes AddType { get; } = LinkAddTypes.SingleSearchResult;
public override string SearchUrl { get; } = "https://itch.io/api/1/{0}/search/games?query={1}";
- public string LibraryUrl { get; } = "https://itch.io/api/1/{0}/game/{1}";
public override bool AddLibraryLink(Game game)
{
@@ -28,7 +29,7 @@ public override bool AddLibraryLink(Game game)
{
try
{
- string apiUrl = string.Format(LibraryUrl, Settings.ApiKey, game.GameId);
+ string apiUrl = string.Format(_libraryUrl, Settings.ApiKey, game.GameId);
WebClient client = new WebClient();
diff --git a/Generic/LinkUtilities/Linker/Libraries/LibraryLinkSteam.cs b/Generic/LinkUtilities/Linker/Libraries/LibraryLinkSteam.cs
index 4c0c4f7de..7ca51496a 100644
--- a/Generic/LinkUtilities/Linker/Libraries/LibraryLinkSteam.cs
+++ b/Generic/LinkUtilities/Linker/Libraries/LibraryLinkSteam.cs
@@ -15,16 +15,17 @@ namespace LinkUtilities.Linker
///
class LibraryLinkSteam : LibraryLink
{
+ private readonly string _libraryUrl = "https://store.steampowered.com/app/";
+
public override Guid LibraryId { get; } = Guid.Parse("cb91dfc9-b977-43bf-8e70-55f46e410fab");
public override string LinkName { get; } = "Steam";
public override LinkAddTypes AddType { get; } = LinkAddTypes.SingleSearchResult;
public override string SearchUrl { get; } = "https://steamcommunity.com/actions/SearchApps/";
- public string LibraryUrl { get; } = "https://store.steampowered.com/app/";
public override bool AddLibraryLink(Game game)
{
// Adding a link to steam is extremely simple. You only have to add the GameId to the base URL.
- LinkUrl = $"{LibraryUrl}{game.GameId}";
+ LinkUrl = $"{_libraryUrl}{game.GameId}";
return LinkHelper.AddLink(game, LinkName, LinkUrl, Plugin);
}
@@ -55,7 +56,7 @@ public override List SearchLink(string searchTerm)
SearchResults.Add(new SearchResult
{
Name = game.Name,
- Url = $"{LibraryUrl}{game.Appid}",
+ Url = $"{_libraryUrl}{game.Appid}",
Description = game.Appid
}
);
diff --git a/Generic/LinkUtilities/Linker/LibraryLink.cs b/Generic/LinkUtilities/Linker/LibraryLink.cs
index 0a6f7ac24..c24e21c93 100644
--- a/Generic/LinkUtilities/Linker/LibraryLink.cs
+++ b/Generic/LinkUtilities/Linker/LibraryLink.cs
@@ -6,13 +6,13 @@ namespace LinkUtilities.Linker
///
/// Base class for a library link
///
- public abstract class LibraryLink : Link, IGameLibrary
+ internal abstract class LibraryLink : Link, IGameLibrary
{
public abstract Guid LibraryId { get; }
public abstract bool AddLibraryLink(Game game);
- protected LibraryLink(LinkUtilities plugin) : base(plugin)
+ public LibraryLink(LinkUtilities plugin) : base(plugin)
{
}
}
diff --git a/Generic/LinkUtilities/Linker/Link.cs b/Generic/LinkUtilities/Linker/Link.cs
index 06f28bb1a..7365a48c1 100644
--- a/Generic/LinkUtilities/Linker/Link.cs
+++ b/Generic/LinkUtilities/Linker/Link.cs
@@ -11,7 +11,7 @@ namespace LinkUtilities.Linker
///
/// Base class for a website link
///
- public abstract class Link : ILink, ILinkAction
+ internal abstract class Link : ILink, ILinkAction
{
public abstract string LinkName { get; }
public virtual string BaseUrl { get; } = string.Empty;
@@ -24,8 +24,8 @@ public abstract class Link : ILink, ILinkAction
public string ProgressMessage { get; } = "LOCLinkUtilitiesProgressLink";
public string ResultMessage { get; } = "LOCLinkUtilitiesDialogAddedMessage";
- private readonly LinkUtilities plugin;
- public LinkUtilities Plugin { get { return plugin; } }
+ private readonly LinkUtilities _plugin;
+ public LinkUtilities Plugin { get { return _plugin; } }
public List SearchResults { get; set; } = new List();
public virtual bool AddSearchedLink(Game game)
@@ -38,7 +38,7 @@ public virtual bool AddSearchedLink(Game game)
if (result != null)
{
- return LinkHelper.AddLink(game, LinkName, ((SearchResult)result).Url, plugin, false);
+ return LinkHelper.AddLink(game, LinkName, ((SearchResult)result).Url, _plugin, false);
}
return false;
@@ -86,7 +86,7 @@ public virtual bool AddLink(Game game)
if (!string.IsNullOrEmpty(LinkUrl))
{
- return LinkHelper.AddLink(game, LinkName, LinkUrl, plugin);
+ return LinkHelper.AddLink(game, LinkName, LinkUrl, _plugin);
}
}
@@ -170,7 +170,7 @@ public virtual bool Execute(Game game, ActionModifierTypes actionModifier = Acti
public Link(LinkUtilities plugin)
{
- this.plugin = plugin;
+ this._plugin = plugin;
Settings = new LinkSourceSetting()
{
LinkName = LinkName,
diff --git a/Generic/LinkUtilities/Linker/LinkSources/LinkAdventureGamers.cs b/Generic/LinkUtilities/Linker/LinkSources/LinkAdventureGamers.cs
index 0fb25ea80..905764fb5 100644
--- a/Generic/LinkUtilities/Linker/LinkSources/LinkAdventureGamers.cs
+++ b/Generic/LinkUtilities/Linker/LinkSources/LinkAdventureGamers.cs
@@ -11,7 +11,7 @@ namespace LinkUtilities.Linker
///
/// Adds a link to Adventure Gamers.
///
- class LinkAdventureGamers : Link
+ internal class LinkAdventureGamers : Link
{
public override string LinkName { get; } = "Adventure Gamers";
public override LinkAddTypes AddType { get; } = LinkAddTypes.SingleSearchResult;
diff --git a/Generic/LinkUtilities/Linker/LinkSources/LinkArcadeDatabase.cs b/Generic/LinkUtilities/Linker/LinkSources/LinkArcadeDatabase.cs
index 6832be50a..8dde48914 100644
--- a/Generic/LinkUtilities/Linker/LinkSources/LinkArcadeDatabase.cs
+++ b/Generic/LinkUtilities/Linker/LinkSources/LinkArcadeDatabase.cs
@@ -13,14 +13,14 @@ namespace LinkUtilities.Linker
///
/// Adds a link to Arcade Database (arcadeitalia.net).
///
- class LinkArcadeDatabase : Link
+ internal class LinkArcadeDatabase : Link
{
+ private readonly string _WebsiteUrl = "http://adb.arcadeitalia.net/";
+
public override string LinkName { get; } = "Arcade Database";
public override string BaseUrl { get; } = "http://adb.arcadeitalia.net/dettaglio_mame.php?lang=en&game_name=";
public override string SearchUrl { get; } = "http://adb.arcadeitalia.net/lista_mame.php?lang=en&ricerca=";
- internal string WebsiteUrl = "http://adb.arcadeitalia.net/";
-
public override bool CheckLink(string link)
{
try
@@ -67,7 +67,7 @@ public override List SearchLink(string searchTerm)
SearchResults.Add(new SearchResult
{
Name = WebUtility.HtmlDecode(node.SelectSingleNode("./a/div[@class='titolo_galleria']").InnerText),
- Url = $"{WebsiteUrl}{node.SelectSingleNode("./a").GetAttributeValue("href", "")}",
+ Url = $"{_WebsiteUrl}{node.SelectSingleNode("./a").GetAttributeValue("href", "")}",
Description = $"{WebUtility.HtmlDecode(node.SelectSingleNode("./a/div[@class='romset_galleria']").InnerText)} - {WebUtility.HtmlDecode(node.SelectSingleNode("./a/div[@class='produttore_galleria']").InnerText)}"
}
);
diff --git a/Generic/LinkUtilities/Linker/LinkSources/LinkCoOptimus.cs b/Generic/LinkUtilities/Linker/LinkSources/LinkCoOptimus.cs
index 11f11339b..187aaf5a2 100644
--- a/Generic/LinkUtilities/Linker/LinkSources/LinkCoOptimus.cs
+++ b/Generic/LinkUtilities/Linker/LinkSources/LinkCoOptimus.cs
@@ -11,7 +11,7 @@ namespace LinkUtilities.Linker
///
/// Adds a link to Co-Optimus.
///
- class LinkCoOptimus : Link
+ internal class LinkCoOptimus : Link
{
public override string LinkName { get; } = "Co-Optimus";
public override LinkAddTypes AddType { get; } = LinkAddTypes.SingleSearchResult;
diff --git a/Generic/LinkUtilities/Linker/LinkSources/LinkEpic.cs b/Generic/LinkUtilities/Linker/LinkSources/LinkEpic.cs
index 3b114c1d4..fe44c560b 100644
--- a/Generic/LinkUtilities/Linker/LinkSources/LinkEpic.cs
+++ b/Generic/LinkUtilities/Linker/LinkSources/LinkEpic.cs
@@ -11,7 +11,7 @@
namespace LinkUtilities.Linker
{
- class LinkEpic : Link
+ internal class LinkEpic : Link
{
public override string LinkName { get; } = "Epic";
public override string BaseUrl { get; } = "https://store.epicgames.com/en-US/p/";
diff --git a/Generic/LinkUtilities/Linker/LinkSources/LinkGamerGuides.cs b/Generic/LinkUtilities/Linker/LinkSources/LinkGamerGuides.cs
index ae58ed2d2..5793948e4 100644
--- a/Generic/LinkUtilities/Linker/LinkSources/LinkGamerGuides.cs
+++ b/Generic/LinkUtilities/Linker/LinkSources/LinkGamerGuides.cs
@@ -6,7 +6,7 @@ namespace LinkUtilities.Linker
///
/// Adds a link to Gamer Guides.
///
- class LinkGamerGuides : Link
+ internal class LinkGamerGuides : Link
{
public override string LinkName { get; } = "Gamer Guides";
public override string BaseUrl { get; } = "https://www.gamerguides.com/";
diff --git a/Generic/LinkUtilities/Linker/LinkSources/LinkGiantBomb.cs b/Generic/LinkUtilities/Linker/LinkSources/LinkGiantBomb.cs
index ff1e93f3d..ce7b96798 100644
--- a/Generic/LinkUtilities/Linker/LinkSources/LinkGiantBomb.cs
+++ b/Generic/LinkUtilities/Linker/LinkSources/LinkGiantBomb.cs
@@ -13,7 +13,7 @@ namespace LinkUtilities.Linker
///
/// Adds a link to Giant Bomb.
///
- class LinkGiantBomb : Link
+ internal class LinkGiantBomb : Link
{
public override string LinkName { get; } = "Giant Bomb";
public override LinkAddTypes AddType { get; } = LinkAddTypes.SingleSearchResult;
diff --git a/Generic/LinkUtilities/Linker/LinkSources/LinkHG101.cs b/Generic/LinkUtilities/Linker/LinkSources/LinkHG101.cs
index 5059134c1..371daa616 100644
--- a/Generic/LinkUtilities/Linker/LinkSources/LinkHG101.cs
+++ b/Generic/LinkUtilities/Linker/LinkSources/LinkHG101.cs
@@ -13,7 +13,7 @@ namespace LinkUtilities.Linker
///
/// Adds a link to Hardcore Gaming 101.
///
- class LinkHG101 : Link
+ internal class LinkHG101 : Link
{
public override string LinkName { get; } = "Hardcore Gaming 101";
public override string BaseUrl { get; } = "http://www.hardcoregaming101.net/";
diff --git a/Generic/LinkUtilities/Linker/LinkSources/LinkHowLongToBeat.cs b/Generic/LinkUtilities/Linker/LinkSources/LinkHowLongToBeat.cs
index ddd41a788..85cb2dc75 100644
--- a/Generic/LinkUtilities/Linker/LinkSources/LinkHowLongToBeat.cs
+++ b/Generic/LinkUtilities/Linker/LinkSources/LinkHowLongToBeat.cs
@@ -14,7 +14,7 @@ namespace LinkUtilities.Linker
///
/// Adds a link to HowLongToBeat.
///
- class LinkHowLongToBeat : Link
+ internal class LinkHowLongToBeat : Link
{
public override string LinkName { get; } = "HowLongToBeat";
public override LinkAddTypes AddType { get; } = LinkAddTypes.SingleSearchResult;
diff --git a/Generic/LinkUtilities/Linker/LinkSources/LinkIGN.cs b/Generic/LinkUtilities/Linker/LinkSources/LinkIGN.cs
index fef2f308b..832557262 100644
--- a/Generic/LinkUtilities/Linker/LinkSources/LinkIGN.cs
+++ b/Generic/LinkUtilities/Linker/LinkSources/LinkIGN.cs
@@ -6,7 +6,7 @@ namespace LinkUtilities.Linker
///
/// Adds a link to IGN.
///
- class LinkIGN : Link
+ internal class LinkIGN : Link
{
public override string LinkName { get; } = "IGN";
public override string BaseUrl { get; } = "https://www.ign.com/games/";
diff --git a/Generic/LinkUtilities/Linker/LinkSources/LinkIsThereAnyDeal.cs b/Generic/LinkUtilities/Linker/LinkSources/LinkIsThereAnyDeal.cs
index db55dd816..a03cfc735 100644
--- a/Generic/LinkUtilities/Linker/LinkSources/LinkIsThereAnyDeal.cs
+++ b/Generic/LinkUtilities/Linker/LinkSources/LinkIsThereAnyDeal.cs
@@ -13,14 +13,14 @@ namespace LinkUtilities.Linker
///
/// Adds a link to IsThereAnyDeal.
///
- class LinkIsThereAnyDeal : Link
+ internal class LinkIsThereAnyDeal : Link
{
- public override string LinkName { get; } = "IsThereAnyDeal";
- public override string BaseUrl => baseUrl;
-
private string baseUrl;
private readonly string steamUrl = "https://isthereanydeal.com/steam/app/";
private readonly string standardUrl = "https://isthereanydeal.com/game/";
+
+ public override string LinkName { get; } = "IsThereAnyDeal";
+ public override string BaseUrl => baseUrl;
public override string SearchUrl { get; } = "https://api.isthereanydeal.com/v02/search/search/?key={0}&q={1}&limit=20&strict=0";
public override string GetGamePath(Game game, string gameName = null)
@@ -31,7 +31,7 @@ public override string GetGamePath(Game game, string gameName = null)
baseUrl = steamUrl;
return game.GameId;
}
- // For all other libraries links need the result name in lowercase without special characters and white spaces with numbers translated to roman numbers.
+ // For all other _libraries links need the result name in lowercase without special characters and white spaces with numbers translated to roman numbers.
else
{
baseUrl = standardUrl;
diff --git a/Generic/LinkUtilities/Linker/LinkSources/LinkLemonAmiga.cs b/Generic/LinkUtilities/Linker/LinkSources/LinkLemonAmiga.cs
index 27d10bca1..ec12b8cd1 100644
--- a/Generic/LinkUtilities/Linker/LinkSources/LinkLemonAmiga.cs
+++ b/Generic/LinkUtilities/Linker/LinkSources/LinkLemonAmiga.cs
@@ -11,7 +11,7 @@ namespace LinkUtilities.Linker
///
/// Adds a link to Lemon Amiga.
///
- class LinkLemonAmiga : Link
+ internal class LinkLemonAmiga : Link
{
public override string LinkName { get; } = "Lemon Amiga";
public override LinkAddTypes AddType { get; } = LinkAddTypes.SingleSearchResult;
diff --git a/Generic/LinkUtilities/Linker/LinkSources/LinkMetacritic.cs b/Generic/LinkUtilities/Linker/LinkSources/LinkMetacritic.cs
index 7c307aac1..a37990820 100644
--- a/Generic/LinkUtilities/Linker/LinkSources/LinkMetacritic.cs
+++ b/Generic/LinkUtilities/Linker/LinkSources/LinkMetacritic.cs
@@ -9,17 +9,16 @@ namespace LinkUtilities.Linker
///
/// Adds a link to Metacritic.
///
- class LinkMetacritic : Link
+ internal class LinkMetacritic : Link
{
public override string LinkName { get; } = "Metacritic";
public override string BaseUrl { get; } = "https://www.metacritic.com/game/";
public override string SearchUrl { get; } = string.Empty;
///
- /// Dictionary with possible platform names and their equivalents in metacritic links. Only needed for names that differ from
- /// the platform in the link.
+ /// Dictionary with playnite platform ids and their equivalents in metacritic links
///
- public static IReadOnlyDictionary Platforms = new Dictionary(StringComparer.OrdinalIgnoreCase)
+ private readonly IReadOnlyDictionary _platforms = new Dictionary(StringComparer.OrdinalIgnoreCase)
{
{ "nintendo_3ds", "3ds" },
{ "nintendo_64", "nintendo-64" },
@@ -45,6 +44,7 @@ class LinkMetacritic : Link
{ "xbox_one", "xbox-one" },
{ "xbox_series", "xbox-series-x" },
};
+
public override bool AddLink(Game game)
{
bool result = false;
@@ -63,9 +63,9 @@ public override bool AddLink(Game game)
if (!LinkHelper.LinkExists(game, linkName))
{
- if (Platforms.ContainsKey(platform.SpecificationId))
+ if (_platforms.ContainsKey(platform.SpecificationId))
{
- LinkUrl = $"{BaseUrl}{Platforms[platform.SpecificationId]}/{GetGamePath(game)}";
+ LinkUrl = $"{BaseUrl}{_platforms[platform.SpecificationId]}/{GetGamePath(game)}";
if (CheckLink(LinkUrl))
{
@@ -73,7 +73,7 @@ public override bool AddLink(Game game)
}
else if (game.Name != game.Name.RemoveEditionSuffix())
{
- LinkUrl = $"{BaseUrl}{Platforms[platform.SpecificationId]}/{GetGamePath(game, game.Name.RemoveEditionSuffix())}";
+ LinkUrl = $"{BaseUrl}{_platforms[platform.SpecificationId]}/{GetGamePath(game, game.Name.RemoveEditionSuffix())}";
if (CheckLink(LinkUrl))
{
diff --git a/Generic/LinkUtilities/Linker/LinkSources/LinkMobyGames.cs b/Generic/LinkUtilities/Linker/LinkSources/LinkMobyGames.cs
index f8b942ccc..c99a82bf1 100644
--- a/Generic/LinkUtilities/Linker/LinkSources/LinkMobyGames.cs
+++ b/Generic/LinkUtilities/Linker/LinkSources/LinkMobyGames.cs
@@ -12,7 +12,7 @@ namespace LinkUtilities.Linker
///
/// Adds a link to MobyGames.
///
- class LinkMobyGames : Link
+ internal class LinkMobyGames : Link
{
public override string LinkName { get; } = "MobyGames";
public override string BaseUrl { get; } = "https://www.mobygames.com/game/";
diff --git a/Generic/LinkUtilities/Linker/LinkSources/LinkNECRetro.cs b/Generic/LinkUtilities/Linker/LinkSources/LinkNECRetro.cs
index 78b69d013..43e791b69 100644
--- a/Generic/LinkUtilities/Linker/LinkSources/LinkNECRetro.cs
+++ b/Generic/LinkUtilities/Linker/LinkSources/LinkNECRetro.cs
@@ -9,13 +9,13 @@ namespace LinkUtilities.Linker
///
/// Adds a link to NEC Retro.
///
- class LinkNECRetro : Link
+ internal class LinkNECRetro : Link
{
public override string LinkName { get; } = "NEC Retro";
public override string BaseUrl { get; } = "https://necretro.org/";
public override string SearchUrl { get; } = "https://necretro.org/index.php?search={0}&fulltext=1";
- internal string WebsiteUrl = "https://necretro.org";
+ private readonly string _websiteUrl = "https://necretro.org";
// NEC Retro Links need the game with underscores instead of whitespaces and special characters simply encoded.
public override string GetGamePath(Game game, string gameName = null)
@@ -25,7 +25,7 @@ public override string GetGamePath(Game game, string gameName = null)
public override List SearchLink(string searchTerm)
{
- SearchResults = ParseHelper.GetMediaWikiResultsFromHtml(SearchUrl, searchTerm, WebsiteUrl, LinkName, 2);
+ SearchResults = ParseHelper.GetMediaWikiResultsFromHtml(SearchUrl, searchTerm, _websiteUrl, LinkName, 2);
return base.SearchLink(searchTerm);
}
diff --git a/Generic/LinkUtilities/Linker/LinkSources/LinkNintendoWiki.cs b/Generic/LinkUtilities/Linker/LinkSources/LinkNintendoWiki.cs
index 5f193e611..8316db61b 100644
--- a/Generic/LinkUtilities/Linker/LinkSources/LinkNintendoWiki.cs
+++ b/Generic/LinkUtilities/Linker/LinkSources/LinkNintendoWiki.cs
@@ -9,7 +9,7 @@ namespace LinkUtilities.Linker
///
/// Adds a link to Nintendo Wiki.
///
- class LinkNintendoWiki : Link
+ internal class LinkNintendoWiki : Link
{
public override string LinkName { get; } = "Nintendo Wiki";
public override string BaseUrl { get; } = "https://nintendo.fandom.com/wiki/";
diff --git a/Generic/LinkUtilities/Linker/LinkSources/LinkPCGamingWiki.cs b/Generic/LinkUtilities/Linker/LinkSources/LinkPCGamingWiki.cs
index ffb74883e..49ead6efa 100644
--- a/Generic/LinkUtilities/Linker/LinkSources/LinkPCGamingWiki.cs
+++ b/Generic/LinkUtilities/Linker/LinkSources/LinkPCGamingWiki.cs
@@ -9,13 +9,13 @@ namespace LinkUtilities.Linker
///
/// Adds a link to PCGamingWiki.
///
- class LinkPCGamingWiki : Link
+ internal class LinkPCGamingWiki : Link
{
public override string LinkName { get; } = "PCGamingWiki";
public override string BaseUrl { get; } = "https://www.pcgamingwiki.com/wiki/";
public override string SearchUrl { get; } = "https://www.pcgamingwiki.com/w/index.php?search={0}&fulltext=1";
- internal string WebsiteUrl = "https://www.pcgamingwiki.com";
+ private string _websiteUrl = "https://www.pcgamingwiki.com";
// PCGamingWiki Links need the game with underscores instead of whitespaces and special characters simply encoded.
public override string GetGamePath(Game game, string gameName = null)
@@ -59,7 +59,7 @@ public override bool AddLink(Game game)
public override List SearchLink(string searchTerm)
{
- SearchResults = ParseHelper.GetMediaWikiResultsFromHtml(SearchUrl, searchTerm, WebsiteUrl, LinkName);
+ SearchResults = ParseHelper.GetMediaWikiResultsFromHtml(SearchUrl, searchTerm, _websiteUrl, LinkName);
return base.SearchLink(searchTerm);
}
diff --git a/Generic/LinkUtilities/Linker/LinkSources/LinkRAWG.cs b/Generic/LinkUtilities/Linker/LinkSources/LinkRAWG.cs
index 0074620f1..8948d7e47 100644
--- a/Generic/LinkUtilities/Linker/LinkSources/LinkRAWG.cs
+++ b/Generic/LinkUtilities/Linker/LinkSources/LinkRAWG.cs
@@ -14,7 +14,7 @@ namespace LinkUtilities.Linker
///
/// Adds a link to RAWG.io.
///
- class LinkRAWG : Link
+ internal class LinkRAWG : Link
{
public override string LinkName { get; } = "RAWG";
public override string BaseUrl { get; } = "https://rawg.io/games/";
diff --git a/Generic/LinkUtilities/Linker/LinkSources/SNKWiki.cs b/Generic/LinkUtilities/Linker/LinkSources/LinkSNKWiki.cs
similarity index 96%
rename from Generic/LinkUtilities/Linker/LinkSources/SNKWiki.cs
rename to Generic/LinkUtilities/Linker/LinkSources/LinkSNKWiki.cs
index 6800de4f0..7f6490528 100644
--- a/Generic/LinkUtilities/Linker/LinkSources/SNKWiki.cs
+++ b/Generic/LinkUtilities/Linker/LinkSources/LinkSNKWiki.cs
@@ -9,7 +9,7 @@ namespace LinkUtilities.Linker
///
/// Adds a link to SNK Wiki.
///
- class LinkSNKWiki : Link
+ internal class LinkSNKWiki : Link
{
public override string LinkName { get; } = "SNK Wiki";
public override string BaseUrl { get; } = "https://snk.fandom.com/wiki/";
diff --git a/Generic/LinkUtilities/Linker/LinkSources/LinkSegaRetro.cs b/Generic/LinkUtilities/Linker/LinkSources/LinkSegaRetro.cs
index fae08e7d5..e9edc0580 100644
--- a/Generic/LinkUtilities/Linker/LinkSources/LinkSegaRetro.cs
+++ b/Generic/LinkUtilities/Linker/LinkSources/LinkSegaRetro.cs
@@ -9,13 +9,13 @@ namespace LinkUtilities.Linker
///
/// Adds a link to Sega Retro.
///
- class LinkSegaRetro : Link
+ internal class LinkSegaRetro : Link
{
public override string LinkName { get; } = "Sega Retro";
public override string BaseUrl { get; } = "https://segaretro.org/";
public override string SearchUrl { get; } = "https://segaretro.org/index.php?search={0}&fulltext=1";
- internal string WebsiteUrl = "https://segaretro.org";
+ private readonly string _websiteUrl = "https://segaretro.org";
// Sega Retro Links need the game with underscores instead of whitespaces and special characters simply encoded.
public override string GetGamePath(Game game, string gameName = null)
@@ -25,7 +25,7 @@ public override string GetGamePath(Game game, string gameName = null)
public override List SearchLink(string searchTerm)
{
- SearchResults = ParseHelper.GetMediaWikiResultsFromHtml(SearchUrl, searchTerm, WebsiteUrl, LinkName, 2);
+ SearchResults = ParseHelper.GetMediaWikiResultsFromHtml(SearchUrl, searchTerm, _websiteUrl, LinkName, 2);
return base.SearchLink(searchTerm);
}
diff --git a/Generic/LinkUtilities/Linker/LinkSources/LinkStrategyWiki.cs b/Generic/LinkUtilities/Linker/LinkSources/LinkStrategyWiki.cs
index 8c49a97dc..b91948cb1 100644
--- a/Generic/LinkUtilities/Linker/LinkSources/LinkStrategyWiki.cs
+++ b/Generic/LinkUtilities/Linker/LinkSources/LinkStrategyWiki.cs
@@ -9,13 +9,13 @@ namespace LinkUtilities.Linker
///
/// Adds a link to StrategyWiki.
///
- class LinkStrategyWiki : Link
+ internal class LinkStrategyWiki : Link
{
public override string LinkName { get; } = "StrategyWiki";
public override string BaseUrl { get; } = "https://strategywiki.org/wiki/";
public override string SearchUrl { get; } = "https://strategywiki.org/w/index.php?search={0}&fulltext=1";
- internal string WebsiteUrl = "https://strategywiki.org";
+ private readonly string _websiteUrl = "https://strategywiki.org";
// StrategyWiki Links need the game with underscores instead of whitespaces and special characters simply encoded.
public override string GetGamePath(Game game, string gameName = null)
@@ -25,7 +25,7 @@ public override string GetGamePath(Game game, string gameName = null)
public override List SearchLink(string searchTerm)
{
- SearchResults = ParseHelper.GetMediaWikiResultsFromHtml(SearchUrl, searchTerm, WebsiteUrl, LinkName);
+ SearchResults = ParseHelper.GetMediaWikiResultsFromHtml(SearchUrl, searchTerm, _websiteUrl, LinkName);
return base.SearchLink(searchTerm);
}
diff --git a/Generic/LinkUtilities/Linker/LinkSources/LinkWikipedia.cs b/Generic/LinkUtilities/Linker/LinkSources/LinkWikipedia.cs
index 7d721974d..6fc3ac739 100644
--- a/Generic/LinkUtilities/Linker/LinkSources/LinkWikipedia.cs
+++ b/Generic/LinkUtilities/Linker/LinkSources/LinkWikipedia.cs
@@ -9,7 +9,7 @@ namespace LinkUtilities.Linker
///
/// Adds a link to Wikipedia.
///
- class LinkWikipedia : Link
+ internal class LinkWikipedia : Link
{
public override string LinkName { get; } = "Wikipedia";
public override string BaseUrl { get; } = "https://en.wikipedia.org/wiki/";
diff --git a/Generic/LinkUtilities/Linker/LinkSources/LinkZopharsDomain.cs b/Generic/LinkUtilities/Linker/LinkSources/LinkZopharsDomain.cs
index 05565238a..75de95ca0 100644
--- a/Generic/LinkUtilities/Linker/LinkSources/LinkZopharsDomain.cs
+++ b/Generic/LinkUtilities/Linker/LinkSources/LinkZopharsDomain.cs
@@ -11,7 +11,7 @@ namespace LinkUtilities.Linker
///
/// Adds a link to Zophar's Domain for game soundtracks.
///
- class LinkZopharsDomain : Link
+ internal class LinkZopharsDomain : Link
{
public override string LinkName { get; } = "Zophar (Music)";
public override LinkAddTypes AddType { get; } = LinkAddTypes.SingleSearchResult;
diff --git a/Generic/LinkUtilities/Linker/Links.cs b/Generic/LinkUtilities/Linker/Links.cs
index b367f2bba..2ae8a4142 100644
--- a/Generic/LinkUtilities/Linker/Links.cs
+++ b/Generic/LinkUtilities/Linker/Links.cs
@@ -5,7 +5,7 @@ namespace LinkUtilities.Linker
///
/// List of all website Links that can be added.
///
- public class Links : List
+ internal class Links : List
{
public Links(LinkUtilities plugin)
{
diff --git a/Generic/LinkUtilities/Settings/LinkNamePatterns.cs b/Generic/LinkUtilities/Settings/LinkNamePatterns.cs
index ba29ca9dc..e84e2c5de 100644
--- a/Generic/LinkUtilities/Settings/LinkNamePatterns.cs
+++ b/Generic/LinkUtilities/Settings/LinkNamePatterns.cs
@@ -69,7 +69,7 @@ public void SortPatterns()
///
/// Type of the pattern to be added
///
- public static List GetDefaultLinkNamePatterns(PatternTypes type)
+ private static List GetDefaultLinkNamePatterns(PatternTypes type)
{
string fileName = string.Empty;
diff --git a/Generic/LinkUtilities/Settings/LinkSourceSettings.cs b/Generic/LinkUtilities/Settings/LinkSourceSettings.cs
index a77f3282c..19244fc2d 100644
--- a/Generic/LinkUtilities/Settings/LinkSourceSettings.cs
+++ b/Generic/LinkUtilities/Settings/LinkSourceSettings.cs
@@ -18,11 +18,11 @@ public LinkSourceSettings()
}
///
- /// Refreshes a LinkSourceCollecion with the actual link sources present in the plugin. Is needed after updates when
+ /// Refreshes a LinkSourceCollecion with the actual link sources present in the _plugin. Is needed after updates when
/// link sources get added or had to be removed.
///
/// Link sources to be added
- public void RefreshLinkSources(Links links)
+ internal void RefreshLinkSources(Links links)
{
LinkSourceSettings newSources = GetLinkSources(links);
@@ -57,11 +57,11 @@ public void RefreshLinkSources(Links links)
}
///
- /// Gets a collection of the settings to all link sources in the plugin.
+ /// Gets a collection of the settings to all link sources in the _plugin.
///
/// Link sources to be added
- /// Collection of the settings to all link sources in the plugin
- public static LinkSourceSettings GetLinkSources(Links links)
+ /// Collection of the settings to all link sources in the _plugin
+ internal static LinkSourceSettings GetLinkSources(Links links)
{
LinkSourceSettings result = new LinkSourceSettings();
diff --git a/Metadata/WikipediaMetadata/ApiCaller.cs b/Metadata/WikipediaMetadata/ApiCaller.cs
index 3e45d6387..0c4d54fb5 100644
--- a/Metadata/WikipediaMetadata/ApiCaller.cs
+++ b/Metadata/WikipediaMetadata/ApiCaller.cs
@@ -13,13 +13,12 @@ namespace WikipediaMetadata
///
internal class ApiCaller
{
- public static readonly string BaseUrl = "https://en.wikipedia.org/w/rest.php/v1/";
- public static string SearchUrl { get => BaseUrl + "search/page?q={0}&limit=100"; }
- public static string PageUrl { get => BaseUrl + "page/{0}"; }
+ private static readonly string _baseUrl = "https://en.wikipedia.org/w/rest.php/v1/";
+ private static readonly string _imageUrl = "https://en.wikipedia.org/w/api.php?action=query&format=json&formatversion=2&prop=pageimages|pageterms&piprop=original&pilicense=any&titles={0}";
+ private static string SearchUrl { get => _baseUrl + "search/page?q={0}&limit=100"; }
+ private static string PageUrl { get => _baseUrl + "page/{0}"; }
- public static readonly string ImageUrl = "https://en.wikipedia.org/w/api.php?action=query&format=json&formatversion=2&prop=pageimages|pageterms&piprop=original&pilicense=any&titles={0}";
-
- public static WebClient GetWebClient()
+ private static WebClient GetWebClient()
{
WebClient client = new WebClient();
@@ -33,7 +32,7 @@ public static WebClient GetWebClient()
return client;
}
- public static WikipediaSearchResult GetSearchResults(string name)
+ internal static WikipediaSearchResult GetSearchResults(string name)
{
WebClient client = GetWebClient();
@@ -43,7 +42,7 @@ public static WikipediaSearchResult GetSearchResults(string name)
return Serialization.FromJson(jsonResult);
}
- public static WikipediaPage GetGameData(string key)
+ internal static WikipediaPage GetGameData(string key)
{
WebClient client = GetWebClient();
@@ -53,11 +52,11 @@ public static WikipediaPage GetGameData(string key)
return Serialization.FromJson(jsonResult);
}
- public static WikipediaImage GetImage(string key)
+ internal static WikipediaImage GetImage(string key)
{
WebClient client = GetWebClient();
- string apiUrl = string.Format(ImageUrl, key.UrlEncode());
+ string apiUrl = string.Format(_imageUrl, key.UrlEncode());
string jsonResult = client.DownloadString(apiUrl);
diff --git a/Metadata/WikipediaMetadata/GameFinder.cs b/Metadata/WikipediaMetadata/GameFinder.cs
index 4a9babd89..8fe26934b 100644
--- a/Metadata/WikipediaMetadata/GameFinder.cs
+++ b/Metadata/WikipediaMetadata/GameFinder.cs
@@ -9,23 +9,23 @@ namespace WikipediaMetadata
///
/// Provides Functionality to find a game on Wikipedia.
///
- public class GameFinder
+ internal class GameFinder
{
- private readonly PluginSettings settings;
- private string wikiNameVideoGame;
- private string wikiName;
- private string wikiStart;
+ private readonly PluginSettings _settings;
+ private string _wikiNameVideoGame;
+ private string _wikiName;
+ private string _wikiStart;
public GameFinder(PluginSettings settings)
{
- this.settings = settings;
+ _settings = settings;
}
- internal void PrepareSearchTerms(string searchTerm)
+ private void PrepareSearchTerms(string searchTerm)
{
- wikiNameVideoGame = (searchTerm + " (video game)").RemoveSpecialChars().ToLower().Replace(" ", "");
- wikiName = searchTerm.RemoveSpecialChars().ToLower().Replace(" ", "");
- wikiStart = wikiName.Substring(0, (wikiName.Length > 5) ? 5 : wikiName.Length);
+ _wikiNameVideoGame = (searchTerm + " (video game)").RemoveSpecialChars().ToLower().Replace(" ", "");
+ _wikiName = searchTerm.RemoveSpecialChars().ToLower().Replace(" ", "");
+ _wikiStart = _wikiName.Substring(0, (_wikiName.Length > 5) ? 5 : _wikiName.Length);
}
///
@@ -54,9 +54,9 @@ public Page FindGame(string gameName)
// use the page in background mode. The description also needs to have the words "video game" in it to
// avoid cases like "Doom", where a completely wrong page would be returned.
foundPage =
- searchResult.Pages.Where(p => p.Description != null && p.Description.ToLower().Contains("video game") && p.KeyMatch == wikiNameVideoGame).FirstOrDefault() ??
+ searchResult.Pages.Where(p => p.Description != null && p.Description.ToLower().Contains("video game") && p.KeyMatch == _wikiNameVideoGame).FirstOrDefault() ??
searchResult.Pages.Where(p => p.Description != null && p.Description.ToLower().Contains("video game") && p.KeyMatch == searchNameVideoGame).FirstOrDefault() ??
- searchResult.Pages.Where(p => p.Description != null && p.Description.ToLower().Contains("video game") && p.KeyMatch == wikiName).FirstOrDefault() ??
+ searchResult.Pages.Where(p => p.Description != null && p.Description.ToLower().Contains("video game") && p.KeyMatch == _wikiName).FirstOrDefault() ??
searchResult.Pages.Where(p => p.Description != null && p.Description.ToLower().Contains("video game") && p.KeyMatch == searchName).FirstOrDefault();
}
return foundPage;
@@ -74,16 +74,16 @@ public List GetSearchResults(string searchTerm)
// We search for the game name on Wikipedia
WikipediaSearchResult searchResult = ApiCaller.GetSearchResults(searchTerm);
- if (settings.AdvancedSearchResultSorting)
+ if (_settings.AdvancedSearchResultSorting)
{
// When displaying the search results, we order them differently to hopefully get the actual game as one
// of the first results. First we order by containing "video game" in the short description, then by
// titles starting with the game name, then by titles starting with the first five characters of the game
// name and at last by page title itself.
return searchResult.Pages.Select(WikipediaItemOption.FromWikipediaSearchResult)
- .OrderByDescending(o => o.Name.RemoveSpecialChars().ToLower().Replace(" ", "").StartsWith(wikiNameVideoGame))
- .ThenByDescending(o => o.Name.RemoveSpecialChars().ToLower().Replace(" ", "").StartsWith(wikiStart))
- .ThenByDescending(o => o.Name.RemoveSpecialChars().ToLower().Replace(" ", "").Contains(wikiName))
+ .OrderByDescending(o => o.Name.RemoveSpecialChars().ToLower().Replace(" ", "").StartsWith(_wikiNameVideoGame))
+ .ThenByDescending(o => o.Name.RemoveSpecialChars().ToLower().Replace(" ", "").StartsWith(_wikiStart))
+ .ThenByDescending(o => o.Name.RemoveSpecialChars().ToLower().Replace(" ", "").Contains(_wikiName))
.ThenByDescending(o => o.Description != null && o.Description.Contains("video game"))
.ToList();
}
diff --git a/Metadata/WikipediaMetadata/HtmlParser.cs b/Metadata/WikipediaMetadata/HtmlParser.cs
index a6891b6bf..1d91937d0 100644
--- a/Metadata/WikipediaMetadata/HtmlParser.cs
+++ b/Metadata/WikipediaMetadata/HtmlParser.cs
@@ -15,19 +15,19 @@ namespace WikipediaMetadata
///
public class HtmlParser
{
+ private readonly PluginSettings _settings;
+
public string Description { get; set; } = string.Empty;
public List Links { get; } = new List();
- private readonly PluginSettings settings;
-
///
/// Creates an instance of the class, fetches the html code and parses it.
///
/// Key of the page we want to parse
- /// Settings of the plugin
+ /// Settings of the _plugin
public HtmlParser(string gameKey, PluginSettings settings)
{
- this.settings = settings;
+ _settings = settings;
// All paragraphs we want to remove from the description by default.
List unwantedParagraphs = new List()
@@ -175,7 +175,7 @@ private void AddSectionToDescription(HtmlNode node)
/// Gets the external links from the provided node.
///
/// Node with the links to add.
- public void GetExternalLinks(HtmlNode node)
+ private void GetExternalLinks(HtmlNode node)
{
// We now fetch the ul or ol list and go through all list items to fetch the links.
HtmlNode linkList = node.SelectSingleNode("./ul[not(contains(@class,'portalbox'))]") ?? node.SelectSingleNode("./ol[not(contains(@class,'portalbox'))]");
@@ -241,7 +241,7 @@ private HtmlNode RemoveUnwantedTags(HtmlNode htmlNode, string[] acceptableTags)
List acceptableTagList = acceptableTags.ToList();
- if (!settings.RemoveDescriptionLinks)
+ if (!_settings.RemoveDescriptionLinks)
{
acceptableTagList.AddMissing("a");
}
diff --git a/Metadata/WikipediaMetadata/MetadataProvider.cs b/Metadata/WikipediaMetadata/MetadataProvider.cs
index 8ac1c2e7e..2e4a9f155 100644
--- a/Metadata/WikipediaMetadata/MetadataProvider.cs
+++ b/Metadata/WikipediaMetadata/MetadataProvider.cs
@@ -11,19 +11,17 @@ namespace WikipediaMetadata
{
public class MetadataProvider : OnDemandMetadataProvider
{
- private readonly MetadataRequestOptions options;
- private readonly WikipediaMetadata plugin;
+ private readonly MetadataRequestOptions _options;
+ private readonly WikipediaMetadata _plugin;
+ private WikipediaGameMetadata _foundGame;
+ private HtmlParser _htmlParser;
- private WikipediaGameMetadata foundGame;
-
- private HtmlParser htmlParser;
-
- public override List AvailableFields => plugin.SupportedFields;
+ public override List AvailableFields => _plugin.SupportedFields;
public MetadataProvider(MetadataRequestOptions options, WikipediaMetadata plugin)
{
- this.options = options;
- this.plugin = plugin;
+ _options = options;
+ _plugin = plugin;
}
///
@@ -33,9 +31,9 @@ public MetadataProvider(MetadataRequestOptions options, WikipediaMetadata plugin
private WikipediaGameMetadata FindGame()
{
// If we already found the game, we simply return it.
- if (foundGame != null)
+ if (_foundGame != null)
{
- return foundGame;
+ return _foundGame;
}
WikipediaPage page = new WikipediaPage();
@@ -43,12 +41,12 @@ private WikipediaGameMetadata FindGame()
try
{
- GameFinder gameFinder = new GameFinder(plugin.Settings.Settings);
+ GameFinder gameFinder = new GameFinder(_plugin.Settings.Settings);
string key = string.Empty;
- if (options.IsBackgroundDownload)
+ if (_options.IsBackgroundDownload)
{
- Page foundPage = gameFinder.FindGame(options.GameData.Name);
+ Page foundPage = gameFinder.FindGame(_options.GameData.Name);
if (foundPage != null)
{
@@ -57,7 +55,7 @@ private WikipediaGameMetadata FindGame()
}
else
{
- GenericItemOption chosen = plugin.PlayniteApi.Dialogs.ChooseItemWithSearch(null, gameFinder.GetSearchResults, options.GameData.Name, $"{plugin.Name}: {ResourceProvider.GetString("LOCWikipediaMetadataSearchDialog")}");
+ GenericItemOption chosen = _plugin.PlayniteApi.Dialogs.ChooseItemWithSearch(null, gameFinder.GetSearchResults, _options.GameData.Name, $"{_plugin.Name}: {ResourceProvider.GetString("LOCWikipediaMetadataSearchDialog")}");
if (chosen != null)
{
@@ -76,7 +74,7 @@ private WikipediaGameMetadata FindGame()
Log.Error(ex, $"Error loading data from Wikipedia");
}
- return foundGame = new WikitextParser(plugin.Settings.Settings, page, plugin.PlayniteApi.Database.Platforms).GameMetadata;
+ return _foundGame = new WikitextParser(_plugin.Settings.Settings, page, _plugin.PlayniteApi.Database.Platforms).GameMetadata;
}
///
@@ -86,13 +84,13 @@ private WikipediaGameMetadata FindGame()
/// Parsed result with the description and additional links
private HtmlParser ParseHtml(string key)
{
- if (htmlParser != null)
+ if (_htmlParser != null)
{
- return htmlParser;
+ return _htmlParser;
}
else
{
- return htmlParser = new HtmlParser(key, plugin.Settings.Settings);
+ return _htmlParser = new HtmlParser(key, _plugin.Settings.Settings);
}
}
diff --git a/Metadata/WikipediaMetadata/Models/PluginSettings.cs b/Metadata/WikipediaMetadata/Models/PluginSettings.cs
index 38212e43f..212950ee9 100644
--- a/Metadata/WikipediaMetadata/Models/PluginSettings.cs
+++ b/Metadata/WikipediaMetadata/Models/PluginSettings.cs
@@ -5,29 +5,29 @@ namespace WikipediaMetadata.Models
{
public class PluginSettings : ObservableObject
{
- private DateToUse dateToUse = DateToUse.Earliest;
- private RatingToUse ratingToUse = RatingToUse.Average;
- private bool advancedSearchResultSorting = true;
- private bool arcadeSystemAsPlatform = false;
- private bool removeDescriptionLinks = false;
- private bool descriptionOverviewOnly = false;
- private ObservableCollection sectionsToRemove = new ObservableCollection();
- private ObservableCollection tagSettings;
+ private DateToUse _dateToUse = DateToUse.Earliest;
+ private RatingToUse _ratingToUse = RatingToUse.Average;
+ private bool _advancedSearchResultSorting = true;
+ private bool _arcadeSystemAsPlatform = false;
+ private bool _removeDescriptionLinks = false;
+ private bool _descriptionOverviewOnly = false;
+ private ObservableCollection _sectionsToRemove = new ObservableCollection();
+ private ObservableCollection _tagSettings;
- public DateToUse DateToUse { get => dateToUse; set => SetValue(ref dateToUse, value); }
- public RatingToUse RatingToUse { get => ratingToUse; set => SetValue(ref ratingToUse, value); }
- public bool AdvancedSearchResultSorting { get => advancedSearchResultSorting; set => SetValue(ref advancedSearchResultSorting, value); }
- public bool ArcadeSystemAsPlatform { get => arcadeSystemAsPlatform; set => SetValue(ref arcadeSystemAsPlatform, value); }
- public bool RemoveDescriptionLinks { get => removeDescriptionLinks; set => SetValue(ref removeDescriptionLinks, value); }
- public bool DescriptionOverviewOnly { get => descriptionOverviewOnly; set => SetValue(ref descriptionOverviewOnly, value); }
- public ObservableCollection SectionsToRemove { get => sectionsToRemove; set => SetValue(ref sectionsToRemove, value); }
- public ObservableCollection TagSettings { get => tagSettings; set => SetValue(ref tagSettings, value); }
+ public DateToUse DateToUse { get => _dateToUse; set => SetValue(ref _dateToUse, value); }
+ public RatingToUse RatingToUse { get => _ratingToUse; set => SetValue(ref _ratingToUse, value); }
+ public bool AdvancedSearchResultSorting { get => _advancedSearchResultSorting; set => SetValue(ref _advancedSearchResultSorting, value); }
+ public bool ArcadeSystemAsPlatform { get => _arcadeSystemAsPlatform; set => SetValue(ref _arcadeSystemAsPlatform, value); }
+ public bool RemoveDescriptionLinks { get => _removeDescriptionLinks; set => SetValue(ref _removeDescriptionLinks, value); }
+ public bool DescriptionOverviewOnly { get => _descriptionOverviewOnly; set => SetValue(ref _descriptionOverviewOnly, value); }
+ public ObservableCollection SectionsToRemove { get => _sectionsToRemove; set => SetValue(ref _sectionsToRemove, value); }
+ public ObservableCollection TagSettings { get => _tagSettings; set => SetValue(ref _tagSettings, value); }
public void PopulateTagSettings()
{
- if (tagSettings is null)
+ if (_tagSettings is null)
{
- tagSettings = new ObservableCollection
+ _tagSettings = new ObservableCollection
{
new TagSetting()
{
diff --git a/Metadata/WikipediaMetadata/Models/WikipediaGameMetadata.cs b/Metadata/WikipediaMetadata/Models/WikipediaGameMetadata.cs
index c29ee7a23..641c4b88e 100644
--- a/Metadata/WikipediaMetadata/Models/WikipediaGameMetadata.cs
+++ b/Metadata/WikipediaMetadata/Models/WikipediaGameMetadata.cs
@@ -6,7 +6,7 @@ namespace WikipediaMetadata.Models
///
/// Class with all relevant metadata fields
///
- public class WikipediaGameMetadata
+ internal class WikipediaGameMetadata
{
///
/// Name of the game
diff --git a/Metadata/WikipediaMetadata/Resources.cs b/Metadata/WikipediaMetadata/Resources.cs
index e680a208a..811581dca 100644
--- a/Metadata/WikipediaMetadata/Resources.cs
+++ b/Metadata/WikipediaMetadata/Resources.cs
@@ -20,52 +20,52 @@ public enum RatingToUse
///
/// contains several resources needed to parse the wikipedia data
///
- public static class Resources
+ internal static class Resources
{
///
/// Possible names for video game info box templates.
///
- public static readonly string[] InfoBoxVideoGameTemplateNames = { "infobox video game", "infobox vg" };
+ internal static readonly string[] InfoBoxVideoGameTemplateNames = { "infobox video game", "infobox vg" };
///
/// names of all list templates used to split values.
///
- public static readonly string[] ListTemplateNames = { "unbulleted list", "ubl", "collapsible list", "flatlist", "plainlist", "vgrelease", "video game release" };
+ internal static readonly string[] ListTemplateNames = { "unbulleted list", "ubl", "collapsible list", "flatlist", "plainlist", "vgrelease", "video game release" };
///
/// Possible names for video game release templates. Is needed to remove the country value from the list of platforms.
///
- public static readonly string[] VgReleaseTemplateNames = { "vgrelease", "video game release" };
+ internal static readonly string[] VgReleaseTemplateNames = { "vgrelease", "video game release" };
///
/// Templates that will be removed from the results.
///
- public static readonly string[] UnwantedTemplateNames = { "efn", "cite web" };
+ internal static readonly string[] UnwantedTemplateNames = { "efn", "cite web" };
///
/// Templates that will treated like their own list of values.
///
- public static readonly string[] AllowedSubListTemplates = { "nobold", "nowrap", "start date" };
+ internal static readonly string[] AllowedSubListTemplates = { "nobold", "nowrap", "start date" };
///
/// Array of strings to separate the values by.
///
- public static readonly string[] StringSeparators = { "
", "
", "
", "\n" };
+ internal static readonly string[] StringSeparators = { "
", "
", "
", "\n" };
///
/// Typical date formats from wikipedia pages.
///
- public static readonly string[] DateFormatStringsFull = { "MM/dd/yyyy", "MMMM d, yyyy", "d MMMM yyyy", "yyyy-MM-dd" };
+ internal static readonly string[] DateFormatStringsFull = { "MM/dd/yyyy", "MMMM d, yyyy", "d MMMM yyyy", "yyyy-MM-dd" };
///
/// Typical date formats from wikipedia pages.
///
- public static readonly string[] DateFormatStringsYearMonth = { "MM/yyyy", "MMMM, yyyy", "MMMM yyyy", "yyyy-MM" };
+ internal static readonly string[] DateFormatStringsYearMonth = { "MM/yyyy", "MMMM, yyyy", "MMMM yyyy", "yyyy-MM" };
///
/// List of all possible platform codes for metacritic ratings.
///
- public static readonly List PlatformCodes = new List {
+ internal static readonly List PlatformCodes = new List {
"3DO", "3DS", "AMI", "ARC", "A2600", "JAG", "LYNX", "AST", "C64", "CD32", "CV", "DOS", "SDC", "DS", "GB",
"GBA", "GBC", "NGC", "GEN", "iOS", "MAC", "SMS", "MOB", "N-G", "N64", "NES", "NS", "PC", "VITA", "PS", "PS2",
"PS3", "PS4", "PS5", "PSP", "SSAT", "SMD", "SGG", "NSHI", "SNES", "TG16", "WII", "WIIU", "XBOX", "X360",
@@ -74,33 +74,33 @@ public static class Resources
///
/// Url to fetch the HTML of a page.
///
- public static readonly string PageHtmlUrl = "https://en.wikipedia.org/api/rest_v1/page/html/{0}";
+ internal static readonly string PageHtmlUrl = "https://en.wikipedia.org/api/rest_v1/page/html/{0}";
///
/// We only fetch headings, paragraphs, lists and su sections from a section, because stuff like blockquotes or tables
/// don't work well in Playnite and usually aren't essential to the description of a video game.
///
- public static readonly string[] AllowedSecondLevelNodes = { "h2", "p", "ul", "ol", "section" };
+ internal static readonly string[] AllowedSecondLevelNodes = { "h2", "p", "ul", "ol", "section" };
///
/// The same for third levels...
///
- public static readonly string[] AllowedThirdLevelNodes = { "h3", "p", "ul", "ol", "section" };
+ internal static readonly string[] AllowedThirdLevelNodes = { "h3", "p", "ul", "ol", "section" };
///
/// The same for fourth levels...
///
- public static readonly string[] AllowedFourthLevelNodes = { "h4", "p", "ul", "ol" };
+ internal static readonly string[] AllowedFourthLevelNodes = { "h4", "p", "ul", "ol" };
///
/// Array of all in a paragraph accepted tags.
///
- public static readonly string[] AllowedParagraphTags = { "u", "b", "strong", "i", "em", "sub", "sup", "mark", "small", "del", "ins" };
+ internal static readonly string[] AllowedParagraphTags = { "u", "b", "strong", "i", "em", "sub", "sup", "mark", "small", "del", "ins" };
///
/// List of rename patterns for the links
///
- public static readonly List LinkPairs = new List()
+ internal static readonly List LinkPairs = new List()
{
new LinkPair { Contains = "gamefaqs.gamespot.com",
Name = "GameFAQs"},
@@ -122,7 +122,7 @@ public static class Resources
///
/// Simple class for a pair of string values to rename links.
///
- public class LinkPair
+ internal class LinkPair
{
///
/// Value the link must contain
@@ -137,7 +137,7 @@ public class LinkPair
///
/// Simple class for a pair of string values to rename links.
///
- public class PartialDate
+ internal class PartialDate
{
///
/// DateTime representation of the value
diff --git a/Metadata/WikipediaMetadata/Settings.cs b/Metadata/WikipediaMetadata/Settings.cs
index e9583b81f..749ddcc3f 100644
--- a/Metadata/WikipediaMetadata/Settings.cs
+++ b/Metadata/WikipediaMetadata/Settings.cs
@@ -9,16 +9,17 @@ namespace WikipediaMetadata
{
public class WikipediaMetadataSettingsViewModel : ObservableObject, ISettings
{
- private readonly WikipediaMetadata plugin;
+ private readonly WikipediaMetadata _plugin;
+ private PluginSettings _settings;
+
private PluginSettings EditingClone { get; set; }
- private PluginSettings settings;
public PluginSettings Settings
{
- get => settings;
+ get => _settings;
set
{
- settings = value;
+ _settings = value;
OnPropertyChanged();
}
}
@@ -61,10 +62,10 @@ public RelayCommand> RemoveSectionCommand
public WikipediaMetadataSettingsViewModel(WikipediaMetadata plugin)
{
- // Injecting your plugin instance is required for Save/Load method because Playnite saves data to a location based on what plugin requested the operation.
- this.plugin = plugin;
+ // Injecting your _plugin instance is required for Save/Load method because Playnite saves data to a location based on what _plugin requested the operation.
+ this._plugin = plugin;
- // Load saved settings.
+ // Load saved _settings.
PluginSettings savedSettings = plugin.LoadPluginSettings();
// LoadPluginSettings returns null if no saved data is available.
@@ -83,7 +84,7 @@ public WikipediaMetadataSettingsViewModel(WikipediaMetadata plugin)
{
Settings.PopulateTagSettings();
}
- // Hotfix to a bug that duplicated the tag settings in version 1.3 and 1.4
+ // Hotfix to a bug that duplicated the tag _settings in version 1.3 and 1.4
else if (Settings.TagSettings.Count > 9)
{
while (Settings.TagSettings.Count > 9)
@@ -95,7 +96,7 @@ public WikipediaMetadataSettingsViewModel(WikipediaMetadata plugin)
public void BeginEdit()
{
- // Code executed when settings view is opened and user starts editing values.
+ // Code executed when _settings view is opened and user starts editing values.
EditingClone = Serialization.GetClone(Settings);
}
@@ -109,8 +110,8 @@ public void CancelEdit()
public void EndEdit()
{
// Code executed when user decides to confirm changes made since BeginEdit was called.
- // This method should save settings made to Option1 and ArcadeSystemAsPlatform.
- plugin.SavePluginSettings(Settings);
+ // This method should save _settings made to Option1 and ArcadeSystemAsPlatform.
+ _plugin.SavePluginSettings(Settings);
}
public bool VerifySettings(out List errors)
diff --git a/Metadata/WikipediaMetadata/WikitextParser.cs b/Metadata/WikipediaMetadata/WikitextParser.cs
index 5e6beb0ab..2f234aab7 100644
--- a/Metadata/WikipediaMetadata/WikitextParser.cs
+++ b/Metadata/WikipediaMetadata/WikitextParser.cs
@@ -14,21 +14,21 @@ namespace WikipediaMetadata
///
/// Parses the given wikitext to get the relevant metadata informations.
///
- public class WikitextParser
+ internal class WikitextParser
{
- private readonly PluginSettings settings;
+ private readonly PluginSettings _settings;
public WikipediaGameMetadata GameMetadata { get; set; }
///
/// Creates an instance of the class and fills the parameters by parsing the wikitext.
///
- /// Settings of the plugin
+ /// Settings of the _plugin
/// Page object from wikipedia containing the wikitext and other data.
/// List of all platforms in the database
public WikitextParser(PluginSettings settings, WikipediaPage gameData, IItemCollection platformList)
{
- this.settings = settings;
+ this._settings = settings;
GameMetadata = new WikipediaGameMetadata();
@@ -240,7 +240,7 @@ private List GetValues(Template infoBox, string field, bool re
}
}
- // If dates were found, We'll return the one depending on the settings.
+ // If dates were found, We'll return the one depending on the _settings.
if (dates.Count > 0)
{
foreach (PartialDate date in dates)
@@ -258,7 +258,7 @@ private List GetValues(Template infoBox, string field, bool re
PartialDate dateToUse = null;
- switch (settings.DateToUse)
+ switch (_settings.DateToUse)
{
case DateToUse.Earliest:
dateToUse = dates.OrderBy(d => d.Date).First();
@@ -397,7 +397,7 @@ private int GetCriticScore(Wikitext ast)
// If we found ratings, we return the average rating.
if (ratings.Count > 0)
{
- switch (settings.RatingToUse)
+ switch (_settings.RatingToUse)
{
case RatingToUse.Lowest: return ratings.Min();
case RatingToUse.Highest: return ratings.Max();
@@ -530,7 +530,7 @@ private TemplateArgument StripUnwantedElements(TemplateArgument argument)
///
/// name of the template
/// The cleaned up name
- public string CleanTemplateName(string name)
+ private string CleanTemplateName(string name)
{
if (name.IndexOf("\n") > 0)
{