private void StartVnc(string userId, VncEntry data) { int result = vncClientImpl.StartClient(data.IpAddress, data.Port); // save to user list int userDBid = ConnectedClientHelper.GetInstance().GetClientInfo(userId).DbUserId; Server.LaunchedVncHelper.GetInstance().AddLaunchedApp(userDBid, result, data.Identifier); }
/// <summary> /// launch remote stored base in db index /// </summary> /// <param name="command"> /// command[0] = "command pattern" /// command[1] = "db index" /// command[2] = "username" /// command[3] = "password" /// </param> /// <returns></returns> public override string executeCommand(string[] command) { if (command.Count() != 4) { throw new Exception(); } List <UserData> userDataList = new List <UserData>(Server.ServerDbHelper.GetInstance().GetAllUsers()); UserData userData = userDataList.Find(user => (user.username.CompareTo(command[2]) == 0 && user.password.CompareTo(command[3]) == 0)); if (userData == null) { // no matched return("Credential verification failed. Please check login info."); } int dbIndex = 0; if (int.TryParse(command[1], out dbIndex) == false) { throw new Exception(); } // get the info from database RemoteVncData vncInfo = Server.ServerDbHelper.GetInstance().GetRemoteVncList().ToList().Find( vncData => vncData.id == dbIndex); if (vncInfo == null) { // no matched return("No matched id found."); } // launch and save the data try { int result = _vncClient.StartClient(vncInfo.remoteIp, vncInfo.remotePort); Server.LaunchedVncHelper.GetInstance().AddLaunchedApp(userData.id, result, dbIndex); } catch (Exception e) { Trace.WriteLine(e.Message); } return("Remote launched successfully"); }
public void LaunchPresetExternal(int dbUserId, int presetDbId) { // get the rect from the preset table PresetData preset = Server.ServerDbHelper.GetInstance().GetPresetByUserId(dbUserId).First(PresetData => PresetData.Id == presetDbId); ClientAppCmdImpl clientImpl = new ClientAppCmdImpl(); foreach (ApplicationData appData in preset.AppDataList) { int result = clientImpl.LaunchApplication(appData); LaunchedWndHelper.GetInstance().AddLaunchedApp(dbUserId, result, appData.id); } // start vnc foreach (RemoteVncData remoteData in preset.VncDataList) { int result = vncClient.StartClient( remoteData.remoteIp, remoteData.remotePort, remoteData.rect.Left, remoteData.rect.Top, remoteData.rect.Right - remoteData.rect.Left, remoteData.rect.Bottom - remoteData.rect.Top); // add to the connected client info LaunchedVncHelper.GetInstance().AddLaunchedApp(dbUserId, result, remoteData.id); } // start source input foreach (VisionData inputData in preset.InputDataList) { int result = ServerVisionHelper.getInstance().LaunchVisionWindow( inputData.id, inputData.rect.Left, inputData.rect.Top, inputData.rect.Right - inputData.rect.Left, inputData.rect.Bottom - inputData.rect.Top); // add to the connected client info LaunchedSourcesHelper.GetInstance().AddLaunchedApp(dbUserId, result, inputData.id); } }
private void StartVnc(VncEntry data) { ClientInfoModel clientInfo = server.GetClientInfo(data.Identifier); vncClientImpl.StartClient(clientInfo.VncInfo.IpAdress, clientInfo.VncInfo.ListeningPort); }