|
I can't help but think that part of the problem is the fact that you're doing a traversal and then doing a search of the results of the traversal. Why not combine the two operations and only return the values that match? You might be tempted to take advantage of something like Parallel.For to help with the traversal because the search looks to be atomic but I would advise against it; ultimately, you're always going to be limited by the hardware and you could well end up making the drive head do more work than it needs to as it jumps around reading the allocation tables because different cores are processing demanding access.
|
|
|
|
|
In the original question[^], he was looking for sub-directories with a specific name at any depth in the tree. To do that, you have to recursively look at all directories, not just the ones that match the name you're looking for.
For example, if you're looking for a directory called "drivers", the parent directories are called "Windows" and "System32". If you only looked inside directories called "drivers", you'd never find it.
However, this new question does make it sound more like he's looking for a directory which is an immediate child of the root directory, which makes the searchPattern parameter a viable option.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
As I said in the comments, if the directories you're looking for are immediate children of the root directory, you'll probably get faster results using this:
private void btn_procura_Click(object sender, EventArgs e)
{
string toFind = txt_procura.Text;
var root = new DirectoryInfo(@"c:\");
var matchingDirectories = root.EnumerateDirectories(toFind, SearchOption.TopDirectoryOnly);
foreach (DirectoryInfo directory in matchingDirectories)
{
Process.Start(new ProcessStartInfo
{
FileName = directory.FullName,
UseShellExecute = true,
Verb = "open"
});
}
}
That will also let you use wildcard characters (* and ? ) in the search box.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I once wrote similar thing and used recursive methods to traverse the folders.
It was quite performant, but indeed searching through files can be time consuming.
What you could do is write some sort of service that creates an index of some sort and make your code search through that index.
just thinking out loud.
|
|
|
|
|
I have this function which append an array of byte to an other array of bytes
but the problem appears when the source contains '\0'
this what I have :
private void Aes_Strcat(sbyte[] a_pchResult, sbyte[] pchResult, int m_iBlockSize)
{
int x = 0;
while (a_pchResult[x] != 0)
{
x++;
}
Buffer.BlockCopy(pchResult, 0, a_pchResult, x, m_iBlockSize);
}
here when the a_pchResult contains for example { -10, 15,3,45,17,25,0,56,41,12,0,0,0,0,0,0}
and I want to add pchResult to it at the end (it means after the '12' element)
but as you say it will add it after '25' because it find the '0' before the end.
any idea how know the last position to add the new array at the end of source array if it contains '\0' element.
|
|
|
|
|
Please do not post the same thing in multiple places - it wastes time and annoys people.
You already have this is QA - so pick one and stick to it!
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
.
modified 28-Jan-19 5:54am.
|
|
|
|
|
string filesToDelete = @"roremove.doc";
string[] fileList = System.IO.Directory.GetFiles(rootFolder, filesToDelete);
foreach(string file in fileList)
Here rootFolder is the path of the directory where you have all the files listed.
|
|
|
|
|
|
Message Closed
modified 28-Jan-19 5:55am.
|
|
|
|
|
My message was about the fact that you posted your question first in the "quick answers"-forum of this website and then in this forum. And that's not so nice because what if someone sees your second post and makes an effort to answer it while you already got an answer to the first post? You would have wasted his time.
If the brain were so simple we could understand it, we would be so simple we couldn't. — Lyall Watson
|
|
|
|
|
Hi,
Below is my code snippet.
postdata = "{\"Id\":\"100\"}"; // Example postdata
var Data = CheckPostData(postdata) ? serializer.Deserialize<dynamic>(postdata) : null;
if(postDataFilter.ContainsKey("test")) //Getting error in this line as per log. But i am unable to replicate the issue.
{
}
Please let me know how to replicate the issue and fix it.
Thanks,
|
|
|
|
|
The exception is telling you that postDataFilter is a string, not some form of Dictionary. As you don't show the definition of postDataFilter, we can't help any more I'm afraid.
|
|
|
|
|
Sorry pls go through the below code.
postdata = "{\"Id\":\"100\"}"; // Example postdata
var Data = CheckPostData(postdata) ? serializer.Deserialize<dynamic>(postdata) : null;
if(Data.ContainsKey("test")) //Getting error in this line as per log. But i am unable to replicate the issue. This issue is not occuring for all. I am not sure when the deserialization returns string.
{
}
|
|
|
|
|
Hi,
I'm going to use TURN Server to implement Video Chating in .NET Windows form application.
But I couldn't connect to TURN Server.
Please help me,
Thanks.
|
|
|
|
|
Help you with what? You haven't shown any code or indicated what errors/exceptions you are getting.
|
|
|
|
|
Sorry, but I don't know how to start.
Is there any source that works?
|
|
|
|
|
Member 11612662 wrote: Sorry, but I don't know how to start.
But you said
Member 11612662 wrote: But I couldn't connect to TURN Server. So presumably you have started this - so you will have code that tries and fails.
We need to see the code, and know how it fails.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
If you don't start you also can't connect
If the brain were so simple we could understand it, we would be so simple we couldn't. — Lyall Watson
|
|
|
|
|
I setup TURN server in CentOS server.
Then I'm going to connect to TURN Server in C# Windows Application.
I want to know how to send and receive media data using TURN Server in C# Windows Application.
|
|
|
|
|
Do you already have a working video chat without TURN ?
If the brain were so simple we could understand it, we would be so simple we couldn't. — Lyall Watson
|
|
|
|
|
I think, without TURN/STUN server, we cann't TCP communicate in Internet.
I implemented video chat in local network.
|
|
|
|
|
Alright - I just wanted to know if you're not trying to do the second step before the first one
Please understand that it happens extremely often that people post questions here before even attempting to solve the problem themselves or by asking Google. That's why we're here a bit sensitive to questions where nothing is being said about what has already been tried. In your case, I think I can understand it now though. I just spend two hours or so searching for something along the lines of C# TURN client but found nothing except commercial solutions. However, I found a link to a Google Group for an open source TURN Server project. I would suggest you to ask there; if I were searching for this, it would be my next step.
https://code.google.com/p/rfc5766-turn-server/[^]
https://groups.google.com/forum/#!forum/turn-server-project-rfc5766-turn-server[^]
Good luck!
If the brain were so simple we could understand it, we would be so simple we couldn't. — Lyall Watson
|
|
|
|
|
A simple Google search found this[^]. If you don't know how to start something, you should try doing some research using sources such as Google to find things.
|
|
|
|
|
Thanks,
I alreay execute STUN client sample.
I think, I can get public IP address with STUN server.
I want to send and receive viedo and audio through TURN server.
I setup TURN server in server, but I don't know how to send and receive media data through TURN server.
|
|
|
|