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,859 @@
namespace DTS.Serialization.SliceRaw
{
partial class ModifyChannel
{
/// <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.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.btnWrite = new System.Windows.Forms.Button();
this.btnCancel = new System.Windows.Forms.Button();
this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel();
this.tbMagicKey = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.label6 = new System.Windows.Forms.Label();
this.label7 = new System.Windows.Forms.Label();
this.label8 = new System.Windows.Forms.Label();
this.label9 = new System.Windows.Forms.Label();
this.label10 = new System.Windows.Forms.Label();
this.label11 = new System.Windows.Forms.Label();
this.label12 = new System.Windows.Forms.Label();
this.label13 = new System.Windows.Forms.Label();
this.label14 = new System.Windows.Forms.Label();
this.label15 = new System.Windows.Forms.Label();
this.label16 = new System.Windows.Forms.Label();
this.label17 = new System.Windows.Forms.Label();
this.label18 = new System.Windows.Forms.Label();
this.label19 = new System.Windows.Forms.Label();
this.label20 = new System.Windows.Forms.Label();
this.label21 = new System.Windows.Forms.Label();
this.label22 = new System.Windows.Forms.Label();
this.tbVersionNumber = new System.Windows.Forms.TextBox();
this.tbOffset = new System.Windows.Forms.TextBox();
this.tbNumberOfSamples = new System.Windows.Forms.TextBox();
this.tbNumberOfBitsPerSample = new System.Windows.Forms.TextBox();
this.tbSignedSamples = new System.Windows.Forms.TextBox();
this.tbSampleRate = new System.Windows.Forms.TextBox();
this.tbNumberOfTriggers = new System.Windows.Forms.TextBox();
this.tbTriggerSampleNumber = new System.Windows.Forms.TextBox();
this.tbPreTestZeroADC = new System.Windows.Forms.TextBox();
this.tbPreTestCalLevel = new System.Windows.Forms.TextBox();
this.tbPreTestNoise = new System.Windows.Forms.TextBox();
this.PostTestZeroADC = new System.Windows.Forms.TextBox();
this.tbPostTestCalLevel = new System.Windows.Forms.TextBox();
this.tbDataZeroLevel = new System.Windows.Forms.TextBox();
this.tbScaleFactorMV = new System.Windows.Forms.TextBox();
this.tbScaleFactorEU = new System.Windows.Forms.TextBox();
this.tbNumberOfBytesEU = new System.Windows.Forms.TextBox();
this.tbEU = new System.Windows.Forms.TextBox();
this.tbISO = new System.Windows.Forms.TextBox();
this.tbCRC32 = new System.Windows.Forms.TextBox();
this.lblFilename = new System.Windows.Forms.Label();
this.btnBrowse = new System.Windows.Forms.Button();
this.label23 = new System.Windows.Forms.Label();
this.tbPreTestZeroMv = new System.Windows.Forms.TextBox();
this.label24 = new System.Windows.Forms.Label();
this.label25 = new System.Windows.Forms.Label();
this.label26 = new System.Windows.Forms.Label();
this.label27 = new System.Windows.Forms.Label();
this.tbExcitation = new System.Windows.Forms.TextBox();
this.tbOriginalOffset = new System.Windows.Forms.TextBox();
this.tbZeroMVInADC = new System.Windows.Forms.TextBox();
this.tbTriggerAdjustmentSamples = new System.Windows.Forms.TextBox();
this.label4 = new System.Windows.Forms.Label();
this.label28 = new System.Windows.Forms.Label();
this.tbWindowAverageADC = new System.Windows.Forms.TextBox();
this.tableLayoutPanel1.SuspendLayout();
this.tableLayoutPanel2.SuspendLayout();
this.SuspendLayout();
//
// tableLayoutPanel1
//
this.tableLayoutPanel1.ColumnCount = 2;
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanel1.Controls.Add(this.btnWrite, 0, 1);
this.tableLayoutPanel1.Controls.Add(this.btnCancel, 1, 1);
this.tableLayoutPanel1.Controls.Add(this.tableLayoutPanel2, 0, 0);
this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0);
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
this.tableLayoutPanel1.RowCount = 2;
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 60F));
this.tableLayoutPanel1.Size = new System.Drawing.Size(408, 804);
this.tableLayoutPanel1.TabIndex = 0;
//
// btnWrite
//
this.btnWrite.Dock = System.Windows.Forms.DockStyle.Fill;
this.btnWrite.Location = new System.Drawing.Point(8, 729);
this.btnWrite.Margin = new System.Windows.Forms.Padding(8);
this.btnWrite.Name = "btnWrite";
this.btnWrite.Size = new System.Drawing.Size(188, 44);
this.btnWrite.TabIndex = 0;
this.btnWrite.Text = "WRITE";
this.btnWrite.UseVisualStyleBackColor = true;
//this.btnWrite.VisualStyle = C1.Win.C1Input.VisualStyle.Office2007Blue;
//this.btnWrite.VisualStyleBaseStyle = C1.Win.C1Input.VisualStyle.Office2007Blue;
this.btnWrite.Click += new System.EventHandler(this.btnWrite_Click);
//
// btnCancel
//
this.btnCancel.Dock = System.Windows.Forms.DockStyle.Fill;
this.btnCancel.Location = new System.Drawing.Point(212, 729);
this.btnCancel.Margin = new System.Windows.Forms.Padding(8);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(188, 44);
this.btnCancel.TabIndex = 1;
this.btnCancel.Text = "Cancel";
this.btnCancel.UseVisualStyleBackColor = true;
//this.btnCancel.VisualStyle = C1.Win.C1Input.VisualStyle.Office2007Blue;
//this.btnCancel.VisualStyleBaseStyle = C1.Win.C1Input.VisualStyle.Office2007Blue;
this.btnCancel.Click += new System.EventHandler(this.c1Button2_Click);
//
// tableLayoutPanel2
//
this.tableLayoutPanel2.ColumnCount = 2;
this.tableLayoutPanel1.SetColumnSpan(this.tableLayoutPanel2, 2);
this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanel2.Controls.Add(this.tbMagicKey, 1, 0);
this.tableLayoutPanel2.Controls.Add(this.label1, 0, 0);
this.tableLayoutPanel2.Controls.Add(this.label2, 0, 1);
this.tableLayoutPanel2.Controls.Add(this.label3, 0, 2);
this.tableLayoutPanel2.Controls.Add(this.label5, 0, 3);
this.tableLayoutPanel2.Controls.Add(this.label6, 0, 4);
this.tableLayoutPanel2.Controls.Add(this.label7, 0, 5);
this.tableLayoutPanel2.Controls.Add(this.label8, 0, 6);
this.tableLayoutPanel2.Controls.Add(this.label9, 0, 7);
this.tableLayoutPanel2.Controls.Add(this.label10, 0, 8);
this.tableLayoutPanel2.Controls.Add(this.label11, 0, 9);
this.tableLayoutPanel2.Controls.Add(this.label12, 0, 10);
this.tableLayoutPanel2.Controls.Add(this.label13, 0, 11);
this.tableLayoutPanel2.Controls.Add(this.label14, 0, 12);
this.tableLayoutPanel2.Controls.Add(this.label15, 0, 13);
this.tableLayoutPanel2.Controls.Add(this.label16, 0, 14);
this.tableLayoutPanel2.Controls.Add(this.label17, 0, 16);
this.tableLayoutPanel2.Controls.Add(this.label18, 0, 17);
this.tableLayoutPanel2.Controls.Add(this.label19, 0, 18);
this.tableLayoutPanel2.Controls.Add(this.label20, 0, 19);
this.tableLayoutPanel2.Controls.Add(this.label21, 0, 25);
this.tableLayoutPanel2.Controls.Add(this.label22, 0, 26);
this.tableLayoutPanel2.Controls.Add(this.tbVersionNumber, 1, 1);
this.tableLayoutPanel2.Controls.Add(this.tbOffset, 1, 2);
this.tableLayoutPanel2.Controls.Add(this.tbNumberOfSamples, 1, 3);
this.tableLayoutPanel2.Controls.Add(this.tbNumberOfBitsPerSample, 1, 4);
this.tableLayoutPanel2.Controls.Add(this.tbSignedSamples, 1, 5);
this.tableLayoutPanel2.Controls.Add(this.tbSampleRate, 1, 6);
this.tableLayoutPanel2.Controls.Add(this.tbNumberOfTriggers, 1, 7);
this.tableLayoutPanel2.Controls.Add(this.tbTriggerSampleNumber, 1, 8);
this.tableLayoutPanel2.Controls.Add(this.tbPreTestZeroADC, 1, 9);
this.tableLayoutPanel2.Controls.Add(this.tbPreTestCalLevel, 1, 10);
this.tableLayoutPanel2.Controls.Add(this.tbPreTestNoise, 1, 11);
this.tableLayoutPanel2.Controls.Add(this.PostTestZeroADC, 1, 12);
this.tableLayoutPanel2.Controls.Add(this.tbPostTestCalLevel, 1, 13);
this.tableLayoutPanel2.Controls.Add(this.tbDataZeroLevel, 1, 14);
this.tableLayoutPanel2.Controls.Add(this.tbScaleFactorMV, 1, 16);
this.tableLayoutPanel2.Controls.Add(this.tbScaleFactorEU, 1, 17);
this.tableLayoutPanel2.Controls.Add(this.tbNumberOfBytesEU, 1, 18);
this.tableLayoutPanel2.Controls.Add(this.tbEU, 1, 19);
this.tableLayoutPanel2.Controls.Add(this.tbISO, 1, 25);
this.tableLayoutPanel2.Controls.Add(this.tbCRC32, 1, 26);
this.tableLayoutPanel2.Controls.Add(this.lblFilename, 0, 27);
this.tableLayoutPanel2.Controls.Add(this.btnBrowse, 1, 27);
this.tableLayoutPanel2.Controls.Add(this.label23, 0, 15);
this.tableLayoutPanel2.Controls.Add(this.tbPreTestZeroMv, 1, 15);
this.tableLayoutPanel2.Controls.Add(this.label24, 0, 20);
this.tableLayoutPanel2.Controls.Add(this.label25, 0, 21);
this.tableLayoutPanel2.Controls.Add(this.label26, 0, 22);
this.tableLayoutPanel2.Controls.Add(this.label27, 0, 23);
this.tableLayoutPanel2.Controls.Add(this.tbExcitation, 1, 20);
this.tableLayoutPanel2.Controls.Add(this.tbOriginalOffset, 1, 21);
this.tableLayoutPanel2.Controls.Add(this.tbZeroMVInADC, 1, 22);
this.tableLayoutPanel2.Controls.Add(this.tbTriggerAdjustmentSamples, 1, 23);
this.tableLayoutPanel2.Controls.Add(this.label28, 0, 24);
this.tableLayoutPanel2.Controls.Add(this.tbWindowAverageADC, 1, 24);
this.tableLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel2.Location = new System.Drawing.Point(3, 3);
this.tableLayoutPanel2.Name = "tableLayoutPanel2";
this.tableLayoutPanel2.RowCount = 28;
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel2.Size = new System.Drawing.Size(402, 738);
this.tableLayoutPanel2.TabIndex = 2;
//
// tbMagicKey
//
this.tbMagicKey.Dock = System.Windows.Forms.DockStyle.Fill;
this.tbMagicKey.Location = new System.Drawing.Point(204, 3);
this.tbMagicKey.Name = "tbMagicKey";
this.tbMagicKey.Size = new System.Drawing.Size(195, 20);
this.tbMagicKey.TabIndex = 0;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Dock = System.Windows.Forms.DockStyle.Fill;
this.label1.Location = new System.Drawing.Point(3, 0);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(195, 26);
this.label1.TabIndex = 1;
this.label1.Text = "Magic Key";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(3, 26);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(82, 13);
this.label2.TabIndex = 2;
this.label2.Text = "Version Number";
this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// label3
//
this.label3.AutoSize = true;
this.label3.Dock = System.Windows.Forms.DockStyle.Fill;
this.label3.Location = new System.Drawing.Point(3, 52);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(195, 26);
this.label3.TabIndex = 3;
this.label3.Text = "Offset";
this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// label5
//
this.label5.AutoSize = true;
this.label5.Dock = System.Windows.Forms.DockStyle.Fill;
this.label5.Location = new System.Drawing.Point(3, 78);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(195, 26);
this.label5.TabIndex = 4;
this.label5.Text = "Number of Samples";
this.label5.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// label6
//
this.label6.AutoSize = true;
this.label6.Dock = System.Windows.Forms.DockStyle.Fill;
this.label6.Location = new System.Drawing.Point(3, 104);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(195, 26);
this.label6.TabIndex = 5;
this.label6.Text = "Number of Bits Per Sample";
this.label6.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// label7
//
this.label7.AutoSize = true;
this.label7.Dock = System.Windows.Forms.DockStyle.Fill;
this.label7.Location = new System.Drawing.Point(3, 130);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(195, 26);
this.label7.TabIndex = 6;
this.label7.Text = "Signed Samples";
this.label7.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// label8
//
this.label8.AutoSize = true;
this.label8.Dock = System.Windows.Forms.DockStyle.Fill;
this.label8.Location = new System.Drawing.Point(3, 156);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(195, 26);
this.label8.TabIndex = 7;
this.label8.Text = "Sample Rate";
this.label8.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// label9
//
this.label9.AutoSize = true;
this.label9.Dock = System.Windows.Forms.DockStyle.Fill;
this.label9.Location = new System.Drawing.Point(3, 182);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(195, 26);
this.label9.TabIndex = 8;
this.label9.Text = "Number of Triggers";
this.label9.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// label10
//
this.label10.AutoSize = true;
this.label10.Dock = System.Windows.Forms.DockStyle.Fill;
this.label10.Location = new System.Drawing.Point(3, 208);
this.label10.Name = "label10";
this.label10.Size = new System.Drawing.Size(195, 26);
this.label10.TabIndex = 9;
this.label10.Text = "Trigger Sample Number";
this.label10.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// label11
//
this.label11.AutoSize = true;
this.label11.Dock = System.Windows.Forms.DockStyle.Fill;
this.label11.Location = new System.Drawing.Point(3, 234);
this.label11.Name = "label11";
this.label11.Size = new System.Drawing.Size(195, 26);
this.label11.TabIndex = 10;
this.label11.Text = "Pre Test Zero (ADC)";
this.label11.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// label12
//
this.label12.AutoSize = true;
this.label12.Dock = System.Windows.Forms.DockStyle.Fill;
this.label12.Location = new System.Drawing.Point(3, 260);
this.label12.Name = "label12";
this.label12.Size = new System.Drawing.Size(195, 26);
this.label12.TabIndex = 11;
this.label12.Text = "Pre Test Cal Level (ADC)";
this.label12.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// label13
//
this.label13.AutoSize = true;
this.label13.Dock = System.Windows.Forms.DockStyle.Fill;
this.label13.Location = new System.Drawing.Point(3, 286);
this.label13.Name = "label13";
this.label13.Size = new System.Drawing.Size(195, 26);
this.label13.TabIndex = 12;
this.label13.Text = "Pre Test Noise";
this.label13.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// label14
//
this.label14.AutoSize = true;
this.label14.Dock = System.Windows.Forms.DockStyle.Fill;
this.label14.Location = new System.Drawing.Point(3, 312);
this.label14.Name = "label14";
this.label14.Size = new System.Drawing.Size(195, 26);
this.label14.TabIndex = 13;
this.label14.Text = "Post Test Zero (ADC)";
this.label14.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// label15
//
this.label15.AutoSize = true;
this.label15.Dock = System.Windows.Forms.DockStyle.Fill;
this.label15.Location = new System.Drawing.Point(3, 338);
this.label15.Name = "label15";
this.label15.Size = new System.Drawing.Size(195, 26);
this.label15.TabIndex = 14;
this.label15.Text = "Post Test Cal Level";
this.label15.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// label16
//
this.label16.AutoSize = true;
this.label16.Dock = System.Windows.Forms.DockStyle.Fill;
this.label16.Location = new System.Drawing.Point(3, 364);
this.label16.Name = "label16";
this.label16.Size = new System.Drawing.Size(195, 26);
this.label16.TabIndex = 15;
this.label16.Text = "Data Zero Level";
this.label16.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// label17
//
this.label17.AutoSize = true;
this.label17.Dock = System.Windows.Forms.DockStyle.Fill;
this.label17.Location = new System.Drawing.Point(3, 416);
this.label17.Name = "label17";
this.label17.Size = new System.Drawing.Size(195, 26);
this.label17.TabIndex = 16;
this.label17.Text = "Scale Factor mV";
this.label17.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// label18
//
this.label18.AutoSize = true;
this.label18.Dock = System.Windows.Forms.DockStyle.Fill;
this.label18.Location = new System.Drawing.Point(3, 442);
this.label18.Name = "label18";
this.label18.Size = new System.Drawing.Size(195, 26);
this.label18.TabIndex = 17;
this.label18.Text = "Scale Factor EU";
this.label18.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// label19
//
this.label19.AutoSize = true;
this.label19.Dock = System.Windows.Forms.DockStyle.Fill;
this.label19.Location = new System.Drawing.Point(3, 468);
this.label19.Name = "label19";
this.label19.Size = new System.Drawing.Size(195, 26);
this.label19.TabIndex = 18;
this.label19.Text = "Number of Bytes in EU";
this.label19.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// label20
//
this.label20.AutoSize = true;
this.label20.Dock = System.Windows.Forms.DockStyle.Fill;
this.label20.Location = new System.Drawing.Point(3, 494);
this.label20.Name = "label20";
this.label20.Size = new System.Drawing.Size(195, 26);
this.label20.TabIndex = 19;
this.label20.Text = "EU";
this.label20.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// label21
//
this.label21.AutoSize = true;
this.label21.Dock = System.Windows.Forms.DockStyle.Fill;
this.label21.Location = new System.Drawing.Point(3, 650);
this.label21.Name = "label21";
this.label21.Size = new System.Drawing.Size(195, 26);
this.label21.TabIndex = 20;
this.label21.Text = "ISO";
this.label21.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// label22
//
this.label22.AutoSize = true;
this.label22.Dock = System.Windows.Forms.DockStyle.Fill;
this.label22.Location = new System.Drawing.Point(3, 676);
this.label22.Name = "label22";
this.label22.Size = new System.Drawing.Size(195, 26);
this.label22.TabIndex = 21;
this.label22.Text = "CRC32";
this.label22.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// tbVersionNumber
//
this.tbVersionNumber.Dock = System.Windows.Forms.DockStyle.Fill;
this.tbVersionNumber.Location = new System.Drawing.Point(204, 29);
this.tbVersionNumber.Name = "tbVersionNumber";
this.tbVersionNumber.Size = new System.Drawing.Size(195, 20);
this.tbVersionNumber.TabIndex = 27;
//
// tbOffset
//
this.tbOffset.Dock = System.Windows.Forms.DockStyle.Fill;
this.tbOffset.Location = new System.Drawing.Point(204, 55);
this.tbOffset.Name = "tbOffset";
this.tbOffset.Size = new System.Drawing.Size(195, 20);
this.tbOffset.TabIndex = 28;
//
// tbNumberOfSamples
//
this.tbNumberOfSamples.Dock = System.Windows.Forms.DockStyle.Fill;
this.tbNumberOfSamples.Location = new System.Drawing.Point(204, 81);
this.tbNumberOfSamples.Name = "tbNumberOfSamples";
this.tbNumberOfSamples.Size = new System.Drawing.Size(195, 20);
this.tbNumberOfSamples.TabIndex = 29;
//
// tbNumberOfBitsPerSample
//
this.tbNumberOfBitsPerSample.Dock = System.Windows.Forms.DockStyle.Fill;
this.tbNumberOfBitsPerSample.Location = new System.Drawing.Point(204, 107);
this.tbNumberOfBitsPerSample.Name = "tbNumberOfBitsPerSample";
this.tbNumberOfBitsPerSample.Size = new System.Drawing.Size(195, 20);
this.tbNumberOfBitsPerSample.TabIndex = 30;
//
// tbSignedSamples
//
this.tbSignedSamples.Dock = System.Windows.Forms.DockStyle.Fill;
this.tbSignedSamples.Location = new System.Drawing.Point(204, 133);
this.tbSignedSamples.Name = "tbSignedSamples";
this.tbSignedSamples.Size = new System.Drawing.Size(195, 20);
this.tbSignedSamples.TabIndex = 31;
//
// tbSampleRate
//
this.tbSampleRate.Dock = System.Windows.Forms.DockStyle.Fill;
this.tbSampleRate.Location = new System.Drawing.Point(204, 159);
this.tbSampleRate.Name = "tbSampleRate";
this.tbSampleRate.Size = new System.Drawing.Size(195, 20);
this.tbSampleRate.TabIndex = 32;
//
// tbNumberOfTriggers
//
this.tbNumberOfTriggers.Dock = System.Windows.Forms.DockStyle.Fill;
this.tbNumberOfTriggers.Location = new System.Drawing.Point(204, 185);
this.tbNumberOfTriggers.Name = "tbNumberOfTriggers";
this.tbNumberOfTriggers.Size = new System.Drawing.Size(195, 20);
this.tbNumberOfTriggers.TabIndex = 33;
//
// tbTriggerSampleNumber
//
this.tbTriggerSampleNumber.Dock = System.Windows.Forms.DockStyle.Fill;
this.tbTriggerSampleNumber.Location = new System.Drawing.Point(204, 211);
this.tbTriggerSampleNumber.Name = "tbTriggerSampleNumber";
this.tbTriggerSampleNumber.Size = new System.Drawing.Size(195, 20);
this.tbTriggerSampleNumber.TabIndex = 34;
//
// tbPreTestZeroADC
//
this.tbPreTestZeroADC.Dock = System.Windows.Forms.DockStyle.Fill;
this.tbPreTestZeroADC.Location = new System.Drawing.Point(204, 237);
this.tbPreTestZeroADC.Name = "tbPreTestZeroADC";
this.tbPreTestZeroADC.Size = new System.Drawing.Size(195, 20);
this.tbPreTestZeroADC.TabIndex = 35;
//
// tbPreTestCalLevel
//
this.tbPreTestCalLevel.Dock = System.Windows.Forms.DockStyle.Fill;
this.tbPreTestCalLevel.Location = new System.Drawing.Point(204, 263);
this.tbPreTestCalLevel.Name = "tbPreTestCalLevel";
this.tbPreTestCalLevel.Size = new System.Drawing.Size(195, 20);
this.tbPreTestCalLevel.TabIndex = 36;
//
// tbPreTestNoise
//
this.tbPreTestNoise.Dock = System.Windows.Forms.DockStyle.Fill;
this.tbPreTestNoise.Location = new System.Drawing.Point(204, 289);
this.tbPreTestNoise.Name = "tbPreTestNoise";
this.tbPreTestNoise.Size = new System.Drawing.Size(195, 20);
this.tbPreTestNoise.TabIndex = 37;
//
// PostTestZeroADC
//
this.PostTestZeroADC.Dock = System.Windows.Forms.DockStyle.Fill;
this.PostTestZeroADC.Location = new System.Drawing.Point(204, 315);
this.PostTestZeroADC.Name = "PostTestZeroADC";
this.PostTestZeroADC.Size = new System.Drawing.Size(195, 20);
this.PostTestZeroADC.TabIndex = 38;
//
// tbPostTestCalLevel
//
this.tbPostTestCalLevel.Dock = System.Windows.Forms.DockStyle.Fill;
this.tbPostTestCalLevel.Location = new System.Drawing.Point(204, 341);
this.tbPostTestCalLevel.Name = "tbPostTestCalLevel";
this.tbPostTestCalLevel.Size = new System.Drawing.Size(195, 20);
this.tbPostTestCalLevel.TabIndex = 39;
//
// tbDataZeroLevel
//
this.tbDataZeroLevel.Dock = System.Windows.Forms.DockStyle.Fill;
this.tbDataZeroLevel.Location = new System.Drawing.Point(204, 367);
this.tbDataZeroLevel.Name = "tbDataZeroLevel";
this.tbDataZeroLevel.Size = new System.Drawing.Size(195, 20);
this.tbDataZeroLevel.TabIndex = 40;
//
// tbScaleFactorMV
//
this.tbScaleFactorMV.Dock = System.Windows.Forms.DockStyle.Fill;
this.tbScaleFactorMV.Location = new System.Drawing.Point(204, 419);
this.tbScaleFactorMV.Name = "tbScaleFactorMV";
this.tbScaleFactorMV.Size = new System.Drawing.Size(195, 20);
this.tbScaleFactorMV.TabIndex = 41;
//
// tbScaleFactorEU
//
this.tbScaleFactorEU.Dock = System.Windows.Forms.DockStyle.Fill;
this.tbScaleFactorEU.Location = new System.Drawing.Point(204, 445);
this.tbScaleFactorEU.Name = "tbScaleFactorEU";
this.tbScaleFactorEU.Size = new System.Drawing.Size(195, 20);
this.tbScaleFactorEU.TabIndex = 42;
//
// tbNumberOfBytesEU
//
this.tbNumberOfBytesEU.Dock = System.Windows.Forms.DockStyle.Fill;
this.tbNumberOfBytesEU.Location = new System.Drawing.Point(204, 471);
this.tbNumberOfBytesEU.Name = "tbNumberOfBytesEU";
this.tbNumberOfBytesEU.Size = new System.Drawing.Size(195, 20);
this.tbNumberOfBytesEU.TabIndex = 43;
//
// tbEU
//
this.tbEU.Dock = System.Windows.Forms.DockStyle.Fill;
this.tbEU.Location = new System.Drawing.Point(204, 497);
this.tbEU.Name = "tbEU";
this.tbEU.Size = new System.Drawing.Size(195, 20);
this.tbEU.TabIndex = 44;
//
// tbISO
//
this.tbISO.Dock = System.Windows.Forms.DockStyle.Fill;
this.tbISO.Location = new System.Drawing.Point(204, 653);
this.tbISO.Name = "tbISO";
this.tbISO.Size = new System.Drawing.Size(195, 20);
this.tbISO.TabIndex = 45;
//
// tbCRC32
//
this.tbCRC32.Dock = System.Windows.Forms.DockStyle.Fill;
this.tbCRC32.Location = new System.Drawing.Point(204, 679);
this.tbCRC32.Name = "tbCRC32";
this.tbCRC32.Size = new System.Drawing.Size(195, 20);
this.tbCRC32.TabIndex = 47;
//
// lblFilename
//
this.lblFilename.AutoSize = true;
this.lblFilename.Dock = System.Windows.Forms.DockStyle.Fill;
this.lblFilename.Location = new System.Drawing.Point(3, 702);
this.lblFilename.Name = "lblFilename";
this.lblFilename.Size = new System.Drawing.Size(195, 39);
this.lblFilename.TabIndex = 48;
this.lblFilename.Text = "filename";
this.lblFilename.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// btnBrowse
//
this.btnBrowse.Dock = System.Windows.Forms.DockStyle.Fill;
this.btnBrowse.Location = new System.Drawing.Point(209, 710);
this.btnBrowse.Margin = new System.Windows.Forms.Padding(8);
this.btnBrowse.Name = "btnBrowse";
this.btnBrowse.Size = new System.Drawing.Size(185, 23);
this.btnBrowse.TabIndex = 49;
this.btnBrowse.Text = "Browse";
this.btnBrowse.UseVisualStyleBackColor = true;
//this.btnBrowse.VisualStyle = C1.Win.C1Input.VisualStyle.Office2007Black;
//this.btnBrowse.VisualStyleBaseStyle = C1.Win.C1Input.VisualStyle.Office2007Black;
this.btnBrowse.Click += new System.EventHandler(this.btnBrowse_Click);
//
// label23
//
this.label23.AutoSize = true;
this.label23.Dock = System.Windows.Forms.DockStyle.Fill;
this.label23.Location = new System.Drawing.Point(3, 390);
this.label23.Name = "label23";
this.label23.Size = new System.Drawing.Size(195, 26);
this.label23.TabIndex = 50;
this.label23.Text = "Pre Test Zero Level mV";
this.label23.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// tbPreTestZeroMv
//
this.tbPreTestZeroMv.Dock = System.Windows.Forms.DockStyle.Fill;
this.tbPreTestZeroMv.Location = new System.Drawing.Point(204, 393);
this.tbPreTestZeroMv.Name = "tbPreTestZeroMv";
this.tbPreTestZeroMv.Size = new System.Drawing.Size(195, 20);
this.tbPreTestZeroMv.TabIndex = 51;
//
// label24
//
this.label24.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.label24.AutoSize = true;
this.label24.Location = new System.Drawing.Point(3, 526);
this.label24.Name = "label24";
this.label24.Size = new System.Drawing.Size(69, 13);
this.label24.TabIndex = 52;
this.label24.Text = "Excitation (V)";
//
// label25
//
this.label25.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.label25.AutoSize = true;
this.label25.Location = new System.Drawing.Point(3, 552);
this.label25.Name = "label25";
this.label25.Size = new System.Drawing.Size(104, 13);
this.label25.TabIndex = 53;
this.label25.Text = "Original Offset (ADC)";
//
// label26
//
this.label26.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.label26.AutoSize = true;
this.label26.Location = new System.Drawing.Point(3, 578);
this.label26.Name = "label26";
this.label26.Size = new System.Drawing.Size(78, 13);
this.label26.TabIndex = 54;
this.label26.Text = "Zero mV (ADC)";
//
// label27
//
this.label27.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.label27.AutoSize = true;
this.label27.Location = new System.Drawing.Point(3, 604);
this.label27.Name = "label27";
this.label27.Size = new System.Drawing.Size(138, 13);
this.label27.TabIndex = 55;
this.label27.Text = "Trigger Adjustment Samples";
//
// tbExcitation
//
this.tbExcitation.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.tbExcitation.Location = new System.Drawing.Point(204, 523);
this.tbExcitation.Name = "tbExcitation";
this.tbExcitation.Size = new System.Drawing.Size(195, 20);
this.tbExcitation.TabIndex = 56;
//
// tbOriginalOffset
//
this.tbOriginalOffset.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.tbOriginalOffset.Location = new System.Drawing.Point(204, 549);
this.tbOriginalOffset.Name = "tbOriginalOffset";
this.tbOriginalOffset.Size = new System.Drawing.Size(195, 20);
this.tbOriginalOffset.TabIndex = 57;
//
// tbZeroMVInADC
//
this.tbZeroMVInADC.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.tbZeroMVInADC.Location = new System.Drawing.Point(204, 575);
this.tbZeroMVInADC.Name = "tbZeroMVInADC";
this.tbZeroMVInADC.Size = new System.Drawing.Size(195, 20);
this.tbZeroMVInADC.TabIndex = 58;
//
// tbTriggerAdjustmentSamples
//
this.tbTriggerAdjustmentSamples.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.tbTriggerAdjustmentSamples.Location = new System.Drawing.Point(204, 601);
this.tbTriggerAdjustmentSamples.Name = "tbTriggerAdjustmentSamples";
this.tbTriggerAdjustmentSamples.Size = new System.Drawing.Size(195, 20);
this.tbTriggerAdjustmentSamples.TabIndex = 59;
//
// label4
//
this.label4.AutoSize = true;
this.label4.Dock = System.Windows.Forms.DockStyle.Fill;
this.label4.Location = new System.Drawing.Point(3, 0);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(391, 7);
this.label4.TabIndex = 1;
this.label4.Text = "label4";
//
// label28
//
this.label28.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.label28.AutoSize = true;
this.label28.Location = new System.Drawing.Point(3, 630);
this.label28.Name = "label28";
this.label28.Size = new System.Drawing.Size(120, 13);
this.label28.TabIndex = 60;
this.label28.Text = "Window Average (ADC)";
//
// tbWindowAverageADC
//
this.tbWindowAverageADC.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.tbWindowAverageADC.Location = new System.Drawing.Point(204, 627);
this.tbWindowAverageADC.Name = "tbWindowAverageADC";
this.tbWindowAverageADC.Size = new System.Drawing.Size(195, 20);
this.tbWindowAverageADC.TabIndex = 61;
//
// ModifyChannel
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(408, 804);
this.Controls.Add(this.tableLayoutPanel1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.SizableToolWindow;
this.Name = "ModifyChannel";
this.Text = "ModifyChannel";
this.tableLayoutPanel1.ResumeLayout(false);
this.tableLayoutPanel2.ResumeLayout(false);
this.tableLayoutPanel2.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
private System.Windows.Forms.Button btnWrite;
private System.Windows.Forms.Button btnCancel;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel2;
private System.Windows.Forms.TextBox tbMagicKey;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.Label label8;
private System.Windows.Forms.Label label9;
private System.Windows.Forms.Label label10;
private System.Windows.Forms.Label label11;
private System.Windows.Forms.Label label12;
private System.Windows.Forms.Label label13;
private System.Windows.Forms.Label label14;
private System.Windows.Forms.Label label15;
private System.Windows.Forms.Label label16;
private System.Windows.Forms.Label label17;
private System.Windows.Forms.Label label18;
private System.Windows.Forms.Label label19;
private System.Windows.Forms.Label label20;
private System.Windows.Forms.Label label21;
private System.Windows.Forms.Label label22;
private System.Windows.Forms.TextBox tbVersionNumber;
private System.Windows.Forms.TextBox tbOffset;
private System.Windows.Forms.TextBox tbNumberOfSamples;
private System.Windows.Forms.TextBox tbNumberOfBitsPerSample;
private System.Windows.Forms.TextBox tbSignedSamples;
private System.Windows.Forms.TextBox tbSampleRate;
private System.Windows.Forms.TextBox tbNumberOfTriggers;
private System.Windows.Forms.TextBox tbTriggerSampleNumber;
private System.Windows.Forms.TextBox tbPreTestZeroADC;
private System.Windows.Forms.TextBox tbPreTestCalLevel;
private System.Windows.Forms.TextBox tbPreTestNoise;
private System.Windows.Forms.TextBox PostTestZeroADC;
private System.Windows.Forms.TextBox tbPostTestCalLevel;
private System.Windows.Forms.TextBox tbDataZeroLevel;
private System.Windows.Forms.TextBox tbScaleFactorMV;
private System.Windows.Forms.TextBox tbScaleFactorEU;
private System.Windows.Forms.TextBox tbNumberOfBytesEU;
private System.Windows.Forms.TextBox tbEU;
private System.Windows.Forms.TextBox tbISO;
private System.Windows.Forms.TextBox tbCRC32;
private System.Windows.Forms.Label lblFilename;
private System.Windows.Forms.Button btnBrowse;
private System.Windows.Forms.Label label23;
private System.Windows.Forms.TextBox tbPreTestZeroMv;
private System.Windows.Forms.Label label24;
private System.Windows.Forms.Label label25;
private System.Windows.Forms.Label label26;
private System.Windows.Forms.Label label27;
private System.Windows.Forms.TextBox tbExcitation;
private System.Windows.Forms.TextBox tbOriginalOffset;
private System.Windows.Forms.TextBox tbZeroMVInADC;
private System.Windows.Forms.TextBox tbTriggerAdjustmentSamples;
private System.Windows.Forms.Label label28;
private System.Windows.Forms.TextBox tbWindowAverageADC;
}
}

