Using a Server in C# [closed] - c#

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I made a program that saves information on .dat files.
On each time the program is closed the old information is replaced by the new information.
When I open the program, it reads the information from the dat files.
I want to create a server that I will be able to upload the .dat files to it and on each Form_Close the old information will be deleted from the sever and the new information will be uploaded to the server.
When I open the program, I want it to delete the .dat files on the computer and replace them by the information from the server.
What is the best choise of service for that kind of problem ?
I thought maybe I should use Google Drive.
But I don't know if it's a good choise.
Thanks for helping.

You have tons of options here, which one is better depends on your project and goals, but all of them will work.
You can use cloud drives, like google drive, dropbox, amazon s3 and so on.
And there is 2 ways to use them.
Just File.Copy your file to the local folder and let cloud client deal with it.
Use cloud drive's API to upload file
You can buy an ftp/http hosting, or set up one of your own and upload files with c# FtpClient or HttpClient.
You can use WebDAV
You can copy your file to shared folder on the server.
You can write your own simple socket/http/ftp server. (with c# HttpListener for example)

Related

How do I embed meta data in a non-standard file? [closed]

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 3 years ago.
Improve this question
I need to write code that receives firmware update files from various sources (nothing is a given, not even the file extensions) and passes them up to the cloud so that our software can download them to individual machines.
As part of the process, the front end needs to give the users a richer experience, so I need to include information such as the version number, last time there was an approved update to the file, and some other info about who is responsible for the update.
I've been directed to pass the data in as "meta-data" so that we don't have to include two files and at this point that doesn't seem like a very viable option. I've been researching meta data all day. TagLib is only for media files. I can use Microsoft API Code Pack to read some attributes but it won't let me write anything.
The shell32 option looks like the only other possibility but I can't figure out how to write to it. I'm using C# code in VS 2019, currently .NET framework 4.6.1 but we are about to upgrade to 4.8, I think.
Is there a practical way to write a string value as meta-data into a file without knowing anything more about the file than what I could discover with c#?
If you don't want to provide additional files or locations with the meta information you can create a new single file which contains your meta data and the actual firmware update. Think of it as a ZIP file where you have the firmware update file and some other file with the meta information. This way you will have only one file you can send around, but it has all the information you will need at any later point.
You cannot change the firmware update file in any way, specially if you don't know how the file format is. It would most likely break the firmware update.

Moving and Copying Remote Files [closed]

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.

executable file including a database [closed]

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 8 years ago.
Improve this question
i wanted to create single executable file with c#
with my database and application.I wanted to install that application in client machine which have no internet. how can i include my database into my executable file (.exe) to let the user in client machine save and retrieve information.
thank you
This is simplest with single-file databases like SQLite. Create the database, pack it up with one of the compression APIs, then include the result as a resource in your application. On startup when the application fails to find the SQLite database file it can unpack it from the resource, save it to disk, then carry on. From that point the user is working on a copy of the database on disk and can make whatever changes they like.
If you're using a proper SQL server of some sort it's a bit more difficult, but essentially the same idea. Gather the data into a format you can work with, compress it and bind into a resource. On startup if the database doesn't exist you create it with whatever scripts or EF code you need, then unpack the resource and load all the data into the database.
Of course if your database is very large then you'll have a lot of bloat in your application. Better to pack the application and any data it needs as separate files in a ZIP or similar, then distribute the ZIP file. User unpacks the ZIP file and runs your application, which finds everything it needs sitting in the folder it was unpacked to.
Honestly, I'd go with the ZIP file option unless you have a really good reason not to.

Implementing a application HTML help system [closed]

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
We want to implement a application help and documentation system. It should be based on HTML, because there are a lot of existing files and it gives us the most flexibility. Currently we use CHM files. We want to enable internal people (not developers) to edit the contents.
We thought of a stand-alone application that supports TOC, indexing (tags), search, etc. We also thought of using a local web server.
Until now our application uses pure C#, it would be good to keep this.
We are totally clean of web/asp knowledge, so the question is:
Where is a good place to start?
You can use documentation apps like SandCastle
Which use your XML documentation in your code to generate a help file.
Finally we ended up implementing a local HTTP server:
Internal people creates HTML content within our internal network
Our own build-tool creates the TOC and a search index and packs all content to a zipped file
The zipped file is packed into the application installation
When the end-user call help from within our application, the local http server is started
The HTTP server uses the HttpListener class
With this, it is possible to have some HTTP queries for special tasks like starting tools of our application by clicking a link without interception of the browser

Backup software solution problem [closed]

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.

Categories

Resources