How to programmatically create a self extracting archive? [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 2 years ago.
Improve this question
I was trying to create a utility that generates an self extracting executable, containing a pregenerated executable and a dynamically generated text file.
I have looked, i may be looking with the wrong keywords, but i have not been able to find anything that would help.

Quick-n-dirty way
You can append whatever you want to an exe and it will work. So you have your pre-made fixed exe unpacker. You append to it an easily-to-find byte sequence, then you append the file. Or better, you append the file to the stub and then append the length as an int64. So in the unpacker you take a look at the last 8 bytes, see how much big is the payload, then you read the payload. No magic sequence necessary. See appending data to an exe for some suggestions.
Better way
You use mono.cecil to modify the exe stub and add as a resource the compressed content. Here there is a question about the argument.

Related

How to parse and extract c# class data [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
I have a c# file as in .txt file format, I have to read it dynamically and extract all data available, I need a parser to idenitify
c# class instances,
C# class fields,
etc..
Can anyone have idea to do this in simple way ?
If your C# file is an actual, valid C# file, you could wrap it in a project inside a solution (very simple, one file project), and then compile it. From the EXE file that got generated, you could use reflection to extract types, fields and methods dynamically during runtime.
Another option is to write a basic text parser that recognizes C# keywords and understands what that metadata is, but I think that the first alternative is easier and faster to implement.

Given a file without extension, how to determine the type of that 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 7 years ago.
Improve this question
Say there are three types of file I want to distinguish, pure text file, JavaScript file, and VB script file. Given file has no extension, how do I tell the file type programmatically?
If the file types are text, as in the examples given, you would need to parse the file content to determine the file type, other file types have a predefined structure which includes headers, such as .dll and .exe files, which follow the PE format (COFF on nix systems).

How to create a file format for a custom application [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 currently have an application written in C#, which performs some calculations on electrical lines sag and tensions.
The program has only the option of exporting a .doc file, or printing to PDF. As it stands, I cannot save it into a format that allows me to change any data, as it is already in word, or pdf.
i need to setup an intermediary file format, that allows editing of the file, while retaining the ability to export the project file to Word or PDF.
Thank you in advance.
You'll have to define your own binary file format. How to define it depends on the data to store and this is up to you.
Or you can use XML file format. Of course again you'll have to define what to write in which structure to the file. It might be a good idea to provide your own DTD.

How to generate a report as a .CIF(Catalog Interchange Format) file format? [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 9 years ago.
Improve this question
I need to generate a report as a .CIF(Catalog Interchange Format) file. I searched on Google, unfortunately I couldn't get any solution.
Do we have any library available to export .cif files?
Thanks in advance.
If you know the specification of the .CIF file and also if this isn't Binary based. you could just safe the file with the .cif extension.
If this is a binary file, you would need the correct classes to save the file as binary .CIF file using the binary formatter.
Otherwise it would just be like saving an xml file or even a plain .txt file.

Generating COBOL code with C# [closed]

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 9 years ago.
Improve this question
I have to generate COBOL code with C# but I haven't got suitable ideas how I could tackle this problem.
The only idea which I have was to generate the COBOL code as plain text but I think this isn't really efficient.
Are there any other/better ways? Could anyone provide an approach for me?
I would be also glad to hear about the smallest tips.
For your information: The data, which I need for the COBOL code I get from a PDF file. Unfortunately I am not able to use Cobol.NET.
The main goal is that a user is able to open a PDF file in the C# program. This PDF file is an empty form where the user have to place several kind of data on it. After editing this form the user must press a button 'run'. The 'run'-button trigger an event which translate the data into COBOL code. Now the COBOL code should contain the data types, values and coordinates of the used fields (data). The coordinates identify the place where the fields should printed on the formular.
If you're using Visual Studio I'd suggest looking into T4 Templates. They allow you to specify the format of your output as it will appear and write C# to manipulate that output.

Categories