public string GetShortNameByType(VMWareInfo.VMCoreTypes type) { if (map_type_to_short_name.ContainsKey(type)) return map_type_to_short_name[type]; else return map_type_to_short_name[VMWareInfo.VMCoreTypes.UNKNOWN]; }
public Service(string vmx_file, VMWareInfo.VMCoreTypes vm_target) : base() { SetServiceBehavior(); _vmx_file = vmx_file; try { if (IsUsingApi) { _control = new VMControllerByAPI(vm_target); } else { _control = new VMControllerByVMRun(vm_target); } } catch (VMXServiceException) { _invalid_state = true; WriteLog("Failed To Initialize VMWare controller!", EventLogEntryType.Error); return; } if (!File.Exists(_vmx_file)) { WriteLog("Specified vmx file '{0}' does not exists!", EventLogEntryType.FailureAudit, _vmx_file); _invalid_state = true; return; } _timer = new Timer(TimeSpan.FromSeconds(20).TotalMilliseconds); _timer.Elapsed += new ElapsedEventHandler(OnTimerEvent); _timer.Enabled = false; }
public VMControllerByVMRun(VMWareInfo.VMCoreTypes type) { VMWareInfo vm_info = new VMWareInfo(); _vmware_core = GetTargetNameByType(type); _vmrun_path = vm_info.PathToVMRun; }
protected string GetTargetNameByType(VMWareInfo.VMCoreTypes type) { if (map_type_to_target.ContainsKey(type)) return map_type_to_target[type]; else return map_type_to_target[VMWareInfo.VMCoreTypes.UNKNOWN]; }