anyone know c#

Status
Not open for further replies.

Gangleider

speak into the shell
Community Leader
Developer
Joined
Jun 11, 2007
Messages
3,019
Reaction score
2,273
I'm working on a project for my c# classes and decided to make a utility for installing source game servers without all the command line hassle(idc if theres already 50 of them out there.)

Everything works, but I'd appreciate if someone could tell me how to avoid depending on people having a C:\ drive or not(I know some people who have a D or something as their main drives and no C drive at all.)

Also, I don't want to require the end user to install hldsupdatetool in a specific directory, because I need to check if they have hldsupdatetool installed or not and am currently telling them to put it in C:/Servers because that's the only place my program checks in.

The thing is that the only thing I'm doing is checking if the hldsupdatetool.exe file exists in a single directory and completely depend on the end user being clever enough to read what I ask them to do, which isn't too bad but yeah. Rather not take the risk.

Same goes for other things, I am only able to check if files exist in certain specific folders, but I don't know how to, for example, "check if this file exists somewhere on the computer and tell me where it is if it does exist"

tl;dr I want to make this part of my code more foolproof, and work on every(obviously windows based) computer:
Code:
            InitializeComponent();
            string hlds = @"C:\Servers\HldsUpdateTool.exe"; [B]//ARGH[/B]
            if (File.Exists(hlds))
            {
                MessageBox.Show("It appears Hldsupdatetool has been installed correctly, please proceed!");
            }
            else
            {
                MessageBox.Show(@"Hldsupdatetool appears not to be installed in your C:\Servers directory. Please continue and install it! Remember that you MUST install it in C:\Servers"); [B]//GET RID OF THIS SHIT[/B]
                System.Diagnostics.Process.Start(@"C:\hldsupdatetool.exe"); [B]//AND THIS[/B]
            }

edit:i even used grammar because it proved to be hard enough to read as is even though i cant really explain it that well
 
that solves part of the problem but not all of it
i still need to figure out how to fix the code i posted

actually as im typing this i just figured out i might know how to fix it lol hold on
 
Status
Not open for further replies.

Users who are viewing this thread