TryGetTemplatePath
(
out String templatePath
)
{
String sTemplateFolderPath;
if (RunningInDevelopmentEnvironment)
{
// Samples, depending on which program is being run:
//
// 1. "C:\NodeXL\ExcelTemplate\bin\Debug"
//
// 2. "C:\NodeXL\NetworkServer\bin\Debug"
//
// 3. "C:\NodeXL\GraphMLFileProcessor\bin\Debug"
sTemplateFolderPath = Path.GetDirectoryName(
GetExecutingAssemblyPath() );
// The template in the development environment is under the
// ExcelTemplate folder. For cases 2 and 3, fix the folder.
const String ExcelTemplateFolderName = "ExcelTemplate";
sTemplateFolderPath = sTemplateFolderPath.Replace(
"NetworkServer", ExcelTemplateFolderName);
sTemplateFolderPath = sTemplateFolderPath.Replace(
"GraphMLFileProcessor", ExcelTemplateFolderName);
}
else
{
// The deployment process puts the template file in a subfolder of
// the deployment folder.
sTemplateFolderPath = Path.Combine(
GetApplicationFolder(),
ProjectInformation.ExcelTemplateSubfolder
);
}
templatePath = Path.Combine(
sTemplateFolderPath, ProjectInformation.ExcelTemplateName);
return ( File.Exists(templatePath) );
}