MET08DDUPSP1TBI - v2.39.0 - DevOps
Dummy Update references
This commit is contained in:
@ -220,61 +220,47 @@ public class FileRead : Shared.FileRead, IFileRead
|
||||
{
|
||||
try
|
||||
{
|
||||
string pathSegment;
|
||||
string monARessource;
|
||||
string sourceParentDirectory;
|
||||
string targetParentDirectory;
|
||||
DateTime dateTime = DateTime.Now;
|
||||
if (!_FileConnectorConfiguration.TargetFileLocation.Contains(_FileConnectorConfiguration.SourceFileLocation))
|
||||
throw new Exception("Target must start with source");
|
||||
if (!string.IsNullOrEmpty(Path.GetFileName(_FileConnectorConfiguration.SourceFileLocation)))
|
||||
sourceParentDirectory = Path.GetDirectoryName(_FileConnectorConfiguration.SourceFileLocation);
|
||||
else
|
||||
sourceParentDirectory = Path.GetDirectoryName(Path.GetDirectoryName(_FileConnectorConfiguration.SourceFileLocation));
|
||||
if (!string.IsNullOrEmpty(Path.GetFileName(_FileConnectorConfiguration.TargetFileLocation)))
|
||||
targetParentDirectory = Path.GetDirectoryName(_FileConnectorConfiguration.TargetFileLocation);
|
||||
else
|
||||
targetParentDirectory = Path.GetDirectoryName(Path.GetDirectoryName(_FileConnectorConfiguration.TargetFileLocation));
|
||||
if (sourceParentDirectory != targetParentDirectory)
|
||||
throw new Exception("Target and source must have the same parent for Si Dummy FileConnectorConfiguration!");
|
||||
bool check = dateTime.Hour > 7 && dateTime.Hour < 18 && dateTime.DayOfWeek != DayOfWeek.Sunday && dateTime.DayOfWeek != DayOfWeek.Saturday;
|
||||
if (!_IsEAFHosted || check)
|
||||
{
|
||||
string checkSegment;
|
||||
string checkDirectory;
|
||||
string monARessource;
|
||||
string sourceFileFilter;
|
||||
string sourceArchiveFile;
|
||||
string sourceFileLocation;
|
||||
string weekOfYear = _Calendar.GetWeekOfYear(dateTime, CalendarWeekRule.FirstDay, DayOfWeek.Sunday).ToString("00");
|
||||
string traceDummyDirectory = Path.Combine(Path.GetPathRoot(_TracePath), "TracesDummy", _CellInstanceName, "Source", $"{dateTime:yyyy}___Week_{weekOfYear}");
|
||||
if (!Directory.Exists(traceDummyDirectory))
|
||||
_ = Directory.CreateDirectory(traceDummyDirectory);
|
||||
string traceDummyFile = Path.Combine(traceDummyDirectory, $"{dateTime.Ticks} - {_CellInstanceName}.txt");
|
||||
File.AppendAllText(traceDummyFile, string.Empty);
|
||||
if (_FileConnectorConfiguration.SourceFileLocation.EndsWith("\\"))
|
||||
sourceFileLocation = _FileConnectorConfiguration.SourceFileLocation;
|
||||
else
|
||||
sourceFileLocation = string.Concat(_FileConnectorConfiguration.SourceFileLocation, '\\');
|
||||
for (int i = 0; i < _FileConnectorConfiguration.SourceFileFilters.Count; i++)
|
||||
{
|
||||
_LastDummyRunIndex += 1;
|
||||
if (_LastDummyRunIndex >= _FileConnectorConfiguration.SourceFileFilters.Count)
|
||||
_LastDummyRunIndex = 0;
|
||||
sourceFileFilter = _FileConnectorConfiguration.SourceFileFilters[_LastDummyRunIndex];
|
||||
sourceArchiveFile = Path.GetFullPath(string.Concat(sourceFileLocation, sourceFileFilter));
|
||||
sourceArchiveFile = Path.Combine(_FileConnectorConfiguration.SourceFileLocation, sourceFileFilter);
|
||||
if (File.Exists(sourceArchiveFile))
|
||||
{
|
||||
checkSegment = _FileConnectorConfiguration.TargetFileLocation.Substring(sourceFileLocation.Length);
|
||||
checkDirectory = Path.GetDirectoryName(sourceArchiveFile);
|
||||
for (int z = 0; z < int.MaxValue; z++)
|
||||
{
|
||||
if (checkDirectory.Length < sourceFileLocation.Length || !checkDirectory.StartsWith(sourceFileLocation))
|
||||
break;
|
||||
checkDirectory = Path.GetDirectoryName(checkDirectory);
|
||||
if (Directory.Exists(Path.Combine(checkDirectory, checkSegment)))
|
||||
{
|
||||
checkDirectory = Path.Combine(checkDirectory, checkSegment);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!checkDirectory.EndsWith(checkSegment))
|
||||
throw new Exception("Could not determine dummy target directory for extract!");
|
||||
if (!long.TryParse(Path.GetFileNameWithoutExtension(sourceArchiveFile).Replace("x", string.Empty), out long sequence))
|
||||
throw new Exception("Invalid file name for source archive file!");
|
||||
pathSegment = checkDirectory.Substring(sourceFileLocation.Length);
|
||||
monARessource = GetCellName(pathSegment);
|
||||
monARessource = GetCellName(sourceArchiveFile);
|
||||
if (string.IsNullOrEmpty(monARessource))
|
||||
throw new Exception("Could not determine which cell archive file is associated with!");
|
||||
if (_IsEAFHosted)
|
||||
CallbackFileExists(sourceArchiveFile, traceDummyFile, checkDirectory, monARessource, sequence);
|
||||
CallbackFileExists(sourceArchiveFile, traceDummyFile, _FileConnectorConfiguration.TargetFileLocation, monARessource, sequence);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user