Switched to xml for InfinityQS push and removed process-data-standard-format copy
This commit is contained in:
@ -103,19 +103,6 @@ public class FileRead : Shared.FileRead, IFileRead
|
|||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void FileCopy<T>(string reportFullPath, DateTime dateTime, List<T> descriptions) where T : Shared.Properties.IDescription
|
|
||||||
{
|
|
||||||
bool isDummyRun = false;
|
|
||||||
string successDirectory = string.Empty;
|
|
||||||
List<(Shared.Properties.IScopeInfo, string)> collection = new();
|
|
||||||
string duplicateDirectory = Path.Combine(_FileConnectorConfiguration.SourceFileLocation, _CellInstanceName);
|
|
||||||
if (!Directory.Exists(duplicateDirectory))
|
|
||||||
_ = Directory.CreateDirectory(duplicateDirectory);
|
|
||||||
string duplicateFile = Path.Combine(duplicateDirectory, Path.GetFileName(reportFullPath));
|
|
||||||
File.Copy(reportFullPath, duplicateFile, overwrite: true);
|
|
||||||
WaitForFileConsumption(dateTime, descriptions, isDummyRun, successDirectory, duplicateDirectory, collection, duplicateFile);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void WriteFile<T>(string reportFullPath, DateTime dateTime, List<T> descriptions) where T : Shared.Properties.IDescription
|
private void WriteFile<T>(string reportFullPath, DateTime dateTime, List<T> descriptions) where T : Shared.Properties.IDescription
|
||||||
{
|
{
|
||||||
bool isDummyRun = false;
|
bool isDummyRun = false;
|
||||||
@ -140,8 +127,6 @@ public class FileRead : Shared.FileRead, IFileRead
|
|||||||
List<Shared.Properties.IDescription> descriptions = GetDuplicatorDescriptions(jsonElements);
|
List<Shared.Properties.IDescription> descriptions = GetDuplicatorDescriptions(jsonElements);
|
||||||
Test[] tests = (from l in descriptions select (Test)l.Test).ToArray();
|
Test[] tests = (from l in descriptions select (Test)l.Test).ToArray();
|
||||||
if (_IsEAFHosted && _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0)
|
if (_IsEAFHosted && _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0)
|
||||||
FileCopy(reportFullPath, dateTime, descriptions);
|
|
||||||
if (string.IsNullOrEmpty(reportFullPath) && _IsEAFHosted && _FileConnectorConfiguration.FileScanningIntervalInSeconds > 0)
|
|
||||||
WriteFile(reportFullPath, dateTime, descriptions);
|
WriteFile(reportFullPath, dateTime, descriptions);
|
||||||
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(string.Join(Environment.NewLine, processDataStandardFormat.Logistics), tests, jsonElements, new List<FileInfo>());
|
results = new Tuple<string, Test[], JsonElement[], List<FileInfo>>(string.Join(Environment.NewLine, processDataStandardFormat.Logistics), tests, jsonElements, new List<FileInfo>());
|
||||||
return results;
|
return results;
|
||||||
|
@ -41,24 +41,6 @@ stages:
|
|||||||
displayName: "Nuget Clear"
|
displayName: "Nuget Clear"
|
||||||
enabled: false
|
enabled: false
|
||||||
|
|
||||||
- task: CopyFiles@2
|
|
||||||
displayName: 'Copy GhostPCL Files to: D:\EAF-Mesa-Integration\copy'
|
|
||||||
inputs:
|
|
||||||
Contents: "*"
|
|
||||||
SourceFolder: '\\mesfs.infineon.com\EC_EAFRepository\Staging\DeploymentStorage\GhostPCL'
|
|
||||||
TargetFolder: 'D:\EAF-Mesa-Integration\copy\GhostPCL'
|
|
||||||
OverWrite: true
|
|
||||||
enabled: true
|
|
||||||
|
|
||||||
- task: CopyFiles@2
|
|
||||||
displayName: 'Copy LincPDFC Files to: D:\EAF-Mesa-Integration\copy'
|
|
||||||
inputs:
|
|
||||||
Contents: "*"
|
|
||||||
SourceFolder: '\\mesfs.infineon.com\EC_EAFRepository\Staging\DeploymentStorage\LincPDFC'
|
|
||||||
TargetFolder: 'D:\EAF-Mesa-Integration\copy\LincPDFC'
|
|
||||||
OverWrite: true
|
|
||||||
enabled: true
|
|
||||||
|
|
||||||
- script: |
|
- script: |
|
||||||
"C:\program files\dotnet\dotnet.exe" user-secrets init
|
"C:\program files\dotnet\dotnet.exe" user-secrets init
|
||||||
"C:\program files\dotnet\dotnet.exe" user-secrets set "BuildNumber" "$(Build.BuildId)"
|
"C:\program files\dotnet\dotnet.exe" user-secrets set "BuildNumber" "$(Build.BuildId)"
|
||||||
@ -202,24 +184,6 @@ stages:
|
|||||||
displayName: "Nuget Clear"
|
displayName: "Nuget Clear"
|
||||||
enabled: false
|
enabled: false
|
||||||
|
|
||||||
- task: CopyFiles@2
|
|
||||||
displayName: 'Copy GhostPCL Files to: D:\EAF-Mesa-Integration\copy'
|
|
||||||
inputs:
|
|
||||||
Contents: "*"
|
|
||||||
SourceFolder: '\\mestsa003.infineon.com\EC_EAFRepository\Staging\DeploymentStorage\GhostPCL'
|
|
||||||
TargetFolder: 'D:\EAF-Mesa-Integration\copy\GhostPCL'
|
|
||||||
OverWrite: true
|
|
||||||
enabled: true
|
|
||||||
|
|
||||||
- task: CopyFiles@2
|
|
||||||
displayName: 'Copy LincPDFC Files to: D:\EAF-Mesa-Integration\copy'
|
|
||||||
inputs:
|
|
||||||
Contents: "*"
|
|
||||||
SourceFolder: '\\mestsa003.infineon.com\EC_EAFRepository\Staging\DeploymentStorage\LincPDFC'
|
|
||||||
TargetFolder: 'D:\EAF-Mesa-Integration\copy\LincPDFC'
|
|
||||||
OverWrite: true
|
|
||||||
enabled: true
|
|
||||||
|
|
||||||
- script: |
|
- script: |
|
||||||
"C:\program files\dotnet\dotnet.exe" user-secrets init
|
"C:\program files\dotnet\dotnet.exe" user-secrets init
|
||||||
"C:\program files\dotnet\dotnet.exe" user-secrets set "BuildNumber" "$(Build.BuildId)"
|
"C:\program files\dotnet\dotnet.exe" user-secrets set "BuildNumber" "$(Build.BuildId)"
|
||||||
|
@ -872,6 +872,8 @@ internal class ProcessDataStandardFormat
|
|||||||
string tag;
|
string tag;
|
||||||
string value;
|
string value;
|
||||||
string[] segments;
|
string[] segments;
|
||||||
|
List<string> values;
|
||||||
|
Dictionary<string, List<string>> results = new();
|
||||||
ReadOnlyCollection<string> body = processDataStandardFormat.InputPDSF is null ?
|
ReadOnlyCollection<string> body = processDataStandardFormat.InputPDSF is null ?
|
||||||
processDataStandardFormat.Body : processDataStandardFormat.InputPDSF.Body;
|
processDataStandardFormat.Body : processDataStandardFormat.InputPDSF.Body;
|
||||||
ReadOnlyCollection<string> columns = processDataStandardFormat.InputPDSF is null ?
|
ReadOnlyCollection<string> columns = processDataStandardFormat.InputPDSF is null ?
|
||||||
@ -879,7 +881,6 @@ internal class ProcessDataStandardFormat
|
|||||||
List<string> lines = new() { "<?xml version=\"1.0\" encoding=\"UTF-8\"?>", "<records>" };
|
List<string> lines = new() { "<?xml version=\"1.0\" encoding=\"UTF-8\"?>", "<records>" };
|
||||||
for (int i = 0; i < body.Count; i++)
|
for (int i = 0; i < body.Count; i++)
|
||||||
{
|
{
|
||||||
lines.Add(" <record>");
|
|
||||||
segments = body[i].Trim().Split('\t');
|
segments = body[i].Trim().Split('\t');
|
||||||
if (segments.Length != columns.Count)
|
if (segments.Length != columns.Count)
|
||||||
break;
|
break;
|
||||||
@ -891,7 +892,42 @@ internal class ProcessDataStandardFormat
|
|||||||
.Replace("\"", """)
|
.Replace("\"", """)
|
||||||
.Replace("'", "'");
|
.Replace("'", "'");
|
||||||
tag = Regex.Replace(columns[c].Trim('"'), @"[^a-zA-Z0-9]", "_").Split('\r')[0].Split('\n')[0];
|
tag = Regex.Replace(columns[c].Trim('"'), @"[^a-zA-Z0-9]", "_").Split('\r')[0].Split('\n')[0];
|
||||||
lines.Add(string.Concat(" <", tag, '>', value, "</", tag, '>'));
|
if (i == 0)
|
||||||
|
{
|
||||||
|
if (results.ContainsKey(tag))
|
||||||
|
continue;
|
||||||
|
results.Add(tag, new List<string>());
|
||||||
|
}
|
||||||
|
results[tag].Add(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
foreach (KeyValuePair<string, List<string>> keyValuePair in results)
|
||||||
|
{
|
||||||
|
if (body.Count < 3)
|
||||||
|
break;
|
||||||
|
if (keyValuePair.Value.Count != body.Count)
|
||||||
|
continue;
|
||||||
|
values = keyValuePair.Value.Distinct().ToList();
|
||||||
|
if (values.Count == 2 && (string.IsNullOrEmpty(values[0]) || string.IsNullOrEmpty(values[1])))
|
||||||
|
{
|
||||||
|
for (int i = 0; i < body.Count; i++)
|
||||||
|
keyValuePair.Value[i] = string.Empty;
|
||||||
|
foreach (string v in values)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(v))
|
||||||
|
continue;
|
||||||
|
keyValuePair.Value[0] = v;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (int i = 0; i < body.Count; i++)
|
||||||
|
{
|
||||||
|
lines.Add(" <record>");
|
||||||
|
foreach (KeyValuePair<string, List<string>> keyValuePair in results)
|
||||||
|
{
|
||||||
|
if (keyValuePair.Value.Count != body.Count)
|
||||||
|
continue;
|
||||||
|
lines.Add(string.Concat(" <", keyValuePair.Key, '>', keyValuePair.Value[i], "</", keyValuePair.Key, '>'));
|
||||||
}
|
}
|
||||||
lines.Add(" </record>");
|
lines.Add(" </record>");
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user