Skip to content

Commit

Permalink
Renamed extension from Link Manager to Link Utilities
Browse files Browse the repository at this point in the history
  • Loading branch information
HerrKnarz committed Oct 14, 2022
1 parent 92f7fde commit 478ed78
Show file tree
Hide file tree
Showing 15 changed files with 83 additions and 83 deletions.
20 changes: 10 additions & 10 deletions LinkActions.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Game = Playnite.SDK.Models.Game;

namespace LinkManager
namespace LinkUtilities
{
/// <summary>
/// Interface for classes, that can be used as a link action. Contains texts for the progress bar, result dialog and the action to
Expand All @@ -19,7 +19,7 @@ public interface ILinkAction
/// <summary>
/// Settings to use for the action
/// </summary>
LinkManagerSettings Settings { get; set; }
LinkUtilitiesSettings Settings { get; set; }

/// <summary>
/// Executes the action on a game.
Expand All @@ -36,12 +36,12 @@ public class SortLinks : ILinkAction
{
public string ProgressMessage { get; set; }
public string ResultMessage { get; set; }
public LinkManagerSettings Settings { get; set; }
public LinkUtilitiesSettings Settings { get; set; }

public SortLinks(LinkManagerSettings settings)
public SortLinks(LinkUtilitiesSettings settings)
{
ProgressMessage = "LOCLinkManagerLSortLinksProgress";
ResultMessage = "LOCLinkManagerSortedMessage";
ProgressMessage = "LOCLinkUtilitiesLSortLinksProgress";
ResultMessage = "LOCLinkUtilitiesSortedMessage";
Settings = settings;
}

Expand All @@ -63,12 +63,12 @@ public class AddLibraryLinks : ILinkAction

public string ProgressMessage { get; set; }
public string ResultMessage { get; set; }
public LinkManagerSettings Settings { get; set; }
public LinkUtilitiesSettings Settings { get; set; }

public AddLibraryLinks(LinkManagerSettings settings)
public AddLibraryLinks(LinkUtilitiesSettings settings)
{
ProgressMessage = "LOCLinkManagerLibraryLinkProgress";
ResultMessage = "LOCLinkManagerAddedMessage";
ProgressMessage = "LOCLinkUtilitiesLibraryLinkProgress";
ResultMessage = "LOCLinkUtilitiesAddedMessage";
Settings = settings;

libraries = new Libraries(Settings);
Expand Down
22 changes: 11 additions & 11 deletions LinkAssociations.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
using LinkManager.Models.Gog;
using LinkManager.Models.Itch;
using LinkUtilities.Models.Gog;
using LinkUtilities.Models.Itch;
using System;
using System.Collections.Generic;
using System.Net;
using Game = Playnite.SDK.Models.Game;

namespace LinkManager
namespace LinkUtilities
{
/// <summary>
/// Interface for all the websites a link can be added to
Expand All @@ -27,7 +27,7 @@ interface ILinkAssociation
/// <summary>
/// Settings to be used
/// </summary>
LinkManagerSettings Settings { get; set; }
LinkUtilitiesSettings Settings { get; set; }

/// <summary>
/// Adds a link to the specific game page of the specified website.
Expand All @@ -47,15 +47,15 @@ class SteamLink : ILinkAssociation
public Guid AssociationId { get; set; }
public string LinkName { get; set; }
public string LinkUrl { get; set; }
public LinkManagerSettings Settings { get; set; }
public LinkUtilitiesSettings Settings { get; set; }

public bool AddLink(Game game)
{
// Adding a link to steam is extremely simple. You only have to add the GameId to the base URL.
return LinkHelper.AddLink(game, LinkName, string.Format(LinkUrl, game.GameId));
}

public SteamLink(LinkManagerSettings settings)
public SteamLink(LinkUtilitiesSettings settings)
{
AssociationId = Guid.Parse("cb91dfc9-b977-43bf-8e70-55f46e410fab");
LinkName = "Steam";
Expand All @@ -72,7 +72,7 @@ class GogLink : ILinkAssociation
public Guid AssociationId { get; set; }
public string LinkName { get; set; }
public string LinkUrl { get; set; }
public LinkManagerSettings Settings { get; set; }
public LinkUtilitiesSettings Settings { get; set; }

public bool AddLink(Game game)
{
Expand All @@ -88,7 +88,7 @@ public bool AddLink(Game game)
return LinkHelper.AddLink(game, LinkName, gogMetaData.Links.Store.Href);
}

public GogLink(LinkManagerSettings settings)
public GogLink(LinkUtilitiesSettings settings)
{
AssociationId = Guid.Parse("aebe8b7c-6dc3-4a66-af31-e7375c6b5e9e");
LinkName = "GOG";
Expand All @@ -105,7 +105,7 @@ class ItchLink : ILinkAssociation
public Guid AssociationId { get; set; }
public string LinkName { get; set; }
public string LinkUrl { get; set; }
public LinkManagerSettings Settings { get; set; }
public LinkUtilitiesSettings Settings { get; set; }

public bool AddLink(Game game)
{
Expand All @@ -128,7 +128,7 @@ public bool AddLink(Game game)
}
}

public ItchLink(LinkManagerSettings settings)
public ItchLink(LinkUtilitiesSettings settings)
{
AssociationId = Guid.Parse("00000001-ebb2-4eec-abcb-7c89937a42bb");
LinkName = "Itch";
Expand All @@ -142,7 +142,7 @@ public ItchLink(LinkManagerSettings settings)
/// </summary>
class Libraries : List<ILinkAssociation>
{
public Libraries(LinkManagerSettings settings)
public Libraries(LinkUtilitiesSettings settings)
{
Add(new SteamLink(settings));
Add(new GogLink(settings));
Expand Down
4 changes: 2 additions & 2 deletions LinkHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
using System.Collections.ObjectModel;
using System.Linq;

namespace LinkManager
namespace LinkUtilities
{
/// <summary>
/// Helper class containing functions used in the link manager
/// Helper class containing functions used in the link utilities extension
/// </summary>
internal class LinkHelper
{
Expand Down
12 changes: 0 additions & 12 deletions LinkManagerSettingsView.xaml.cs

This file was deleted.

22 changes: 11 additions & 11 deletions LinkManager.cs → LinkUtilities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
using System.Windows.Controls;
using Game = Playnite.SDK.Models.Game;

namespace LinkManager
namespace LinkUtilities
{
/// <summary>
/// Class of the actual playnite extension
/// </summary>
public class LinkManager : GenericPlugin
public class LinkUtilities : GenericPlugin
{
/// <summary>
/// Class to sort the links of a game
Expand All @@ -23,9 +23,9 @@ public class LinkManager : GenericPlugin
/// </summary>
public AddLibraryLinks AddLibraryLinks;

public LinkManager(IPlayniteAPI api) : base(api)
public LinkUtilities(IPlayniteAPI api) : base(api)
{
Settings = new LinkManagerSettingsViewModel(this);
Settings = new LinkUtilitiesSettingsViewModel(this);
Properties = new GenericPluginProperties
{
HasSettings = true
Expand Down Expand Up @@ -55,7 +55,7 @@ private void DoForAll(List<Game> games, ILinkAction linkAction)
using (PlayniteApi.Database.BufferedUpdate())
{
GlobalProgressOptions globalProgressOptions = new GlobalProgressOptions(
$"LinkManager - {ResourceProvider.GetString(linkAction.ProgressMessage)}",
$"LinkUtilities - {ResourceProvider.GetString(linkAction.ProgressMessage)}",
true
)
{
Expand Down Expand Up @@ -85,7 +85,7 @@ private void DoForAll(List<Game> games, ILinkAction linkAction)
}
catch (Exception ex)
{
logger.Info("LinkManager:" + ex.Message);
logger.Info("LinkUtilities:" + ex.Message);
}
}, globalProgressOptions);

Expand All @@ -98,14 +98,14 @@ private void DoForAll(List<Game> games, ILinkAction linkAction)

public override IEnumerable<GameMenuItem> GetGameMenuItems(GetGameMenuItemsArgs args)
{
string menuSection = ResourceProvider.GetString("LOCLinkManagerName");
string menuSection = ResourceProvider.GetString("LOCLinkUtilitiesName");

return new List<GameMenuItem>
{
// Adds the "sort links" item to the game menu.
new GameMenuItem
{
Description = ResourceProvider.GetString("LOCLinkManagerSortLinks"),
Description = ResourceProvider.GetString("LOCLinkUtilitiesSortLinks"),
MenuSection = menuSection,
Action = a =>
{
Expand All @@ -116,7 +116,7 @@ public override IEnumerable<GameMenuItem> GetGameMenuItems(GetGameMenuItemsArgs
// Adds the "add library links" item to the game menu.
new GameMenuItem
{
Description = ResourceProvider.GetString("LOCLinkManagerAddLibraryLink"),
Description = ResourceProvider.GetString("LOCLinkUtilitiesAddLibraryLink"),
MenuSection = menuSection,
Action = a =>
{
Expand All @@ -132,7 +132,7 @@ public override IEnumerable<GameMenuItem> GetGameMenuItems(GetGameMenuItemsArgs
/// <summary>
/// The settings view model of the extension
/// </summary>
public LinkManagerSettingsViewModel Settings { get; set; }
public LinkUtilitiesSettingsViewModel Settings { get; set; }

/// <summary>
/// The global GUID to identify the extension in playnite
Expand All @@ -156,7 +156,7 @@ public override ISettings GetSettings(bool firstRunSettings)
/// <returns>Settings view</returns>
public override UserControl GetSettingsView(bool firstRunSettings)
{
return new LinkManagerSettingsView();
return new LinkUtilitiesSettingsView();
}
}
}
14 changes: 7 additions & 7 deletions LinkManager.csproj → LinkUtilities.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
<ProjectGuid>{4FDF1E89-5BC3-4C72-8FDA-0D580E7A5D5F}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>LinkManager</RootNamespace>
<AssemblyName>LinkManager</AssemblyName>
<RootNamespace>LinkUtilities</RootNamespace>
<AssemblyName>LinkUtilities</AssemblyName>
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
Expand Down Expand Up @@ -58,10 +58,10 @@
<Compile Include="Models\GogMetaData.cs" />
<Compile Include="LinkHelper.cs" />
<Compile Include="LinkAssociations.cs" />
<Compile Include="LinkManager.cs" />
<Compile Include="LinkManagerSettings.cs" />
<Compile Include="LinkManagerSettingsView.xaml.cs">
<DependentUpon>LinkManagerSettingsView.xaml</DependentUpon>
<Compile Include="LinkUtilities.cs" />
<Compile Include="LinkUtilitiesSettings.cs" />
<Compile Include="LinkUtilitiesSettingsView.xaml.cs">
<DependentUpon>LinkUtilitiesSettingsView.xaml</DependentUpon>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
Expand All @@ -73,7 +73,7 @@
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<Page Include="LinkManagerSettingsView.xaml">
<Page Include="LinkUtilitiesSettingsView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
Expand Down
2 changes: 1 addition & 1 deletion LinkManager.sln → LinkUtilities.sln
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.3.32901.215
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LinkManager", "LinkManager.csproj", "{4FDF1E89-5BC3-4C72-8FDA-0D580E7A5D5F}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LinkUtilities", "LinkUtilities.csproj", "{4FDF1E89-5BC3-4C72-8FDA-0D580E7A5D5F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down
20 changes: 10 additions & 10 deletions LinkManagerSettings.cs → LinkUtilitiesSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
using Playnite.SDK.Data;
using System.Collections.Generic;

namespace LinkManager
namespace LinkUtilities
{
/// <summary>
/// Contains all settings for the extension
/// </summary>
public class LinkManagerSettings : ObservableObject
public class LinkUtilitiesSettings : ObservableObject
{
private string itchApiKey = string.Empty;

Expand All @@ -17,13 +17,13 @@ public class LinkManagerSettings : ObservableObject
public string ItchApiKey { get => itchApiKey; set => SetValue(ref itchApiKey, value); }
}

public class LinkManagerSettingsViewModel : ObservableObject, ISettings
public class LinkUtilitiesSettingsViewModel : ObservableObject, ISettings
{
private readonly LinkManager plugin;
private LinkManagerSettings EditingClone { get; set; }
private readonly LinkUtilities plugin;
private LinkUtilitiesSettings EditingClone { get; set; }

private LinkManagerSettings settings;
public LinkManagerSettings Settings
private LinkUtilitiesSettings settings;
public LinkUtilitiesSettings Settings
{
get => settings;
set
Expand All @@ -33,13 +33,13 @@ public LinkManagerSettings Settings
}
}

public LinkManagerSettingsViewModel(LinkManager plugin)
public LinkUtilitiesSettingsViewModel(LinkUtilities 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.
LinkManagerSettings savedSettings = plugin.LoadPluginSettings<LinkManagerSettings>();
LinkUtilitiesSettings savedSettings = plugin.LoadPluginSettings<LinkUtilitiesSettings>();

// LoadPluginSettings returns null if not saved data is available.
if (savedSettings != null)
Expand All @@ -48,7 +48,7 @@ public LinkManagerSettingsViewModel(LinkManager plugin)
}
else
{
Settings = new LinkManagerSettings();
Settings = new LinkUtilitiesSettings();
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<UserControl x:Class="LinkManager.LinkManagerSettingsView"
<UserControl x:Class="LinkUtilities.LinkUtilitiesSettingsView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:linkmanager="clr-namespace:LinkManager"
d:DataContext="{d:DesignInstance Type=linkmanager:LinkManagerSettingsViewModel}"
xmlns:linkutilities="clr-namespace:LinkUtilities"
d:DataContext="{d:DesignInstance Type=linkutilities:LinkUtilitiesSettingsViewModel}"
mc:Ignorable="d"
d:DesignHeight="400" d:DesignWidth="600">
<StackPanel>
<TextBlock Text="{DynamicResource LOCLinkManagerSettingsItchApiKey}" Margin="20,20,20,0"/>
<TextBlock Text="{DynamicResource LOCLinkUtilitiesSettingsItchApiKey}" Margin="20,20,20,0"/>
<TextBox Text="{Binding Settings.ItchApiKey}" Margin="20,5,20,0"/>
</StackPanel>
</UserControl>
12 changes: 12 additions & 0 deletions LinkUtilitiesSettingsView.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using System.Windows.Controls;

namespace LinkUtilities
{
public partial class LinkUtilitiesSettingsView : UserControl
{
public LinkUtilitiesSettingsView()
{
InitializeComponent();
}
}
}
Loading

0 comments on commit 478ed78

Please sign in to comment.