I need to change some text values inside an after effect project file that I assume it's a binary file. You cannot edit this file with a text editor, if you do next time you open it you will encounter the error message about corrupted project file.
So i need to for example change "TextArea1" to "Some new text" so as you see the length of the new text is not the same as the original one. should i use BinaryReader or something? how can i find the original String in Byte Array i get from this command...
As I'm a newbie in this field please tell me what should I do in this matter.
The Benefits of Using Function Pointers
Is there a best practice for accessing C++ native COM functions to interop from C#?
How do I use DLLImport with structs as parameters in C#?
- File->Open and select the file.
- On the open button, press the drop down arrow.
- Choose "Open With..."
- Select: Binary Editor.
Speed of virtual call in C# vs C++
This is at least a good starting point.
Connect to Exchange - Getting Started Tutorial? [closed]
It will show you the byte values, and any character value for the byte on the right-hand side..
How to find all possible subsets of a given array?
As for how to edit the text, it all depends on what the format of the data is.
“Unable to find an entry point named [function] in dll” (c++ to c# type conversion)
I know you say it's binary, but that isn't a format, saying something is binary just means you don't actually know what the format is.
Calling C++ dll function from C#: Of structs, strings and wchar_t arrays
It might be that before a string (text) value, the previous byte gives the length of the text, so you could insert some more text and then increase this value.
It might be that the length is stored in two or more bytes (because a byte can only hold values up to 256, and they might use two bytes for the format if they expect they might want text longer than 256).
The format might after a piece of text have a byte that has the value 0 to mark the end of the text.
Also, text may often be stored with one character in 1 byte, or 1 character in 2 bytes, or for some characters (mandarin etc), the number of bytes per characters can vary.. Good luck! The best advice is to try and track down someone who knows what the files format is.
Tell us more about the file, what type is it? Has it got an extension..
As a test, if you just replaced characters byte for byte, then it would probably not be corrupted..
byte data = File.ReadAllBytes("C:\theFileName"); // modify data here File.WriteAllBytes("C:\theFileName", data);
- Read the file in as bytes.
- Locate where the change needs to be made.
- Write out the bytes before the change.
- Write out the bytes of the new text.
- Write out the bytes of the file from after the old text.