3 Replies - 559 Views - Last Post: 19 November 2012 - 05:12 PM Rate Topic: -----

#1 spreadzz  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 19-November 12

Populate tree view with remote computer directories

Posted 19 November 2012 - 10:41 AM

I want to make an Explorer to view folders from a remote computer using the TcpClient

Dose anyone have any solutions ?

The method i apropched is that on the server side i made that when i send the string "DirectoryInfo path" the server launches DirectoryInfo mypath returns the folders in a string and sends them back using NetworkStream, then i read the stream an add them to the treevies using a very raw and shitty method ex:


TreeNode hdd1 = new TreeNode(@"C:\");
string[] folder =Regex.Split("return string from netStream", "\r\n");
foreach (string fd in folder)
{
hdd1.Nodes.Add(fd);
}
treeView1.Nodes.Add(hdd1);



and that is how i get the first folders in "C:\", as you can see it is a primitive method, any ideas on how can i do this cleaner ? or how to get the next subfolders and so on, or at least improve my code?

Thanks in advance.

Is This A Good Question/Topic? 0
  • +

Replies To: Populate tree view with remote computer directories

#2 Skydiver  Icon User is online

  • Code herder
  • member icon

Reputation: 3589
  • View blog
  • Posts: 11,165
  • Joined: 05-May 12

Re: Populate tree view with remote computer directories

Posted 19 November 2012 - 11:12 AM

Why not just use WMI? http://msdn.microsof...4(v=vs.85).aspx

Is it because you don't have admin rights on the other machine? If you don't have admin rights on the other machine, how are you luring the person who owns that machine to run your server program so that you can talk to it using your TcpClient?
Was This Post Helpful? 0
  • +
  • -

#3 spreadzz  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 19-November 12

Re: Populate tree view with remote computer directories

Posted 19 November 2012 - 11:41 AM

It is because i did not heard of WMI, and i dont understand what it is... it is an windows api ?
Was This Post Helpful? 0
  • +
  • -

#4 Skydiver  Icon User is online

  • Code herder
  • member icon

Reputation: 3589
  • View blog
  • Posts: 11,165
  • Joined: 05-May 12

Re: Populate tree view with remote computer directories

Posted 19 November 2012 - 05:12 PM

Yes, it is a Windows API.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1