Advertisement

Programmatically search .fla Flash file for imported component

Started by February 17, 2015 09:37 PM
2 comments, last by musafir2007 9 years, 10 months ago

Hi,

I have about 500 flash files that I need to search for various imported components.

There is a program called "Windows Grep", which is able to search through the fla and find the name of the component I am looking for, but searching is tedious since I have to do each one manually.

I am trying to do a simple search in C#, using

string fileContent = File.ReadAllText(@"C:\MyFile.fla");
richTextBox1.Text = fileContent;
but this just prints: ?
I feel like this has to do something with encoding, but I am not sure how. Can someone help me with this.
Thanks,
Shivam
The problem is that flash files are in binary, and you're attempting to read them as text, which is a big no-no (in the general case). I'm assuming that you are only attempting to identify files having the component and nothing more. If this is the case, then you may be able to use any text editor with a "find all in files" feature.
Advertisement

thanks, but I don't want to do that since I have to parse almost 300+ files.

I also noticed that windows notepad somehow figures out the encoding of the .fla and displays some useful information which if I can just get into C# string will make my life so much easier.

I have tried almost every encoding available to open a file, but can't get text that notepad shows

string allText = File.ReadAllText("C:\\SimpleFlaFile.fla", Encoding.UTF8);

I have attached a simple fla file (just change ext to .txt because I can't upload .fla) with a Clip named "BlueBox" and when you open the fla in notepad, and search it has text "B l u e B o x". I can parse files if I can get that...

Hi, another small discovery..

If I open the above SimpleFlaFile in Notepad++, and then go to Encoding > Convert to UTF-8, it then shows the same content that notepad shows and I can parse.

If notepad++ can do this by converting, then there must be some way using c#.

Anyone know how this converting works? thanks!!

This topic is closed to new replies.

Advertisement