Added Validity Check - Procedure Set Path against Config DataPath
Removed PDF Path and validity checks
This commit is contained in:
parent
505bfa467d
commit
f8a73cfefe
@ -16,6 +16,7 @@ namespace DataLoader
|
||||
[Serializable]
|
||||
class DataLoaderSettings:ICloneable
|
||||
{
|
||||
private static List<string> _MyDataPaths = Loader.DataPaths;
|
||||
#region Clone
|
||||
public object Clone()
|
||||
{
|
||||
@ -221,18 +222,18 @@ namespace DataLoader
|
||||
set { _PurgeExistingData = value; }
|
||||
}
|
||||
#endregion
|
||||
#region PDFs
|
||||
private string _PDFFolder; // Folder
|
||||
[Category("PDFs")]
|
||||
[DisplayName("PDF Folder")]
|
||||
[Description("Location for PDFs when printing.")]
|
||||
[EditorAttribute(typeof(UIFolderEditor), typeof(System.Drawing.Design.UITypeEditor))]
|
||||
public string PDFFolder
|
||||
{
|
||||
get { return _PDFFolder; }
|
||||
set { _PDFFolder = value; }
|
||||
}
|
||||
#endregion
|
||||
//#region PDFs
|
||||
//private string _PDFFolder; // Folder
|
||||
//[Category("PDFs")]
|
||||
//[DisplayName("PDF Folder")]
|
||||
//[Description("Location for PDFs when printing.")]
|
||||
//[EditorAttribute(typeof(UIFolderEditor), typeof(System.Drawing.Design.UITypeEditor))]
|
||||
//public string PDFFolder
|
||||
//{
|
||||
// get { return _PDFFolder; }
|
||||
// set { _PDFFolder = value; }
|
||||
//}
|
||||
//#endregion
|
||||
#region Debugging
|
||||
private ExecutionMode _ExecutionMode;
|
||||
[TypeConverter(typeof(EnumDescConverter))]
|
||||
@ -360,13 +361,34 @@ namespace DataLoader
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!File.Exists(ProcedureSetPath + @"\set.dbf"))
|
||||
if (!InDataPaths(ProcedureSetPath))
|
||||
{
|
||||
sb.Append(ErrorPrefix + string.Format("Procedure Folder not in DataPath from Config File '{0}' \r\n", DataLoaderSettings._MyDataPaths[0]));
|
||||
ErrorPrefix = "";
|
||||
}
|
||||
else if (!File.Exists(ProcedureSetPath + @"\set.dbf"))
|
||||
{
|
||||
sb.Append(ErrorPrefix + "Procedure Folder must point to an existing procedure data folder\r\n");
|
||||
ErrorPrefix = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((ProcedureSetPath ?? "") == "" || !Directory.Exists(ProcedureSetPath))
|
||||
{
|
||||
sb.Append(ErrorPrefix + "Procedure Folder must point to an existing folder\r\n");
|
||||
ErrorPrefix = "";
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!InDataPaths(ProcedureSetPath))
|
||||
{
|
||||
sb.Append(ErrorPrefix + string.Format("Procedure Folder not in DataPath from Config File '{0}' \r\n", DataLoaderSettings._MyDataPaths[0]));
|
||||
ErrorPrefix = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
//added by jcb 20121127
|
||||
//check is ProcedureSetPath contains ProcessOnlyInLocation
|
||||
if (ProcedureSetPath != null && ProcedureSetPath.StartsWith(ProcessOnlyInLocation ?? "") == false)
|
||||
@ -459,11 +481,11 @@ namespace DataLoader
|
||||
}
|
||||
}
|
||||
// PDFFolder = if not set, then don't set PDFFolder in DocVersion.Config
|
||||
if (ExecutionMode == ExecutionMode.Debug && ((PDFFolder ?? "") == "" || !Directory.Exists(PDFFolder)))
|
||||
{
|
||||
sb.Append(ErrorPrefix + "PDF Folder must point to an existing folder in debug mode\r\n");
|
||||
ErrorPrefix = "";
|
||||
}
|
||||
//if (ExecutionMode == ExecutionMode.Debug && ((PDFFolder ?? "") == "" || !Directory.Exists(PDFFolder)))
|
||||
//{
|
||||
// sb.Append(ErrorPrefix + "PDF Folder must point to an existing folder in debug mode\r\n");
|
||||
// ErrorPrefix = "";
|
||||
//}
|
||||
// Skip = Any NUmber
|
||||
// PurgeExistingData = N/A
|
||||
// OnlyThisSet = N/A
|
||||
@ -473,6 +495,12 @@ namespace DataLoader
|
||||
return sb.ToString();
|
||||
}
|
||||
}
|
||||
private bool InDataPaths(string ProcedureSetPath)
|
||||
{
|
||||
foreach (string dp in _MyDataPaths)
|
||||
if (ProcedureSetPath.ToUpper().StartsWith(dp.ToUpper())) return true;
|
||||
return false;
|
||||
}
|
||||
private string ValidateConnectionString(string dbName)
|
||||
{
|
||||
if(!ConnectionString.Contains("{DBName}"))
|
||||
|
Loading…
x
Reference in New Issue
Block a user