Einzelnen Beitrag anzeigen
Alt 02.05.2012, 19:26   #10 (permalink)
Xeno
10 Jahre hx3
5000 Beiträge
 
Benutzerbild von Xeno
 
Registriert seit: 03.01.2008
Alter: 84
Beiträge: 6.552
Standard

Rockhount, so lese ich den A2/OA Pfad aus, eventuell kannst Du es gebrauchen:

Code:
RegistryKey _regkey = Registry.LocalMachine;
string _arma2path = string.Empty;

try {
	_regkey = _regkey.OpenSubKey(@"SOFTWARE\Bohemia Interactive Studio\ArmA 2 OA", false);

	_arma2path = _regkey.GetValue("MAIN").ToString();
} catch (Exception) {}
finally {
	if (_regkey != null) {
		_regkey.Close();
		_regkey = null;
	}
}

if (_arma2path.Equals(String.Empty)) {
	try {
		_regkey = Registry.LocalMachine;
		_regkey = _regkey.OpenSubKey(@"SOFTWARE\Bohemia Interactive Studio\ArmA 2", false);
		_arma2path = _regkey.GetValue("MAIN").ToString();					
	} catch (Exception) {}
	finally {
		if (_regkey != null) {
			_regkey.Close();
			_regkey = null;
		}
	}
}
			
if (_arma2path.Equals(String.Empty)) {
	try {
		_regkey = Registry.LocalMachine;
		_regkey = _regkey.OpenSubKey(@"SOFTWARE\Valve\Steam\Common\ARMA 2 OA", false);
		_arma2path = _regkey.GetValue("MAIN").ToString();
	} catch (Exception) {}
	finally {
		if (_regkey != null) {
			_regkey.Close();
			_regkey = null;
		}
	}
}
			
if (_arma2path.Equals(String.Empty)) {
	try {
		_regkey = Registry.LocalMachine;
		_regkey = _regkey.OpenSubKey(@"SOFTWARE\Valve\Steam\Common\ARMA 2", false);
		_arma2path = _regkey.GetValue("MAIN").ToString();
	} catch (Exception) {}
	finally {
		if (_regkey != null) {
			_regkey.Close();
			_regkey = null;
		}
	}
}
Könnteste jetzt noch in if then else Statements verschachteln, aber drauf geschi****

Lass aber das Button zum Wählen des Pfades trotzdem drin (falls doch noch irgendeine Variante von A2/OA kommt).

Xeno
__________________
In arma everything is made of refined explodium, armored with wet paper towels.
Xeno ist offline