cs-codex-dist-tests/ProjectPlugins/CodexPlugin/Hooks/CodexHooksFactory.cs

45 lines
964 B
C#

namespace CodexPlugin.Hooks
{
public interface ICodexHooksProvider
{
ICodexNodeHooks CreateHooks(string nodeName);
}
public class CodexHooksFactory
{
public ICodexHooksProvider Provider { get; set; } = new DoNothingHooksProvider();
public ICodexNodeHooks CreateHooks(string nodeName)
{
return Provider.CreateHooks(nodeName);
}
}
public class DoNothingHooksProvider : ICodexHooksProvider
{
public ICodexNodeHooks CreateHooks(string nodeName)
{
return new DoNothingCodexHooks();
}
}
public class DoNothingCodexHooks : ICodexNodeHooks
{
public void OnFileDownloaded(ContentId cid)
{
}
public void OnFileUploaded(ContentId cid)
{
}
public void OnNodeStarted(string name, string image)
{
}
public void OnNodeStopping()
{
}
}
}