Using C#, I want to locate the local root folder where MEGAsync syncronizes into.
There are several similar questions for other clould providers:
How do I programmatically locate my Dropbox folder using C#?
How do I programmatically locate my Google Drive folder using C#?
How do I find the OneDrive (SkyDrive) and GoogleDrive folders without the API?
Still for MEGAsync I found no solution.
My question:
Is there any chance to find the MEGAsync folder without additional libraries?
Update 1:
There is a configuration file located at
C:\Users\MyUser\AppData\Local\Mega Limited\MEGAsync\MEGAsync.cfg
All the content seems to be encrypted. So I doubt that there is any solution at all.
I had the same question and I figured out that the MEGAsync.cfg file that you mention in your question is actually not encrypted, each entry is just encoded as base64. The format of each line is:
<key>=<base64_encoded_value>
You can decode each entry in the config file using C#'s "Base64" decoder, although I have only tested it with python.
Related
There is a feature in OneDrive that you can see a file that is on the OneDrive site on your system without actually having that file in your system. And when you double click on that file, that file starts to download and you can see its contents.
I want to implement such a possibility with C#.
I have a site where files are uploaded.
I download the files from there and put them in a folder on my C drive.
But I want that file not to be downloaded until it is double-clicked, something similar to OneDrive.
What should I do?
I compared the FileInfo of these two files, but I didn't see any difference and I couldn't find a solution for this problem.
This is a virtual filesystem implemented using a file system driver.
There are multiple ways to implement this feature using C/C++.
But in your case, using C# means you should use third-party libraries to create a virtual files system.
There is a library called Dokan, which lets you implement a full-featured virtual file system, and you have complete control over its behaviour in your C# project.
it called "Windows Shell namespace"
https://learn.microsoft.com/en-us/windows/win32/shell/namespace-intro
i used EZNameSpace Wrapper for handling this.
there is another library called "CBFS Shell" (formerly shelboost) that you can use.
You could create a dummy file that appears to be correct but is really just a pointer to some code that downloads the correct file. Then use File.Move or File.Copy to replace the dummy file with the actual file.
I'm working in a very basic C# application, I want to compress a directory that has some files (specifically a dbf database) that are already opened or in use for other software.
I use the class "ZipFile" in this way:
ZipFile.CreateFromDirectory(source, path);
And I get an exception that says that It could not access to the file because it was already in use for other application.
Is there another way to do this?
Thanks!
I am in the process of making a web application. It allows you to upload a .txt or .log file (IIS Logs for example).
The current way I am checking if it is a .txt or .log is checking the file extension. Now I don't like this as it allows anyone to change virus.exe to virus.txt and it will upload.
How can I verify if it really is a text file?
I am sure this is a common problem, but I can't seem to find any good solutions.
As far as I know there is no perfect solution to this.
You can read a portion of bytes from the file and make an educated guess of the file type from that. Try reading through the answers from this SO post :
Using .NET, how can you find the mime type of a file based on the file signature not the extension
My question is pretty straightforward. I have an exe file on an ftp server with a version of 1.0.0.0. I'd like to download it, but only if the version is greater than a certain pre-set value. (All of this inside a C# desktop application).
I read online that it isn't possible to tell the version of a file through FTP without downloading it first. Is this correct? (I would rather not do this as the file is fairly large and will not need to be downloaded most of the time).
If it is, the solution I saw recommended was to create a text file in the FTP directory that contained the version of the target exe file. Obviously it would not be large so it could be downloaded quickly. Is this the best solution if I can't grab the exe version directly?
Thanks for the help!
You can't because FTP has no protocol specification for the file version. Depending on the FTP server you are using, in the DIR command you may have the datetime information about the file. So yes in my opinion having the metadata file is the best simpler solution. Another more challenging solution is to craft some FTP source code to return the version information along with the DIR command, as far as I know ftp protocol is not restrictive at all about the details of a dir command, but it is not easy so is up to you to evaluate the benefit and keep in mind that was a solution working just with you server client pair. If you don't mind about the protocol, having a Mercurial ( or other verioning system ) repository served would be probably the smartest opion.
No the FTP protcol does not support this without downloading the exe.
I would recommend the version file.
The FTP protocol dosn't support any version check. Add a HTTP service that can check the version of your file.
I am trying to make tool for backup/restore of Documents from Google account.
Backup is easy and I have no problems with it. But I have two unsolved questions for restore:
1) Is it possible to upload new version of existing document? When I upload document, it appears as separate copy.
I found it was discussed already here Upload and replace file in given folder on Google Docs using .net api, but it seems it was suggested just to remove old version before uploading new, the Id of document will be changed. Is this correct?
2) Google Docs have limit for size of documents able to be converted into internal format. http://docs.google.com/support/bin/answer.py?hl=en&answer=37603. So it is possible to create large document, save it to local computer and then Google Docs will refuse to convert it because the document's size is over limit. In such case it is possible to upload the document without convert, but it becomes un-editable via web site. Is there some workaround for this situation?
Unable to upload large files to Google Docs - Here is advice to break document into small pieces before uploading and link them together after. But maybe there some other ideas?
1. Is it possible to upload new version of existing document? When I upload document, it appears as separate copy.
Yes, this is possible. We call it "upload & replace" as you've noticed. No need to remove the existing version first. The following link describes how to do this in the protocol:
http://code.google.com/apis/documents/docs/3.0/developers_guide_protocol.html#UpdatingMetadataAndContent
From the .NET client library, what you need to do is attach a an input stream to the Update() request. The method header for what you need is here:
http://code.google.com/p/google-gdata/source/browse/trunk/clients/cs/src/core/service.cs#554
Create a stream containing your new file content, and just pass that in. That should be it!
2. Google Docs have limit for size... Is there some workaround for this situation?
Unfortunately there is not a way currently to circumvent the size limitations of converted documents. They must be uploaded as unconverted files, and thus, are not editable in the Google Docs user interface.