View File

@@ -0,0 +1,111 @@
using DTS.Common.Utilities.Logging;
using System;
using System.Windows.Forms;
namespace DTS.Serialization.SliceRaw
{
public partial class ModifyChannel : Form
{
private File.PersistentChannel _channel;
public File.PersistentChannel ChannelToModify
{
set { _channel = value; PopulateFromTest(); }
}
private void PopulateFromTest()
{
tbDataZeroLevel.Text = _channel.DataZeroLevelCounts.ToString();
tbEU.Text = new string(_channel.EngineeringUnit);
tbISO.Text = new string(_channel.IsoCode);
tbMagicKey.Text = _channel.MagicKey.ToString();
tbNumberOfBitsPerSample.Text = _channel.NumberOfBitsPerSample.ToString();
tbNumberOfSamples.Text = _channel.NumberOfSamples.ToString();
tbNumberOfTriggers.Text = _channel.NumberOfTriggers.ToString();
tbOffset.Text = _channel.OffsetOfSampleDataStart.ToString();
tbPostTestCalLevel.Text = _channel.PostTestDiagnosticsLevelCounts.ToString();
tbPreTestCalLevel.Text = _channel.PreTestDiagnosticsLevelCounts.ToString();
tbPreTestNoise.Text = _channel.PreTestNoisePercentageOfFullScale.ToString();
tbPreTestZeroADC.Text = _channel.PreTestZeroLevelCounts.ToString();
tbPreTestZeroMv.Text = _channel.RemovedADC.ToString();
tbSampleRate.Text = _channel.SampleRate.ToString();
tbScaleFactorMV.Text = _channel.ScaleFactorMv.ToString();
tbTriggerSampleNumber.Text = _channel.TriggerSampleNumbers.Length > 0 ? _channel.TriggerSampleNumbers[0].ToString() : "0";
tbScaleFactorEU.Text = _channel.MvPerEu.ToString();
lblFilename.Text = _channel.Filename;
tbVersionNumber.Text = _channel.HeaderVersionNumber.ToString();
tbZeroMVInADC.Text = _channel.ZeroMvInADC.ToString();
tbWindowAverageADC.Text = _channel.WindowAverageADC.ToString();
tbTriggerAdjustmentSamples.Text = _channel.TriggerAdjustmentSamples.ToString();
tbOriginalOffset.Text = _channel.OriginalOffsetADC.ToString();
tbExcitation.Text = _channel.Excitation.ToString();
}
public ModifyChannel()
{
InitializeComponent();
}
private void c1Button2_Click(object sender, EventArgs e)
{
DialogResult = DialogResult.Cancel;
Close();
}
private void btnWrite_Click(object sender, EventArgs e)
{
_channel.DataZeroLevelCounts = Convert.ToInt32(tbDataZeroLevel.Text);
_channel.EngineeringUnit = tbEU.Text.ToCharArray();
_channel.IsoCode = tbISO.Text.ToCharArray();
_channel.MagicKey = Convert.ToUInt32(tbMagicKey.Text);
_channel.NumberOfBitsPerSample = Convert.ToUInt32(tbNumberOfBitsPerSample.Text);
_channel.NumberOfSamples = Convert.ToUInt64(tbNumberOfSamples.Text);
//_channel.NumberOfTriggers = Convert.ToUInt16(tbNumberOfTriggers.Text);
_channel.OffsetOfSampleDataStart = Convert.ToUInt64(tbOffset.Text);
_channel.PostTestDiagnosticsLevelCounts = Convert.ToInt32(tbPostTestCalLevel.Text);
_channel.PreTestDiagnosticsLevelCounts = Convert.ToInt32(tbPreTestCalLevel.Text);
_channel.PreTestNoisePercentageOfFullScale = Convert.ToDouble(tbPreTestNoise.Text);
_channel.RemovedADC = Convert.ToInt32(tbPreTestZeroMv.Text);
_channel.PreTestZeroLevelCounts = Convert.ToInt32(tbPreTestZeroADC.Text);
_channel.SampleRate = Convert.ToDouble(tbSampleRate.Text);
_channel.ScaleFactorMv = Convert.ToDouble(tbScaleFactorMV.Text);
_channel.WindowAverageADC = Convert.ToInt32(tbWindowAverageADC.Text);
_channel.TriggerSampleNumbers = new ulong[] { Convert.ToUInt64(tbTriggerSampleNumber.Text) };
_channel.ZeroMvInADC = Convert.ToInt32(tbZeroMVInADC.Text);
_channel.TriggerAdjustmentSamples = Convert.ToInt32(tbTriggerAdjustmentSamples.Text);
_channel.OriginalOffsetADC = Convert.ToInt32(tbOriginalOffset.Text);
_channel.Excitation = Convert.ToDouble(tbExcitation.Text);
_channel.MvPerEu = Convert.ToDouble(tbScaleFactorEU.Text);
lblFilename.Text = _channel.Filename;
_channel.HeaderVersionNumber = Convert.ToUInt32(tbVersionNumber.Text);
_channel.StampCrc();
DialogResult = DialogResult.OK;
Close();
}
private void btnBrowse_Click(object sender, EventArgs e)
{
using (var ofd = new OpenFileDialog())
{
ofd.RestoreDirectory = true;
ofd.InitialDirectory = System.IO.Path.Combine(Environment.CurrentDirectory, "DATA");
ofd.Filter = "SLICE Binary Channel (*.chn) | *.chn";
ofd.FilterIndex = 0;
var dr = ofd.ShowDialog();
if (dr == DialogResult.OK)
{
try
{
var fi = new System.IO.FileInfo(ofd.FileName);
var newFile = System.IO.Path.Combine(fi.Directory.FullName, fi.Name);
newFile += ".BAK";
if (System.IO.File.Exists(newFile)) { System.IO.File.Delete(newFile); }
System.IO.File.Copy(fi.FullName, newFile);
ChannelToModify = new File.PersistentChannel(fi.FullName, null, false);
}
catch (Exception ex)
{
APILogger.Log(ex.Message);
}
}
}
}
}
}

