protected bool ValidateDirectory(string p_strPath, string p_strPathName, string p_strProperty)
{
Errors.Clear(p_strProperty);
if (String.IsNullOrEmpty(p_strPath))
{
Errors.SetError(p_strProperty, String.Format("You must select a {0}.", p_strPathName));
return false;
}
else if (
(String.Equals(EnvironmentInfo.Settings.InstallationPaths[GameModeDescriptor.ModeId], p_strPath)) ||
(p_strPath.Length <= 4)
)
{
Errors.SetError(p_strProperty, string.Format("You can't set the {0} equal to the following:" + Environment.NewLine +
"HD root - {2}" + Environment.NewLine +
"Game root folder - {1}" + Environment.NewLine,
p_strPathName, EnvironmentInfo.Settings.InstallationPaths[GameModeDescriptor.ModeId],
Path.GetPathRoot(p_strPath)));
return false;
}
else
{
try
{
if (String.Equals(GameModeDescriptor.PluginDirectory, p_strPath))
{
Errors.SetError(p_strProperty, string.Format("You can't set the {0} equal to the plugin folder.", p_strPathName));
return false;
}
}
catch (ArgumentNullException)
{
// If the game doesn't supports plugins no need to check for it.
}
}
return true;
}