public static string GetConfigFile()
{
try
{
string pathToUserProf = generateUserCachePath();
string configFileName = fileName + "." + type + ".config";
List<string> pPrevConfFiles = new List<string>(Directory.GetFiles(pathToUserProf, "loaded.config", System.IO.SearchOption.AllDirectories));
if (pathToUserProf != "")
{
if (File.Exists(Path.Combine(pathToUserProf, configFileName)))
{
return Path.Combine(pathToUserProf, configFileName);
}
else
if (pPrevConfFiles.Count > 0 && type != "gas")
{
getInstalledConfig(pathToUserProf, true);
File.Copy(pPrevConfFiles[0], Path.Combine(pathToUserProf, configFileName));
return Path.Combine(pathToUserProf, configFileName);
}
else
{
return getInstalledConfig(pathToUserProf,false);
}
}
else
return "";
}
catch (Exception ex)
{
MessageBox.Show("GetConfigFile: " + ex.Message);
return "";
}
}