|
Hi all,
Is there any way to detect File Copy or move from a particular direcotry using FileSystemWatcher !!!!
Thanks in Advance !!!
Happy Programming
-----
Abhijit
|
|
|
|
|
I don't think you can tell, just by watching the target directory, whether a file being created there has been moved or copied from another directory. If you knew where the files were coming from, you could set up a FileSystemWatcher on the source directory. You could then detect a file move by watching for a delete event on the source directory and a create event on the target directory. You would be able to detect file being coped though. If you don't know where the files are coming from, then this approach won't work.
Paul Marfleet
|
|
|
|
|
Thank for your reply !!!
but is there no way to detect for the same !!!!
Happy Programming
-----
Abhijit
|
|
|
|
|
FROM a particular directory, no there isn't. You can tell if the file shows up in the target directory though, if the FileSystemWatcher is looking at it.
|
|
|
|
|
I'm using XNA game studio but when i try to compile a simple window with a image. It tells me there is a error in the Microsoft.XNA.Framework.Content.Pipeline. And the first time i tried it said the pipeline exetenion wasn't installed.
Can anyone give me a answer to this question??? Plz!!!!
Michael
(Up and coming Game programmer)
EST
|
|
|
|
|
I know this is an easy question, but what is the operator for 'or'? Please no hassle, just answer... Thanks...
|
|
|
|
|
one of these |
If your using it in an if statement, like: if(a == b OR a == c)
then you need to use two of them, just like with the equals sign, or the AND sign.
My current favourite word is: Waffle
Cheese is still good though.
|
|
|
|
|
This isn't quite correct. C# supports both the bitwise (|) and conditional (||) OR operators. They can both be used for logical operations. The difference is that the conditional OR operator performs short-circuit evaluation. This means that if the first expression evaluates to TRUE then the second expression will not be evaluated, as the overall result of the operation will be true regardless of the value of the second expression. The bitwise operator, as its name suggests, is typically used for bitwise operations. For general-purpose programming, it is preferable to use the conditional operator as its short-circuit evaluation is more efficient.
Paul Marfleet
|
|
|
|
|
|
MasterSharp wrote: Please no hassle, just answer...
I assume this means that you knew I would say that this is the sort of stuff you should be learning from a book. Or google. Really, the forums work best when people have tried to write some code and ask why it's broken, or at least when people ask about a specific task. Language features are widely documented. My point is solely that while you got a good answer on this question, in general it's quicker and more detailed to read a book or google it.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
I'm trying to integrate into a webservice and haven't done C# in awhile, there is an event that I need to catch after calling a method but I'm drawing a blank on how to do this...ANY help is appreciated.
So what happens is I am uploading a file using the code below and need to know when the upload is complete (as it returns an identifier for the file I just uploaded as well) The webservice description shows "public event ApplyUploadCompletedEventHandler ApplyUploadCompleted;" as a valid event
<br />
try {<br />
objDocushare.ApplyUpload("admin", "xerox", "DocuShare", sProperties, sValues, sParent, filename, data);<br />
}<br />
catch (Exception ex) {<br />
Response.Write(ex.Message);<br />
}<br />
amclint
There's no place like 127.0.0.1
|
|
|
|
|
Not sure if i can post the entire bit of code in here describing the webservice, as I'm not familiar with this posting board, so if that helps I can put the webservice description in here.
amclint
There's no place like 127.0.0.1
|
|
|
|
|
Here is what I've done just now, but UploadFileCallback isn't getting called
<br />
objDocushare.ApplyUploadCompleted += new com.src_solutions.srchq.ApplyUploadCompletedEventHandler(UploadFileCallback);<br />
try {<br />
objDocushare.ApplyUpload("admin", "xerox", "DocuShare", sProperties, sValues, sParent, filename, data);<br />
}<br />
catch (Exception ex) {<br />
Response.Write(ex.Message);<br />
}<br />
<br />
.....................<br />
private static void UploadFileCallback(Object sender, com.src_solutions.srchq.ApplyUploadCompletedEventArgs e)<br />
{<br />
Console.WriteLine(e.Result.ToString()); <br />
}<br />
amclint
There's no place like 127.0.0.1
|
|
|
|
|
I think you would be better off looking at asynchronous[^] web service calls. Invoke your web method asynchronously and wait for the callback. Use the callback to pass back status information about the upload to your calling code.
Paul Marfleet
|
|
|
|
|
Ah, that is so simple and effective, thank you it works great.
amclint
There's no place like 127.0.0.1
|
|
|
|
|
I am trying to read a variable number of bytes from another .Net application but the messages are not always received correctly, sometimes I read the first half of the message and then the second half. Since the message sizes I am sending are constantly changing, I know I cannot hardcode the receive buffer. Right now that is how I have it and it works most of the time when my update rate is 1x/second but not at 10x/second. My data is a string with ids and data values (id:value|id:value|...) that I convert to bytes before sending (.GetBytes(dataString)).
I keep reading on forums that the standard way of remedying this situation is to append the number of bytes to the front of the message but I cannot find any examples of how to do that. Some of the channels have a more data than others (40KB vs 500 bytes) but the sending routine is the same so I need to make sure it will work across all channels.
Any help would be appreciated - I am really on a tight schedule
thanks in advance
|
|
|
|
|
captainmogo wrote: I keep reading on forums that the standard way of remedying this situation is to append the number of bytes to the front of the message
Standard? I don't know if I would agree with that. In any event you are talking about a protocol[^].
|
|
|
|
|
When i was sending / receiving stuff, i would send one message which contains the length of the peice of data, so the receiving end knows what to expect, and had the buffer at say 50KB. The sending end would send in 50Kb chunks until the end of the file, and the receiving end would receive until it had the full 50KB chunk (not all the data comes through in one big chunk) or until it reached the end of the file.
It basically worked like this:
Sender: 123456 <- the size in bytes
Receiver: "OK";
Sender: *sends 50KB*
Receiver: *keeps trying to receive until 50KB has been downloaded*
Receiver: "OK";
Sender: *sends next 50KB*
Receiver: *keeps trying to receive until 50KB has been downloaded*
Receiver: "OK";
Sender: *sends last part of data (less than 50KB)*
Receiver: *keeps trying to receive until the current amount of bytes == total amount of bytes*
Receiver: "OK";
All done. I also had it send an MD5 hash, just to make sure nothing went wrong somewhere.
My current favourite word is: Waffle
Cheese is still good though.
|
|
|
|
|
If the buffer size is not hard coded, the process will have to retrieve one byte at a time from the socket and constantly resize the incoming buffer to accommodate the byte until the message has been received. That can be very time expensive.
What can be done is on the receive side, set up a hard coded buffer size. Each time a message is received, pass that buffer up to another method that will parse the buffer copying it into a second buffer. Then the original buffer is cleared. When the next message is received, the same process happens again. Let the parsing method determine when the message is complete and further processing of the completed message is necessary. This requires some analysis of the message and how it is structured so that the receiving process can put the message back together correctly.
There are many applications out there that do the second method effectively. In fact there are some examples on this web site of both methods.
Phil
|
|
|
|
|
I have been mia for the past few weeks but I am finally getting back to it. I understand the concept of your post but I am not really sure how to start implementing that. Would there be some sort of EOF char to determine the end of the message and then only pull out of the buffer up to that point. Would it be possible to maybe get me started on that. Thanks a lot
|
|
|
|
|
I'm beginner, with C#. I've learned basic language C# and Window forms.
Now, I want to build a application what allow create tasks list, appointments, to do list, calender...a desktop application run in system tray, show message at time that defined before...!
I used notify icon, contextmenustrip to minimize program into system tray...but I don't know how to continue develop program?
Somebody show me the way to go on, learn, reference articles or any books for my issues.
Thanks so much!
|
|
|
|
|
hanght wrote: I'm beginner, with C#. I've learned basic language C# and Window forms.
I think you should start a little smaller first.
only two letters away from being an asset
|
|
|
|
|
thanks for your idea! If you can, please give me a smaller project(I'll try it!)
I learned C,C++,VB(not API Programming)! I think I should learn more about system programming(as my project)(I've done a management application).
I hope will receive many your ideas...
|
|
|
|
|
Replacing windows calculator ( just the basic view ) is a good first C# project.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi, Before strat to doing a small project please try to learn ADO.NET concept (if u dont have) , coz, for any project you have to use database.... and the application you want to build will need database to maintain records....
Good luck !!!
Happy Programming
-----
Abhijit
|
|
|
|