1

I am creating a game with winforms C#.

The game contains some images that are shown during the game.

I would like to forbid the players to open the game directory and open the image files because seeing them would ruin the gameplay.

For example, in C&C, the players can't just enter the game library and watch the mamoth tank sprites, or view the movies.

Is there a way to forbid players to see those images?

galhajaj
  • 125
  • 1
  • 10
  • 2
    Rename them from `.jpg` to `.dat` ;) – mellamokb Jun 22 '12 at 13:36
  • 1
    Honestly consider your time and efforts it will take to do something like this. Is it really worth it? – asawyer Jun 22 '12 at 13:36
  • This might help: http://stackoverflow.com/questions/1192054/load-image-from-resources-in-c-sharp – Stefan Keller Jun 22 '12 at 13:37
  • 1
    @mellamokb: Renaming is insufficient. There are a lot of image viewers that do not rely on the file ending but check some header information at the beginning of the file instead. Also, someone who is really interested in the file contents might as well be capabale enough to have a look with a Hex editor tool, then find the same header information, and... try to rename the file. – Jens H Jun 22 '12 at 14:31

2 Answers2

3

You could embed them into resources fairly easily and extract them when you need them. See this link for more

Or you could encrypt them and decrypt them when you need them

Kell
  • 3,252
  • 20
  • 19
1

Linked resources are stored as files within the project; during compilation the resource data is taken from the files and placed into the manifest for the application. The application's resource file (.resx) stores only a relative path or link to the file on disk.

With embedded resources, the resource data is stored directly in the .resx file in a text representation of the binary data. In either case, the resource data is compiled into the executable file.

To change a resource from linked to embedded

  1. With a project selected in Solution Explorer, on the Project menu click Properties.
  2. Click the Resources tab.
  3. On the Resource Designer toolbar, point to the resource view drop-down, click the arrow, and select the type of resource that you want to edit.
  4. Select the resource that you wish to change.
  5. In the Properties window, select the Persistence property and change it to Embedded in .resx.