View File

@@ -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=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@@ -0,0 +1,430 @@
/*
* SliceRaw.File.BinaryChannelHeader.cs
*
* Copyright © 2009
* Diversified Technical Systems, Inc.
* All Rights Reserved
*/
using System;
using System.Collections.Generic;
using System.Text;
using DTS.Common.Utilities;
using DTS.Common.Utilities.Logging;
using DTS.Common.Utils;
namespace DTS.Serialization.SliceRaw
{
// *** see SliceRaw.File.cs ***
public partial class File
{ ///
/// <summary>
/// Representation of the information found in a binary channel header.
/// </summary>
///
public class BinaryChannelHeader
: Exceptional,
IChannelHeader
{ ///
/// <summary>
/// "Magic Key" required for our binary file type.
/// </summary>
///
public static uint RequiredMagicKey => 0x2C36351F;
public static uint CurrentVersionNumber => 0x04;
/// <summary>
/// Header version number required for our binary file type.
/// </summary>
public static List<uint> KnownHeaderVersionNumbers => new List<uint>(new uint[] { 0x01, 0x02, 0x03, 0x04 });
/// <summary>
/// "Magic Key" relatively-UID <see cref="UInt32"/> for our binary file type.
/// </summary>
public uint MagicKey
{
get;
set;
}
/// <summary>
/// <see cref="UInt32"/> header version number for our binary file type.
/// </summary>
public uint HeaderVersionNumber
{
get;
set;
}
/// <summary>
/// Get/set offset of sample data start value.
/// </summary>
public ulong OffsetOfSampleDataStart
{
get;
set;
}
/// <summary>
/// Get/set number of samples.
/// </summary>
public ulong NumberOfSamples
{
get;
set;
}
/// <summary>
/// Get/set number of bits per sample.
/// </summary>
public uint NumberOfBitsPerSample
{
get;
set;
}
/// <summary>
/// Get/set signed sample indicator.
/// </summary>
public uint AreSamplesSigned
{
get;
set;
}
/// <summary>
/// Get/set sample rate value.
/// </summary>
public double SampleRate
{
get;
set;
}
/// <summary>
/// Get/set number of triggers.
/// </summary>
public ushort NumberOfTriggers
{
get;
set;
}
/// <summary>
/// Get/set the trigger sample numbers
/// </summary>
public ulong[] TriggerSampleNumbers
{
get;
set;
}
/// <summary>
/// the number of adjustment samples for the channel
/// The nature of level triggered is such that a number of qualification samples must pass before the
/// trigger is issued and then backdated to where the trigger started, which requires all other units
/// all be adjusted
/// </summary>
public int TriggerAdjustmentSamples
{
get;
set;
}
/// <summary>
/// Get/set pre test zero level counts.
/// </summary>
public int PreTestZeroLevelCounts
{
get;
set;
}
/// <summary>
/// the number of Analog Data Counts (ADC) removed during any hardware
/// zeroing on the device.
/// In the case of SLICE the firmware will remove as much offset as possible and zero the DAC
/// </summary>
public int RemovedADC
{
get;
set;
}
/// <summary>
/// Get/set pre test diagnostics level counts.
/// </summary>
public int PreTestDiagnosticsLevelCounts
{
get;
set;
}
/// <summary>
/// the Analog Data Counts (ADC) when 0mV is injected
/// (SLICE 1 can not inject 0mV and so will always return 0)
/// </summary>
public int ZeroMvInADC
{
get;
set;
}
/// <summary>
/// The average ADC over the Zero Window specified for the channel
/// </summary>
public int WindowAverageADC
{
get;
set;
}
/// <summary>
/// Initial Offset in ADC
/// </summary>
public int OriginalOffsetADC
{
get;
set;
}
/// <summary>
/// Get/set pre test noise percentage of full scale.
/// </summary>
public double PreTestNoisePercentageOfFullScale
{
get;
set;
}
/// <summary>
/// excitation on this channel
/// with SLICE2 excitation can differ on each channel, so this gives a firm placeholder for information
/// </summary>
public double Excitation
{
get;
set;
}
/// <summary>
/// Get/set post test zero level counts.
/// </summary>
public int PostTestZeroLevelCounts
{
get;
set;
}
/// <summary>
/// Get/set post test diagnostics level counts.
/// </summary>
public int PostTestDiagnosticsLevelCounts
{
get;
set;
}
/// <summary>
/// Get/set data zero level counts.
/// </summary>
public int DataZeroLevelCounts
{
get;
set;
}
/// <summary>
/// Get/set scale factor MV.
/// </summary>
public double ScaleFactorMv
{
get;
set;
}
/// <summary>
/// Get/set sensitivity MV/EU
/// </summary>
public double MvPerEu
{
get;
set;
}
/// <summary>
/// Get/set EU field length (with terminator).
/// </summary>
public ushort EuFieldLengthWithTerminator
{
get;
set;
}
/// <summary>
/// Get/set engineering units.
/// </summary>
public char[] EngineeringUnit
{
get;
set;
}
/// <summary>
/// Get/set ISO code.
/// </summary>
public char[] IsoCode
{
get;
set;
}
private const int HEADER_VERSION_REMOVEDADC = 2;
private const int HEADER_VERSION_3 = 3;
private const int HEADER_VERSION_4 = 4;
/// <summary>
/// Calculate the CRC32 for this binary channe header.
/// </summary>
///
/// <param name="stripEuPadding">
/// <see cref="bool"/> option enables/disables automatic stripping of EU padding.
/// </param>
///
/// <returns>
/// The CRC32 of the binary channel header.
/// </returns>
///
private uint CalculateCrc32(bool stripEuPadding, bool bKeepEuLength)
{
try
{
var data = new List<byte>();
data.AddRange(BitConverter.GetBytes(MagicKey));
data.AddRange(BitConverter.GetBytes(HeaderVersionNumber));
data.AddRange(BitConverter.GetBytes(OffsetOfSampleDataStart));
data.AddRange(BitConverter.GetBytes(NumberOfSamples));
data.AddRange(BitConverter.GetBytes(NumberOfBitsPerSample));
data.AddRange(BitConverter.GetBytes(NumberOfSamples));
data.AddRange(BitConverter.GetBytes(AreSamplesSigned));
data.AddRange(BitConverter.GetBytes(SampleRate));
data.AddRange(BitConverter.GetBytes(NumberOfTriggers));
for (var i = 0; i < TriggerSampleNumbers.Length; i++)
data.AddRange(BitConverter.GetBytes(TriggerSampleNumbers[i]));
data.AddRange(BitConverter.GetBytes(PreTestZeroLevelCounts));
//data.AddRange(BitConverter.GetBytes(PreTestZeroLevelMv));
if (HeaderVersionNumber >= HEADER_VERSION_REMOVEDADC) { data.AddRange(BitConverter.GetBytes(RemovedADC)); }
if (HeaderVersionNumber >= HEADER_VERSION_3)
{
data.AddRange(BitConverter.GetBytes(Excitation));
data.AddRange(BitConverter.GetBytes(TriggerAdjustmentSamples));
data.AddRange(BitConverter.GetBytes(ZeroMvInADC));
data.AddRange(BitConverter.GetBytes(OriginalOffsetADC));
}
if (HeaderVersionNumber >= HEADER_VERSION_4)
{
data.AddRange(BitConverter.GetBytes(WindowAverageADC));
}
data.AddRange(BitConverter.GetBytes(PreTestDiagnosticsLevelCounts));
data.AddRange(BitConverter.GetBytes(PreTestNoisePercentageOfFullScale));
data.AddRange(BitConverter.GetBytes(PostTestZeroLevelCounts));
data.AddRange(BitConverter.GetBytes(PostTestDiagnosticsLevelCounts));
data.AddRange(BitConverter.GetBytes(DataZeroLevelCounts));
data.AddRange(BitConverter.GetBytes(ScaleFactorMv));
data.AddRange(BitConverter.GetBytes(MvPerEu));
// Some data sets have an erroneous EuFieldLengthWithTerminator value that's +1 what it should be,
// so we'll want to make an allowance for these ones too.
var plusOneFieldLengthBugErrorPresent = EuFieldLengthWithTerminator > EngineeringUnit.Length + 1;
if (bKeepEuLength) { plusOneFieldLengthBugErrorPresent = true; }
var padAdjustedEu = new string(EngineeringUnit).Trim().ToCharArray();
if (!stripEuPadding)
{ //
// If we want to calculate the CRC of the header with leading/trailing
// whitespace intact/added.
//
if (padAdjustedEu.Length % 2 != 0)
padAdjustedEu = (new string(padAdjustedEu) + ' ').ToCharArray();
}
var euBA = Encoding.UTF8.GetBytes(padAdjustedEu);
var euFieldLength = plusOneFieldLengthBugErrorPresent ? EuFieldLengthWithTerminator : (ushort)(euBA.Length + 1);
data.AddRange(BitConverter.GetBytes(euFieldLength));
for (var i = 0; i < padAdjustedEu.Length; i++)
data.AddRange(BitConverter.GetBytes(padAdjustedEu[i]));
for (var i = 0; i < IsoCode.Length; i++)
data.AddRange(BitConverter.GetBytes(IsoCode[i]));
// We need to pad the offset so DIAdem .dat file word alignment will work. DIAdem .dat files reference the .chn files directly.
if (data.Count % 2 > 0) data.Add(0x0);
var byteDataArray = data.ToArray();
//APILogger.Log($"[DTM]: data array for CRC: {BitConverter.ToString(byteDataArray)}");
ushort crc = 0xFFFF;
for (var i = 0; i < data.Count; i += 2)
crc = Utils.Math_DoCRC16Step(BitConverter.ToUInt16(byteDataArray, i), crc);
//APILogger.Log($"[DTM]: crc {crc}");
return crc;
}
catch (System.Exception ex)
{
throw new Exception("encountered problem calculating CRC 32", ex);
}
}
public uint UnpaddedEuStringPaddedEuLengthCrc32
{
get
{
try { return CalculateCrc32(true, true); }
catch (System.Exception ex)
{
throw new Exception("encountered problem getting CRC32 for binary header channel with unpadded EU string and padded EU Length", ex);
}
}
}
/// <summary>
/// Get The CRC for the current state of the header (autostrip padding from EU first).
/// </summary>
public uint UnpaddedEuCrc32
{
get
{
try
{
return CalculateCrc32(true, false);
}
catch (System.Exception ex)
{
throw new Exception("encountered problem getting CRC32 for binary header channel with unpadded EU string", ex);
}
}
}
/// <summary>
/// Get the CRC for the current state of the header.
/// </summary>
public uint Crc32
{
get
{
try
{
return CalculateCrc32(false, false);
}
catch (System.Exception ex)
{
throw new Exception("encountered problem generating CRC for binary channel header information", ex);
}
}
}
}
}
}

