dat idx files database recognition - c#

I have some .dat and .idx files and one .sup file in a directory , and i would like to know if there is any tool or .net programming tecnique to find out what type of database is?
I dont know if this could help, but if i open one .dat file as text file, i get this: 0~0904021846460509040218464605>ÀÀX2Ü
And the common part of all the .dat files, is the following string at the start 0~09040218.
Could you give me a hand?
Thanks a lot.
Kind Regards.
Josema.

Linux has a file command that uses a listing of magic numbers to try and id a file type. There's a Win32 port - but I can't vouch for it. Personally, I'd xfer it over to a Linux system and run it there.

Related

SSIS - Move and open zip file / load xml file to the BD

first of all you're amazing.
About my problem, what i have to do, is:
I have a folder in the sftp with multiple files (zip).
What i need do do is, load those files from the sftp, one by one to a stagging folder, open them, inside they are 3 files, 2 pdf and one xml.
I need to upload the xml to the bd.
After that, based in one field of the xml (ExternalID) i need to move the file in some folder, that depends of the ExternalID, before i move the files, i need to zip all 3 files and name the zip with the ExternalID.
Anyone did something similar? Or some advises to do this?
Any help will be appreciated.
Regards.
SSIS doesn't support SFTP natively.
WinSCP (free of charge) could be handy.
Here is its link: SFTP Task for SSIS/SSDT

Need to change the language of a .xml file compared to an excel file c#

I want to make a multi language app that uses .xml files but i want to upload a excel file and a base language file (french) and the language of the .xml file will be changed according to the ID's each word/phrase is linked to. All of the words/translations will be on the excel file before hand. So yeah just want to compare the base lang file to the excel file and then produce a new xml file with a different language.
Are there any good sites or places i could go do research on this type of project? I have been looking for a good few days now and it have found nothing really that helps me with my issue. So yeah if you could point me int he right direction i would be really grateful.

Importing .csv files to SSIS

For reasons best known to a supplier I am being provided a number of .CSV files in both ANSI and UTF formats and this is confusing my flat file load process. Basically, I cannot rely on the format being the same each time, although the structure is consistent.
So my questions are:
Does the fact that my flat file process has issues with (UTF and ANSI) mean that I have not set up the flat file connection properly?
I believe I have identified two possible solutions, but which of these solutions would be best?
A split by type (ANSI vs UTF) and if so how?
Convert all the .csv files to "excel" as part of a VB/C# script task? For "excel" read any other common format.
Thanks for your help.
Flat file connection manager change code page to 65001 (utf -8)
sample com

Detect file extension c#

There is a virus that my brother got in his computer and what that virus did was to rename almost all files in his computer. It changed the file extensions as well. so a file that might have been named picture.jpg was renamed to kjfks.doc for example.
so what I have done in order to solve this problem is:
remove all file extensions from files. (I use a recursive method to search for all files in a directory and as I go through the files I remove the extension)
now the files do not have an extension. the files now look like:
I think this file names are stored in a local database created by the virus and if I purchase the anti virus they will be renamed back to their original name.
since my brother created a backup I selected the files that had a creation date latter than when my brother performed the backup. so I have placed that files in a directory.
I am not interested in getting the right extension as long as I can see the content of the file. for example, I will scan each file and if it has text inside I know it will have a .txt extension. maybe it was a .html or .css extension I will not be able to know that I know.
I belive that all pdf files should have something in common. or doc files should also have something in common. How can I figure what the most common types (pdf, doc, docx, png, jpg, etc) files have in common)
Edit:
I know it will probably take less time to go over all this 200 files and test each one instead of creating this program. it is just that I am curios to see if it will be possible to get the file extension.
In unix, you can use file to determine the type of file. There is also a port for windows and you can obviously write a script (batch, powershell, etc.) or C# program to automate this.
First, congratulate your brother on doing a backup. Many people don't, and are absolutely wiped out by these problems.
You're going to have to do a lot of research, I'm afraid, but you're on the right track.
Open each file with a TextReader or a BinaryReader and examine the headers. Most of them are detectable.
For instance: Every PDF starts with "%PDF-" and then its version number. Just look at those first 5 characters. If it's "%PDF-", then put a PDF on the filename and move on.
Similarly: "ÿØÿà..JFIF" for JPEG's, "[InternetShortcut]" for URL shortcuts, "L...........À......Fƒ" for regular shortcuts (the "." is a zero/null, BTW)
ZIPs / Compressed directories start with {0x50}{0x4B]{0x03}{0x04}{0x14}, and you should be aware that Office 2007/2010 documents are really ZIPs with XML files inside of them.
You'll have to do some digging as you find each type, but you should be able to write something to establish most of the file types.
You'll have to write some recursion to work through directories, but you can eliminate any file with no extension.
BTW - A great tool to help pwith this is HxD: http://www.mh-nexus.de/ It's what I used to pull this answer together!
Good luck!
"most common types" each have it's own format and most of them have some magic bytes at the fixed position near beginning of the file. You can detect most of formats quite easily. Even HTML, XML, .CSS and similar text files can be detected by analyzing their beginning. But it will take some time to write an application that will guess the format. For some types (such as ODF format or JAR format, which are built on top of regular ZIPs) you will be also able to detect this format.
But ... Can it be that there exists such application on the market? I guess you can find something if you search, cause the task is not as tricky as it initially seems to be.

How to extract files from .CAB file using C#.Net?

I have a CAB file generated from CABARC.EXE. I need to extract the file using ASP.Net C#.Net.
How to do it in C#.net itself? I don't want to use the same CABARC.EXE for extraction. Because we don't use this tool in production environment.
Please give your valuable suggestions/code to achieve this task.
Thanks in advance
Ganesh.
I googled this for you.
http://www.codeproject.com/KB/files/CABCompressExtract.aspx
Looks like it does everything you want.
If you want a native C# solution I suggest you start with the file specification for CAB files here:
http://msdn.microsoft.com/en-us/library/cc483132(EXCHG.80).aspx
Have a look at https://learn.microsoft.com/en-us/previous-versions//bb267310(v=vs.85)#microsoft-cabinet-file-format
There you have a file format description for the CAB file.

Categories

Resources