Exemplo n.º 1
0
        /// <summary>
        /// Convert string to VM Info Model
        /// </summary>
        /// <param name="vm">VM Loaded From</param>
        /// <param name="vmStr">vboxmange showvminfo uuid</param>
        /// <param name="getHddInfoAction">function to get disk info</param>
        /// <returns></returns>
        public static VboxVmInfo GetVmInfo(
            VboxVm vm,
            string vmStr,
            Func <Guid, VboxHdd> getHddInfoAction = null)
        {
            var newVm = new VboxVmInfo(vm)
            {
                GetHddInfoAction = getHddInfoAction
            };

            newVm.Parse(vmStr);

            return(newVm);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Convert to Model based on Vm String
        /// </summary>
        /// <param name="vmStr">vm string from vboxmanage list vms</param>
        /// <param name="getInfoStrAction">function for getting VM Info model</param>
        /// <param name="getHddAction">function for getting VM Disk model</param>
        /// <returns></returns>
        public static VboxVm GetVm(
            string vmStr,
            Func <VboxVm, string> getInfoStrAction = null,
            Func <Guid, VboxHdd> getHddAction      = null)
        {
            if (string.IsNullOrWhiteSpace(vmStr))
            {
                return(null);
            }

            var newVm = new VboxVm()
            {
                GetInfoStrAction = getInfoStrAction,
                GetHddAction     = getHddAction
            };

            newVm.Parse(vmStr);

            return(newVm);
        }
Exemplo n.º 3
0
 internal VboxVmInfo(VboxVm vm)
 {
     this.Vm = vm ?? throw new ArgumentNullException(nameof(vm), "Info object requires parent vm object");
 }