Various.CoverTest component created, few Elde components removed, ver. 3.1.1609
This commit is contained in:
@@ -0,0 +1,143 @@
|
||||
///
|
||||
/// Copyright (c) 2017-2021 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Dirichlet.Numerics;
|
||||
using log4net;
|
||||
using TBF.Rig.ControlBoard.Legacy;
|
||||
using TBF.Rig.GenericDevices;
|
||||
using TBF.Resources;
|
||||
|
||||
namespace TBF.Rig.Various.CoverTest
|
||||
{
|
||||
public class CoverTest : ComponentBase, IOperation, ISequenceCondition
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(CoverTest));
|
||||
private static readonly ILog bypassLog = LogManager.GetLogger("BypassLog");
|
||||
|
||||
public override string ToString() { return string.Format("CoverTest({0})", Cfg.ToString(-1)); }
|
||||
|
||||
readonly CoverTestCfg coverTestCfg;
|
||||
|
||||
readonly CBoard controlBoard;
|
||||
readonly int bitPosition; /// 0 .. 127
|
||||
readonly UInt128 mask; /// derived from bitPosition in the constructor
|
||||
readonly UInt128 target;
|
||||
readonly string message;
|
||||
readonly Users.Entities.GID[] bypassLevel;
|
||||
|
||||
public CoverTest()
|
||||
{
|
||||
}
|
||||
|
||||
public CoverTest(Generic.IComponentCfg cfg, IList<Generic.IComponent> components)
|
||||
: base(cfg)
|
||||
{
|
||||
coverTestCfg = cfg as CoverTestCfg;
|
||||
|
||||
controlBoard = (CBoard)TbfComponents.FindComponent(cfg.ParentName, components);
|
||||
if (controlBoard == null) throw new Exception("Cannot find " + Name + " parent");
|
||||
|
||||
bitPosition = coverTestCfg.BitNr;
|
||||
mask = (((UInt128)1) << coverTestCfg.BitNr);
|
||||
target = coverTestCfg.Inverted ? 0 : mask;
|
||||
message = coverTestCfg.Message;
|
||||
var groups = new List<Users.Entities.GID>();
|
||||
if (coverTestCfg.BypassGroup1 != Users.Entities.GID.None) groups.Add(coverTestCfg.BypassGroup1);
|
||||
if (coverTestCfg.BypassGroup2 != Users.Entities.GID.None) groups.Add(coverTestCfg.BypassGroup2);
|
||||
if (coverTestCfg.BypassGroup3 != Users.Entities.GID.None) groups.Add(coverTestCfg.BypassGroup3);
|
||||
if (coverTestCfg.BypassGroup4 != Users.Entities.GID.None) groups.Add(coverTestCfg.BypassGroup4);
|
||||
bypassLevel = groups.ToArray();
|
||||
|
||||
log.Warn(this.ToString());
|
||||
}
|
||||
|
||||
|
||||
public int ConditionsCount { get { return 1; } }
|
||||
|
||||
/// Strings are added to the combo-box for transition sequence condition selection
|
||||
public string ConditionName(int i)
|
||||
{
|
||||
if (i < 1 && i >= 0)
|
||||
return Name;
|
||||
else
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
/// Operation to be executed as a part of a transition sequence
|
||||
public IOperation ConditionOp(int i)
|
||||
{
|
||||
if (i < 1 && i >= 0)
|
||||
return this;
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
CoverTestForm coverTestForm;
|
||||
bool completed = false;
|
||||
|
||||
|
||||
delegate void CoverTestFormDlgt(CoverTest myRef);
|
||||
///
|
||||
void OpenFormDlg(CoverTest myRef)
|
||||
{
|
||||
myRef.coverTestForm = new CoverTestForm(message, bypassLevel, bypassLog);
|
||||
coverTestForm.Show();
|
||||
}
|
||||
|
||||
|
||||
public IOperation CoverTestOp()
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>Start this operation</summary>
|
||||
public void Start()
|
||||
{
|
||||
log.DebugFormat("Start()");
|
||||
completed = false;
|
||||
Program.MainWnd.Invoke(new CoverTestFormDlgt(OpenFormDlg), this);
|
||||
}
|
||||
|
||||
/// <summary>Run this operation</summary>
|
||||
/// <returns>Event.ResultsPrinted</returns>
|
||||
public Event Run()
|
||||
{
|
||||
bool conditionMet = ((controlBoard.Route & mask) == target);
|
||||
|
||||
if (completed || conditionMet)
|
||||
{
|
||||
completed = true;
|
||||
}
|
||||
|
||||
if (completed || coverTestForm.Completed)
|
||||
{
|
||||
completed = true;
|
||||
CloseModelessDlg();
|
||||
log.DebugFormat("Run() ... conditionMet={0} completed={1} ... Event.ConditionMet", conditionMet, completed);
|
||||
return Event.ConditionMet;
|
||||
}
|
||||
|
||||
log.DebugFormat("Run() ... conditionMet={0} completed={1} ... Event.ConditionNotMet", conditionMet, completed);
|
||||
return Event.ConditionNotMet;
|
||||
}
|
||||
|
||||
/// <summary>Stop this operation</summary>
|
||||
public void Stop()
|
||||
{
|
||||
log.DebugFormat("Stop()");
|
||||
CloseModelessDlg();
|
||||
}
|
||||
|
||||
void CloseModelessDlg()
|
||||
{
|
||||
if (coverTestForm != null)
|
||||
{
|
||||
coverTestForm.OnCloseThisForm(this, null);
|
||||
coverTestForm = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,232 @@
|
||||
///
|
||||
/// Copyright (c) 2017-2021 Sensus Slovensko a.s.
|
||||
///
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
using System.Xml.Serialization;
|
||||
using Config;
|
||||
using Config.Entities;
|
||||
using SchematicDrawing;
|
||||
using TBF.Rig.Generic;
|
||||
using TBF.Resources;
|
||||
|
||||
namespace TBF.Rig.Various.CoverTest
|
||||
{
|
||||
public class CoverTestCfg : ComponentCfgBase, IComponentCfg, IParamsProvider, IDrawingItem
|
||||
{
|
||||
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(CoverTestCfg) })[0];
|
||||
public override XmlSerializer GetSerializer() { return Serializer; }
|
||||
|
||||
public IComponentCfgCtrl GetControl(IList<Component> cmpntEntities)
|
||||
{
|
||||
return new Configs.ParamsProvider.ComponentCfgCtrl(this, null);
|
||||
}
|
||||
|
||||
///
|
||||
/// Serialized parameters
|
||||
///
|
||||
public int BitNr { get; set; } /// Bit-position
|
||||
public bool Inverted { get; set; } /// When true the valve function is inverted: 0 = open, 1 = closed
|
||||
public string Message;
|
||||
public Users.Entities.GID BypassGroup1;
|
||||
public Users.Entities.GID BypassGroup2;
|
||||
public Users.Entities.GID BypassGroup3;
|
||||
public Users.Entities.GID BypassGroup4;
|
||||
|
||||
/// Schematic drawing info
|
||||
public Shape Shape { get; set; }
|
||||
public int X { get; set; }
|
||||
public int Y { get; set; }
|
||||
public Sz Sz { get; set; }
|
||||
public Orient Orient { get; set; }
|
||||
public bool Flip { get; set; }
|
||||
public int LblX { get; set; }
|
||||
public int LblY { get; set; }
|
||||
public Orient LblOrient { get; set; }
|
||||
|
||||
[XmlIgnore]
|
||||
public IList<GNode> GNodes { get; set; }
|
||||
[XmlIgnore]
|
||||
public IList<GEdge> EdgesToSet { get; set; }
|
||||
|
||||
/// Private parameterless constructor invoked by all other (public) constructors
|
||||
CoverTestCfg()
|
||||
{
|
||||
GNodes = new List<GNode>();
|
||||
EdgesToSet = new List<GEdge>();
|
||||
}
|
||||
|
||||
public CoverTestCfg(string name, IComponentFactory factory)
|
||||
: this()
|
||||
{
|
||||
//Shape = Shape.RtBasedArrow;
|
||||
Shape = Shape.Pump;
|
||||
Sz = Sz.M;
|
||||
Name = name;
|
||||
Factory = factory;
|
||||
ParentName = string.Empty;
|
||||
InitializeAll();
|
||||
}
|
||||
|
||||
public string ComponentName { get { return Name; } }
|
||||
|
||||
public void InitializeAll()
|
||||
{
|
||||
BitNr = 22;
|
||||
Inverted = false;
|
||||
Message = Strings.Close_the_cover;
|
||||
BypassGroup1 = Users.Entities.GID.TestingSpecialists;
|
||||
BypassGroup2 = Users.Entities.GID.None;
|
||||
BypassGroup3 = Users.Entities.GID.None;
|
||||
BypassGroup4 = Users.Entities.GID.None;
|
||||
}
|
||||
|
||||
string[] paramNames = new string[]
|
||||
{
|
||||
"Route bit number",
|
||||
"Inverted",
|
||||
"Message when open",
|
||||
"Group 1 to bypass cover test",
|
||||
"Group 2 to bypass cover test",
|
||||
"Group 3 to bypass cover test",
|
||||
"Group 4 to bypass cover test",
|
||||
};
|
||||
public string ParamName(int i) { return paramNames[i]; }
|
||||
public int ParamsCount() { return paramNames.Length; }
|
||||
|
||||
public ICollection<string> ParamValues(int i)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 1:
|
||||
return new string[] { Strings.yes, Strings.no };
|
||||
case 3:
|
||||
case 4:
|
||||
case 5:
|
||||
case 6:
|
||||
ICollection<string> values = new List<string>();
|
||||
values.Add(Users.Entities.GID.None.ToString());
|
||||
for (Users.Entities.GID gid = 0; gid < Users.Entities.GID.NrOfGroups; gid++)
|
||||
{
|
||||
values.Add(gid.ToString());
|
||||
}
|
||||
return values;
|
||||
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public string ToString(int i)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0: return BitNr.ToString();
|
||||
case 1: return Inverted ? Strings.yes : Strings.no;
|
||||
case 2: return Message;
|
||||
case 3: return BypassGroup1.ToString();
|
||||
case 4: return BypassGroup2.ToString();
|
||||
case 5: return BypassGroup3.ToString();
|
||||
case 6: return BypassGroup4.ToString();
|
||||
default:
|
||||
return string.Format("{0} Bit={1}, Inv={2}, Message={3}", Name, BitNr, Inverted, Message);
|
||||
}
|
||||
}
|
||||
|
||||
public CfgUpdateFlags UpdateParam(int i, string str)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0: BitNr = int.Parse(str); return CfgUpdateFlags.RestartRqrd;
|
||||
case 1: Inverted = (str == Strings.yes); return CfgUpdateFlags.RestartRqrd;
|
||||
case 2: Message = str; return CfgUpdateFlags.RestartRqrd;
|
||||
|
||||
case 3:
|
||||
for (Users.Entities.GID gid = 0; gid < Users.Entities.GID.NrOfGroups; gid++)
|
||||
{
|
||||
if (gid.ToString() == str) { BypassGroup1 = gid; return CfgUpdateFlags.RestartRqrd; }
|
||||
}
|
||||
BypassGroup1 = Users.Entities.GID.None;
|
||||
return CfgUpdateFlags.RestartRqrd;
|
||||
|
||||
case 4:
|
||||
for (Users.Entities.GID gid = 0; gid < Users.Entities.GID.NrOfGroups; gid++)
|
||||
{
|
||||
if (gid.ToString() == str) { BypassGroup2 = gid; return CfgUpdateFlags.RestartRqrd; }
|
||||
}
|
||||
BypassGroup2 = Users.Entities.GID.None;
|
||||
return CfgUpdateFlags.RestartRqrd;
|
||||
|
||||
case 5:
|
||||
for (Users.Entities.GID gid = 0; gid < Users.Entities.GID.NrOfGroups; gid++)
|
||||
{
|
||||
if (gid.ToString() == str) { BypassGroup3 = gid; return CfgUpdateFlags.RestartRqrd; }
|
||||
}
|
||||
BypassGroup3 = Users.Entities.GID.None;
|
||||
return CfgUpdateFlags.RestartRqrd;
|
||||
|
||||
case 6:
|
||||
for (Users.Entities.GID gid = 0; gid < Users.Entities.GID.NrOfGroups; gid++)
|
||||
{
|
||||
if (gid.ToString() == str) { BypassGroup4 = gid; return CfgUpdateFlags.RestartRqrd; }
|
||||
}
|
||||
BypassGroup4 = Users.Entities.GID.None;
|
||||
return CfgUpdateFlags.RestartRqrd;
|
||||
|
||||
default:
|
||||
return CfgUpdateFlags.None;
|
||||
}
|
||||
}
|
||||
|
||||
public bool ValidateParam(int i, string str, out string message)
|
||||
{
|
||||
message = string.Empty;
|
||||
int n;
|
||||
|
||||
switch (i)
|
||||
{
|
||||
case 0:
|
||||
if (int.TryParse(str, out n) && n >= 0 && n <= 127) return true;
|
||||
break;
|
||||
case 2:
|
||||
return true;
|
||||
case 1:
|
||||
case 3:
|
||||
case 4:
|
||||
case 5:
|
||||
case 6:
|
||||
if (ParamValues(i).Contains(str)) return true;
|
||||
break;
|
||||
default:
|
||||
message = "Invalid index";
|
||||
return false;
|
||||
}
|
||||
|
||||
message = ParamName(i) + " is invalid";
|
||||
return false;
|
||||
}
|
||||
|
||||
void CopyContentTo(CoverTestCfg prms)
|
||||
{
|
||||
prms.BitNr = BitNr;
|
||||
prms.Inverted = Inverted;
|
||||
prms.Message = Message;
|
||||
prms.BypassGroup1 = BypassGroup1;
|
||||
prms.BypassGroup2 = BypassGroup2;
|
||||
prms.BypassGroup3 = BypassGroup3;
|
||||
prms.BypassGroup4 = BypassGroup4;
|
||||
}
|
||||
|
||||
public Config.Entities.IParamsProvider Clone()
|
||||
{
|
||||
var pars = new CoverTestCfg();
|
||||
CopyContentTo(pars);
|
||||
return pars;
|
||||
}
|
||||
|
||||
public bool UpdateEmbeddedDbEntity()
|
||||
{
|
||||
return true; /// =OK, do nothing
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
///
|
||||
/// Copyright (c) 2017 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using log4net;
|
||||
using TBF.Resources;
|
||||
|
||||
namespace TBF.Rig.Various.CoverTest
|
||||
{
|
||||
public partial class CoverTestForm : Form
|
||||
{
|
||||
ILog bypassLog;
|
||||
string message;
|
||||
|
||||
/// Set to 'true' when the form closes
|
||||
public bool Completed { get { return completed; } }
|
||||
bool completed;
|
||||
|
||||
Users.Entities.GID[] bypassLevel;
|
||||
|
||||
public CoverTestForm(string message, Users.Entities.GID[] bypassLevel, ILog bypassLog)
|
||||
{
|
||||
InitializeComponent();
|
||||
ControlBox = false;
|
||||
|
||||
this.message = message;
|
||||
this.bypassLevel = bypassLevel;
|
||||
this.bypassLog = bypassLog;
|
||||
|
||||
Localize();
|
||||
messageLabel.Text = this.message;
|
||||
|
||||
float textWidth = Graphics.FromImage(new Bitmap(1, 1)).MeasureString(messageLabel.Text, messageLabel.Font).Width;
|
||||
int rqrdFormWidth = (int)textWidth + 80; /// Form width calculated from the text width
|
||||
|
||||
if (rqrdFormWidth > Width)
|
||||
{
|
||||
int shift = (rqrdFormWidth - Width) / 2;
|
||||
Width = rqrdFormWidth;
|
||||
bypassButton.Left += shift;
|
||||
}
|
||||
|
||||
completed = false;
|
||||
StartForceCloseHandler();
|
||||
}
|
||||
|
||||
void Localize()
|
||||
{
|
||||
Text = Strings.Message;
|
||||
bypassButton.Text = Strings.Bypass;
|
||||
}
|
||||
|
||||
private void bypassButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (!Users.GlobalData.CurrentUser.IsMemberOf(bypassLevel))
|
||||
{
|
||||
if ((new Users.Forms.LoginDlg(bypassLevel)).ShowDialog() != DialogResult.OK)
|
||||
{
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Program.MainWnd != null) Program.MainWnd.UpdateUser();
|
||||
}
|
||||
}
|
||||
|
||||
bypassLog.InfoFormat("{0} bypassed by {1}", message, Users.GlobalData.CurrentUser.UserName);
|
||||
|
||||
completed = true;
|
||||
Close();
|
||||
}
|
||||
|
||||
#region Forced close handling
|
||||
|
||||
/// <summary>
|
||||
/// Used by CoverTest, AskYesNoOp and MessageBoxOp.
|
||||
/// </summary>
|
||||
public void OnCloseThisForm(object sender, EventArgs args)
|
||||
{
|
||||
if (CloseThisFormHandler == null) return;
|
||||
try
|
||||
{
|
||||
CloseThisFormHandler(sender, null);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public event EventHandler<EventArgs> CloseThisFormHandler;
|
||||
|
||||
public void StartForceCloseHandler()
|
||||
{
|
||||
CloseThisFormHandler += delegate(object sender, EventArgs args)
|
||||
{
|
||||
if (InvokeRequired)
|
||||
Invoke(new EventHandler<EventArgs>(OnForceClose), sender, args);
|
||||
else
|
||||
OnForceClose(sender, args);
|
||||
};
|
||||
}
|
||||
|
||||
private void OnForceClose(object sender, EventArgs args)
|
||||
{
|
||||
DialogResult = DialogResult.Cancel;
|
||||
Close();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
+81
@@ -0,0 +1,81 @@
|
||||
///
|
||||
/// Copyright (c) 2017 Sensus Slovensko a.s.
|
||||
///
|
||||
namespace TBF.Rig.Various.CoverTest
|
||||
{
|
||||
partial class CoverTestForm
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.bypassButton = new System.Windows.Forms.Button();
|
||||
this.messageLabel = new System.Windows.Forms.Label();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// bypassButton
|
||||
//
|
||||
this.bypassButton.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.bypassButton.ForeColor = System.Drawing.Color.Black;
|
||||
this.bypassButton.Location = new System.Drawing.Point(126, 99);
|
||||
this.bypassButton.Name = "bypassButton";
|
||||
this.bypassButton.Size = new System.Drawing.Size(200, 63);
|
||||
this.bypassButton.TabIndex = 1;
|
||||
this.bypassButton.Text = "Bypass";
|
||||
this.bypassButton.UseVisualStyleBackColor = true;
|
||||
this.bypassButton.Click += new System.EventHandler(this.bypassButton_Click);
|
||||
//
|
||||
// messageLabel
|
||||
//
|
||||
this.messageLabel.AutoSize = true;
|
||||
this.messageLabel.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.messageLabel.Location = new System.Drawing.Point(34, 39);
|
||||
this.messageLabel.Name = "messageLabel";
|
||||
this.messageLabel.Size = new System.Drawing.Size(91, 23);
|
||||
this.messageLabel.TabIndex = 4;
|
||||
this.messageLabel.Text = "Message";
|
||||
//
|
||||
// CoverTestForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.BackColor = System.Drawing.Color.DarkOrange;
|
||||
this.ClientSize = new System.Drawing.Size(454, 201);
|
||||
this.Controls.Add(this.messageLabel);
|
||||
this.Controls.Add(this.bypassButton);
|
||||
this.Name = "CoverTestForm";
|
||||
this.Text = "Message";
|
||||
this.TopMost = true;
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Button bypassButton;
|
||||
private System.Windows.Forms.Label messageLabel;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
@@ -0,0 +1,27 @@
|
||||
///
|
||||
/// Copyright (c) 2017-2021 Sensus Slovensko a.s.
|
||||
///
|
||||
using System.Collections.Generic;
|
||||
using TBF.Rig.Generic;
|
||||
|
||||
namespace TBF.Rig.Various.CoverTest
|
||||
{
|
||||
public class Factory : IComponentFactory
|
||||
{
|
||||
public string ClassName { get { return GetType().Namespace.Substring(8); } }
|
||||
public override string ToString() { return ClassName; }
|
||||
|
||||
public void ResetStaticProperties() { CoverTest.ResetStaticProperties(); }
|
||||
|
||||
public IComponent DummyComponent() { return new CoverTest(); }
|
||||
|
||||
public IComponent GetComponent(IComponentCfg cfg, IList<IComponent> components) { return new CoverTest(cfg, components); }
|
||||
|
||||
public IComponentCfg DefaultConfig() { return new CoverTestCfg("Cover", this); }
|
||||
|
||||
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
|
||||
{
|
||||
return ComponentCfgBase.CreateFromDbEntity(CoverTestCfg.Serializer, component, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user