This commit is contained in:
2026-04-17 14:55:32 -04:00
commit bc3ac1d4c9
18017 changed files with 4371742 additions and 0 deletions

View File

@@ -0,0 +1,9 @@
using DTS.Common.Base;
namespace DTS.Common.Interface.TestSetups.Imports.TTS.DIChannels
{
public interface IDigitalInputChannelsViewModel : IBaseViewModel
{
IDigitalInputChannelsView View { get; set; }
}
}

View File

@@ -0,0 +1,98 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Xml.Linq;
using DTS.Common.Utilities.Logging;
using DTS.Common.Utils;
// ReSharper disable UnusedVariable
namespace DTS.Common.XMLUtils
{
public static class TestMetadataXml
{
/// <summary>
/// Return list of files
/// </summary>
/// <param name="path"></param>
/// <param name="file"></param>
/// <param name="pattern"></param>
/// <returns></returns>
public static XDocument GetTestMetadataXml(string path, string file = "", string pattern = "")
{
if (string.IsNullOrEmpty(pattern)) pattern = ".dts";
FileUtils.FileList = new List<string>();
if (!String.IsNullOrEmpty(file))
{ FileUtils.FileList.Add(file); }
else
{ FileUtils.FindFiles(path, pattern); }
return SetTestMetadataType(FileUtils.FileList);
}
/// <summary>
/// Read all DTS xml files
/// </summary>
/// <param name="fileList">DTS xml file list</param>
/// <returns></returns>
private static XDocument SetTestMetadataType(IEnumerable<string> fileList)
{
try
{
var count = 0;
var x = new XDocument();
x.Add(new XElement("Tests"));
foreach (var file in fileList)
{
try
{
var xTestMetadata = new XElement("TestMetadata");
xTestMetadata.SetAttributeValue("Id", count++.ToString());
using (var reader = new StreamReader(file))
{
var allText = reader.ReadToEnd();
var delimiter = "<?xml version=";
var delimiterArray = new string[] {delimiter};
var allTextArray = allText.Split(delimiterArray, StringSplitOptions.RemoveEmptyEntries);
var xmlCounter = 0;
foreach (var fullstring in allTextArray)
{
var fullString = delimiter + allTextArray[xmlCounter];
xmlCounter++;
var sr = new StringReader(fullString);
var xDoc = XDocument.Load(sr);
if (xDoc.Element("Test") != null)
{
//remove file name and check folder
xDoc.Element("Test")
?.SetAttributeValue("DataType", file.Contains("ALL") ? "ALL" : "ROI");
xDoc.Element("Test")?.SetAttributeValue("FilePath", file);
xDoc.Element("Test")?.SetAttributeValue("FileDate", File.GetCreationTime(file));
xTestMetadata.Add(xDoc.Element("Test"));
}
else
{
xTestMetadata.Add(xDoc.Element("TestSetup"));
}
}
}
x.Root?.Add(xTestMetadata);
}
catch (Exception ex)
{
APILogger.Log("failed to process file:", file, ex);
}
}
return x;
}
catch (Exception ex)
{
var error = ex.Message;
return new XDocument();
}
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 643 B

View File

@@ -0,0 +1,29 @@
using System;
using System.Windows.Data;
using System.Windows.Media;
namespace DTS.Common.Converters
{
public class BooleanToColorConverter : IValueConverter
{
public bool Background { get; set; } = false;
public bool Inverted { get; set; } = false;
public bool AttentionBrush { get; set; } = false;
public bool WarningBrush { get; set; } = false;
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
value = Inverted ? !(bool) value : value;
if ((bool)value)
{
return Background ? Brushes.Transparent : BrushesAndColors.Brush_NoError;
}
return AttentionBrush ? BrushesAndColors.Brush_Attention : WarningBrush ? BrushesAndColors.Brush_Warning : BrushesAndColors.Brush_Error;
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
return null;
}
}
}

View File

@@ -0,0 +1,12 @@
using System.ComponentModel;
using DTS.Common.Converters;
namespace DTS.Common.Enums
{
[TypeConverter(typeof(EnumDescriptionTypeConverter))]
public enum ScriptTypes
{
Migration,
Initialization
}
}