View File

@@ -0,0 +1,133 @@
using System;
using System.Collections.Generic;
using System.Text;
using DTS.Common.Utilities;
using DTS.Common.Utilities.Logging;
using DTS.Common.Utils;
namespace DTS.Serialization.SliceRaw
{
public partial class File
{ ///
/// <summary>
/// Representation of the information found in a binary module timestamp header.
/// </summary>
///
public class BinaryDasTimestampHeader
: Exceptional,
IDasTimestampHeader
{
///
/// <summary>
/// "Magic Key" required for our binary file type.
/// </summary>
///
public static uint RequiredMagicKey => 0xF15363C2; //persistentchannel's backwards
public static uint CurrentVersionNumber => 0x01;
/// <summary>
/// Header version number required for our binary file type.
/// </summary>
public static List<uint> KnownHeaderVersionNumbers => new List<uint>(new uint[] { 0x01 });
/// <summary>
/// "Magic Key" relatively-UID <see cref="UInt32"/> for our binary file type.
/// </summary>
public uint MagicKey
{
get;
set;
}
/// <summary>
/// <see cref="UInt32"/> header version number for our binary file type.
/// </summary>
public uint HeaderVersionNumber
{
get;
set;
}
/// <summary>
/// Get/set offset of sample data start value.
/// </summary>
public ulong OffsetOfSampleDataStart
{
get;
set;
}
/// <summary>
/// Get/set number of samples.
/// </summary>
public ulong NumberOfSamples
{
get;
set;
}
/// <summary>
/// Get/set sample rate value.
/// </summary>
public uint NumberOfBitsPerSample
{
get;
set;
}
/// <summary>
/// Calculate the CRC32 for this binary channe header.
/// </summary>
///
/// <returns>
/// The CRC32 of the binary channel header.
/// </returns>
///
private uint CalculateCrc32()
{
try
{
var data = new List<byte>();
data.AddRange(BitConverter.GetBytes(MagicKey));
data.AddRange(BitConverter.GetBytes(HeaderVersionNumber));
data.AddRange(BitConverter.GetBytes(OffsetOfSampleDataStart));
data.AddRange(BitConverter.GetBytes(NumberOfSamples));
data.AddRange(BitConverter.GetBytes(NumberOfBitsPerSample));
if (data.Count % 2 > 0) data.Add(0x0);
var byteDataArray = data.ToArray();
//APILogger.Log($"[DTM]: data array for CRC: {BitConverter.ToString(byteDataArray)}");
ushort crc = 0xFFFF;
for (var i = 0; i < data.Count; i += 2)
crc = Utils.Math_DoCRC16Step(BitConverter.ToUInt16(byteDataArray, i), crc);
//APILogger.Log($"[DTM]: crc {crc}");
return crc;
}
catch (System.Exception ex)
{
throw new Exception("encountered problem calculating CRC 32", ex);
}
}
/// <summary>
/// Get the CRC for the current state of the header.
/// </summary>
public uint Crc32
{
get
{
try
{
return CalculateCrc32();
}
catch (System.Exception ex)
{
throw new Exception("encountered problem generating CRC for binary channel header information", ex);
}
}
}
}
}
}

