Ejemplo n.º 1
0
 public void AddRange(Info[] cInfo)
 {
     foreach (Info cI in cInfo)
     {
         List.Add(cI);
     }
 }
 public InterfaceControl(Control Parent, Base Protocol, Info Info)
 {
     try
     {
         this.Protocol = Protocol;
         this.Info = Info;
         this.Parent = Parent;
         this.Location = new Point(0, 0);
         this.Size = this.Parent.Size;
         this.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top;
         InitializeComponent();
     }
     catch (Exception ex)
     {
         Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg,
                                             (string)
                                             ("Couldn\'t create new InterfaceControl" + Constants.vbNewLine +
                                              ex.Message));
     }
 }
Ejemplo n.º 3
0
            private static void CreateADSubNodes(TreeNode rNode, string ldapPath)
            {
                try
                {
                    string strDisplayName;
                    string strDescription;
                    string strHostName;

                    string ldapFilter = "(objectClass=computer)"; //"sAMAccountName=*"

                    DirectorySearcher ldapSearcher = new DirectorySearcher();
                    SearchResultCollection ldapResults;

                    string[] ResultFields = new string[] { "securityEquals", "cn" };

                    ldapSearcher.SearchRoot = new DirectoryEntry(ldapPath);
                    ldapSearcher.PropertiesToLoad.AddRange(ResultFields);
                    ldapSearcher.Filter = ldapFilter;
                    ldapSearcher.SearchScope = SearchScope.OneLevel;
                    ldapResults = ldapSearcher.FindAll();

                    foreach (SearchResult ldapResult in ldapResults)
                    {
                        System.DirectoryServices.DirectoryEntry with_2 = ldapResult.GetDirectoryEntry();
                        strDisplayName = (string)(with_2.Properties["cn"].Value);
                        strDescription = (string)(with_2.Properties["Description"].Value);
                        strHostName = (string)(with_2.Properties["dNSHostName"].Value);

                        TreeNode adNode = Tree.Node.AddNode(Type.Connection, strDisplayName);

                        Info nConI = new Info();
                        Info.Inheritance nInh = new Info.Inheritance(nConI, true);
                        nInh.Description = false;
                        if (rNode.Tag is Container.Info)
                        {
                            nConI.Parent = rNode.Tag;
                        }
                        nConI.Inherit = nInh;
                        nConI.Name = strDisplayName;
                        nConI.Hostname = strHostName;
                        nConI.Description = strDescription;
                        nConI.TreeNode = adNode;
                        adNode.Tag = nConI; //set the nodes tag to the conI
                        //add connection to connections
                        Runtime.ConnectionList.Add(nConI);

                        rNode.Nodes.Add(adNode);
                    }
                }
                catch (Exception ex)
                {
                    Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg,
                                                        (string)
                                                        ("CreateADSubNodes failed" + Constants.vbNewLine + ex.Message),
                                                        true);
                }
            }
Ejemplo n.º 4
0
            public static TreeNode Find(TreeNode treeNode, Info conInfo)
            {
                TreeNode tmpNode;

                try
                {
                    if (treeNode.Tag == conInfo)
                    {
                        return treeNode;
                    }
                    else
                    {
                        foreach (TreeNode childNode in treeNode.Nodes)
                        {
                            tmpNode = Find(childNode, conInfo);
                            if (tmpNode != null)
                            {
                                return tmpNode;
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg,
                                                        (string)("Find node failed" + Constants.vbNewLine + ex.Message),
                                                        true);
                }

                return null;
            }
Ejemplo n.º 5
0
 public Info Add(Info cInfo)
 {
     this.List.Add(cInfo);
     return cInfo;
 }
Ejemplo n.º 6
0
        void TestAsync(Info con1)
        {
            try
            {
                ThreadPool.QueueUserWorkItem(state =>
                 {
                     bool result = TestStatus(con1);
                     lstStatus.Invoke((MethodInvoker)(() =>
                     {
                         foreach (ListViewItem i in lstStatus.Items.Cast<ListViewItem>().Where(i => i.Tag == con1))
                         {
                             i.SubItems[2].Text = result ? "Up" : "Down";
                             i.ForeColor = result ? Color.Green : Color.Red;
                         }
                         lstStatus.Sort();
                     }));
                 });
            }
            catch (Exception)
            {

            }
        }
Ejemplo n.º 7
0
 void TestAsync(Info con1)
 {
     try
     {
         ThreadPool.QueueUserWorkItem(state =>
          {
              try
              {
                  bool result = TestStatus(con1);
                  lstStatus.Invoke((MethodInvoker)(() =>
                  {
                      foreach (ListViewItem i in lstStatus.Items.Cast<ListViewItem>().Where(i => i.Tag == con1))
                      {
                          i.SubItems[2].Text = result ? "Up" : "Down";
                          i.ForeColor = result ? Color.Green : Color.Red;
                      }
                      lstStatus.Sort();
                  }));
              }
              catch (Exception ex)
              {
                  Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg,
                                                      "lstStatus.Invoke at TestAsync failed" + Constants.vbNewLine + ex.Message,
                                                      true);
              }
          });
     }
     catch (Exception ex)
     {
         Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg,
                                             "TestAsync failed" + Constants.vbNewLine + ex.Message,
                                             true);
     }
 }
