예제 #1
0
        public void CatchRadmin()
        {
            var p = IntPtr.Zero;
            while (p == IntPtr.Zero)
            {
                p = Native.GetPtrToProcWithWindowWithTextInCap(": " + InterfaceControl.Info.Hostname);
                if (p == IntPtr.Zero)
                {
                    Thread.Sleep(100);
                    continue;
                }
                Native.ForceForegroundWindow(Handle);
                SendKeys.SendWait(InterfaceControl.Info.Username + "{Tab}" + InterfaceControl.Info.Password + "{ENTER}");
            }
            p = IntPtr.Zero;
            while (p == IntPtr.Zero)
            {
                p = Native.GetPtrToProcWithWindowWithTextInCap(InterfaceControl.Info.Hostname + " - ");
                if (p == IntPtr.Zero)
                {
                    Thread.Sleep(10);
                }
            }

            //Windows API call to change the parent of the target window.
            //It returns the hWnd of the window's parent prior to this call.
            //Thread.Sleep(500);
            var l = new List<Native.WINDOWPLACEMENT>();
            Handle = p;
            Native.SetParent(Handle, IcHandle);
            Thread.Sleep(50);
            Native.ForceForegroundWindow(Handle);
            SendKeys.SendWait("{F12}{F12}");
            Event_Connected(this);
        }
예제 #2
0
        private void AddFoundConnections(IEnumerable<Info> iEnumerable)
        {
            try
            {
                var l = new List<EXImageListViewItem>();
                foreach (var info in iEnumerable)
                {
                    var item = new EXImageListViewItem { Tag = info };
                    item.SubItems.Add(new EXBoolListViewSubItem(true));
                    item.SubItems.Add(new EXImageListViewSubItem(Connection.Icon.FromString(info.Icon).ToBitmap()));
                    item.SubItems.Add(info.Description);
                    item.SubItems.Add(info.Protocol.ToString());
                    item.SubItems.Add(info.Hostname);
                    item.SubItems.Add(info.Port.ToString());
                    l.Add(item);
                }
                if (lvFoundConections.InvokeRequired)
                {
                    lvFoundConections.Invoke(new MethodInvoker(() =>
                                                                   {
                                                                       lvFoundConections.Items.AddRange(l.ToArray());
                                                                   }));
                }
                else
                {
                    lvFoundConections.Items.AddRange(l.ToArray());
                }
            }
            catch (Exception)
            {

            }
            
        }
예제 #3
0
 public IEnumerable<Info> GetConnections()
 {
     var result = new List<Info>();
     try
     {
         result.AddRange(FileEnumerator.AllFiles.AsParallel().Where(s => s.EndsWith(".rdp")).Select(RDPFileToConnectionInfo));
     }
     catch (Exception ex)
     {
         Debug.WriteLine(ex.ToString());
     }
     return result;
 }
예제 #4
0
파일: Tree.cs 프로젝트: hmaster20/mRemoteNC
 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);
     }
 }
예제 #5
0
파일: Tree.cs 프로젝트: hmaster20/mRemoteNC
 IEnumerable<TreeNode> GetAllNodes(TreeNode nodes)
 {
     var allNodes = new List<TreeNode>();
     allNodes.Add(nodes);
     foreach (TreeNode tn in nodes.Nodes)
     {
         allNodes.AddRange(GetAllNodes(tn));
     }
     return allNodes;
 }