public void Flow_Installation(string buildPath, bool checkRemove = true, string language = "English") { UtilProcess.KillProcessByFuzzyName("MasterPlus"); UtilTime.WaitTime(1); var uninstallerPath = UtilRegistry.GetProductInfo("MasterPlus(PER. Only).*", UtilRegistry.ProductInfo.UninstallString); if (!uninstallerPath.Equals(string.Empty)) { WriteConsoleTitle(LaunchTimes, $"Waiting for silent uninstalling. ({2}s)", 2); UtilProcess.StartProcessGetString(uninstallerPath, "/silent"); UtilTime.WaitTime(1); } UtilProcess.StartProcess(buildPath); AT Window_SelectLauguage = new AT().GetElement(PortalObj.Window_SelectLauguage, Timeout = 5, treeScope: AT.TreeScope.Children); AT ComboBox_SelectLauguage = Window_SelectLauguage.GetElement(PortalObj.ComboBox_SelectLauguage); ComboBox_SelectLauguage.DoExpand(); Window_SelectLauguage = new AT().GetElement(PortalObj.Window_SelectLauguage, Timeout = 5, treeScope: AT.TreeScope.Children); //refresh Window_SelectLauguage.GetElement(name: language, treeScope: AT.TreeScope.Descendants).DoSelect(1); AT Button_OK = Window_SelectLauguage.GetElement(PortalObj.Button_Install_OK, Timeout = 2); Button_OK.DoClick(1); AT Window_InstallWizard = new AT().GetElement(PortalObj.Window_InstallWizard, Timeout = 5, treeScope: AT.TreeScope.Children); UtilTime.WaitTime(1); AT Button_RemoveCache = Window_InstallWizard.GetElement(PortalObj.CheckBox_RemoveCache, Timeout = 2); Button_RemoveCache.DoClickPoint(waitTime: 1); AT Button_Next = Window_InstallWizard.GetElement(PortalObj.Button_Next); Button_Next.DoClick(1); AT Button_Location_Next = Window_InstallWizard.GetElement(PortalObj.Button_Location_Next); Button_Location_Next.DoClick(2); try { AT Dialog_FolderExists = Window_InstallWizard.GetElement(PortalObj.Dialog_FolderExists); AT Button_DialogFolderExists_Yes = Dialog_FolderExists.GetElement(PortalObj.Button_DialogFolderExists_Yes); Button_DialogFolderExists_Yes.DoClick(1); } catch (Exception) { } AT Button_SelectStartMemuFolder_Next = Window_InstallWizard.GetElement(PortalObj.Button_SelectStartMemuFolder_Next); Button_SelectStartMemuFolder_Next.DoClick(1); AT Button_AddtionalTask_Next = Window_InstallWizard.GetElement(PortalObj.Button_AddtionalTask_Next); Button_AddtionalTask_Next.DoClick(1); AT Button_ReadyToInstall_Install = Window_InstallWizard.GetElement(PortalObj.Button_ReadyToInstall_Install); Button_ReadyToInstall_Install.DoClick(1); AT CheckBox_LaunchPortal = Window_InstallWizard.GetElement(PortalObj.CheckBox_LaunchPortal, Timeout = 20); AT Button_Finish = Window_InstallWizard.GetElement(PortalObj.Button_Finish); Button_Finish.DoClick(1); AT Window_MasterPlusPer = new AT().GetElement(PortalObj.Window_MasterPlusPer, timeout: 10); }
public void DeleteShareConnect(string ipOrName, string folderName = "") { string para = string.Format(@"use /delete {0}", this.ShareFolderFullPath); try { UtilProcess.StartProcessGetString("net", para); } catch (Exception) { //Logger.LogThrowMessage(string.Format(@"Failed to execute [net {0}]", para), new StackFrame(0).GetMethod().Name, ex.Message); throw new Exception(string.Format(@"Failed to execute [net {0}]", para)); } }
public void PowerOff(int waitSecond = 10) { try { if (IsVmRunning(vmxFullPath)) { string strlist = UtilProcess.StartProcessGetString(VmCmdControl.vmrunInstallFullPath, string.Format("-T ws stop \"{0}\"", this.vmxFullPath)); UtilTime.WaitTime(waitSecond); } } catch (Exception ex) { Logger.LogThrowMessage(string.Format("Failed to power off VM [{0}]", this.vmxFullPath), new StackFrame(0).GetMethod().Name, ex.Message); } }
public void RevertToSnapshot(string revertSnapshotName) { try { string result = UtilProcess.StartProcessGetString(VmCmdControl.vmrunInstallFullPath, string.Format("revertToSnapshot \"{0}\" \"{1}\"", this.vmxFullPath, revertSnapshotName)); if (!result.Equals("")) { throw new Exception(result); } } catch (Exception ex) { Logger.LogThrowMessage(string.Format("Failed to revert Snapshot [{0}] of VM [{1}].", revertSnapshotName, this.vmxFullPath), new StackFrame(0).GetMethod().Name, ex.Message); } }
public void RevertToSnapshot(string revertSnapshotName) { try { var result = UtilProcess.StartProcessGetString(VmrunInstallFullPath, $"revertToSnapshot \"{_vmxFullPath}\" \"{revertSnapshotName}\""); if (!result.Equals("")) { throw new Exception(result); } } catch (Exception ex) { Logger.LogThrowMessage($"Failed to revert Snapshot [{revertSnapshotName}] of VM [{_vmxFullPath}].", new StackFrame(0).GetMethod().Name, ex.Message); } }
public void PowerOn(int waitSecond = 10) { try { string result = UtilProcess.StartProcessGetString(VmCmdControl.vmrunInstallFullPath, string.Format("-T ws start \"{0}\"", this.vmxFullPath)); if (!result.Equals("")) { throw new Exception(result); } UtilTime.WaitTime(waitSecond); } catch (Exception ex) { Logger.LogThrowMessage(string.Format("Failed to power on VM [{0}].", this.vmxFullPath), new StackFrame(0).GetMethod().Name, ex.Message); } }
public void PowerOn(int waitSecond = 10) { try { var result = UtilProcess.StartProcessGetString(VmrunInstallFullPath, $"-T ws start \"{_vmxFullPath}\""); if (!result.Equals("")) { throw new Exception(result); } UtilTime.WaitTime(waitSecond); } catch (Exception ex) { Logger.LogThrowMessage($"Failed to power on VM [{_vmxFullPath}].", new StackFrame(0).GetMethod().Name, ex.Message); } }
public void PowerOff(int waitSecond = 10) { try { if (!IsVmRunning(_vmxFullPath)) { return; } UtilProcess.StartProcessGetString(VmrunInstallFullPath, $"-T ws stop \"{_vmxFullPath}\""); UtilTime.WaitTime(waitSecond); } catch (Exception ex) { Logger.LogThrowMessage($"Failed to power off VM [{_vmxFullPath}]", new StackFrame(0).GetMethod().Name, ex.Message); } }
public void TakeSnapshot(string takeSnapshotName) { try { if (takeSnapshotName.Trim().Equals("")) { throw new Exception("Snapshot was invalid."); } string result = UtilProcess.StartProcessGetString(VmCmdControl.vmrunInstallFullPath, string.Format("snapshot \"{0}\" \"{1}\"", this.vmxFullPath, takeSnapshotName)); if (!result.Equals("")) { throw new Exception(result); } } catch (Exception ex) { Logger.LogThrowMessage(string.Format("Failed to take Snapshot [{0}] of VM [{1}].", takeSnapshotName, this.vmxFullPath), new StackFrame(0).GetMethod().Name, ex.Message); } }
public void ConnectShare(bool isPersistent = true) { string persistentValue = "YES"; if (!isPersistent) { persistentValue = "NO"; } string para = string.Format(@"use {0} {1} {2} /PERSISTENT:{3}", this.ShareFolderFullPath, UserName.Equals("") ? "" : "/User:"******"net", para); } catch (Exception) { //Logger.LogThrowMessage(string.Format(@"Failed to execute [net {0}]", para), new StackFrame(0).GetMethod().Name, ex.Message); throw new Exception(string.Format(@"Failed to execute [net {0}]", para)); } }
public void TakeSnapshot(string takeSnapshotName) { try { if (takeSnapshotName.Trim().Equals("")) { throw new Exception("Snapshot was invalid."); } var result = UtilProcess.StartProcessGetString(VmrunInstallFullPath, $"snapshot \"{_vmxFullPath}\" \"{takeSnapshotName}\""); if (!result.Equals("")) { throw new Exception(result); } } catch (Exception ex) { Logger.LogThrowMessage($"Failed to take Snapshot [{takeSnapshotName}] of VM [{_vmxFullPath}].", new StackFrame(0).GetMethod().Name, ex.Message); } }
public void ConnectShare(bool isPersistent = true) { var persistentValue = "YES"; if (!isPersistent) { persistentValue = "NO"; } var para = $@"use {ShareFolderFullPath} {(UserName.Equals("") ? "" : "/User:"******"; try { UtilProcess.StartProcessGetString("net", para); } catch (Exception) { //Logger.LogThrowMessage(string.Format(@"Failed to execute [net {0}]", para), new StackFrame(0).GetMethod().Name, ex.Message); throw new Exception($@"Failed to execute [net {para}]"); } }