update heh

move to proper persistent
This commit is contained in:
zznty
2022-08-28 02:29:00 +07:00
parent c20e468b99
commit 2f60fc33f6
5 changed files with 10 additions and 8 deletions

View File

@@ -1,5 +1,6 @@
using System.IO; using System.IO;
using System.Windows.Controls; using System.Windows.Controls;
using heh.Utils;
using Torch; using Torch;
using Torch.API; using Torch.API;
using Torch.API.Managers; using Torch.API.Managers;
@@ -11,12 +12,12 @@ namespace LightPerms.Discord;
public class Plugin : TorchPluginBase, IWpfPlugin public class Plugin : TorchPluginBase, IWpfPlugin
{ {
private Persistent<Config> _config = null!; private ProperPersistent<Config> _config = null!;
public override void Init(ITorchBase torch) public override void Init(ITorchBase torch)
{ {
base.Init(torch); base.Init(torch);
_config = Persistent<Config>.Load(Path.Combine(StoragePath, "LightPerms.Discord.cfg")); _config = new(Path.Combine(StoragePath, "LightPerms.Discord.cfg"));
Torch.Managers.GetManager<ITorchSessionManager>().AddFactory(s => new DiscordManager(s.Torch, _config.Data)); Torch.Managers.GetManager<ITorchSessionManager>().AddFactory(s => new DiscordManager(s.Torch, _config.Data));
} }

View File

@@ -2,11 +2,11 @@
<PluginManifest xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <PluginManifest xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Name>LightPerms.Discord</Name> <Name>LightPerms.Discord</Name>
<Guid>d53cf5e6-27ea-491b-9579-8506d93f184b</Guid> <Guid>d53cf5e6-27ea-491b-9579-8506d93f184b</Guid>
<Version>v1.0.1</Version> <Version>v1.0.3</Version>
<Dependencies> <Dependencies>
<PluginDependency> <PluginDependency>
<Plugin>5c3f35b3-ac9d-486f-8559-f931536c6700</Plugin> <Plugin>5c3f35b3-ac9d-486f-8559-f931536c6700</Plugin>
<MinVersion>v1.0.1</MinVersion> <MinVersion>v1.0.3</MinVersion>
</PluginDependency> </PluginDependency>
</Dependencies> </Dependencies>
</PluginManifest> </PluginManifest>

View File

@@ -71,7 +71,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="heh" Version="1.0.4" /> <PackageReference Include="heh" Version="1.0.10" />
<PackageReference Include="PropertyChanged.Fody" Version="4.0.0" PrivateAssets="all" /> <PackageReference Include="PropertyChanged.Fody" Version="4.0.0" PrivateAssets="all" />
</ItemGroup> </ItemGroup>

View File

@@ -1,6 +1,7 @@
using System.IO; using System.IO;
using System.Windows.Controls; using System.Windows.Controls;
using heh; using heh;
using heh.Utils;
using Torch; using Torch;
using Torch.API; using Torch.API;
using Torch.API.Managers; using Torch.API.Managers;
@@ -12,12 +13,12 @@ namespace LightPerms;
public class Plugin : TorchPluginBase, IWpfPlugin public class Plugin : TorchPluginBase, IWpfPlugin
{ {
private Persistent<Config> _config = null!; private ProperPersistent<Config> _config = null!;
public override void Init(ITorchBase torch) public override void Init(ITorchBase torch)
{ {
base.Init(torch); base.Init(torch);
_config = Persistent<Config>.Load(Path.Combine(StoragePath, "LightPerms.cfg")); _config = new(Path.Combine(StoragePath, "LightPerms.cfg"));
Torch.Managers.AddManager(DbManager.Static); Torch.Managers.AddManager(DbManager.Static);
Torch.Managers.AddManager(new PermissionsManager(Torch)); Torch.Managers.AddManager(new PermissionsManager(Torch));
Torch.Managers.GetManager<ITorchSessionManager>().AddFactory(s => new MultiplayerMembersManager(s.Torch)); Torch.Managers.GetManager<ITorchSessionManager>().AddFactory(s => new MultiplayerMembersManager(s.Torch));

View File

@@ -2,5 +2,5 @@
<PluginManifest xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <PluginManifest xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Name>LightPerms</Name> <Name>LightPerms</Name>
<Guid>5c3f35b3-ac9d-486f-8559-f931536c6700</Guid> <Guid>5c3f35b3-ac9d-486f-8559-f931536c6700</Guid>
<Version>v1.0.1</Version> <Version>v1.0.4</Version>
</PluginManifest> </PluginManifest>