init
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,14 @@
|
||||
using DTS.Common.Interface.DASFactory.Diagnostics.HardwareList;
|
||||
using Prism.Events;
|
||||
|
||||
namespace DTS.Common.Events.Hardware.HardwareList
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// The HardwareListHardwareSelectedEvent event.
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>This event is used to indicate hardware was selected.</remarks>
|
||||
///
|
||||
public class HardwareListHardwareSelectedEvent : PubSubEvent<string[]> { }
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
using DTS.Common.Interface.Groups;
|
||||
using DTS.Common.Interface.Groups.GroupList;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Data;
|
||||
|
||||
namespace DTS.Common.Classes.Groups
|
||||
{
|
||||
/// <summary>
|
||||
/// represents a record of a channel in the db
|
||||
/// <inheritdoc cref="IChannelDbRecord"/>
|
||||
/// </summary>
|
||||
public class GroupDbRecord : Base.BasePropertyChanged, IGroupDbRecord
|
||||
{
|
||||
protected int _id = -1;
|
||||
/// <summary>
|
||||
/// The database id of the Channel
|
||||
/// </summary>
|
||||
[Key]
|
||||
public int Id
|
||||
{
|
||||
get => _id;
|
||||
set => SetProperty(ref _id, value, "Id");
|
||||
}
|
||||
public string SerialNumber { get; set; }
|
||||
public string Picture { get; set; }
|
||||
public string DisplayName { get; set; }
|
||||
public string Description { get; set; }
|
||||
public bool Embedded { get; set; }
|
||||
public DateTime LastModified { get; set; }
|
||||
public string LastModifiedBy { get; set; }
|
||||
public int? StaticGroupId { get; set; }
|
||||
public string ExtraProperties { get; set; }
|
||||
|
||||
public GroupDbRecord() { }
|
||||
public GroupDbRecord(IGroupDbRecord copy)
|
||||
{
|
||||
Id = copy.Id;
|
||||
SerialNumber = copy.SerialNumber;
|
||||
Picture = copy.Picture;
|
||||
DisplayName = copy.DisplayName;
|
||||
Description = copy.Description;
|
||||
Embedded = copy.Embedded;
|
||||
LastModified = copy.LastModified;
|
||||
LastModifiedBy = copy.LastModifiedBy;
|
||||
StaticGroupId = copy.StaticGroupId;
|
||||
ExtraProperties = copy.ExtraProperties;
|
||||
}
|
||||
public GroupDbRecord(IGroup copy, List<KeyValuePair<string, string>> extraProperties)
|
||||
{
|
||||
Id = copy.Id;
|
||||
SerialNumber = copy.Name;
|
||||
Picture = "";
|
||||
DisplayName = copy.DisplayName;
|
||||
Description = copy.Description;
|
||||
Embedded = copy.Embedded;
|
||||
LastModified = copy.LastModified;
|
||||
LastModifiedBy = copy.LastModifiedBy;
|
||||
StaticGroupId = copy.StaticGroupId;
|
||||
|
||||
ExtraProperties = new System.Web.Script.Serialization.JavaScriptSerializer().Serialize(extraProperties);
|
||||
}
|
||||
public GroupDbRecord(IDataReader reader)
|
||||
{
|
||||
Id = Utility.GetInt(reader, "Id", -1);
|
||||
SerialNumber = Utility.GetString(reader, "SerialNumber");
|
||||
Picture = Utility.GetString(reader, "Picture");
|
||||
DisplayName = Utility.GetString(reader, "DisplayName");
|
||||
Description = Utility.GetString(reader, "Description");
|
||||
Embedded = Utility.GetBool(reader, "Embedded");
|
||||
LastModified = Utility.GetDateTime(reader, "LastModified", DateTime.MinValue);
|
||||
LastModifiedBy = Utility.GetString(reader, "LastModifiedBy");
|
||||
StaticGroupId = Utility.GetNullableInt(reader, "StaticGroupId");
|
||||
ExtraProperties = Utility.GetString(reader, "ExtraProperties");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
namespace DTS.Common.Classes.DSP
|
||||
{
|
||||
/// <summary>
|
||||
/// this is a restriction on who can use this filter
|
||||
/// </summary>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Minor Code Smell", "S101:Types should be named in PascalCase", Justification = "Acronym")]
|
||||
public class DASRestriction
|
||||
{
|
||||
/// <summary>
|
||||
/// the Hardware_Type string value for the das (e.g. SLICE6_AIR, etc)
|
||||
/// empty string means all das
|
||||
/// </summary>
|
||||
public string DASType { get; set; }
|
||||
/// <summary>
|
||||
/// the protocol version for that das (<=0 means all protocol versions will work)
|
||||
/// </summary>
|
||||
public int ProtocolVersion { get; set; }
|
||||
|
||||
public DASRestriction()
|
||||
{
|
||||
DASType = string.Empty;
|
||||
ProtocolVersion = -1;
|
||||
}
|
||||
|
||||
public DASRestriction(string dasType, int protocolVersion)
|
||||
{
|
||||
DASType = dasType;
|
||||
ProtocolVersion = protocolVersion;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
using DTS.Common.Base;
|
||||
|
||||
namespace DTS.Common.Interface.TestSetups.Imports.TTS.DOChannels
|
||||
{
|
||||
public interface IDigitalOutputChannelsViewModel : IBaseViewModel
|
||||
{
|
||||
IDigitalOutputChannelsView View { get; set; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user