Ejemplo n.º 8
0
 public QuickHostScanner(Info info)
 {
     InitializeComponent();
     this.info = info;
 }
Ejemplo n.º 9
0
                private bool IsConnectionOpen(Info[] ConnectionInfos)
                {
                    try
                    {
                        if (ConnectionInfos != null)
                        {
                            if (ConnectionInfos.Any(conI => conI.OpenConnections.Count > 0))
                            {
                                return true;
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg,
                                                            (string)
                                                            ("IsConnectionOpen (UI.Window.Tree) failed" +
                                                             Constants.vbNewLine + ex.Message), true);
                    }

                    return false;
                }
Ejemplo n.º 10
0
 internal void ChangeConProp(Info info, int p, Protocols protocols)
 {
     try
     {
         var allNodes = new List<TreeNode>();
         foreach (TreeNode t in tvConnections.Nodes)
         {
             allNodes.AddRange(GetAllNodes(t));
         }
         foreach (var treeNode in allNodes)
         {
             var il = treeNode.Tag as Info;
             if (il != null && il == info)
             {
                 il.Protocol = protocols;
                 il.Port = p;
                 tvConnections.SelectedNode = treeNode;
                 InitialRefresh();
             }
         }
     }
     catch (Exception ex)
     {
         Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg,
                     (string)
                     ("ChangeConProp (UI.Window.Tree) failed" +
                         Constants.vbNewLine + ex.Message), true);
     }
 }
Ejemplo n.º 11
0
                public void AddConnection()
                {
                    try
                    {
                        TreeNode nNode = Node.AddNode(Node.Type.Connection);

                        if (nNode != null)
                        {
                            Info nConI = new Info();


                            if (tvConnections.Nodes.Count < 1)
                            {
                                System.Windows.Forms.TreeNode treeNode1 =
                                    new System.Windows.Forms.TreeNode("Connections");
                                treeNode1.Name = "nodeRoot";
                                treeNode1.Text = "Connections";
                                this.tvConnections.Nodes.AddRange(new[] {treeNode1});
                            }

                            if (this.tvConnections.SelectedNode == null)
                            {
                                this.tvConnections.SelectedNode = this.tvConnections.Nodes[0];
                            }
                            if (this.tvConnections.SelectedNode.Tag is Container.Info)
                            {
                                nConI.Parent = this.tvConnections.SelectedNode.Tag;
                            }
                            else
                            {
                                nConI.Inherit.TurnOffInheritanceCompletely();
                            }

                            nConI.TreeNode = nNode;

                            nNode.Tag = nConI;
                            Runtime.ConnectionList.Add(nConI);

                            if (Node.GetNodeType(this.tvConnections.SelectedNode) == Node.Type.Connection)
                            {
                                this.tvConnections.SelectedNode.Parent.Nodes.Add(nNode);
                            }
                            else
                            {
                                this.tvConnections.SelectedNode.Nodes.Add(nNode);
                            }

                            this.tvConnections.SelectedNode = nNode;
                            this.tvConnections.SelectedNode.BeginEdit();
                        }
                    }
                    catch (Exception ex)
                    {
                        Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg,
                                                            (string)
                                                            ("AddConnection (UI.Window.Tree) failed" +
                                                             Constants.vbNewLine + ex.Message), true);
                    }
                }
