Example #1
0
 private static bool IsICAOkInternal()
 {
     try
     {
         using (var ICA = new AxWFICALib.AxICAClient {
             Parent = frmMain.defaultInstance
         })
         {
             ICA.CreateControl();
             ICAVer = ICA.ClientVersion;
         }
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
Example #2
0
 private static bool IsICAOkInternal()
 {
     try
     {
         using (var ICA = new AxWFICALib.AxICAClient { Parent = frmMain.defaultInstance })
         {
             ICA.CreateControl();
             ICAVer = ICA.ClientVersion;
         }
         return true;
     }
     catch (Exception)
     {
         return false;
     }
 }
        public override bool Connect()
        {
            try
            {
                iIcaClient = new AxWFICALib.AxICAClient();
                ((Control)iIcaClient).DragEnter += new DragEventHandler(ICAConnection_DragEnter);
                ((Control)iIcaClient).DragDrop += new DragEventHandler(ICAConnection_DragDrop);
                iIcaClient.OnDisconnect += new EventHandler(iIcaClient_OnDisconnect);
                iIcaClient.Dock = DockStyle.Fill;

                Controls.Add(iIcaClient);

                string domainName = Favorite.DomainName;
                if(domainName == null || domainName == "") domainName = Settings.DefaultDomain;
                string pass = Favorite.Password;
                if(pass == null || pass == "") pass = Settings.DefaultPassword;
                string userName = Favorite.UserName;
                if(userName == null || userName == "") userName = Settings.DefaultUsername;

                icaPassword = pass;

                //rd.SendSpecialKeys(VncSharp.SpecialKeys);
                iIcaClient.Parent = base.TerminalTabPage;
                this.Parent = TerminalTabPage;
                iIcaClient.Dock = DockStyle.Fill;

                iIcaClient.Address = Favorite.ServerName;
                switch(Favorite.Colors)
                {
                    case Colors.Bit16:
                        iIcaClient.SetProp("DesiredColor", "16");
                        break;
                    case Colors.Bits32:
                        iIcaClient.SetProp("DesiredColor", "32");
                        break;
                    case Colors.Bits8:
                        iIcaClient.SetProp("DesiredColor", "16");
                        break;
                    default:
                        iIcaClient.SetProp("DesiredColor", "24");
                        break;

                }
                iIcaClient.Application = "Terminals " + Program.TerminalsVersion.ToString();

                iIcaClient.AppsrvIni = Favorite.IcaServerINI;
                iIcaClient.WfclientIni = Favorite.IcaClientINI;
                iIcaClient.Encrypt = Favorite.IcaEnableEncryption;
                string encryptLevel = "Encrypt";
                string specifiedLevel = Favorite.IcaEncryptionLevel.Trim();
                if(specifiedLevel.Contains(" ")) {
                    encryptLevel = specifiedLevel.Substring(0, specifiedLevel.IndexOf(" ")).Trim();
                    if(encryptLevel != "") iIcaClient.EncryptionLevelSession = encryptLevel;
                }

                iIcaClient.Domain = domainName;
                iIcaClient.Address = Favorite.ServerName;
                iIcaClient.Username = userName;

                if(Favorite.ICAApplicationName != "")
                {
                    iIcaClient.ConnectionEntry = Favorite.ICAApplicationName;
                    //iIcaClient.Application = favorite.applicationName;
                    iIcaClient.InitialProgram = Favorite.ICAApplicationName;
                    iIcaClient.Application = Favorite.ICAApplicationPath;
                    iIcaClient.WorkDirectory = Favorite.ICAApplicationWorkingFolder;
                }

                Text = "Connecting to ICA Server...";

                iIcaClient.Visible = true;

                iIcaClient.SetProp("ScalingMode", "3");
                iIcaClient.Launch = false;
                iIcaClient.TransportDriver = "TCP/IP";
                iIcaClient.Connect();
                iIcaClient.Focus();

                return true;
            }
            catch(Exception exc)
            {
                Terminals.Logging.Log.Fatal("Connecting to ICA", exc);
                return false;
            }
        }
        private void CheckComponents()
        {
            string errorMsg = Language.strCcNotInstalledProperly;

            pnlCheck1.Visible = true;
            pnlCheck2.Visible = true;
            pnlCheck3.Visible = true;
            pnlCheck4.Visible = true;
            pnlCheck5.Visible = true;

            AxMSTSCLib.AxMsRdpClient5NotSafeForScripting rdpClient = null;

            try
            {
                rdpClient = new AxMSTSCLib.AxMsRdpClient5NotSafeForScripting();
                rdpClient.CreateControl();

                while (!rdpClient.Created)
                {
                    Thread.Sleep(0);
                    System.Windows.Forms.Application.DoEvents();
                }

                if (!(new Version(Convert.ToString(rdpClient.Version)) >= ProtocolRDP.Versions.RDC80))
                {
                    throw (new Exception(string.Format("Found RDC Client version {0} but version {1} or higher is required.", rdpClient.Version, ProtocolRDP.Versions.RDC80)));
                }

                pbCheck1.Image      = Resources.Good_Symbol;
                lblCheck1.ForeColor = Color.DarkOliveGreen;
                lblCheck1.Text      = "RDP (Remote Desktop) " + Language.strCcCheckSucceeded;
                txtCheck1.Text      = string.Format(Language.strCcRDPOK, rdpClient.Version);
            }
            catch (Exception ex)
            {
                pbCheck1.Image      = Resources.Bad_Symbol;
                lblCheck1.ForeColor = Color.Firebrick;
                lblCheck1.Text      = "RDP (Remote Desktop) " + Language.strCcCheckFailed;
                txtCheck1.Text      = Language.strCcRDPFailed;

                Runtime.MessageCollector.AddMessage(Messages.MessageClass.WarningMsg, "RDP " + errorMsg, true);
                Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, ex.Message, true);
            }

            if (rdpClient != null)
            {
                rdpClient.Dispose();
            }


            VncSharp.RemoteDesktop VNC = null;

            try
            {
                VNC = new VncSharp.RemoteDesktop();
                VNC.CreateControl();

                while (!VNC.Created)
                {
                    Thread.Sleep(10);
                    System.Windows.Forms.Application.DoEvents();
                }

                pbCheck2.Image      = Resources.Good_Symbol;
                lblCheck2.ForeColor = Color.DarkOliveGreen;
                lblCheck2.Text      = "VNC (Virtual Network Computing) " + Language.strCcCheckSucceeded;
                txtCheck2.Text      = string.Format(Language.strCcVNCOK, VNC.ProductVersion);
            }
            catch (Exception)
            {
                pbCheck2.Image      = Resources.Bad_Symbol;
                lblCheck2.ForeColor = Color.Firebrick;
                lblCheck2.Text      = "VNC (Virtual Network Computing) " + Language.strCcCheckFailed;
                txtCheck2.Text      = Language.strCcVNCFailed;

                Runtime.MessageCollector.AddMessage(Messages.MessageClass.WarningMsg, "VNC " + errorMsg, true);
            }

            if (VNC != null)
            {
                VNC.Dispose();
            }


            string pPath = "";

            if (Settings.Default.UseCustomPuttyPath == false)
            {
                pPath = GeneralAppInfo.HomePath + "\\PuTTYNG.exe";
            }
            else
            {
                pPath = Convert.ToString(Settings.Default.CustomPuttyPath);
            }

            if (File.Exists(pPath))
            {
                pbCheck3.Image      = Resources.Good_Symbol;
                lblCheck3.ForeColor = Color.DarkOliveGreen;
                lblCheck3.Text      = "PuTTY (SSH/Telnet/Rlogin/RAW) " + Language.strCcCheckSucceeded;
                txtCheck3.Text      = Language.strCcPuttyOK;
            }
            else
            {
                pbCheck3.Image      = Resources.Bad_Symbol;
                lblCheck3.ForeColor = Color.Firebrick;
                lblCheck3.Text      = "PuTTY (SSH/Telnet/Rlogin/RAW) " + Language.strCcCheckFailed;
                txtCheck3.Text      = Language.strCcPuttyFailed;

                Runtime.MessageCollector.AddMessage(Messages.MessageClass.WarningMsg, "PuTTY " + errorMsg, true);
                Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, "File " + pPath + " does not exist.", true);
            }


            AxWFICALib.AxICAClient ICA = null;

            try
            {
                ICA        = new AxWFICALib.AxICAClient();
                ICA.Parent = this;
                ICA.CreateControl();

                while (!ICA.Created)
                {
                    Thread.Sleep(10);
                    System.Windows.Forms.Application.DoEvents();
                }

                pbCheck4.Image      = Resources.Good_Symbol;
                lblCheck4.ForeColor = Color.DarkOliveGreen;
                lblCheck4.Text      = "ICA (Citrix ICA) " + Language.strCcCheckSucceeded;
                txtCheck4.Text      = string.Format(Language.strCcICAOK, ICA.Version);
            }
            catch (Exception ex)
            {
                pbCheck4.Image      = Resources.Bad_Symbol;
                lblCheck4.ForeColor = Color.Firebrick;
                lblCheck4.Text      = "ICA (Citrix ICA) " + Language.strCcCheckFailed;
                txtCheck4.Text      = Language.strCcICAFailed;

                Runtime.MessageCollector.AddMessage(Messages.MessageClass.WarningMsg, "ICA " + errorMsg, true);
                Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, ex.Message, true);
            }

            if (ICA != null)
            {
                ICA.Dispose();
            }


            bool GeckoBad    = false;
            var  GeckoFxPath = Path.Combine(GeneralAppInfo.HomePath, "Firefox");

            if (File.Exists(Path.Combine(GeneralAppInfo.HomePath, "Geckofx-Core.dll")))
            {
                if (Directory.Exists(GeckoFxPath))
                {
                    if (!File.Exists(Path.Combine(GeckoFxPath, "xul.dll")))
                    {
                        GeckoBad = true;
                    }
                }
                else
                {
                    GeckoBad = true;
                }
            }

            if (GeckoBad == false)
            {
                pbCheck5.Image      = Resources.Good_Symbol;
                lblCheck5.ForeColor = Color.DarkOliveGreen;
                lblCheck5.Text      = "Gecko (Firefox) Rendering Engine (HTTP/S) " + Language.strCcCheckSucceeded;
                if (!Xpcom.IsInitialized)
                {
                    Xpcom.Initialize("Firefox");
                }
                txtCheck5.Text = Language.strCcGeckoOK + " Version: " + Xpcom.XulRunnerVersion;
            }
            else
            {
                pbCheck5.Image      = Resources.Bad_Symbol;
                lblCheck5.ForeColor = Color.Firebrick;
                lblCheck5.Text      = "Gecko (Firefox) Rendering Engine (HTTP/S) " + Language.strCcCheckFailed;
                txtCheck5.Text      = Language.strCcGeckoFailed;

                Runtime.MessageCollector.AddMessage(Messages.MessageClass.WarningMsg, "Gecko " + errorMsg, true);
                Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, "GeckoFx was not found in " + GeckoFxPath, true);
            }
        }
