Vishal Suthar
Vishal Suthar

Reputation: 17194

Keep file restricted from opening it by anyone

I have an application in c#.net in which I have embeded the SWF file in SWFObject from COM Object.

Now after installation, the original SWF file also available in the application root directory. So from that place(application root directory) anyone can access that file. But I want to restrict that file from being opened.

axShockwaveFlash1.Movie = Directory.GetCurrentDirectory() + "\\XYZ.swf";

I did something like this.

So how can I restrict that file in application root directory such that only from my application I can access it..??

Upvotes: 1

Views: 157

Answers (3)

Chris Haas
Chris Haas

Reputation: 55427

Permissions are based on users, not applications, so the short answer is you can't. However, you can build your own application-specific authentication pretty easily. Have your SWF require specific FlashVars to be set in order to move beyond frame 1. People can still decompile your SWF but this will at least stop most people. Another option is to try to store the data within you binary somehow and load the SWF using a byte-array, see this post for one attempt at that.

Upvotes: 1

YoryeNathan
YoryeNathan

Reputation: 14522

You could save the swf file binary data as static bytes in your code and statically load them and convert back to an swf file. The conversion might take a little while but it only occurs once as you open the program.

Edit: But k3b's answer is better.

Upvotes: 1

k3b
k3b

Reputation: 14755

You can embed the file into a dll or exe file and play it from there. this way it is not (as a seperate file) in the file system at all.

For details see How to embed and access resources by using Visual C#.

Upvotes: 1

Related Questions