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.
Related
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.
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 have an application i have designed and built in C# that uses some complex filtering. i have manually calculated filter values/parameters outside of my application and added them in. this method works temporarily, but ideally i want to generate my values inside my application. The values i generate come from C++. so my thought process is to create a standalone C++ application that i run from my C# application and generate the new values and save them into some .txt file that will automatically add the new filter in. is there a better way to do this without converting this code into C#?
Off the top of my head, here's a few ideas:
Like you suggested, you could save the values to a text file, and then read them in.
You could make the C++ program into a server, and connect the C# program to the C++ program over a TCP connection.
You could use a database like SQL Server to store the values.
I'm sure there's other ways to do it, but those are what came to mind.
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 path, which contains different kind of files(like .sdf,.sdb). I need to find out how many files are password protected. I searched but i found the result only for doc,xls kind of files. I need generic result. Can any one suggest me.
Define "is password protected" in general terms; I don't think it exists... you'd need to handle individual file types individually. "password protected" isn't a file-system feature - it is a file format feature, or sometimes just an application feature (the data in the file not actually being protected).
So: no, you can't do this except by handling a wide range of file types.
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.
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.