Example #5
0
        public override bool Connect()
        {
            try
            {
                iIcaClient = new AxWFICALib.AxICAClient();
                ((Control)iIcaClient).DragEnter += new DragEventHandler(ICAConnection_DragEnter);
                ((Control)iIcaClient).DragDrop  += new DragEventHandler(ICAConnection_DragDrop);
                iIcaClient.OnDisconnect         += new EventHandler(iIcaClient_OnDisconnect);
                iIcaClient.Dock = DockStyle.Fill;


                Controls.Add(iIcaClient);


                string domainName = Favorite.DomainName;
                if (domainName == null || domainName == "")
                {
                    domainName = Settings.DefaultDomain;
                }
                string pass = Favorite.Password;
                if (pass == null || pass == "")
                {
                    pass = Settings.DefaultPassword;
                }
                string userName = Favorite.UserName;
                if (userName == null || userName == "")
                {
                    userName = Settings.DefaultUsername;
                }

                icaPassword = pass;


                //rd.SendSpecialKeys(VncSharp.SpecialKeys);
                iIcaClient.Parent = base.TerminalTabPage;
                this.Parent       = TerminalTabPage;
                iIcaClient.Dock   = DockStyle.Fill;

                iIcaClient.Address = Favorite.ServerName;
                switch (Favorite.Colors)
                {
                case Colors.Bit16:
                    iIcaClient.SetProp("DesiredColor", "16");
                    break;

                case Colors.Bits32:
                    iIcaClient.SetProp("DesiredColor", "32");
                    break;

                case Colors.Bits8:
                    iIcaClient.SetProp("DesiredColor", "16");
                    break;

                default:
                    iIcaClient.SetProp("DesiredColor", "24");
                    break;
                }
                iIcaClient.Application = "Terminals " + Program.TerminalsVersion.ToString();

                iIcaClient.AppsrvIni   = Favorite.IcaServerINI;
                iIcaClient.WfclientIni = Favorite.IcaClientINI;
                iIcaClient.Encrypt     = Favorite.IcaEnableEncryption;
                string encryptLevel   = "Encrypt";
                string specifiedLevel = Favorite.IcaEncryptionLevel.Trim();
                if (specifiedLevel.Contains(" "))
                {
                    encryptLevel = specifiedLevel.Substring(0, specifiedLevel.IndexOf(" ")).Trim();
                    if (encryptLevel != "")
                    {
                        iIcaClient.EncryptionLevelSession = encryptLevel;
                    }
                }



                iIcaClient.Domain   = domainName;
                iIcaClient.Address  = Favorite.ServerName;
                iIcaClient.Username = userName;

                if (Favorite.ICAApplicationName != "")
                {
                    iIcaClient.ConnectionEntry = Favorite.ICAApplicationName;
                    //iIcaClient.Application = favorite.applicationName;
                    iIcaClient.InitialProgram = Favorite.ICAApplicationName;
                    iIcaClient.Application    = Favorite.ICAApplicationPath;
                    iIcaClient.WorkDirectory  = Favorite.ICAApplicationWorkingFolder;
                }


                Text = "Connecting to ICA Server...";

                iIcaClient.Visible = true;

                iIcaClient.SetProp("ScalingMode", "3");
                iIcaClient.Launch          = false;
                iIcaClient.TransportDriver = "TCP/IP";
                iIcaClient.Connect();
                iIcaClient.Focus();


                return(true);
            }
            catch (Exception exc)
            {
                Terminals.Logging.Log.Fatal("Connecting to ICA", exc);
                return(false);
            }
        }