﻿using EasyRoslynScript;
using VMLab.Helpers;
using VMLab.Hypervisor;

namespace VMLab.Script
{
    public static class MiscScriptMethods
    {
        public static IEnvironmentHelper EnvironmentHelper { private get; set; }
        public static IProcessRunner ProcessRunner { private get; set; }
        public static IFileSystem FileSystem { private get; set; }

        public static void Sleep(this IScriptContext context, int seconds)
        {
            EnvironmentHelper.Sleep(seconds);
        }

        public static ProcessExecutionResult HostExec(this IScriptContext context, string command)
        {
            return ProcessRunner.Execute(command);
        }

        public static bool HostFileExist(this IScriptContext context, string file)
        {
            return FileSystem.FileExists(file);
        }

        public static bool HostDirectoryExists(this IScriptContext context, string path)
        {
            return FileSystem.DirectoryExists(path);
        }

        public static void HostFileCopy(this IScriptContext context, string source, string destination)
        {
            FileSystem.CopyFile(source, destination);
        }

        public static void HostDeleteFile(this IScriptContext context, string path)
        {
            FileSystem.DeleteFile(path);
        }
    }
}
