galhajaj
galhajaj

Reputation: 125

Forbid access to images in a C# WinForms game

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?

Upvotes: 1

Views: 174

Answers (2)

user1465261
user1465261

Reputation:

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.

Upvotes: 1

Kell
Kell

Reputation: 3317

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

Upvotes: 3

Related Questions