View File

@@ -0,0 +1,271 @@
/*
* DTS.Serialization.SliceRaw.File.IChannelHeader.cs
*
* Copyright © 2009
* Diversified Technical Systems, Inc.
* All Rights Reserved
*/
using System;
namespace DTS.Serialization.SliceRaw
{
public interface IChannelHeader
{
///// <summary>
///// "Magic Key" required for our binary file type.
///// </summary>
/////
//UInt32 RequiredMagicKey
//{
// get;
//}
///// <summary>
///// Header version number required for our binary file type.
///// </summary>
//UInt32 RequiredHeaderVersionNumber
//{
// get;
//}
/// <summary>
/// "Magic Key" relatively-UID <see cref="UInt32"/> for our binary file type.
/// </summary>
uint MagicKey
{
get;
set;
}
/// <summary>
/// <see cref="UInt32"/> header version number for our binary file type.
/// </summary>
uint HeaderVersionNumber
{
get;
set;
}
/// <summary>
/// Get/set offset of sample data start value.
/// </summary>
ulong OffsetOfSampleDataStart
{
get;
set;
}
/// <summary>
/// Get/set number of samples.
/// </summary>
ulong NumberOfSamples
{
get;
set;
}
/// <summary>
/// Get/set number of bits per sample.
/// </summary>
uint NumberOfBitsPerSample
{
get;
set;
}
/// <summary>
/// Get/set signed sample indicator.
/// </summary>
uint AreSamplesSigned
{
get;
set;
}
/// <summary>
/// Get/set sample rate value.
/// </summary>
double SampleRate
{
get;
set;
}
/// <summary>
/// Get/set number of triggers.
/// </summary>
ushort NumberOfTriggers
{
get;
set;
}
/// <summary>
/// Get/set the trigger sample numbers
/// </summary>
ulong[] TriggerSampleNumbers
{
get;
set;
}
/// <summary>
/// Get/set pre test zero level counts.
/// </summary>
int PreTestZeroLevelCounts
{
get;
set;
}
/// <summary>
/// ADC removed during hardware zeroing
/// (added back in for mV values)
/// </summary>
int RemovedADC
{
get;
set;
}
/// <summary>
/// excitation voltage
/// </summary>
double Excitation
{
get;
set;
}
/// <summary>
/// Analog Data Counts (ADC) for 0mV injected signal
/// </summary>
int ZeroMvInADC
{
get;
set;
}
/// <summary>
/// Average ADC over Zero Window specified for channel
/// </summary>
int WindowAverageADC
{
get;
set;
}
/// <summary>
///
/// </summary>
int OriginalOffsetADC
{
get;
set;
}
int TriggerAdjustmentSamples
{
get;
set;
}
/// <summary>
/// Get/set pre test diagnostics level counts.
/// </summary>
int PreTestDiagnosticsLevelCounts
{
get;
set;
}
/// <summary>
/// Get/set pre test noise percentage of full scale.
/// </summary>
double PreTestNoisePercentageOfFullScale
{
get;
set;
}
/// <summary>
/// Get/set post test zero level counts.
/// </summary>
int PostTestZeroLevelCounts
{
get;
set;
}
/// <summary>
/// Get/set post test diagnostics level counts.
/// </summary>
int PostTestDiagnosticsLevelCounts
{
get;
set;
}
/// <summary>
/// Get/set data zero level counts.
/// </summary>
int DataZeroLevelCounts
{
get;
set;
}
/// <summary>
/// Get/set scale factor MV.
/// </summary>
double ScaleFactorMv
{
get;
set;
}
/// <summary>
/// Get/set sensitivity MV/EU
/// </summary>
double MvPerEu
{
get;
set;
}
/// <summary>
/// Get/set EU field length (with terminator).
/// </summary>
ushort EuFieldLengthWithTerminator
{
get;
set;
}
/// <summary>
/// Get/set engineering units.
/// </summary>
char[] EngineeringUnit
{
get;
set;
}
/// <summary>
/// Get/set ISO code.
/// </summary>
char[] IsoCode
{
get;
set;
}
/// <summary>
/// Get the CRC for the current state of the header.
/// </summary>
uint Crc32
{
get;
}
}
}

View File

@@ -0,0 +1,59 @@
using System;
namespace DTS.Serialization.SliceRaw
{
public interface IDasTimestampHeader
{
/// <summary>
/// "Magic Key" relatively-UID <see cref="UInt32"/> for our binary file type.
/// </summary>
uint MagicKey
{
get;
set;
}
/// <summary>
/// <see cref="UInt32"/> header version number for our binary file type.
/// </summary>
uint HeaderVersionNumber
{
get;
set;
}
/// <summary>
/// Get/set offset of sample data start value.
/// </summary>
ulong OffsetOfSampleDataStart
{
get;
set;
}
/// <summary>
/// Get/set number of samples.
/// </summary>
ulong NumberOfSamples
{
get;
set;
}
/// <summary>
/// Get/set number of bits per sample.
/// </summary>
uint NumberOfBitsPerSample
{
get;
set;
}
/// <summary>
/// Get the CRC for the current state of the header.
/// </summary>
uint Crc32
{
get;
}
}
}

View File

@@ -0,0 +1,68 @@
/*
* SliceRaw.File.PersistentChannel.AlreadyInitializedException.cs
*
* Copyright © 2009
* Diversified Technical Systems, Inc.
* All Rights Reserved
*/
using System;
namespace DTS.Serialization.SliceRaw
{
// *** see SliceRaw.File.cs ***
public partial class File
{
// *** see SliceRaw.File.PersistentChannel.cs ***
public partial class PersistentChannel
{
/// <summary>
/// Representation of an attempt to set a property that has already been initialized
/// and exhibits set-once behavior.
/// </summary>
public class AlreadyInitializedException : ApplicationException
{ ///
/// <summary>
/// Initialize an instance of the AlreadyInitializedException class.
/// </summary>
///
public AlreadyInitializedException()
{
}
/// <summary>
/// Initialize an instance of the AlreadyInitializedException class.
/// </summary>
///
/// <param name="msg">
/// The <see cref="string"/> message to be associated with this exception.
/// </param>
///
public AlreadyInitializedException(string msg)
: base(msg)
{
}
/// <summary>
/// Initialize an instance of the AlreadyInitializedException class.
/// </summary>
///
/// <param name="msg">
/// The <see cref="string"/> message to be associated with this exception.
/// </param>
///
/// <param name="innerEx">
/// The <see cref="System.Exception"/> responsible for this exception inception.
/// </param>
///
public AlreadyInitializedException(string msg, System.Exception innerEx)
: base(msg, innerEx)
{
}
}
} // *** end PersistentChannel ***
} // *** end File ***
}

