/// <summary> /// Get the folder name /// </summary> /// <returns></returns> public static string GetFolderName(EnumXmlFilePathType pathType) { switch(pathType) { case EnumXmlFilePathType.FILE_PARSE: return "FileParse"; default: return ""; } }
/// <summary> /// Create the Xml file full path /// </summary> /// <param name="xmlFile"></param> /// <param name="pathType"></param> /// <returns></returns> private string ConstructXmlFilePath(string xmlFile, EnumXmlFilePathType pathType) { // Get application path in both ASp.NET or console application Uri uri = new Uri(Assembly.GetExecutingAssembly().GetName().CodeBase); string currentAppPath = Path.GetDirectoryName(uri.LocalPath); // We want the Model string filePath = Path.Combine(currentAppPath, @"App_Data\Models"); // Get the folder name from the Model type filePath = Path.Combine(filePath, FactoryFolderName.GetFolderName(pathType)); filePath = Path.Combine(filePath, xmlFile); return filePath; }
/// <summary> /// Create object using the Assembly Xml file name /// </summary> /// <param name="xmlFile"></param> /// <param name="pathType"></param> public GenerateRuntimeAssembly(string xmlFile, EnumXmlFilePathType pathType) { LoadAssemblyXmlData(ConstructXmlFilePath(xmlFile, pathType)); }