Ignore:
Timestamp:
Dec 24, 2015, 10:43:43 AM (8 years ago)
Author:
Faisal Sami
Message:

ClinicalScheduling version 2.0.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Scheduling/trunk/cs/bsdx0200GUISourceCode/CGDocumentManager.cs

    r1474 r1728  
    3636       
    3737        //Connection variables (tied to command line parameters /a /v /s /p /e)
     38        //New variables for ssh
    3839        private string                      m_AccessCode="";
    3940        private string                      m_VerifyCode="";
    4041        private string                      m_Server="";
     42        private string                      m_SshUser = "";
     43        private string                      m_SshPassword = "";
    4144        private int                         m_Port=0;
    4245        private string                      m_Encoding="";  //Encoding is "" by default;
     46        public Process                     m_SsshProcess;
    4347
    4448        //Globalization Object (tied to command line parameter /culture)
     
    212216                { "v=", v => _current.m_VerifyCode = v },
    213217                { "e=", e => _current.m_Encoding = e},
     218                { "su=",su => _current.m_SshUser = su },
     219                { "sp=",sp => _current.m_SshPassword = sp },
    214220                { "culture=", culture => _current.m_CultureName = culture }
    215221            };
     
    377383            LoginProcess login;
    378384            this.WinFramework = WinFramework.CreateWithNetworkBroker(true, RPCLogger);
     385
     386            if (m_SshUser != "")
     387            {
     388                string path = System.IO.Directory.GetCurrentDirectory();
     389                path = path.Substring(0, path.LastIndexOf('\\'));
     390                //path = path.Substring(0, path.LastIndexOf('\\'));
     391                path = path + '\\' + "Putty\\putty.exe";
     392                if (System.IO.File.Exists(path))
     393                {
     394                    string prms = "-ssh -l " + m_SshUser + " -pw " + m_SshPassword + " -L " + m_Port + ":127.0.0.1:" + m_Port + " " + m_Server;
     395                    //m_SsshProcess = System.Diagnostics.Process.Start(path, prms);
     396                    ProcessStartInfo si = new ProcessStartInfo(path, prms);
     397                    si.WindowStyle = ProcessWindowStyle.Minimized;
     398                    m_SsshProcess = Process.Start(si);
     399                }               
     400            }
    379401           
    380402            if (bReLogin) // if logging in again...
     
    410432                spec.Port = m_Port;
    411433                spec.Server = m_Server;
     434                if (m_SsshProcess != null)
     435                {
     436                    spec.Server = "127.0.0.1";
     437                }
    412438                spec.UseWindowsAuthentication = false; //for now
    413439                spec.UseDefaultNamespace = true; //for now
     
    444470            if (!login.WasSuccessful)
    445471            {
     472                if (m_SsshProcess != null)
     473                {
     474                    if (!m_SsshProcess.HasExited)
     475                    {
     476                        m_SsshProcess.Kill();
     477                    }                   
     478                }
    446479                return false;
    447480            }
     
    451484            if ((this.WinFramework.Context.User.Division == null) && !this.WinFramework.AttemptUserInputSetDivision("Set Initial Division", firstSplash))
    452485            {
     486                if (m_SsshProcess != null)
     487                {
     488                    if (!m_SsshProcess.HasExited)
     489                    {
     490                        m_SsshProcess.Kill();
     491                    }
     492                }
    453493                return false;
    454494            }
     
    650690                    "Version Mismatch");
    651691                closeSplashDelegate();
     692                if (m_SsshProcess != null)
     693                {
     694                    if (!m_SsshProcess.HasExited)
     695                    {
     696                        m_SsshProcess.Kill();
     697                    }
     698                }
    652699                return false;
    653700            }
Note: See TracChangeset for help on using the changeset viewer.