View File

@@ -0,0 +1,68 @@
/*
* SliceRaw.File.PersistentChannel.DataTooBigForArrayException.cs
*
* Copyright © 2009
* Diversified Technical Systems, Inc.
* All Rights Reserved
*/
using System;
namespace DTS.Serialization.SliceRaw
{
// *** see SliceRaw.File.cs ***
public partial class File
{
// *** see SliceRaw.File.PersistentChannel.cs ***
public partial class PersistentChannel
{
/// <summary>
/// Representation of an attempt to "arrayify" a large dataset that's too large to be
/// safely handled in an array.
/// </summary>
public class DataTooBigForArrayException : ApplicationException
{ ///
/// <summary>
/// Initialize an instance of the DataTooBigForArrayException class.
/// </summary>
///
public DataTooBigForArrayException()
{
}
/// <summary>
/// Initialize an instance of the DataTooBigForArrayException class.
/// </summary>
///
/// <param name="msg">
/// The <see cref="string"/> message to be associated with this exception.
/// </param>
///
public DataTooBigForArrayException(string msg)
: base(msg)
{
}
/// <summary>
/// Initialize an instance of the DataTooBigForArrayException class.
/// </summary>
///
/// <param name="msg">
/// The <see cref="string"/> message to be associated with this exception.
/// </param>
///
/// <param name="innerEx">
/// The <see cref="System.Exception"/> responsible for this exception inception.
/// </param>
///
public DataTooBigForArrayException(string msg, System.Exception innerEx)
: base(msg, innerEx)
{
}
}
} // *** end PersistentChannel ***
} // *** end File ***
}

View File

@@ -0,0 +1,69 @@
/*
* SliceRaw.File.PersistentChannel.DependencyNotInitializedException.cs
*
* Copyright © 2009
* Diversified Technical Systems, Inc.
* All Rights Reserved
*/
using System;
namespace DTS.Serialization.SliceRaw
{
// *** see SliceRaw.File.cs ***
public partial class File
{
// *** see SliceRaw.File.PersistentChannel.cs ***
public partial class PersistentChannel
{
/// <summary>
/// Representation of an attempt to get a property that has an uninitialized dependency.
/// </summary>
public class DependencyNotInitializedException : ApplicationException
{ ///
/// <summary>
/// Initialize an instance of the DependencyNotInitializedException class.
/// </summary>
///
public DependencyNotInitializedException()
{
}
/// <summary>
/// Initialize an instance of the DependencyNotInitializedException class.
/// </summary>
///
/// <param name="msg">
/// The <see cref="string"/> message to be associated with this exception.
/// </param>
///
public DependencyNotInitializedException(string msg)
: base(msg)
{
}
/// <summary>
/// Initialize an instance of the DependencyNotInitializedException class.
/// </summary>
///
/// <param name="msg">
/// The <see cref="string"/> message to be associated with this exception.
/// </param>
///
/// <param name="innerEx">
/// The <see cref="System.Exception"/> responsible for this exception exception.
/// </param>
///
public DependencyNotInitializedException(string msg, System.Exception innerEx)
: base(msg, innerEx)
{
}
}
} // *** end PersistentChannel ***
} // *** end File ***
}

View File

@@ -0,0 +1,69 @@
/*
* SliceRaw.File.PersistentChannel.IsInitializingException.cs
*
* Copyright © 2009
* Diversified Technical Systems, Inc.
* All Rights Reserved
*/
using System;
namespace DTS.Serialization.SliceRaw
{
// *** see SliceRaw.File.cs ***
public partial class File
{
// *** see SliceRaw.File.PersistentChannel.cs ***
public partial class PersistentChannel
{
/// <summary>
/// Representation of an attempt to get a property of a persistent channel still
/// being initialized.
/// </summary>
public class IsInitializingException : ApplicationException
{ ///
/// <summary>
/// Initialize an instance of the IsInitializingException class.
/// </summary>
///
public IsInitializingException()
{
}
/// <summary>
/// Initialize an instance of the IsInitializingException class.
/// </summary>
///
/// <param name="msg">
/// The <see cref="string"/> message to be associated with this exception.
/// </param>
///
public IsInitializingException(string msg)
: base(msg)
{
}
/// <summary>
/// Initialize an instance of the IsInitializingException class.
/// </summary>
///
/// <param name="msg">
/// The <see cref="string"/> message to be associated with this exception.
/// </param>
///
/// <param name="innerEx">
/// The <see cref="System.Exception"/> responsible for this exception exception.
/// </param>
///
public IsInitializingException(string msg, System.Exception innerEx)
: base(msg, innerEx)
{
}
}
} // *** end PersistentChannel ***
} // *** end File ***
}

View File

