mirror of
https://github.com/tribufu/ServerManagers
synced 2026-06-01 09:42:39 +00:00
New Fetch Profiles
Added a fetch profile method to the Common Plugin Helper.
This commit is contained in:
parent
0cdd760a48
commit
2df6f0cbaf
4 changed files with 36 additions and 1 deletions
|
|
@ -0,0 +1,7 @@
|
||||||
|
using ServerManagerTool.Plugin.Common.Lib;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace ServerManagerTool.Plugin.Common.Delegates
|
||||||
|
{
|
||||||
|
public delegate IList<Profile> FetchProfilesDelegate();
|
||||||
|
}
|
||||||
8
Plugins/Discord/source/Plugin.Common/Lib/Profile.cs
Normal file
8
Plugins/Discord/source/Plugin.Common/Lib/Profile.cs
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
namespace ServerManagerTool.Plugin.Common.Lib
|
||||||
|
{
|
||||||
|
public class Profile
|
||||||
|
{
|
||||||
|
public string ProfileName { get; set; }
|
||||||
|
public string InstallationFolder { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,4 +1,7 @@
|
||||||
using System;
|
using ServerManagerTool.Plugin.Common.Delegates;
|
||||||
|
using ServerManagerTool.Plugin.Common.Lib;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
|
@ -17,6 +20,8 @@ namespace ServerManagerTool.Plugin.Common
|
||||||
private static readonly object _syncLock = new object();
|
private static readonly object _syncLock = new object();
|
||||||
|
|
||||||
private readonly Object _syncLockProcessAlert = new Object();
|
private readonly Object _syncLockProcessAlert = new Object();
|
||||||
|
private readonly Object _syncLockFetchProfiles = new Object();
|
||||||
|
private FetchProfilesDelegate _fetchProfilesCallback;
|
||||||
private bool _disposed;
|
private bool _disposed;
|
||||||
|
|
||||||
private PluginHelper()
|
private PluginHelper()
|
||||||
|
|
@ -143,6 +148,14 @@ namespace ServerManagerTool.Plugin.Common
|
||||||
File.Delete(pluginFile);
|
File.Delete(pluginFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal IList<Profile> FetchProfileList()
|
||||||
|
{
|
||||||
|
lock (_syncLockFetchProfiles)
|
||||||
|
{
|
||||||
|
return _fetchProfilesCallback?.Invoke() ?? new List<Profile>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
internal void LoadPlugin(string pluginFile)
|
internal void LoadPlugin(string pluginFile)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrWhiteSpace(pluginFile))
|
if (string.IsNullOrWhiteSpace(pluginFile))
|
||||||
|
|
@ -251,6 +264,11 @@ namespace ServerManagerTool.Plugin.Common
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal void SetFetchProfileCallback(FetchProfilesDelegate callback)
|
||||||
|
{
|
||||||
|
_fetchProfilesCallback = callback;
|
||||||
|
}
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
Dispose(true);
|
Dispose(true);
|
||||||
|
|
@ -265,6 +283,7 @@ namespace ServerManagerTool.Plugin.Common
|
||||||
|
|
||||||
if (disposing)
|
if (disposing)
|
||||||
{
|
{
|
||||||
|
_fetchProfilesCallback = null;
|
||||||
_instance = null;
|
_instance = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -37,3 +37,4 @@ using System.Runtime.InteropServices;
|
||||||
[assembly: InternalsVisibleTo("ARK Server Manager")]
|
[assembly: InternalsVisibleTo("ARK Server Manager")]
|
||||||
[assembly: InternalsVisibleTo("ConanServerManager")]
|
[assembly: InternalsVisibleTo("ConanServerManager")]
|
||||||
[assembly: InternalsVisibleTo("ServerManager")]
|
[assembly: InternalsVisibleTo("ServerManager")]
|
||||||
|
[assembly: InternalsVisibleTo("ServerManager.Plugin.Common.UnitTests")]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue