Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I need to backup a file located on a remote machine using C#.
For example: "\server1\docs\test.txt" needs to be copied or moved to "\server1\docs\backup\test.txt."
Question: When I use File.Copy, does that move the file from the server, to my machine, back to the server -- essentially round-tripping the file across the network?
I'd like to avoid round-tripping.
Details: Both machines are Windows OS's on the same Domain.
Note: I want you guys to know that I have searched all over for the answer to this question, however, I have found contradicting answers. I'd like to know definitively. Thank you for your time.
You should run this from the server in order to avoid round-tripping the data. Keep in mind that if the files you're trying to work on are located on the same hard drive, moving them will be faster than copying them.
Just looking at the source code of C# (http://referencesource.microsoft.com/#mscorlib/system/io/file.cs,4a0905e7dc32d77d) it seems that File.Copy calls Win32Native.CopyFile function. To be honest I don't know exactly what it does, I mean I never saw the code, but I guess there's no magic and it reads the bytes from the remote computer and writes to the other remote computer.
Edit
One alternative is to login into the remote server via powershell (you can invoke ps scripts via C#) and execute the command to copy to the 2nd machine.
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I'm building a class library with bunch of methods. One of which is for creating File. I want to make it run only 'N' times and after that to throw exceptions that the limit exceeded. Is there any way to embed that 'N' in the dll or how should i store it to be secure from changing that number.
So far i've tried with static field in the class but the static field is reset everytime the application using that dll is run.
Any suggestions ?
The safest solution would be:
Have the local application collect all relevant local data needed to create the file.
Request the file to a web service that knows how to create it with the supplied data.
The server will verify that the user’s credentials allow him to create the file; he’s a valid registered user, has payed his dues and still has file creations to spare.
Create the file on the server side and allow the user to download it.
Anything running locally in your computer is susceptible to being cracked. Professional softwware and game industries have wasted millions in anti piracy devices and they’ve failed miserably, don’t expect to have any better luck.
All of this obviously has a significant cost. If the risk of your average user knowing how to circumvent a basic protection is small and the loss of profit of those few that would know how to decompile, modify and compile your application is tolerable, then who cares?
Moral of the story: stop thinking about safest and start thinking about safe enough. It’s almost always cheaper.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I just tried a program demonstrated in C# on YouTube. The video shows how to build a client/server based program to capture desktop remotely, and it works perfectly. Now I have a question. Is is possible to do the same job without the client/server architecture? Is there some kind of relative windows API that I can access remotely? My imagination is just to click a button on computer A(with specific program) and receive a screenshot from computer B(without specific program) through network. Is is possible? Thank you very much!
The thing is, that when you access "some API" remotely and get result from that "some API" it's called a client / server architecture, where you is a client and "some API" is a server.
You can't receive something if there is no one to give))
If you wanted to ask "is there anything in windows that would give me a screenshot without injecting anything and etc?" - then:
if you don't care about laws, theoretically, you could find some bug in system itself or applications that are running on it, and through them get access to that computer and make it do whatever you want, that's called hacking, the very black hacking, and that type of things are hard to do.
if you care just a little about any of laws and don't want to visit a prison, then the answer is no.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
How can I tell the difference between source and published .NET code?
I am looking at some inherited code that I have not touched in about a year. The original designer had me first publish locally before uploading the published code to the internet server. Now I am looking a number of backed up source folders as well bas backed up published folders. I should have done a better job at naming the folders, I guess. Now I wonder: How can I tell the difference between source and published .NET code? Is there some easy way to see if some folder that contains only published code is lacking a file or xml setting?
As changes are made, they are published in the UI, so that means there should be some new files, or deleted files, and the directory tree may not be 100% the same. What you could do is download the deployed code to your local machine, and use a tool like Beyond Compare or some other directory comparer and let it determine the markup changes for you. There are several tools that do a good job for this.
That would give you an idea of the difference between files, but won't parse DLL's. That you would have to use a tool like reflector or Telerik's JustDecompile to compare the code, but I really wouldn't go that far, but you could.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I am about to setup my first windows application which is built in C# Visual studio 2010 to my customer.
I want to limit usage to only one computer per installation, but I don't know how to do that.
Can anyone guide me on how I might accomplish this?
Typically this is managed by what's called a "product activation" system. When the customer installs your application, they must enter a serial number or key to "activate" it. If they don't do this, the application remains locked. When they activate your product, the system calls back into your server and says "Hey, this key has been used, and this is the machine it was used on. don't let anyone else use this key again."
http://en.wikipedia.org/wiki/Product_activation
You probably don't want to write this yourself, so there are many third party packages you can purchase to make it difficult for your client to install on multiple machines. There's a fine line though between alienating your client by treating them like a criminal, and trying to protect your hard work.
Pirates gonna pirate.
Encrypt the serial number of the hard-drive into your program. It must be saved to a DB of some kind. Name the field something obscure (not related to a HDD serial #). Then check that it matches every time the app is launched. Not super-high tech, not super-secure, but will work in most situatons. If someone copies the app to another PC, display a message not related to copying the app, but you will know what happened. I've been doing it for years in VB and .NET. Works fine.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
Good time of a day!
My team develop the soft to backup files to web storage. Now it has simle functionality - just take files from hdd, check date in local and remote file and update remote to new local.
The product owner want to to make backup in another way: on remote server replace only chenge peace of file. They want to make less traffic to storage (it's Amazon S3)
Now we have a next solution: brake file into peaces (4 kb each), count checksum of each peace, store this data in local db and at next backup verify checksums and transfer only changed peace.
But the metadata take much place on db if we backup a big amount of files
Can anybody have another solution? Thanks for help!
Rsync uses rolling hash algorithm, so you might research that.