Correction for real water density used in all methods, in Metrology UI.
This commit is contained in:
@@ -9,11 +9,11 @@ namespace TBF.BenchControl
|
|||||||
public static class Formulas
|
public static class Formulas
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Calculate water density from temperature
|
/// Calculate density of distilled water from temperature
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="t">Temperature in [degC]</param>
|
/// <param name="t">Temperature in [degC]</param>
|
||||||
/// <returns>Density in [kg/m3]</returns>
|
/// <returns>Density in [kg/m3]</returns>
|
||||||
public static float WaterDensityFromTemp(float t)
|
public static float DistilledWaterDensityFromTemp(float t)
|
||||||
{
|
{
|
||||||
double tt = (double)t;
|
double tt = (double)t;
|
||||||
const double a0 = 999.842594;
|
const double a0 = 999.842594;
|
||||||
@@ -26,6 +26,21 @@ namespace TBF.BenchControl
|
|||||||
return (float)(((((a5 * tt + a4) * tt + a3) * tt + a2) * tt + a1) * tt + a0);
|
return (float)(((((a5 * tt + a4) * tt + a3) * tt + a2) * tt + a1) * tt + a0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Calculate corrected (real) water density from temperature
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="t">Temperature in [degC]</param>
|
||||||
|
/// <returns>Density in [kg/m3]</returns>
|
||||||
|
public static float WaterDensityFromTemp(float t)
|
||||||
|
{
|
||||||
|
float realDensity = Program.LocalSettings.RealDensity;
|
||||||
|
float atTemperature = Program.LocalSettings.AtTemperature;
|
||||||
|
|
||||||
|
float c_rho = realDensity / DistilledWaterDensityFromTemp(atTemperature);
|
||||||
|
|
||||||
|
return c_rho * DistilledWaterDensityFromTemp(t);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public static float AirDensityFromAmbientVales(float tempC, float pressureBar, float humiPct)
|
public static float AirDensityFromAmbientVales(float tempC, float pressureBar, float humiPct)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -43,9 +43,11 @@ namespace TBF
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
[XmlElementAttribute("LastProcedure")]
|
[XmlElementAttribute("LastProcedure")]
|
||||||
public string LastProcedureName;
|
public string LastProcedureName;
|
||||||
|
|
||||||
public int BatchNr;
|
public int BatchNr;
|
||||||
|
|
||||||
|
public float RealDensity;
|
||||||
|
public float AtTemperature;
|
||||||
|
|
||||||
public int RightPaneHorizSplitterDistance;
|
public int RightPaneHorizSplitterDistance;
|
||||||
|
|
||||||
/// MainWnd
|
/// MainWnd
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ namespace TBF
|
|||||||
|
|
||||||
Text = Strings.Metrology;
|
Text = Strings.Metrology;
|
||||||
|
|
||||||
|
int fixedCount = 0;
|
||||||
int balancesCount = 0;
|
int balancesCount = 0;
|
||||||
int flowMetersCount = 0;
|
int flowMetersCount = 0;
|
||||||
int pressMetersCount = 0;
|
int pressMetersCount = 0;
|
||||||
@@ -52,10 +53,20 @@ namespace TBF
|
|||||||
cmpntEntities = session.CreateQuery("FROM Component ORDER BY ItemNr")
|
cmpntEntities = session.CreateQuery("FROM Component ORDER BY ItemNr")
|
||||||
.List<Entities.Component>();
|
.List<Entities.Component>();
|
||||||
|
|
||||||
|
// Density tab-page
|
||||||
|
fixedCount++;
|
||||||
|
TabPage dstyTabPage = new TabPage(" " + Strings.Density + " ");
|
||||||
|
MetrologyDlgDensityTab uiCtl = new MetrologyDlgDensityTab();
|
||||||
|
uiCtl.Dock = DockStyle.Fill;
|
||||||
|
dstyTabPage.Tag = uiCtl;
|
||||||
|
dstyTabPage.Controls.Add(uiCtl);
|
||||||
|
metrologyTabControl.TabPages.Add(dstyTabPage);
|
||||||
|
|
||||||
foreach (var cmpnt in cmpntEntities)
|
foreach (var cmpnt in cmpntEntities)
|
||||||
{
|
{
|
||||||
BenchControl.Generic.IComponentFactory factory = TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName);
|
BenchControl.Generic.IComponentFactory factory = TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName);
|
||||||
|
|
||||||
|
// Balance tab-pages
|
||||||
if (factory is BenchControl.MettlerToledo.Standard.BalanceFactory ||
|
if (factory is BenchControl.MettlerToledo.Standard.BalanceFactory ||
|
||||||
factory is BenchControl.MettlerToledo.Standard.BalanceNewFactory)
|
factory is BenchControl.MettlerToledo.Standard.BalanceNewFactory)
|
||||||
{
|
{
|
||||||
@@ -68,6 +79,7 @@ namespace TBF
|
|||||||
tabPage.Controls.Add(uiControl);
|
tabPage.Controls.Add(uiControl);
|
||||||
metrologyTabControl.TabPages.Add(tabPage);
|
metrologyTabControl.TabPages.Add(tabPage);
|
||||||
}
|
}
|
||||||
|
// Flowmeter tab-pages
|
||||||
if (factory is BenchControl.Elde.FlowMeter.FlowMeterFactory)
|
if (factory is BenchControl.Elde.FlowMeter.FlowMeterFactory)
|
||||||
{
|
{
|
||||||
flowMetersCount++;
|
flowMetersCount++;
|
||||||
@@ -79,6 +91,7 @@ namespace TBF
|
|||||||
tabPage.Controls.Add(uiControl);
|
tabPage.Controls.Add(uiControl);
|
||||||
metrologyTabControl.TabPages.Add(tabPage);
|
metrologyTabControl.TabPages.Add(tabPage);
|
||||||
}
|
}
|
||||||
|
// Pressure meter tab-pages
|
||||||
if (factory is BenchControl.Elde.PressureMeter.PressureMeterFactory)
|
if (factory is BenchControl.Elde.PressureMeter.PressureMeterFactory)
|
||||||
{
|
{
|
||||||
pressMetersCount++;
|
pressMetersCount++;
|
||||||
@@ -107,8 +120,11 @@ namespace TBF
|
|||||||
{
|
{
|
||||||
IMetrologyDlgTab tab = tabPage.Tag as IMetrologyDlgTab;
|
IMetrologyDlgTab tab = tabPage.Tag as IMetrologyDlgTab;
|
||||||
tab.OkBtnClicked();
|
tab.OkBtnClicked();
|
||||||
FluentCommon.SaveToDb(session, tab.MeterEntity);
|
if (!(tabPage.Tag is MetrologyDlgDensityTab))
|
||||||
foreach (var entity in tab.ToBeRemoved) FluentCommon.DeleteFromDb(session, entity);
|
{
|
||||||
|
FluentCommon.SaveToDb(session, tab.MeterEntity);
|
||||||
|
foreach (var entity in tab.ToBeRemoved) FluentCommon.DeleteFromDb(session, entity);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Program.LocalSettings.MetrologyDlgLeft = Location.X;
|
Program.LocalSettings.MetrologyDlgLeft = Location.X;
|
||||||
|
|||||||
+27
@@ -186,6 +186,15 @@ namespace TBF.Resources {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to @temperature [degC].
|
||||||
|
/// </summary>
|
||||||
|
internal static string AtTemperature_C {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("AtTemperature_C", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to Aux Water Meter.
|
/// Looks up a localized string similar to Aux Water Meter.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -537,6 +546,24 @@ namespace TBF.Resources {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Density.
|
||||||
|
/// </summary>
|
||||||
|
internal static string Density {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("Density", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Density [kg/liter].
|
||||||
|
/// </summary>
|
||||||
|
internal static string Density_kgLtr {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("Density_kgLtr", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to Description.
|
/// Looks up a localized string similar to Description.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -1033,4 +1033,13 @@
|
|||||||
<data name="Start" xml:space="preserve">
|
<data name="Start" xml:space="preserve">
|
||||||
<value>Start</value>
|
<value>Start</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="AtTemperature_C" xml:space="preserve">
|
||||||
|
<value>@temperature [degC]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Density_kgLtr" xml:space="preserve">
|
||||||
|
<value>Density [kg/liter]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Density" xml:space="preserve">
|
||||||
|
<value>Density</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
@@ -1055,6 +1055,12 @@
|
|||||||
<Compile Include="UiControls\IParentOfListViewEx.cs" />
|
<Compile Include="UiControls\IParentOfListViewEx.cs" />
|
||||||
<Compile Include="UiControls\ITabWithListViewEx.cs" />
|
<Compile Include="UiControls\ITabWithListViewEx.cs" />
|
||||||
<Compile Include="UiControls\IMetrologyDlgTab.cs" />
|
<Compile Include="UiControls\IMetrologyDlgTab.cs" />
|
||||||
|
<Compile Include="UiControls\MetrologyDlgDensityTab.cs">
|
||||||
|
<SubType>UserControl</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="UiControls\MetrologyDlgDensityTab.designer.cs">
|
||||||
|
<DependentUpon>MetrologyDlgDensityTab.cs</DependentUpon>
|
||||||
|
</Compile>
|
||||||
<Compile Include="UiControls\MetrologyDlgFlowMeterTab.cs">
|
<Compile Include="UiControls\MetrologyDlgFlowMeterTab.cs">
|
||||||
<SubType>UserControl</SubType>
|
<SubType>UserControl</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
@@ -1486,6 +1492,9 @@
|
|||||||
<EmbeddedResource Include="UiControls\CameraPictureCtrl.resx">
|
<EmbeddedResource Include="UiControls\CameraPictureCtrl.resx">
|
||||||
<DependentUpon>CameraPictureCtrl.cs</DependentUpon>
|
<DependentUpon>CameraPictureCtrl.cs</DependentUpon>
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
|
<EmbeddedResource Include="UiControls\MetrologyDlgDensityTab.resx">
|
||||||
|
<DependentUpon>MetrologyDlgDensityTab.cs</DependentUpon>
|
||||||
|
</EmbeddedResource>
|
||||||
<EmbeddedResource Include="UiControls\MetrologyDlgFlowMeterTab.resx">
|
<EmbeddedResource Include="UiControls\MetrologyDlgFlowMeterTab.resx">
|
||||||
<DependentUpon>MetrologyDlgFlowMeterTab.cs</DependentUpon>
|
<DependentUpon>MetrologyDlgFlowMeterTab.cs</DependentUpon>
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
|
|||||||
@@ -0,0 +1,120 @@
|
|||||||
|
///
|
||||||
|
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||||
|
///
|
||||||
|
namespace TBF.UiControls
|
||||||
|
{
|
||||||
|
partial class MetrologyDlgDensityTab
|
||||||
|
{
|
||||||
|
/// <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 Component 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.splitContainer1 = new System.Windows.Forms.SplitContainer();
|
||||||
|
this.temperatureTextBox = new System.Windows.Forms.TextBox();
|
||||||
|
this.temperatureLabel = new System.Windows.Forms.Label();
|
||||||
|
this.densityTextBox = new System.Windows.Forms.TextBox();
|
||||||
|
this.densityLabel = new System.Windows.Forms.Label();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
|
||||||
|
this.splitContainer1.Panel1.SuspendLayout();
|
||||||
|
this.splitContainer1.SuspendLayout();
|
||||||
|
this.SuspendLayout();
|
||||||
|
//
|
||||||
|
// splitContainer1
|
||||||
|
//
|
||||||
|
this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||||
|
this.splitContainer1.FixedPanel = System.Windows.Forms.FixedPanel.Panel1;
|
||||||
|
this.splitContainer1.Location = new System.Drawing.Point(0, 0);
|
||||||
|
this.splitContainer1.Name = "splitContainer1";
|
||||||
|
this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal;
|
||||||
|
//
|
||||||
|
// splitContainer1.Panel1
|
||||||
|
//
|
||||||
|
this.splitContainer1.Panel1.Controls.Add(this.temperatureTextBox);
|
||||||
|
this.splitContainer1.Panel1.Controls.Add(this.temperatureLabel);
|
||||||
|
this.splitContainer1.Panel1.Controls.Add(this.densityTextBox);
|
||||||
|
this.splitContainer1.Panel1.Controls.Add(this.densityLabel);
|
||||||
|
this.splitContainer1.Size = new System.Drawing.Size(420, 300);
|
||||||
|
this.splitContainer1.SplitterDistance = 80;
|
||||||
|
this.splitContainer1.TabIndex = 1;
|
||||||
|
//
|
||||||
|
// temperatureTextBox
|
||||||
|
//
|
||||||
|
this.temperatureTextBox.Enabled = false;
|
||||||
|
this.temperatureTextBox.Location = new System.Drawing.Point(159, 43);
|
||||||
|
this.temperatureTextBox.Name = "temperatureTextBox";
|
||||||
|
this.temperatureTextBox.Size = new System.Drawing.Size(100, 20);
|
||||||
|
this.temperatureTextBox.TabIndex = 3;
|
||||||
|
//
|
||||||
|
// temperatureLabel
|
||||||
|
//
|
||||||
|
this.temperatureLabel.AutoSize = true;
|
||||||
|
this.temperatureLabel.Location = new System.Drawing.Point(37, 46);
|
||||||
|
this.temperatureLabel.Name = "temperatureLabel";
|
||||||
|
this.temperatureLabel.Size = new System.Drawing.Size(112, 13);
|
||||||
|
this.temperatureLabel.TabIndex = 2;
|
||||||
|
this.temperatureLabel.Text = "@Temperature [degC]";
|
||||||
|
//
|
||||||
|
// densityTextBox
|
||||||
|
//
|
||||||
|
this.densityTextBox.Enabled = false;
|
||||||
|
this.densityTextBox.Location = new System.Drawing.Point(159, 17);
|
||||||
|
this.densityTextBox.Name = "densityTextBox";
|
||||||
|
this.densityTextBox.Size = new System.Drawing.Size(100, 20);
|
||||||
|
this.densityTextBox.TabIndex = 1;
|
||||||
|
//
|
||||||
|
// densityLabel
|
||||||
|
//
|
||||||
|
this.densityLabel.AutoSize = true;
|
||||||
|
this.densityLabel.Location = new System.Drawing.Point(37, 20);
|
||||||
|
this.densityLabel.Name = "densityLabel";
|
||||||
|
this.densityLabel.Size = new System.Drawing.Size(84, 13);
|
||||||
|
this.densityLabel.TabIndex = 0;
|
||||||
|
this.densityLabel.Text = "Density [kg/liter]";
|
||||||
|
//
|
||||||
|
// MetrologyDlgDensityTab
|
||||||
|
//
|
||||||
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
|
this.Controls.Add(this.splitContainer1);
|
||||||
|
this.Name = "MetrologyDlgDensityTab";
|
||||||
|
this.Size = new System.Drawing.Size(420, 300);
|
||||||
|
this.Load += new System.EventHandler(this.MetrologyDlgDensityTab_Load);
|
||||||
|
this.splitContainer1.Panel1.ResumeLayout(false);
|
||||||
|
this.splitContainer1.Panel1.PerformLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
|
||||||
|
this.splitContainer1.ResumeLayout(false);
|
||||||
|
this.ResumeLayout(false);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private System.Windows.Forms.SplitContainer splitContainer1;
|
||||||
|
private System.Windows.Forms.TextBox temperatureTextBox;
|
||||||
|
private System.Windows.Forms.Label temperatureLabel;
|
||||||
|
private System.Windows.Forms.TextBox densityTextBox;
|
||||||
|
private System.Windows.Forms.Label densityLabel;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,108 @@
|
|||||||
|
///
|
||||||
|
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||||
|
///
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Globalization;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
using log4net;
|
||||||
|
using TBF.Resources;
|
||||||
|
|
||||||
|
namespace TBF.UiControls
|
||||||
|
{
|
||||||
|
public partial class MetrologyDlgDensityTab : UserControl, IMetrologyDlgTab
|
||||||
|
{
|
||||||
|
static readonly ILog log = LogManager.GetLogger(typeof(MetrologyDlgDensityTab));
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Component entity that has a list of 'measurement-correction' pairs
|
||||||
|
/// to be updated in the database on OK.
|
||||||
|
/// </summary>
|
||||||
|
public Entities.Component MeterEntity
|
||||||
|
{
|
||||||
|
get { return null; }
|
||||||
|
set { }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A list of 'measurement-correction' pairs to be deleted from the database on OK.
|
||||||
|
/// </summary>
|
||||||
|
public IList<Entities.MeasurementCorrection> ToBeRemoved
|
||||||
|
{
|
||||||
|
get { return toBeRemoved; }
|
||||||
|
set { toBeRemoved = value; }
|
||||||
|
}
|
||||||
|
IList<Entities.MeasurementCorrection> toBeRemoved;
|
||||||
|
|
||||||
|
MetrologyDlg parent;
|
||||||
|
bool unlocked;
|
||||||
|
|
||||||
|
public MetrologyDlgDensityTab()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
toBeRemoved = new List<Entities.MeasurementCorrection>();
|
||||||
|
unlocked = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void MetrologyDlgDensityTab_Load(object sender, System.EventArgs e)
|
||||||
|
{
|
||||||
|
parent = ParentForm as MetrologyDlg;
|
||||||
|
|
||||||
|
/// Panel1
|
||||||
|
densityLabel.Text = Strings.Density_kgLtr;
|
||||||
|
temperatureLabel.Text = Strings.AtTemperature_C;
|
||||||
|
|
||||||
|
/// Panel2
|
||||||
|
|
||||||
|
RefreshAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
void RefreshAll()
|
||||||
|
{
|
||||||
|
densityTextBox.Text = Program.LocalSettings.RealDensity.ToString();
|
||||||
|
temperatureTextBox.Text = Program.LocalSettings.AtTemperature.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Unlock()
|
||||||
|
{
|
||||||
|
unlocked = true;
|
||||||
|
|
||||||
|
densityTextBox.Enabled = true;
|
||||||
|
temperatureTextBox.Enabled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OkBtnClicked()
|
||||||
|
{
|
||||||
|
float tmp;
|
||||||
|
if (Utils.TryParseUFloat(densityTextBox.Text, out tmp))
|
||||||
|
{
|
||||||
|
Program.LocalSettings.RealDensity = tmp;
|
||||||
|
}
|
||||||
|
if (Utils.TryParseUFloat(temperatureTextBox.Text, out tmp))
|
||||||
|
{
|
||||||
|
Program.LocalSettings.AtTemperature = tmp;
|
||||||
|
}
|
||||||
|
Program.LocalSettings.Save();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void CancelBtnClicked()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void AddOne()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RemoveSelected()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void MoveUpSelected()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void MoveDownSelected()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,120 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
||||||
Reference in New Issue
Block a user