Forum C# Error

Error

Postby truefire » February 8th, 2011, 10:00 pm

I've been trying to set up a resources text file called badwords.txt (for a profanity filter) for a while now. I finally got my server code to build with no errors or warnings, but once it starts up, I get the error shown below. I'm not really experienced with C#, so I have no idea what I did that broke it. I've tried removing the code I changed. That did nothing, so I've concluded that I somehow broken something up when I was messing with the project proeperties. Does anyone have any idea what I did? Here's the error text:

Update: If I remove the .resx resource file, then rebuild, it runs again, but that just leaves me back at square one. I'm now almost certain I've done it right. Maybe PlayerIO just doesn't allow resource files? If that's the case, is there any other way for me to embed a text file?

Code: Select all
Server Started
========================
(waiting for connection)

Trying last loaded dll
- error: ServersideGameCode.Properties.Resources.resourceMan is static -- Static fields are disallowed
- error: ServersideGameCode.Properties.Resources.resourceCulture is static -- Static fields are disallowed
- error: ServersideGameCode.Properties.Resources.resourceMan is of the non-allowed type: System.Resources.ResourceManager
- error: return type of ServersideGameCode.Properties.Resources.get_ResourceManager(...) is of the non-allowed type: System.Resources.ResourceManager
- error: ServersideGameCode.Properties.Resources.get_ResourceManager(...) has varible of the non-allowed type: System.Resources.ResourceManager
- error: ServersideGameCode.Properties.Resources.get_ResourceManager(...) has varible of the non-allowed type: System.Resources.ResourceManager
- error: ServersideGameCode.Properties.Resources.get_ResourceManager(...) uses the non-allowed method: System.Void System.Resources.ResourceManager::.ctor(System.String,System.Reflection.Assembly)
- error: ServersideGameCode.Properties.Resources.get_badwords(...) uses the non-allowed method: System.String System.Resources.ResourceManager::GetString(System.String,System.Globalization.CultureInfo)

Trying last loaded dll
- error: Could not find any Player.IO Server types in the dll.

Checking if newGame.dll is a game dll (from application directory)
- error: ServersideGameCode.Properties.Resources.resourceMan is static -- Static fields are disallowed
- error: ServersideGameCode.Properties.Resources.resourceCulture is static -- Static fields are disallowed
- error: ServersideGameCode.Properties.Resources.resourceMan is of the non-allowed type: System.Resources.ResourceManager
- error: return type of ServersideGameCode.Properties.Resources.get_ResourceManager(...) is of the non-allowed type: System.Resources.ResourceManager
- error: ServersideGameCode.Properties.Resources.get_ResourceManager(...) has varible of the non-allowed type: System.Resources.ResourceManager
- error: ServersideGameCode.Properties.Resources.get_ResourceManager(...) has varible of the non-allowed type: System.Resources.ResourceManager
- error: ServersideGameCode.Properties.Resources.get_ResourceManager(...) uses the non-allowed method: System.Void System.Resources.ResourceManager::.ctor(System.String,System.Reflection.Assembly)
- error: ServersideGameCode.Properties.Resources.get_badwords(...) uses the non-allowed method: System.String System.Resources.ResourceManager::GetString(System.String,System.Globalization.CultureInfo)

Checking if newGame.dll is a game dll (from application directory)
- error: Could not find any Player.IO Server types in the dll.
truefire
 
Posts: 15
Joined: November 22nd, 2010, 6:01 am

Re: Error

Postby Henrik » February 9th, 2011, 12:00 pm

If you want to embed resources in your game DLL you should check out this page:

http://playerio.com/documentation/refer ... edresource

Just put your text file with badwords anywhere in the project, right-click it, choose "Properties", and change build action to "Embedded resource". That way it will be copied into the DLL, and you can then use our EmbeddedResource class to get the data. Don't use that .resx thing.
Henrik
.IO
 
Posts: 1880
Joined: January 4th, 2010, 1:53 pm

Re: Error

Postby truefire » February 10th, 2011, 11:15 pm

Thanks! I got it working. I had tried just placing it in the project and setting it to embedded resource before, but I didn't know playerIO has a class for it. (I'd tried the usual way, and it didn't work)
truefire
 
Posts: 15
Joined: November 22nd, 2010, 6:01 am


Return to C#