38 lines
1.1 KiB
C#
38 lines
1.1 KiB
C#
using SQLVision.Core.Enums;
|
|
using SQLVision.Core.Models;
|
|
|
|
namespace SQLVision.Core.Interfaces;
|
|
|
|
public interface IScriptManager
|
|
{
|
|
Task<IEnumerable<ScriptMetadata>> LoadScriptsAsync(string? directory = null);
|
|
Task<ScriptMetadata> ReloadScriptAsync(string filePath);
|
|
void WatchDirectory(string directory, Action<string> onScriptChanged);
|
|
|
|
event EventHandler<ScriptChangedEventArgs> ScriptChanged;
|
|
event EventHandler<ScriptsReloadedEventArgs> ScriptsReloaded;
|
|
}
|
|
|
|
public class ScriptChangedEventArgs : EventArgs
|
|
{
|
|
public string FilePath { get; }
|
|
public ScriptChangeType ChangeType { get; }
|
|
public ScriptMetadata? Script { get; }
|
|
|
|
public ScriptChangedEventArgs(string filePath, ScriptChangeType changeType, ScriptMetadata? script = null)
|
|
{
|
|
FilePath = filePath;
|
|
ChangeType = changeType;
|
|
Script = script;
|
|
}
|
|
}
|
|
|
|
public class ScriptsReloadedEventArgs : EventArgs
|
|
{
|
|
public IEnumerable<ScriptMetadata> Scripts { get; }
|
|
|
|
public ScriptsReloadedEventArgs(IEnumerable<ScriptMetadata> scripts)
|
|
{
|
|
Scripts = scripts;
|
|
}
|
|
} |