Ejemplo n.º 12
0
        public override bool SetProps()
        {
            base.SetProps();

            try
            {
                ICA_Client = (AxICAClient)this.Control;
                Info = this.InterfaceControl.Info;

                ICA_Client.CreateControl();

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

                ICA_Client.Address = Info.Hostname;

                this.SetCredentials();

                this.SetResolution();
                this.SetColors();

                this.SetSecurity();

                //Disable hotkeys for international users
                ICA_Client.Hotkey1Shift = null;
                ICA_Client.Hotkey1Char = null;
                ICA_Client.Hotkey2Shift = null;
                ICA_Client.Hotkey2Char = null;
                ICA_Client.Hotkey3Shift = null;
                ICA_Client.Hotkey3Char = null;
                ICA_Client.Hotkey4Shift = null;
                ICA_Client.Hotkey4Char = null;
                ICA_Client.Hotkey5Shift = null;
                ICA_Client.Hotkey5Char = null;
                ICA_Client.Hotkey6Shift = null;
                ICA_Client.Hotkey6Char = null;
                ICA_Client.Hotkey7Shift = null;
                ICA_Client.Hotkey7Char = null;
                ICA_Client.Hotkey8Shift = null;
                ICA_Client.Hotkey8Char = null;
                ICA_Client.Hotkey9Shift = null;
                ICA_Client.Hotkey9Char = null;
                ICA_Client.Hotkey10Shift = null;
                ICA_Client.Hotkey10Char = null;
                ICA_Client.Hotkey11Shift = null;
                ICA_Client.Hotkey11Char = null;

                ICA_Client.PersistentCacheEnabled = Info.CacheBitmaps;

                ICA_Client.Title = Info.Name;

                return true;
            }
            catch (Exception ex)
            {
                Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg,
                                                    Language.strIcaSetPropsFailed + Constants.vbNewLine + ex.Message,
                                                    true);
                return false;
            }
        }
Ejemplo n.º 13
0
                public Crownwood.Magic.Controls.TabPage AddConnectionTab(Info conI)
                {
                    try
                    {
                        Crownwood.Magic.Controls.TabPage nTab = new Crownwood.Magic.Controls.TabPage();
                        nTab.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top;

                        if (Settings.Default.ShowProtocolOnTabs)
                        {
                            nTab.Title = conI.Protocol.ToString() + ": ";
                        }
                        else
                        {
                            nTab.Title = "";
                        }

                        nTab.Title += (string)conI.Name;

                        if (Settings.Default.ShowLogonInfoOnTabs)
                        {
                            nTab.Title += " (";

                            if (conI.Domain != "")
                            {
                                nTab.Title += (string)conI.Domain;
                            }

                            if (conI.Username != "")
                            {
                                if (conI.Domain != "")
                                {
                                    nTab.Title += "\\";
                                }

                                nTab.Title += (string)conI.Username;
                            }

                            nTab.Title += ")";
                        }
                        nTab.Title = nTab.Title.Replace("&", "&&");
                        Icon conIcon = mRemoteNC.Connection.Icon.FromString(conI.Icon);
                        if (conIcon != null)
                        {
                            nTab.Icon = conIcon;
                        }

                        if (Settings.Default.OpenTabsRightOfSelected)
                        {
                            this.TabController.TabPages.Insert(this.TabController.SelectedIndex + 1, nTab);
                        }
                        else
                        {
                            this.TabController.TabPages.Add(nTab);
                        }

                        nTab.Selected = true;
                        _ignoreChangeSelectedTabClick = false;
                        return nTab;
                    }
                    catch (Exception ex)
                    {
                        Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg,
                                                            (string)
                                                            ("AddConnectionTab (UI.Window.Connections) failed" +
                                                             Constants.vbNewLine + ex.Message), true);
                    }

                    return null;
                }