|
-
Mar 5th, 2016, 10:03 AM
#1
Allow user to embed data while passing exe around
Don't know if this belongs in the C# forum or here, so feel free to move it if you guys feel it would better fit elsewhere.
I have a C# winform app I built that is used for connecting to a game. What I want to do is allow an administrator of a server to download the application, set some stuff up in it like their server IP, port, updater URL, etc., and then distribute that to other players so they don't have to manually re-add that information.
I could always add an app.config or a configuration file to the application, but I was hoping to somehow allow the admin to embed all the data so all the user ever receives is the single .exe.
I could always build something that makes an installer for the user, but I was hoping to avoid that step.
Does anyone have any suggestions or ideas?
Thanks!
-
Mar 6th, 2016, 10:59 AM
#2
Re: Allow user to embed data while passing exe around
It will be interesting to see what others say, but I would suggest that the configuration file approach is the most common solution to problems like this. For one thing, if you have to make a change then you are changing a relatively tiny config file (text, JSON, XML, binary, or whatever) rather than needing to mess with the far more significant .exe file.
My usual boring signature: Nothing
 
-
Mar 6th, 2016, 03:12 PM
#3
Re: Allow user to embed data while passing exe around
Back in my pre-PC days we would patch an .exe with hardcoded values if we needed to.
There must be a way to do that same thing safely.
Probably have to be fixed length values...
-
Mar 6th, 2016, 04:30 PM
#4
Re: Allow user to embed data while passing exe around
Thanks for the replies guys. At this point I've decided to use NullSoft's NSIS. I just set some variables at the top of the script that they can modify and create their own installer.
Not as robust as I wanted, but at least with this they don't need visual studio or a C# compiler to modify the codebase... just download the NSIS compiler, right click the script and voila.
I'm still looking as NSIS has a 2GB limit, and will update the post if I find anything better.
And of course if someone knows a better way, let me in on it
-
Mar 7th, 2016, 09:16 AM
#5
Re: Allow user to embed data while passing exe around
 Originally Posted by kfcSmitty
Thanks for the replies guys. At this point I've decided to use NullSoft's NSIS. I just set some variables at the top of the script that they can modify and create their own installer.
Not as robust as I wanted, but at least with this they don't need visual studio or a C# compiler to modify the codebase... just download the NSIS compiler, right click the script and voila.
I'm still looking as NSIS has a 2GB limit, and will update the post if I find anything better.
And of course if someone knows a better way, let me in on it 
You don't need an IDE to compile .NET apps. As ling as the .NET framework is installed, you have the .NET compiler. It is possible to create your own customized mini-IDE which will compile modules using the C# compiler. You would probably create the configuration file as a resource rather than messing with source code, and the app would just read configuration entries from the resource file.
"Ok, my response to that is pending a Google search" - Bucky Katt.
"There are two types of people in the world: Those who can extrapolate from incomplete data sets." - Unk.
"Before you can 'think outside the box' you need to understand where the box is."
-
Mar 14th, 2016, 09:03 AM
#6
Re: Allow user to embed data while passing exe around
Instead of using a legacy scripted setup you could just package into an MSI database.
Then it should be fairly simple to write a small program to allow editing of config file values and replace the skeleton config file in the MSI database with the new edited one. Just hand out this new MSI database to users for installing.
The only downside is it doesn't work with signed MSI files because you break the signature. This probably isn't an issue though.
If you must use a scripted installer there ought to be some equivalent way of extracting then replacing an individual resource like this. That depends on how your 3rd party tool bundles the pieces and parts (CAB, ZIP, etc. formats usually).
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|