internal void SetupDefaultApplicationBase(string imageLocation) {
StringBuilder config = null;
char[] sep = {'\\', '/'};
int i = imageLocation.LastIndexOfAny(sep);
string appBase = null;
if (i == -1)
config = new StringBuilder(imageLocation);
else {
appBase = imageLocation.Substring(0, i+1);
config = new StringBuilder(imageLocation.Substring(i+1));
}
string appName;
if (i == -1)
appName = imageLocation;
else
appName = imageLocation.Substring(i+1);
config.Append(AppDomainSetup.ConfigurationExtension);
// If there was no configuration file but we built
// the appbase from the module name then add the
// default configuration file.
if (config != null)
this.ConfigurationFile = config.ToString();
if (appBase != null)
this.ApplicationBase = appBase;
if (appName != null)
this.ApplicationName = appName;
}