@@ -0,0 +1,67 @@
/*
* SliceRaw.File.PersistentChannel.NotInitializedException.cs
*
* Copyright © 2009
* Diversified Technical Systems, Inc.
* All Rights Reserved
*/
using System;
namespace DTS.Serialization.SliceRaw
{
// *** see SliceRaw.File.cs ***
public partial class File
{
// *** see SliceRaw.File.PersistentChannel.cs ***
public partial class PersistentChannel
{
/// <summary>
/// Representation of an attempt to get a property that has yet to be initialized.
/// </summary>
public class NotInitializedException : ApplicationException
{ ///
/// <summary>
/// Initialize an instance of the NotInitializedException class.
/// </summary>
///
public NotInitializedException()
{
}
/// <summary>
/// Initialize an instance of the NotInitializedException class.
/// </summary>
///
/// <param name="msg">
/// The <see cref="string"/> message to be associated with this exception.
/// </param>
///
public NotInitializedException(string msg)
: base(msg)
{
}
/// <summary>
/// Initialize an instance of the NotInitializedException class.
/// </summary>
///
/// <param name="msg">
/// The <see cref="string"/> message to be associated with this exception.
/// </param>
///
/// <param name="innerEx">
/// The <see cref="System.Exception"/> responsible for this exception inception.
/// </param>
///
public NotInitializedException(string msg, System.Exception innerEx)
: base(msg, innerEx)
{
}
}
} // *** end PersistentChannel ***
} // *** end File ***
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,129 @@
/*
* SliceRaw.File.PersistentEuChannel.cs
*
* Copyright © 2009
* Diversified Technical Systems, Inc.
* All Rights Reserved
*/
using System;
using DTS.Common.DAS.Concepts;
using DTS.Common.Utilities;
using DTS.Common.Utilities.DotNetProgrammingConstructs;
namespace DTS.Serialization.SliceRaw
{
public partial class File
{
public class PersistentEuChannel : ExceptionalList<double>
{
/// <summary>
/// Initialize an instance of the DTS.Serialization.SliceRaw.File.PersistentEuChannel class.
/// </summary>
///
/// <param name="persistentChannel">
/// The <see cref="DTS.Serialization.SliceRaw.File.PersistentChannel"/> to be wrapped by this
/// "to EU" conversion class.
/// </param>
///
/// <param name="scaler">
/// The <see cref="DTS.Common.DAS.ConceptsDataScalar"/> object that defines the conversion from
/// ADC to EU for the wrapped data.
/// </param>
///
public PersistentEuChannel(PersistentChannel persistentChannel, DataScaler scaler)
{
try
{
BasePersistentChannel = persistentChannel;
EuDataScaler = scaler;
}
catch (System.Exception ex)
{
throw new Exception("encountered problem constructing " + GetType().FullName, ex);
}
}
/// <summary>
/// Get/set the base persistent channel of this EU-ifying wrapper.
/// </summary>
public PersistentChannel BasePersistentChannel
{
get => _BasePersistentChannel.Value;
set => _BasePersistentChannel.Value = value;
}
private readonly Property<PersistentChannel> _BasePersistentChannel
= new Property<PersistentChannel>(
typeof(PersistentEuChannel).Namespace + ".PersistentEuChannel.BasePersistentChannel",
null,
false
);
/// <summary>
/// Get/set the data scaler for converting the ADC data wrapped by this class to EU.
/// </summary>
public DataScaler EuDataScaler
{
get => _EuDataScaler.Value;
set => _EuDataScaler.Value = value;
}
private readonly Property<DataScaler> _EuDataScaler
= new Property<DataScaler>(
typeof(PersistentEuChannel).Namespace + ".PersistentEuChannel.EuDataScaler",
null,
false
);
public double this[ulong i]
{
get
{
try
{
return EuDataScaler.GetEU(BasePersistentChannel[i]);
}
catch (System.Exception ex)
{
throw new Exception("encountered problem getting value at index " + i.ToString(), ex);
}
}
set
{
try
{
throw new NotSupportedException("SliceRaw::File::PersistentEuChannel::[] values are read-only");
}
catch (System.Exception ex)
{
throw new Exception("encountered problem setting value at index " + i.ToString(), ex);
}
}
}
/// <summary>
/// Get the <see cref="long"/> length of this persistent channel's data.
/// </summary>
public long Length => BasePersistentChannel.Length;
/// <summary>
/// Dispose of this object's Disposables.
/// </summary>
public void Dispose()
{
try
{
BasePersistentChannel.Dispose();
}
catch (System.Exception ex)
{
throw new PersistentChannel.Exception("encountered problem disposing of " + GetType().FullName, ex);
}
}
}
}
}

View File

@@ -0,0 +1,63 @@
/*
* SliceRaw.File.Reader.BadCrcException.cs
*
* Copyright © 2009
* Diversified Technical Systems, Inc.
* All Rights Reserved
*/
namespace DTS.Serialization.SliceRaw
{
// *** see SliceRaw.File.cs ***
public partial class File
{
// *** see SliceRaw.File.Reader.cs ***
public partial class Reader
{ ///
/// <summary>
/// Representation of a bad CRC filer event.
/// </summary>
///
public class BadCrcException : Exception
{ ///
/// <summary>
/// Initialize an instance of the BadCrcException class.
/// </summary>
///
public BadCrcException()
{
}
/// <summary>
/// Initialize an instance of the BadCrcException class.
/// </summary>
///
/// <param name="msg">
/// The <see cref="string"/> message to be associated with this exception.
/// </param>
///
public BadCrcException(string msg)
: base(msg)
{
}
/// <summary>
/// Initialize an instance of the BadCrcException class.
/// </summary>
///
/// <param name="msg">
/// The <see cref="string"/> message to be associated with this exception.
/// </param>
///
/// <param name="innerEx">
/// The inner <see cref="System.Exception"/> that led to this exception's inception.
/// </param>
///
public BadCrcException(string msg, System.Exception innerEx)
: base(msg, innerEx)
{
}
}
}
}
}

View File

@@ -0,0 +1,63 @@
/*
* SliceRaw.File.Reader.MissingFileException.cs
*
* Copyright © 2009
* Diversified Technical Systems, Inc.
* All Rights Reserved
*/
namespace DTS.Serialization.SliceRaw
{
// *** see SliceRaw.File.cs ***
public partial class File
{
// *** see SliceRaw.File.Reader.cs ***
public partial class Reader
{ ///
/// <summary>
/// Representation of a missing-file filer event.
/// </summary>
///
public class MissingFileException : Exception
{ ///
/// <summary>
/// Initialize an instance of the MissingFileException class.
/// </summary>
///
public MissingFileException()
{
}
/// <summary>
/// Initialize an instance of the MissingFileException class.
/// </summary>
///
/// <param name="msg">
/// The <see cref="string"/> message to be associated with this exception.
/// </param>
///
public MissingFileException(string msg)
: base(msg)
{
}
/// <summary>
/// Initialize an instance of the MissingFileException class.
/// </summary>
///
/// <param name="msg">
/// The <see cref="string"/> message to be associated with this exception.
/// </param>
///
/// <param name="innerEx">
/// The inner <see cref="System.Exception"/> that led to this exception's inception.
/// </param>
///
public MissingFileException(string msg, System.Exception innerEx)
: base(msg, innerEx)
{
}
}
}
}
}

View File

@@ -0,0 +1,63 @@
/*
* SliceRaw.File.Reader.TooManyFilesException.cs
*
* Copyright © 2009
* Diversified Technical Systems, Inc.
* All Rights Reserved
*/
namespace DTS.Serialization.SliceRaw
{
// *** see SliceRaw.File.cs ***
public partial class File
{
// *** see SliceRaw.File.Reader.cs ***
public partial class Reader
{ ///
/// <summary>
/// Representation of too-many-files filer event.
/// </summary>
///
public class TooManyFilesException : Exception
{ ///
/// <summary>
/// Initialize an instance of the TooManyFilesException class.
/// </summary>
///
public TooManyFilesException()
{
}
/// <summary>
/// Initialize an instance of the TooManyFilesException class.
/// </summary>
///
/// <param name="msg">
/// The <see cref="string"/> message to be associated with this exception.
/// </param>
///
public TooManyFilesException(string msg)
: base(msg)
{
}
/// <summary>
/// Initialize an instance of the TooManyFilesException class.
/// </summary>
///
/// <param name="msg">
/// The <see cref="string"/> message to be associated with this exception.
/// </param>
///
/// <param name="innerEx">
/// The <see cref="System.Exception"/> responsible for this exception inception.
/// </param>
///
public TooManyFilesException(string msg, System.Exception innerEx)
: base(msg, innerEx)
{
}
}
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,364 @@
/*
SliceRaw.File.Writer.cs
Copyright © 2009
Diversified Technical Systems, Inc.
All Rights Reserved
*/
using System;
using System.IO;
using System.Linq;
using System.Text;
using System.Xml.Serialization;
using DTS.Common.Utilities.Logging;
namespace DTS.Serialization.SliceRaw
{
// *** see SliceRaw.File.cs ***
public partial class File
{ ///
/// <summary>
/// Utility object for serializing <see cref="DTS.Serialization.Test"/>s to disk
/// in the SliceRaw format.
/// </summary>
///
public class Writer : Writer<File>, IWriter<Test>
{ ///
/// <summary>
/// Initialize an instance of the SliceRaw.File.Writer class.
/// </summary>
///
/// <param name="fileType">
/// The <see cref="DTS.Serialization.SliceRaw.File"/>-type this serializer is associated with.
/// </param>
///
public Writer(File fileType, int encoding)
: base(fileType, encoding)
{
}
public delegate void SetProgressDelegate(double d);
/// <summary>
/// if present will be used to notify of progress
/// used to provide "finishing download" progrses
/// 17587 Add Finishing download feedback
/// </summary>
public SetProgressDelegate SetProgress { get; set; }
/// <summary>
/// Perform disk serialization now.
/// </summary>
///
/// <param name="directory">
/// The <see cref="string"/> path of the directory to contain the written test.
/// </param>
///
/// <param name="test">
/// The <see cref="DTS.Serialization.Test"/> to be written out.
/// </param>
///
public void Write(string directory, string id, Test test, bool bFiltering, bool includeGroupNameInISOExport, double minStartTime, int dataCollectionLength)
{
try
{
Write(directory, id, null, test, bFiltering, includeGroupNameInISOExport, null, null, 0, null, null, null, null, null, null, minStartTime, dataCollectionLength);
}
catch (System.Exception ex)
{
throw new Exception("encountered problem doing non-event reporting write", ex);
}
}
private void ChannelException(string problem, string channel, System.Exception ex)
{
APILogger.Log("Exception writing channel: ", channel, " field: ", problem, " exception: ", ex);
}
/// <summary>
/// Perform disk serialization now.
/// </summary>
///
/// <param name="directory">
/// The <see cref="string"/> path of the directory to contin the written test.
/// </param>
///
/// <param name="test">
/// The <see cref="DTS.Serialization.Test"/> to be written out.
/// </param>
///
/// <param name="onEvent">
/// The <see cref="DTS.Serialization.File.Writer.EventHandler"/> to be notified whenever
/// the writer does something noteworthy.
/// </param>
///
public void Write(string directory,
string id,
string dataFolder,
Test test,
bool bFiltering,
bool includeGroupNameInISOExport,
FilteredData fd,
Test.Module.Channel tmChannel,
int channelNumber,
BeginEventHandler beginEventHandler,
CancelEventHandler cancelEventHandler,
EndEventHandler endEventHandler,
TickEventHandler tickEventHandler,
ErrorEventHandler errorEventHandler,
CancelRequested cancelRequested,
double minStartTime,
int dataCollectionLength)
{
System.Exception exception = null;
//int line = 0;
try
{
if (null == test)
{
throw new ArgumentNullException("cannot write null test reference");
}
//ConfigurationManager.AppSettings
test.Software = System.Reflection.Assembly.GetEntryAssembly().GetName().Name;
test.SoftwareVersion = System.Reflection.Assembly.GetEntryAssembly().GetName().Version.ToString(4);
//line = 1;
var numberOfFiles = 1; // There will always be the main test file.
var numberOfTicksSent = 0;
foreach (var module in test.Modules)
numberOfFiles += module.Channels.Count;
beginEventHandler?.Invoke(this, (uint)numberOfFiles);
//line = 2;
var encoder = Encoding.Default;
try
{
//force UTF-16 for the dts file, it contains "UTF-16" in the xml by default and isn't consumed by anything that requires
//codepage exports (CSV/excel)
encoder = Common.Utils.FileUtils.GetEncoding(DefaultEncoding);
}
catch (System.Exception ex)
{
APILogger.Log("Problem getting encoder", ex);
encoder = Encoding.Default;
}
//line = 3;
using (StringWriter writer = new StringWriterWithEncoding(encoder))
{
new XmlSerializer(typeof(Test)).Serialize(writer, test);
//FB14854 Add option to move ROI Download folders into the main test folder
// Cleaned up folder get/set to accomodate ROI both within the main test folder and without
var testIdNode = id;// new DirectoryInfo(Path.GetDirectoryName(subPath)).Name;
using (var fileWriter = new StreamWriter((directory.EndsWith("\\") ? directory : directory + "\\") + testIdNode + TestFileExtension, false, encoder))
fileWriter.Write(writer.ToString());
tickEventHandler?.Invoke(this, (uint)(++numberOfTicksSent) / numberOfFiles * 100);
}
var file = 0;
if (true == bFiltering)
{
//line = 4;
foreach (var module in test.Modules)
{
//line = 5;
foreach (var channel in module.Channels)
{
file++;
if (null != cancelRequested && cancelRequested()) { break; }
CreatePersistentChannel(channel, module.NumberOfSamples, module.SampleRateHz, tickEventHandler, cancelRequested, numberOfFiles, numberOfTicksSent);
SetProgress?.Invoke(100D * file / numberOfFiles);
}
}
}
}
catch (System.Exception ex)
{
exception = new Exception("encountered problem doing test file write", ex);
}
finally
{
endEventHandler?.Invoke(this);
if (null != exception && null != errorEventHandler)
{
errorEventHandler(this, exception);
}
else if (null != exception) { throw exception; }
}
}
public void Initialize(string pathname,
string id,
string dataFolder,
Test test,
bool bFiltering,
bool includeGroupNameInISOExport,
FilteredData fd,
Test.Module.Channel tmChannel,
int channelNumber,
BeginEventHandler beginEventHandler,
CancelEventHandler cancelEventHandler,
EndEventHandler endEventHandler,
TickEventHandler tickEventHandler,
ErrorEventHandler errorEventHandler,
CancelRequested cancelRequested)
{
}
public void CreatePersistentChannel(Test.Module.Channel channel,
ulong numberOfSamples,
float sampleRateHz,
TickEventHandler tickEventHandler,
CancelRequested cancelRequested,
int numberOfFiles,
int numberOfTicksSent)
{
try
{
//line = 6;
channel.ExpressDataInlineOnXmlSerialization = false;
const string DefaultIsoCode = "????????????????";
var fields = Enum.GetValues(typeof(PersistentChannel.Field)).Cast<PersistentChannel.Field>().ToArray();
foreach (var field in fields)
{
try
{
//line = 7;
if (null != cancelRequested && cancelRequested()) { break; }
switch (field)
{
case PersistentChannel.Field.AreSamplesSigned:
channel.PersistentChannelInfo.AreSamplesSigned = 1;
break;
case PersistentChannel.Field.BeginningOfData:
break;
case PersistentChannel.Field.BeginningOfFile:
break;
case PersistentChannel.Field.Crc32:
break;
case PersistentChannel.Field.DataZeroLevelCounts:
try { channel.PersistentChannelInfo.DataZeroLevelCounts = channel.DataZeroLevelAdc; }// xxx This needs to be calculated on the fly during download.
catch (System.Exception myException) { ChannelException("DataZeroLevelCounts", channel.ChannelDescriptionString, myException); }
break;
case PersistentChannel.Field.EngineeringUnit:
break;
case PersistentChannel.Field.EuFieldLengthWithTerminator:
break;
case PersistentChannel.Field.Excitation:
try { channel.PersistentChannelInfo.Excitation = channel.Excitation; }
catch (System.Exception) { }
break;
case PersistentChannel.Field.HeaderVersionNumber:
break;
case PersistentChannel.Field.IsoCode:
try
{
channel.PersistentChannelInfo.IsoCode = (channel is Common.DAS.Concepts.DAS.Channel.IIsoCodeAware)
? (channel as Common.DAS.Concepts.DAS.Channel.IIsoCodeAware).IsoCode.PadRight(DefaultIsoCode.Length, '?').ToCharArray(0, DefaultIsoCode.Length)
: DefaultIsoCode.ToCharArray();
}
catch (System.Exception myException)
{
ChannelException("IsoCode", channel.ChannelDescriptionString, myException);
}
break;
case PersistentChannel.Field.MagicKey:
break;
case PersistentChannel.Field.MvPerEu:
try { channel.PersistentChannelInfo.MvPerEu = channel.Data.MvPerEu; }
catch (System.Exception myException) { ChannelException("MvPerEu", channel.ChannelDescriptionString, myException); }
break;
case PersistentChannel.Field.NumberOfBitsPerSample:
channel.PersistentChannelInfo.NumberOfBitsPerSample = 16;
break;
case PersistentChannel.Field.NumberOfSamples:
try
{
var numSamples = (0 != numberOfSamples ? numberOfSamples : (ulong)channel.Data.Values.Length);
channel.PersistentChannelInfo.NumberOfSamples = numSamples;
}
catch (System.Exception myException) { ChannelException("NumberOfSamples", channel.ChannelDescriptionString, myException); }
break;
case PersistentChannel.Field.NumberOfTriggers:
break;
case PersistentChannel.Field.OffsetOfSampleDataStart:
try { channel.PersistentChannelInfo.OffsetOfSampleDataStart = (ulong)(channel.PersistentChannelInfo.GetFileOffsetOf(PersistentChannel.Field.BeginningOfData)); }
catch (System.Exception myException) { ChannelException("OffsetOfSampleDataStart", channel.ChannelDescriptionString, myException); }
break;
case PersistentChannel.Field.OriginalOffsetADC:
try { channel.PersistentChannelInfo.OriginalOffsetADC = channel.OriginalOffsetADC; }
catch (System.Exception) { }
break;
case PersistentChannel.Field.PostTestDiagnosticsLevelCounts:
try { channel.PersistentChannelInfo.PostTestDiagnosticsLevelCounts = 0; }
catch (System.Exception myException) { ChannelException("PostTestDiagnosticsLevelCounts", channel.ChannelDescriptionString, myException); }
break;
case PersistentChannel.Field.PostTestZeroLevelCounts:
try { channel.PersistentChannelInfo.PostTestZeroLevelCounts = channel.PreTestZeroLevelAdc; }
catch (System.Exception myException) { ChannelException("PostTestZeroLevelCounts", channel.ChannelDescriptionString, myException); }
break;
case PersistentChannel.Field.PreTestDiagnosticsLevelCounts:
channel.PersistentChannelInfo.PreTestDiagnosticsLevelCounts = 0;
break;
case PersistentChannel.Field.PreTestNoisePercentageOfFullScale:
try { channel.PersistentChannelInfo.PreTestNoisePercentageOfFullScale = channel.NoiseAsPercentageOfFullScale; }
catch (System.Exception myException) { ChannelException("PreTestNoisePercentageOfFullScale", channel.ChannelDescriptionString, myException); }
break;
case PersistentChannel.Field.PreTestZeroLevelCounts:
try { channel.PersistentChannelInfo.PreTestZeroLevelCounts = channel.PreTestZeroLevelAdc; }
catch (System.Exception myException) { ChannelException("PreTestZeroLevelCounts", channel.ChannelDescriptionString, myException); }
break;
case PersistentChannel.Field.RemovedADC:
try { channel.PersistentChannelInfo.RemovedADC = channel.RemovedADC; }
catch (System.Exception) { }
break;
case PersistentChannel.Field.SampleRate:
try { channel.PersistentChannelInfo.SampleRate = sampleRateHz; }
catch (System.Exception myException) { ChannelException("SampleRate", channel.ChannelDescriptionString, myException); }
break;
case PersistentChannel.Field.ScaleFactorMv:
try { channel.PersistentChannelInfo.ScaleFactorMv = channel.Data.ScaleFactorMv; }
catch (System.Exception myException) { ChannelException("ScaleFactorMv", channel.ChannelDescriptionString, myException); }
break;
case PersistentChannel.Field.TriggerAdjustmentSamples:
try { channel.PersistentChannelInfo.TriggerAdjustmentSamples = channel.TriggerAdjustmentSamples; }
catch (System.Exception) { }
break;
case PersistentChannel.Field.TriggerSampleNumbers:
break;
case PersistentChannel.Field.ZeroMvInADC:
try { channel.PersistentChannelInfo.ZeroMvInADC = channel.ZeroMvInADC; }
catch (System.Exception) { }
break;
case PersistentChannel.Field.WindowAverageADC:
try { channel.PersistentChannelInfo.WindowAverageADC = channel.WindowAverageADC; }
catch (System.Exception) { }
break;
}
}
catch (System.Exception ex)
{
APILogger.Log("exception writing serializing channel header, field: " + field.ToString());
throw ex;
}
}
channel.PersistentChannelInfo.StampCrc();
// force file handle release
try
{
channel.PersistentChannelInfo.Dispose();
channel.PersistentChannelInfo = null;
}
catch (System.Exception) { }
tickEventHandler?.Invoke(this, (uint)(++numberOfTicksSent) / numberOfFiles * 100);
}
catch (System.Exception channelException)
{
APILogger.Log("Exception writing serializing channel header, Channel: ", channel.ChannelDescriptionString, " Exception: ", channelException);
}
}
}
}
}

View File

@@ -0,0 +1,344 @@
/*
* SliceRaw.File.cs
*
* Copyright © 2009
* Diversified Technical Systems, Inc.
* All Rights Reserved
*/
using System;
using System.IO;
using DTS.Common.Utilities.DotNetProgrammingConstructs;
using DTS.Common.Utilities.Logging;
using System.Linq;
namespace DTS.Serialization.SliceRaw
{ ///
/// <summary>
/// Representation of a SliceRaw-type serialization.
/// </summary>
///
public partial class File
: Serialization.File, IReadable<Test>, IWritable<Test>
{ ///
/// <summary>
/// Initialize an instance of the SliceRaw.File class.
/// </summary>
///
public File()
: base("Slice Raw")
{
}
/// <summary>
/// Get the file writer for this file type.
/// </summary>
public IWriter<Test> Exporter
{
get
{
try
{
if (_Exporter == null)
_Exporter = new Writer(this, DefaultEncoding);
return _Exporter;
}
catch (System.Exception ex)
{
throw new Exception("encountered problem getting exporter", ex);
}
}
}
private IWriter<Test> _Exporter = null;
/// <summary>
/// Get the file reader for this file type.
/// </summary>
public IReader<Test> Importer
{
get
{
try
{
if (_Importer == null)
_Importer = new Reader(this);
return _Importer;
}
catch (System.Exception ex)
{
throw new Exception("encountered problem getting importer", ex);
}
}
}
private IReader<Test> _Importer = null;
/// <summary>
/// File extension for the disk entity that contains the serialized test information.
/// </summary>
public static string TestFileExtension
{
get => _TestFileExtension.Value;
private set => _TestFileExtension.Value = value;
}
private static readonly Property<string> _TestFileExtension = new Property<string>("TestFileExtension", ".dts", true);
/// <summary>
/// File extension for the disk entity that contains serialized channel information.
/// </summary>
public static string ChannelFileExtension
{
get => _ChannelFileExtension.Value;
private set => _ChannelFileExtension.Value = value;
}
private static readonly Property<string> _ChannelFileExtension = new Property<string>("ChannelFileExtension", ".chn", true);
/// <summary>
/// File extension for the disk entity that contains serialized channel information.
/// </summary>
public static string CalculatedChannelFileExtension
{
get => _CalculatedChannelFileExtension.Value;
private set => _CalculatedChannelFileExtension.Value = value;
}
private static readonly Property<string> _CalculatedChannelFileExtension = new Property<string>("CalculatedChannelFileExtension", ".cchn", true);
/// <summary>
/// File extension for the disk entity that contains binary information.
/// </summary>
public static string BinaryFileExtension
{
get => _BinaryFileExtension.Value;
private set => _BinaryFileExtension.Value = value;
}
private static readonly Property<string> _BinaryFileExtension = new Property<string>("BinaryFileExtension", ".bin", true);
/// <summary>
/// File extension for the disk entity that contains NMEA information.
/// </summary>
public static string NMEAFileExtension
{
get => _NMEAFileExtension.Value;
private set => _NMEAFileExtension.Value = value;
}
private static readonly Property<string> _NMEAFileExtension = new Property<string>("NMEAFileExtension", ".nmea", true);
/// <summary>
/// File extension for the disk entity that contains plaintext information.
/// </summary>
public static string PlainTextFileExtension
{
get => _PlainTextFileExtension.Value;
private set => _PlainTextFileExtension.Value = value;
}
private static readonly Property<string> _PlainTextFileExtension = new Property<string>("PlainTextFileExtension", ".txt", true);
/// <summary>
/// File extension for the disk entity that contains module timestamp information.
/// </summary>
public static string DasTimestampFileExtension
{
get => _DasTimestampFileExtension.Value;
private set => _DasTimestampFileExtension.Value = value;
}
private static readonly Property<string> _DasTimestampFileExtension = new Property<string>("DasTimestampFileExtension", ".bin", true);
/// <summary>
/// The string that separates the channel numbers from the riffraff.
/// </summary>
public const string ChannelNumberDelimiter = ".";
public const string AbsoluteDisplayOrderDelimiter = "Ch";
/// <summary>
/// Extract the channel file number from the specified channel name string.
/// </summary>
///
/// <param name="testName">
/// The test name <see cref="string"/> to be incorporated into the channel filename.
/// </param>
///
/// <param name="channelNumber">
/// The <see cref="int"/> channel number to be incorporated into the channel filename.
/// </param>
///
/// <returns>
/// A channel filename <see cref="string"/> that uniquely identifies test and channel
/// that this channel informtion belongs to.
/// </returns>
///
public string GetChannelFileNameFromTestNameAndChannelNumber(string testName, int channelNumber, int absoluteDisplayOrder)
{
try
{
if (string.IsNullOrEmpty(testName))
throw new ArgumentException("cannot construct channel file name from null/empty test name string");
else
return string.Format("{0}{5}{1:000}{2}{3:000}{4}",
testName, 1 + absoluteDisplayOrder, ChannelNumberDelimiter, channelNumber, ChannelFileExtension, AbsoluteDisplayOrderDelimiter);
}
catch (System.Exception ex)
{
throw new Exception("encountered problem getting channel file name from channel number \"" + channelNumber.ToString() + "\"", ex);
}
}
///
public string GetCalculatedChannelFileNameFromTestNameAndChannelNumber(string testName, int channelNumber)
{
try
{
if (string.IsNullOrEmpty(testName))
throw new ArgumentException("cannot construct channel file name from null/empty test name string");
return testName + ChannelNumberDelimiter + channelNumber.ToString() + CalculatedChannelFileExtension;
}
catch (System.Exception ex)
{
throw new Exception("encountered problem getting channel file name from channel number \"" + channelNumber.ToString() + "\"", ex);
}
}
/// <summary>
/// Extract the channel number from the specified channel filename.
/// </summary>
///
/// <param name="channelFileName">
/// The channel filename <see cref="string"/> to be converted into a channel number.
/// </param>
///
/// <returns>
/// The <see cref="int"/> channel number represented by the specified file.
/// </returns>
///
public override int GetChannelNumberFromChannelFileName(string channelFileName)
{
try
{
var indexOfExtension = channelFileName.LastIndexOf(ChannelFileExtension);
if (!char.IsDigit(channelFileName[indexOfExtension - 1]))
{
//extension prefix detected, back up some more
indexOfExtension = channelFileName.LastIndexOf(ChannelNumberDelimiter, indexOfExtension - 1);
}
var indexOfFirstChannelNumberCharacter = channelFileName.LastIndexOf(ChannelNumberDelimiter, indexOfExtension - 1) + 1;
return int.Parse(channelFileName.Substring(indexOfFirstChannelNumberCharacter, indexOfExtension - indexOfFirstChannelNumberCharacter));
}
catch (System.Exception ex)
{
throw new Exception("encountered problem getting channel number from channel file name", ex);
}
}
///
public string GetTimestampFileNameFromTestNameAndDASSerialNumber(string testName, string dasSerialNumber)
{
try
{
if (string.IsNullOrEmpty(testName))
throw new ArgumentException("cannot construct das file name from null/empty test name string");
else
return string.Format("TS-{0}{2}{1}{3}",
testName, dasSerialNumber, ChannelNumberDelimiter, DasTimestampFileExtension);
}
catch (System.Exception ex)
{
throw new Exception("encountered problem getting das file name from das serial number \"" + dasSerialNumber.ToString() + "\"", ex);
}
}
public static void ReadTestSetup(string testFileName, ref Test _test, ref TestSetup _testSetup)
{
ReadTestSetup(testFileName, out _test, out _testSetup, false);
}
public static void ReadTestSetup(string testFileName, out Test test, out TestSetup testSetup,
bool justDTSFile)
{
var fi = new FileInfo(testFileName);
var directory = fi.Directory.FullName;
test = null;
testSetup = null;
var f = new Serialization.SliceRaw.File();
try
{
using (var reader = new StreamReader(testFileName))
{
var allText = reader.ReadToEnd();
const string delimiter = "<?xml version=";
var delimiterArray = new[] { delimiter };
var allTextArray = allText.Split(delimiterArray, StringSplitOptions.RemoveEmptyEntries);
var xmlCounter = 0;
foreach (var fullstring in allTextArray)
{
var fullString = allTextArray[xmlCounter];
xmlCounter++;
if (!fullString.Contains("Test")) continue;
fullString = delimiter + fullString;
var sr = new StringReader(fullString);
var tr = new System.Xml.XmlTextReader(sr);
var xmlType = fullString.Substring(fullString.IndexOf('>') + 4, 5).TrimEnd();
switch (xmlType)
{
case "Test":
try
{
if (justDTSFile)
{
System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
doc.LoadXml(fullString);
var id = (doc.ChildNodes[1] as System.Xml.XmlElement).GetAttribute("Id");
var desc =
(doc.ChildNodes[1] as System.Xml.XmlElement).GetAttribute("Description");
//FB 18312 Get the event number from xml if it's not in xaml calculate it from file name
var eventNum = (doc.ChildNodes[1] as System.Xml.XmlElement).GetAttribute("EventNumber");
if (!string.IsNullOrWhiteSpace(eventNum))
{
var eventNumber = Convert.ToInt32(eventNum);
test = new Test(id, desc, eventNumber);
}
else
{
var fileName = fi.Name;
var segments = fileName.Split('_');
if (Array.Exists(segments, p => p.Contains(DTS.Common.Constants.EventNumber)))
{
var foundEvent = Array.Find(segments, p => p.Contains(DTS.Common.Constants.EventNumber));
var eventNumber = Convert.ToInt32(foundEvent.Replace(DTS.Common.Constants.EventNumber, ""));
test = new Test(id, desc, eventNumber);
}
else
{
test = new Test(id, desc, 0);
}
}
}
else
{
f.Importer.Read(directory, out test);
}
}
catch (System.Exception ex)
{
APILogger.Log(ex);
}
break;
case "TestS":
testSetup = new TestSetup();
var xs = new System.Xml.Serialization.XmlSerializer(testSetup.GetType());
testSetup = (TestSetup)xs.Deserialize(tr);
tr.Close();
sr.Close();
break;
}
}
}
}
catch (System.Exception ex)
{
APILogger.Log("exception in read test setup", ex);
}
}
}
}