Compare commits

..
Author SHA1 Message Date
Milan Hanajik df11cc3d0f Reconfigured for GENESIS 2018-02-11 08:10:03 +01:00
1447 changed files with 39064 additions and 145889 deletions
-2
View File
@@ -1,2 +0,0 @@
# Set the default behavior, in case people don't have core.autocrlf set.
* text=auto
+2 -11
View File
@@ -1,25 +1,17 @@
Config/bin/
Config/obj/
Decrypt/bin/
Decrypt/obj/
DeviceTest/bin/
DeviceTest/obj/
Dirichlet.Numerics/bin
Dirichlet.Numerics/obj
Encrypt/bin/
Encrypt/obj/
GemCard/bin
GemCard/obj
GraphLib/bin
GraphLib/obj
TracingDB/bin
TracingDB/obj
MonitoringDB/bin
MonitoringDB/obj
Results/bin/
Results/obj/
ResultsBrowser/bin/
ResultsBrowser/obj/
Statistics/bin/
Statistics/obj/
TBF/bin/
TBF/obj/
TBFSetup/Debug/
@@ -29,6 +21,5 @@ Users/obj/
UserManagement/bin/
UserManagement/obj/
Doc/
.vs/
*.suo
*.bak
+2 -13
View File
@@ -18,7 +18,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG;MUNICH</DefineConstants>
<DefineConstants>TRACE;DEBUG;GENESIS;IPERL;LANG_DE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
@@ -28,7 +28,7 @@
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE;MUNICH</DefineConstants>
<DefineConstants>TRACE;GENESIS;IPERL;LANG_DE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
@@ -77,26 +77,20 @@
<Compile Include="Entities\IHasItemNr.cs" />
<Compile Include="Entities\IHasName.cs" />
<Compile Include="Entities\IHasValves.cs" />
<Compile Include="Entities\IParamsProvider.cs" />
<Compile Include="Entities\IperlEnums.cs" />
<Compile Include="Entities\MeasurementCorrection.cs" />
<Compile Include="Entities\MetersPath.cs" />
<Compile Include="Entities\OutputPath.cs" />
<Compile Include="Entities\Procedure.cs" />
<Compile Include="Entities\ProcedureHistory.cs" />
<Compile Include="Entities\Profile.cs" />
<Compile Include="Entities\PTest.cs" />
<Compile Include="Entities\Test.cs" />
<Compile Include="Entities\TransitionSequence.cs" />
<Compile Include="Entities\TransitionStep.cs" />
<Compile Include="Entities\Uncertainty.cs" />
<Compile Include="Entities\User.cs" />
<Compile Include="Entities\VirtualBenchSequence.cs" />
<Compile Include="Entities\VirtualBenchStep.cs" />
<Compile Include="Entities\Watermeter.cs" />
<Compile Include="Entities\WMType.cs" />
<Compile Include="FluentCommon.cs" />
<Compile Include="Formulas.cs" />
<Compile Include="Mappings\BenchPathMap.cs" />
<Compile Include="Mappings\ComponentMap.cs" />
<Compile Include="Mappings\ComponentProcedureMap.cs" />
@@ -108,12 +102,9 @@
<Compile Include="Mappings\MetersPathMap.cs" />
<Compile Include="Mappings\OutputPathMap.cs" />
<Compile Include="Mappings\ProcedureMap.cs" />
<Compile Include="Mappings\ProfileMap.cs" />
<Compile Include="Mappings\PTestMap.cs" />
<Compile Include="Mappings\TestMap.cs" />
<Compile Include="Mappings\TransitionSequenceMap.cs" />
<Compile Include="Mappings\TransitionStepMap.cs" />
<Compile Include="Mappings\UncertaintyMap.cs" />
<Compile Include="Mappings\UserMap.cs" />
<Compile Include="Mappings\VirtualBenchSequenceMap.cs" />
<Compile Include="Mappings\VirtualBenchStepMap.cs" />
@@ -126,12 +117,10 @@
<DependentUpon>Strings.resx</DependentUpon>
</Compile>
<Compile Include="Units.cs" />
<Compile Include="Utils.cs" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Resources\Strings.cs.resx" />
<EmbeddedResource Include="Resources\Strings.de.resx" />
<EmbeddedResource Include="Resources\Strings.fr.resx" />
<EmbeddedResource Include="Resources\Strings.it.resx" />
<EmbeddedResource Include="Resources\Strings.pl.resx" />
<EmbeddedResource Include="Resources\Strings.resx">
+10 -44
View File
@@ -10,59 +10,29 @@ namespace Config
#if MUNICH
public const int WMsCount = 3;
public const int LineSize = 3;
public const int CompoundWMsCount = 3;
public const int LineSize = 1;
public const int CompoundWMsCount = 1;
public const int HeatMetersCount = 0;
public const int MaxPartNr = 3;
#elif DN100 || BADGER_STREDNA_TRAT || BADGER_VELKA_TRAT || CEVAK_200
#elif DN100 || BADGER_STREDNA_TRAT || BADGER_VELKA_TRAT
public const int WMsCount = 3;
public const int LineSize = 3;
public const int CompoundWMsCount = 1;
public const int HeatMetersCount = 0;
public const int MaxPartNr = WMsCount / LineSize;
#elif FUZHOU_300 || FUZHOU_150 || IZRAEL_200 || GENESIS || SLM_150 || PETERSBURG_200
public const int WMsCount = 6;
public const int LineSize = 6;
public const int CompoundWMsCount = 1;
public const int HeatMetersCount = 0;
public const int MaxPartNr = 3;
#elif PUCHONG_200
#elif FUZHOU300 || FUZHOU150 || PT200IL || PUCHONG_PT200 || GENESIS || SLM_150 || PETERSBURG_200
public const int WMsCount = 6;
public const int LineSize = 6;
public const int CompoundWMsCount = 3;
public const int HeatMetersCount = 0;
public const int MaxPartNr = 3;
#elif DEWA_300 || ROMA_200
public const int WMsCount = 10;
public const int LineSize = 10;
public const int CompoundWMsCount = 1;
public const int HeatMetersCount = 0;
public const int MaxPartNr = WMsCount / LineSize;
#elif DUBAJ_50
public const int WMsCount = 10;
public const int LineSize = 5;
public const int CompoundWMsCount = 0;
public const int HeatMetersCount = 0;
public const int MaxPartNr = WMsCount / LineSize;
#elif IZRAEL_50
public const int WMsCount = 40;
public const int LineSize = 10;
public const int CompoundWMsCount = 0;
public const int HeatMetersCount = 0;
public const int MaxPartNr = WMsCount / LineSize;
#elif FUZHOU_100
public const int WMsCount = 10;
public const int LineSize = 10;
public const int CompoundWMsCount = 1;
public const int HeatMetersCount = 0;
public const int MaxPartNr = WMsCount / LineSize;
#elif TORINO_50 || BADGER_MALA_TRAT || BERLIN
#elif TORINO50 || BADGER_MALA_TRAT || BERLIN
public const int WMsCount = 6;
public const int LineSize = 6;
public const int CompoundWMsCount = 1;
public const int HeatMetersCount = 0;
public const int MaxPartNr = 1;
#elif TORUN_50 || CEVAK_40 || MURES_40 || FUZHOU_50 || PETERSBURG_50 || KEMPNO_50 || BAHRAIN_50 || KRAKOW_50 || JUZNA_AFRIKA_50 || IZRAEL_25 || ZAMBIA || ZODINO || FEWA_50 || FILIPINY_50 || ALZIR_25
#elif TORUN_PT50_2015 || CEVAK_PT40_272 || MURES_PT40 || FUZHOU_40 || PETERSBURG_50 || KEMPNO_50 || BAHRAIN_50 || KRAKOW_50
public const int WMsCount = 20;
public const int LineSize = 10;
public const int CompoundWMsCount = 1;
@@ -74,14 +44,14 @@ namespace Config
public const int CompoundWMsCount = 1;
public const int HeatMetersCount = 0;
public const int MaxPartNr = WMsCount / LineSize;
#elif TURA_IPERL || TURA_IPERL_NEW
#elif TURA_IPERL
public const int WMsCount = 40;
public const int LineSize = 20;
public const int CompoundWMsCount = 1;
public const int HeatMetersCount = 0;
public const int MaxPartNr = WMsCount / LineSize;
#elif TURA_SPECIAL || SENTEC
public const int WMsCount = 6;
#elif TURA_SPECIAL
public const int WMsCount = 6;
public const int LineSize = 6;
public const int CompoundWMsCount = 1;
public const int HeatMetersCount = 0;
@@ -110,9 +80,5 @@ namespace Config
/// Database related: This object reference is set after a successful user login
///
public static DatabaseSettings CurrentBench;
public static double RealDensity = 0; /// true water density [kg/m3]
public static double AtTemperature = 0; /// measured at temperature [°C]
public static double Buoyancy = 0;
}
}
}
+1 -1
View File
@@ -37,7 +37,7 @@ namespace Config
result.IsRealBench = IsRealBench;
result.ProceduresDBSettings = (Users.DBSettings)ProceduresDBSettings.Clone();
result.WaterMetersDBSettings = (Users.DBSettings)WaterMetersDBSettings.Clone();
result.UsersDBSettings = (Users.DBSettings)UsersDBSettings.Clone();
result.UsersDBSettings = (Users.DBSettings)ProceduresDBSettings.Clone();
return result;
}
+2 -10
View File
@@ -1,8 +1,9 @@
///
/// Copyright (c) 2013-2019 Sensus Slovensko a.s.
/// Copyright (c) 2013-2015 Sensus Metering Systems
///
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
namespace Config.Entities
@@ -18,16 +19,12 @@ namespace Config.Entities
public virtual LogLevel Logging { get; set; }
public virtual string Parameters { get; set; }
public virtual IList<MeasurementCorrection> Corrections { get; set; }
public virtual IList<Uncertainty> Uncertainties { get; set; }
/// ------------- Additional stuff not mapped into the database -------------
public Component()
{
Name = string.Empty;
ClassName = string.Empty;
Corrections = new List<MeasurementCorrection>();
Uncertainties = new List<Uncertainty>();
}
public static Component CreateFromCfg(string name, string className, string parentName, int itemNr,
@@ -128,10 +125,5 @@ namespace Config.Entities
return result;
}
public override string ToString()
{
return string.Format("{0} ({1})", Name, ClassName);
}
}
}
+11 -28
View File
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2013-2018 Sensus Slovensko a.s.
/// Copyright (c) 2013-2017 Sensus Metering Systems
///
using System;
using System.IO;
@@ -13,25 +13,13 @@ namespace Config.Entities
public virtual string Parameters { get; set; }
public virtual Procedure Procedure { get; set; }
IParamsProvider paramsProvider;
///
public virtual IParamsProvider GetParamsProvider() { return paramsProvider; }
public virtual void SetParamsProvider(IParamsProvider paramsProvider) { this.paramsProvider = paramsProvider; }
protected ComponentProcedure() { }
public ComponentProcedure(string name, string parameters, Procedure procedure)
{
this.CmpntName = name;
this.Parameters = parameters;
this.Procedure = procedure;
}
public virtual ComponentProcedure Clone(Procedure newProcedure)
{
return new ComponentProcedure(CmpntName, Parameters, newProcedure);
ComponentProcedure result = new ComponentProcedure();
result.CmpntName = CmpntName;
result.Parameters = Parameters;
result.Procedure = newProcedure;
return result;
}
public virtual void Export(StreamWriter output)
@@ -46,16 +34,11 @@ namespace Config.Entities
if (string.IsNullOrEmpty(firstLine)) return null;
try
{
string cmptnName = firstLine;
string parameters = input.ReadLine().Replace("~", Environment.NewLine);
return new ComponentProcedure(cmptnName, parameters, newProcedure);
}
catch (Exception)
{
return null;
}
ComponentProcedure result = new ComponentProcedure();
result.CmpntName = firstLine;
result.Parameters = input.ReadLine().Replace("~", Environment.NewLine);
result.Procedure = newProcedure;
return result;
}
}
}
+11 -28
View File
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2013-2018 Sensus Slovensko a.s.
/// Copyright (c) 2013-2017 Sensus Metering Systems
///
using System;
using System.IO;
@@ -13,25 +13,13 @@ namespace Config.Entities
public virtual string Parameters { get; set; }
public virtual Test Test { get; set; }
IParamsProvider paramsProvider;
///
public virtual IParamsProvider GetParamsProvider() { return paramsProvider; }
public virtual void SetParamsProvider(IParamsProvider paramsProvider) { this.paramsProvider = paramsProvider; }
protected ComponentTest() { }
public ComponentTest(string name, string parameters, Test test)
{
this.CmpntName = name;
this.Parameters = parameters;
this.Test = test;
}
public virtual ComponentTest Clone()
{
return new ComponentTest(CmpntName, Parameters, Test);
ComponentTest result = new ComponentTest();
result.CmpntName = CmpntName;
result.Parameters = Parameters;
result.Test = Test;
return result;
}
public virtual void Export(StreamWriter output)
@@ -46,16 +34,11 @@ namespace Config.Entities
if (string.IsNullOrEmpty(firstLine)) return null;
try
{
string cmptnName = firstLine;
string parameters = input.ReadLine().Replace("~", Environment.NewLine);
return new ComponentTest(cmptnName, parameters, newTest);
}
catch (Exception)
{
return null;
}
ComponentTest result = new ComponentTest();
result.CmpntName = firstLine;
result.Parameters = input.ReadLine().Replace("~", Environment.NewLine);
result.Test = newTest;
return result;
}
}
}
+21 -292
View File
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2013-2018 Sensus Slovensko a.s.
/// Copyright (c) 2013-2017 Sensus Metering Systems
///
using System;
using System.Collections.Generic;
@@ -38,68 +38,13 @@ namespace Config.Entities
}
}
/// <summary>
/// Flags returned by each device configuration control Verify(...) function.
/// </summary>
public enum CfgUpdateFlags
{
None = 0,
Error = 0x1, /// Some settings in the user control are invalid and cannot be set
Warning = 0x02, /// Some settings in the user control are suspicious, can be set after user confirmation
RestartRqrd = 0x04, /// TBF program restart is required to apply all changed parameters
AnyChange = 0x08, /// At least one parameter have changed
VolatileChange = 0x10,
InvokeCfgChange = 0x20, /// Invoke CfgChange handler of the component
}
public enum RemoteDBUse
{
[Description("Local DB only")] LocalDBOnly,
[Description("Remote DB only")] RemoteDBOnly,
[Description("Both DB-s, local 1st")] BothDBsLocalFirst,
[Description("Both DB-s, remote 1st")] BothDBsRemoteFirst,
Count
}
/// <summary>
/// Contains a procedure name and a database specification (local/remote).
/// </summary>
public class ProcedureInfo
{
public readonly string Name;
public readonly Users.Entities.DBKind DBKind;
public ProcedureInfo(string name, Users.Entities.DBKind dbKind)
{
Name = name;
DBKind = dbKind;
}
}
public enum ProcedureState
public enum ProcedureState
{
Active,
History,
Count,
}
public enum ProfileType
{
Q3R,
QnClassColdWater,
QnClassHotWater,
QpQi,
Manual,
Count,
}
public enum ErrorLimitType
{
Manual,
QpClass,
Count,
}
/// <summary> Kind of meters for the procedure / test </summary>
public enum MetersKind
{
@@ -107,10 +52,6 @@ namespace Config.Entities
[Description("Wasserzähler")] Single,
[Description("Verbundwasserzähler")] Combined,
[Description("Wärmezähler")] HeatMeter,
#elif LANG_FR
[Description("Compteurs eau")] Single,
[Description("Mètres composés")] Combined,
[Description("Thermomètres")] HeatMeter,
#elif LANG_CS
[Description("Vodoměry")] Single,
[Description("Kombinované vodoměry")] Combined,
@@ -139,20 +80,9 @@ namespace Config.Entities
public enum Medium
{
[Description("")] NotSpecified,
#if LANG_PL
[Description("zimna")] ColdWater,
[Description("ciepła")] HotWater,
#elif LANG_IT
[Description("freddo")] ColdWater,
[Description("caldo")] HotWater,
#elif LANG_FR
[Description("eau froide")] ColdWater,
[Description("eau chaude")] HotWater,
#else
[Description("cold")] ColdWater,
[Description("hot")] HotWater,
#endif
[Description("")] NotSpecified,
ColdWater,
HotWater,
Count
}
@@ -226,17 +156,6 @@ namespace Config.Entities
Count
}
/// <summary> Register reader type </summary>
public enum RegisterReaderType
{
Unknown,
Pulses, /// Sick, optical and similar
Camera, /// CLP1611
DataStream, /// iPerl
Manual, /// Entered by human via form (also from camera images)
Count
}
/// <summary> Transition step is finished when this condition is fulfilled </summary>
public enum StepCondition
{
@@ -248,14 +167,6 @@ namespace Config.Entities
Count
}
public enum MeretProtocol
{
[Description("<undefined>")] Undefined,
[Description("Meret (obsolete)")] Meret,
[Description("Modbus")] Modbus,
Count
}
public enum Publish : sbyte
{
#if LANG_DE
@@ -264,11 +175,6 @@ namespace Config.Entities
[Description("immer")] Always = 1,
[Description("Bildschirm")] OnScreen = 2,
[Description("intern")] Internal = 3,
#elif LANG_FR
[Description("jamais")] Never = 0,
[Description("toujours")] Always = 1,
[Description("À l'écran")] OnScreen = 2,
[Description("interne")] Internal = 3,
#elif LANG_CS
/// czech
[Description("nikdy")] Never = 0,
@@ -310,10 +216,6 @@ namespace Config.Entities
[Description("Waage")] Scale,
[Description("Spanne")] Spread,
[Description("Standardabw.")] StdDev,
#elif LANG_FR
[Description("Balance")] Scale,
[Description("Envergure")] Spread,
[Description("Déviation std.")] StdDev,
#elif LANG_CS
/// cesky
[Description("váhou")] Scale,
@@ -324,16 +226,22 @@ namespace Config.Entities
[Description("Spread")] Spread,
[Description("Std.dev.")] StdDev,
#endif
Count
Count
}
public enum TestProfile
public enum TestRedType
{
UserDefined,
UserDefinedHeatMeter,
Protected, /// The first protected one
ProtectedHeatMeter,
}
Fix,
/// etc.
Count,
}
public enum FQC1
{
FQC1,
FQP1,
Count,
}
public enum Progress
{
@@ -372,14 +280,6 @@ namespace Config.Entities
[Description("Prüfpunktergebnisse")] TestResult,
[Description("Wasserzelledaten")] MeterData,
[Description("Wasserzelleergebnisse")] MeterResult,
#elif LANG_FR
[Description("Autres")] Other,
[Description("Données de banc")] BenchData,
[Description("Résultats du banc")] BenchResult,
[Description("Données de test")] TestData,
[Description("Résultats de test")] TestResult,
[Description("Données du compteur d'eau")] MeterData,
[Description("Résultats du compteur d'eau")] MeterResult,
#else
[Description("Other")] Other,
[Description("Bench data")] BenchData,
@@ -389,7 +289,7 @@ namespace Config.Entities
[Description("Meter data")] MeterData,
[Description("Meter result")] MeterResult,
#endif
Count,
Count,
}
/// <summary> Possible modes of operation of components and devices. </summary>
@@ -406,17 +306,6 @@ namespace Config.Entities
[Description("Reply")] Reply,
[Description("Simuliert")] Simulate, /// Test bench simulation, this mode does not require any hardware
[Description("Geerbt")] Inherit,
#elif LANG_FR
[Description("Détection automatique: Éteindre")] DetectedOff = -2,
[Description("Détection automatique: Allumé")] DetectedOn = -1,
[Description("Ordinaire")] Normal = 0,
[Description("Détection automatique")] AutoDetect,
[Description("Erreur d'exécution")] FailureDuringOperation,
[Description("Éteindre")] Off,
[Description("Record")] Record,
[Description("Répondre")] Reply,
[Description("Simuler")] Simulate,
[Description("Hériter")] Inherit,
#else
[Description("Detected off")] DetectedOff = -2,
[Description("Detected on")] DetectedOn = -1,
@@ -429,7 +318,7 @@ namespace Config.Entities
[Description("Simulate")] Simulate, /// Test bench simulation, this mode does not require any hardware
[Description("Inherit")] Inherit,
#endif
Count,
Count,
}
public enum LogLevel
@@ -476,11 +365,6 @@ namespace Config.Entities
[Description("zentriert")] Center,
[Description("rechts")] Right,
[Description("angepasst")] Justified,
#elif LANG_FR
[Description("gauche")] Left,
[Description("centré")] Center,
[Description("droit")] Right,
[Description("justifié")] Justified,
#else
[Description("Left")] Left,
[Description("Center")] Center,
@@ -490,22 +374,6 @@ namespace Config.Entities
Count
}
public enum VertAlignment
{
[Description("Top")] Top,
[Description("Middle")] Middle,
[Description("Bottom")] Bottom,
}
public enum TableForm
{
None,
Rows,
Columns,
ColumnsPL,
Count,
}
public enum ImageRotation
{
[Description("0 deg")] None,
@@ -530,10 +398,6 @@ namespace Config.Entities
[Description("aus")] Off,
[Description("info")] Info,
[Description("ein")] On,
#elif LANG_FR
[Description("éteindre")] Off,
[Description("info")] Info,
[Description("allumé")] On,
#elif LANG_CS
[Description("vypnuto")] Off,
[Description("info")] Info,
@@ -551,141 +415,6 @@ namespace Config.Entities
[Description("info")] Info,
[Description("on")] On,
#endif
Count
Count
}
public enum ErrorFlagShift
{
E1 = 0,
E2,
E3,
E4,
E5,
E6,
E7,
E8,
E9,
E10,
E11,
E12,
E13,
E14,
E15,
E16,
E17,
E18,
E19,
E20,
E21,
E22,
E23,
E24,
E25,
E26,
E27,
E28,
E29,
E30,
E31,
E32,
E33,
E34,
E35,
E36,
E37,
E38,
E39,
E40,
E41,
E42,
E43,
E44,
E45,
E46,
E47,
E48,
E49,
E50,
E51,
E52,
E53,
E54,
E55,
E56,
E57,
E58,
E59,
E60,
E61,
E62,
E63,
}
public enum ErrorFlagMask : long
{
E1 = (1 << (int)ErrorFlagShift.E1),
E2 = (1 << (int)ErrorFlagShift.E2),
E3 = (1 << (int)ErrorFlagShift.E3),
E4 = (1 << (int)ErrorFlagShift.E4),
E5 = (1 << (int)ErrorFlagShift.E5),
E6 = (1 << (int)ErrorFlagShift.E6),
E7 = (1 << (int)ErrorFlagShift.E7),
E8 = (1 << (int)ErrorFlagShift.E8),
E9 = (1 << (int)ErrorFlagShift.E9),
E10 = (1 << (int)ErrorFlagShift.E10),
E11 = (1 << (int)ErrorFlagShift.E11),
E12 = (1 << (int)ErrorFlagShift.E12),
E13 = (1 << (int)ErrorFlagShift.E13),
E14 = (1 << (int)ErrorFlagShift.E14),
E15 = (1 << (int)ErrorFlagShift.E15),
E16 = (1 << (int)ErrorFlagShift.E16),
E17 = (1 << (int)ErrorFlagShift.E17),
E18 = (1 << (int)ErrorFlagShift.E18),
E19 = (1 << (int)ErrorFlagShift.E19),
E20 = (1 << (int)ErrorFlagShift.E20),
E21 = (1 << (int)ErrorFlagShift.E21),
E22 = (1 << (int)ErrorFlagShift.E22),
E23 = (1 << (int)ErrorFlagShift.E23),
E24 = (1 << (int)ErrorFlagShift.E24),
E25 = (1 << (int)ErrorFlagShift.E25),
E26 = (1 << (int)ErrorFlagShift.E26),
E27 = (1 << (int)ErrorFlagShift.E27),
E28 = (1 << (int)ErrorFlagShift.E28),
E29 = (1 << (int)ErrorFlagShift.E29),
E30 = (1 << (int)ErrorFlagShift.E30),
E31 = (1 << (int)ErrorFlagShift.E31),
E32 = (1 << (int)ErrorFlagShift.E32),
E33 = (1 << (int)ErrorFlagShift.E33),
E34 = (1 << (int)ErrorFlagShift.E34),
E35 = (1 << (int)ErrorFlagShift.E35),
E36 = (1 << (int)ErrorFlagShift.E36),
E37 = (1 << (int)ErrorFlagShift.E37),
E38 = (1 << (int)ErrorFlagShift.E38),
E39 = (1 << (int)ErrorFlagShift.E39),
E40 = (1 << (int)ErrorFlagShift.E40),
E41 = (1 << (int)ErrorFlagShift.E41),
E42 = (1 << (int)ErrorFlagShift.E42),
E43 = (1 << (int)ErrorFlagShift.E43),
E44 = (1 << (int)ErrorFlagShift.E44),
E45 = (1 << (int)ErrorFlagShift.E45),
E46 = (1 << (int)ErrorFlagShift.E46),
E47 = (1 << (int)ErrorFlagShift.E47),
E48 = (1 << (int)ErrorFlagShift.E48),
E49 = (1 << (int)ErrorFlagShift.E49),
E50 = (1 << (int)ErrorFlagShift.E50),
E51 = (1 << (int)ErrorFlagShift.E51),
E52 = (1 << (int)ErrorFlagShift.E52),
E53 = (1 << (int)ErrorFlagShift.E53),
E54 = (1 << (int)ErrorFlagShift.E54),
E55 = (1 << (int)ErrorFlagShift.E55),
E56 = (1 << (int)ErrorFlagShift.E56),
E57 = (1 << (int)ErrorFlagShift.E57),
E58 = (1 << (int)ErrorFlagShift.E58),
E59 = (1 << (int)ErrorFlagShift.E59),
E60 = (1 << (int)ErrorFlagShift.E60),
E61 = (1 << (int)ErrorFlagShift.E61),
E62 = (1 << (int)ErrorFlagShift.E62),
E63 = (1 << (int)ErrorFlagShift.E63),
}
}
+6 -4
View File
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2013-2019 Sensus Slovensko a.s.
/// Copyright (c) 2013-2017 Sensus Metering Systems
///
using System;
@@ -8,15 +8,17 @@ namespace Config.Entities
public class Group
{
public virtual int Id { get; protected set; }
public virtual Users.Entities.GID GID { get; set; }
public virtual int Gid { get; set; }
public virtual string Name { get; set; }
public Group()
{
}
public Group(Users.Entities.GID gid)
public Group(int gid, string name)
{
GID = gid;
Gid = gid;
Name = name;
}
}
}
-44
View File
@@ -1,44 +0,0 @@
///
/// Copyright (c) 2018 Sensus Slovensko a.s.
///
using System;
namespace Config.Entities
{
public enum Side
{
#if LANG_CS
[Description("Levá")] Left,
[Description("Pravá")] Right,
#else
[Description("Left")] Left,
[Description("Right")] Right,
#endif
Count
}
public enum FlowDir
{
R_L,
L_R,
Count
}
public enum Counting
{
Arbitrary,
Positive,
Negative,
Count
}
public enum OptoHeadState
{
Disabled,
OptoAndDirOK,
OptoNok,
DirNok,
Count
}
}
+2 -5
View File
@@ -12,14 +12,11 @@ namespace Config.Entities
public virtual float Measurement { get; set; }
public virtual float Correction { get; set; }
public MeasurementCorrection()
{
RangeIx = 0;
}
public MeasurementCorrection() { }
public MeasurementCorrection(int rangeIx)
{
RangeIx = rangeIx;
RangeIx = rangeIx;
}
}
}
-325
View File
@@ -1,325 +0,0 @@
///
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using System;
using System.Globalization;
using System.IO;
namespace Config.Entities
{
/// <summary>
/// Test, consisting of one or more repetitions of the test 'SingleTest'.
/// </summary>
public class PTest : IHasName, IHasItemNr
{
public virtual int Id { get; protected set; }
public virtual int ItemNr { get; set; }
public virtual string Name { get; set; }
public virtual int Part { get; set; } /// Part=0 ... test of all WM-s /// Part>0 ... part of a set of tests with the same Name: subset of WM-s is given by MetersPath
public virtual double CoefQfrom { get; set; } /// Water flow low limit in [m3/h]
public virtual double CoefQto { get; set; } /// Water flow high limit in [m3/h]
public virtual double ErrLimLo { get; set; } /// in [%] usually < 0, in case of heat meters: 1=class1, 2=class2, 3=class3
public virtual double ErrLimHi { get; set; } /// in [%] usually > 0, in case of heat meters: -Qn in m3/h
public virtual double TempLimLo { get; set; } /// Lower limit for the controlled temperature
public virtual double TempLimHi { get; set; } /// Upper limit for the controlled temperature
public virtual double PressLimLo { get; set; } /// [bar] min. water pressure
public virtual double PressLimHi { get; set; } /// [bar] max. water pressure
public virtual sbyte E1 { get; set; } ///
public virtual sbyte E2 { get; set; } ///
public virtual sbyte E3 { get; set; } ///
public virtual sbyte E4 { get; set; } ///
public virtual sbyte E5 { get; set; } ///
public virtual sbyte E6 { get; set; } ///
public virtual sbyte E7 { get; set; } ///
public virtual sbyte E8 { get; set; } ///
public virtual sbyte E9 { get; set; } /// 0=off, 1=info, 2=evaluate
public virtual sbyte E10 { get; set; } ///
public virtual sbyte E11 { get; set; } ///
public virtual sbyte E12 { get; set; } ///
public virtual sbyte E13 { get; set; } ///
public virtual sbyte E14 { get; set; } ///
public virtual sbyte E15 { get; set; } ///
public virtual sbyte E16 { get; set; } ///
public virtual sbyte E21 { get; set; } ///
public virtual double Delta_Q_pct { get; set; } /// [%] max deviation from the mean flow
public virtual double Delta_T { get; set; } /// [°C] max. T_up or T_down deviation from the mean temperature
public virtual double Delta_Tup_Tdn { get; set; } /// [°C] max. difference abs(T_up - T_down)
public virtual double TestTime_min { get; set; } /// [s]
public virtual double TestTime_max { get; set; } /// [s]
public virtual double AmbTemp_min { get; set; } /// [°C] min. ambient temperature
public virtual double AmbTemp_max { get; set; } /// [°C] max. ambient temperature
public virtual double Coef_E9 { get; set; } /// Coefficient used in E9, default 0.025
public virtual double Coef_E10 { get; set; } /// Coefficient used in E10, default 0.04
public virtual double Coef_E11 { get; set; } /// Coefficient used in E11, default 0.1
public virtual double Coef_E12 { get; set; } /// Coefficient used in E12, default 1
public virtual double Offset_E9 { get; set; } /// [s] default 0 (no offset)
public virtual double Offset_E12 { get; set; } /// [s] default 0 (no offset)
public virtual Profile Profile { get; set; }
/// ------------- Additional stuff not mapped into the database -------------
public PTest()
{
///
/// Default values
///
Part = 0;
CoefQfrom = 1.0;
CoefQto = 1.1;
ErrLimLo = -2.0; /// [%]
ErrLimHi = 2.0; /// [%]
TempLimLo = 15.0; /// [°C]
TempLimHi = 25.0; /// [°C]
PressLimLo = 0; /// [bar]
PressLimHi = 16.0; /// [bar]
E1 = 1;
E2 = 1;
E3 = 1;
E4 = 1;
E5 = 1;
E6 = 1;
E7 = 1;
E8 = 1;
E9 = 1;
E10 = 1;
E11 = 1;
E12 = 1;
E13 = 1;
E14 = 1;
E15 = 1;
E16 = 1;
E21 = 1;
Delta_Q_pct = 5.0; /// [%]
Delta_T = 10.0; /// [°C]
Delta_Tup_Tdn = 10.0; /// [°C]
TestTime_min = 0; /// [s]
TestTime_max = 99999; /// [s]
AmbTemp_min = 5.0; /// [°C]
AmbTemp_max = 95.0; /// [°C]
Coef_E9 = 0.025;
Coef_E10 = 0.04;
Coef_E11 = 0.1;
Coef_E12 = 1.0;
Offset_E9 = 0; /// [s]
Offset_E12 = 0; /// [s]
}
public PTest(string name, int itemNr, Profile profile)
: this()
{
Name = name;
ItemNr = itemNr;
Profile = profile;
}
// Makes a new copy of this object (not just a reference)
public virtual PTest Clone()
{
PTest result = new PTest(Name, ItemNr, Profile);
result.Part = Part;
result.CoefQfrom = CoefQfrom;
result.CoefQto = CoefQto;
result.ErrLimLo = ErrLimLo;
result.ErrLimHi = ErrLimHi;
result.TempLimLo = TempLimLo;
result.TempLimHi = TempLimHi;
result.PressLimLo = PressLimLo;
result.PressLimHi = PressLimHi;
result.E1 = E1;
result.E2 = E2;
result.E3 = E3;
result.E4 = E4;
result.E5 = E5;
result.E6 = E6;
result.E7 = E7;
result.E8 = E8;
result.E9 = E9;
result.E10 = E10;
result.E11 = E11;
result.E12 = E12;
result.E13 = E13;
result.E14 = E14;
result.E15 = E15;
result.E16 = E16;
result.E21 = E21;
result.Delta_Q_pct = Delta_Q_pct;
result.Delta_T = Delta_T;
result.Delta_Tup_Tdn = Delta_Tup_Tdn;
result.TestTime_min = TestTime_min;
result.TestTime_max = TestTime_max;
result.AmbTemp_min = AmbTemp_min;
result.AmbTemp_max = AmbTemp_max;
result.Coef_E9 = Coef_E9;
result.Coef_E10 = Coef_E10;
result.Coef_E11 = Coef_E11;
result.Coef_E12 = Coef_E12;
result.Offset_E9 = Offset_E9;
result.Offset_E12 = Offset_E12;
return result;
}
public virtual void Export(StreamWriter output)
{
CultureInfo ci = CultureInfo.InvariantCulture;
output.WriteLine(Name);
output.WriteLine(Part);
output.WriteLine(CoefQfrom.ToString(ci));
output.WriteLine(CoefQto.ToString(ci));
output.WriteLine(ErrLimLo.ToString(ci));
output.WriteLine(ErrLimHi.ToString(ci));
output.WriteLine(TempLimLo.ToString(ci));
output.WriteLine(TempLimHi.ToString(ci));
output.WriteLine(PressLimLo.ToString(ci));
output.WriteLine(PressLimHi.ToString(ci));
output.WriteLine(E1.ToString());
output.WriteLine(E2.ToString());
output.WriteLine(E3.ToString());
output.WriteLine(E4.ToString());
output.WriteLine(E5.ToString());
output.WriteLine(E6.ToString());
output.WriteLine(E7.ToString());
output.WriteLine(E8.ToString());
output.WriteLine(E9.ToString());
output.WriteLine(E10.ToString());
output.WriteLine(E11.ToString());
output.WriteLine(E12.ToString());
output.WriteLine(E13.ToString());
output.WriteLine(E14.ToString());
output.WriteLine(E15.ToString());
output.WriteLine(E16.ToString());
output.WriteLine(E21.ToString());
output.WriteLine(Delta_Q_pct.ToString(ci));
output.WriteLine(Delta_T.ToString(ci));
output.WriteLine(Delta_Tup_Tdn.ToString(ci));
output.WriteLine(TestTime_min.ToString(ci));
output.WriteLine(TestTime_max.ToString(ci));
output.WriteLine(AmbTemp_min.ToString(ci));
output.WriteLine(AmbTemp_max.ToString(ci));
output.WriteLine(Coef_E9.ToString(ci));
output.WriteLine(Coef_E10.ToString(ci));
output.WriteLine(Coef_E11.ToString(ci));
output.WriteLine(Coef_E12.ToString(ci));
output.WriteLine(Offset_E9.ToString(ci));
output.WriteLine(Offset_E12.ToString(ci));
}
public static PTest Import(StreamReader input, Profile newProfile)
{
string firstLine = input.ReadLine();
if (string.IsNullOrEmpty(firstLine))
{
return null;
}
CultureInfo ci = CultureInfo.InvariantCulture;
PTest tst = new PTest();
tst.Name = firstLine;
tst.Part = int.Parse(input.ReadLine());
tst.CoefQfrom = double.Parse(input.ReadLine(), ci);
tst.CoefQto = double.Parse(input.ReadLine(), ci);
tst.ErrLimLo = double.Parse(input.ReadLine(), ci);
tst.ErrLimHi = double.Parse(input.ReadLine(), ci);
tst.TempLimLo = double.Parse(input.ReadLine(), ci);
tst.TempLimHi = double.Parse(input.ReadLine(), ci);
/// TODO (E1 .. E21)
tst.Delta_Q_pct = double.Parse(input.ReadLine(), ci);
tst.Delta_T = double.Parse(input.ReadLine(), ci);
tst.Delta_Tup_Tdn = double.Parse(input.ReadLine(), ci);
tst.TestTime_min = double.Parse(input.ReadLine(), ci);
tst.TestTime_max = double.Parse(input.ReadLine(), ci);
tst.AmbTemp_min = double.Parse(input.ReadLine(), ci);
tst.AmbTemp_max = double.Parse(input.ReadLine(), ci);
tst.Coef_E9 = double.Parse(input.ReadLine(), ci);
tst.Coef_E10 = double.Parse(input.ReadLine(), ci);
tst.Coef_E11 = double.Parse(input.ReadLine(), ci);
tst.Coef_E12 = double.Parse(input.ReadLine(), ci);
tst.Offset_E9 = double.Parse(input.ReadLine(), ci);
tst.Offset_E12 = double.Parse(input.ReadLine(), ci);
tst.Profile = newProfile;
return tst;
}
public virtual string Compare(StreamReader inp)
{
System.Text.StringBuilder diff = new System.Text.StringBuilder();
string fmt = string.Format("Test {0} : ", Name) + "{0} = {1}\r\n (in the file {2})\r\n";
string ln;
CultureInfo ci = CultureInfo.InvariantCulture;
string firstLine = inp.ReadLine();
if (string.IsNullOrEmpty(firstLine)) return string.Format("Test {0} is missing in the file\r\n", Name);
if (Name != firstLine) { diff.AppendFormat(fmt, "Name", Name, firstLine); };
ln = inp.ReadLine(); if (ln != Part.ToString()) { diff.AppendFormat(fmt, "Part", Part.ToString(), ln); };
ln = inp.ReadLine(); if (ln != CoefQfrom.ToString(ci)) { diff.AppendFormat(fmt, "CoefQfrom", CoefQfrom.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != CoefQto.ToString(ci)) { diff.AppendFormat(fmt, "CoefQto", CoefQto.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != ErrLimLo.ToString(ci)) { diff.AppendFormat(fmt, "ErrLimLo", ErrLimLo.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != ErrLimHi.ToString(ci)) { diff.AppendFormat(fmt, "ErrLimHi", ErrLimHi.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != TempLimLo.ToString(ci)) { diff.AppendFormat(fmt, "TempLimLo", TempLimLo.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != TempLimHi.ToString(ci)) { diff.AppendFormat(fmt, "TempLimHi", TempLimHi.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != PressLimLo.ToString(ci)) { diff.AppendFormat(fmt, "Pressure_min", TempLimLo.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != PressLimHi.ToString(ci)) { diff.AppendFormat(fmt, "Pressure_max", TempLimHi.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != E1.ToString()) { diff.AppendFormat(fmt, "E1", E1.ToString(), ln); };
ln = inp.ReadLine(); if (ln != E2.ToString()) { diff.AppendFormat(fmt, "E2", E2.ToString(), ln); };
ln = inp.ReadLine(); if (ln != E3.ToString()) { diff.AppendFormat(fmt, "E3", E3.ToString(), ln); };
ln = inp.ReadLine(); if (ln != E4.ToString()) { diff.AppendFormat(fmt, "E4", E4.ToString(), ln); };
ln = inp.ReadLine(); if (ln != E5.ToString()) { diff.AppendFormat(fmt, "E5", E5.ToString(), ln); };
ln = inp.ReadLine(); if (ln != E6.ToString()) { diff.AppendFormat(fmt, "E6", E6.ToString(), ln); };
ln = inp.ReadLine(); if (ln != E7.ToString()) { diff.AppendFormat(fmt, "E7", E7.ToString(), ln); };
ln = inp.ReadLine(); if (ln != E8.ToString()) { diff.AppendFormat(fmt, "E8", E8.ToString(), ln); };
ln = inp.ReadLine(); if (ln != E9.ToString()) { diff.AppendFormat(fmt, "E9", E9.ToString(), ln); };
ln = inp.ReadLine(); if (ln != E10.ToString()) { diff.AppendFormat(fmt, "E10", E10.ToString(), ln); };
ln = inp.ReadLine(); if (ln != E11.ToString()) { diff.AppendFormat(fmt, "E11", E11.ToString(), ln); };
ln = inp.ReadLine(); if (ln != E12.ToString()) { diff.AppendFormat(fmt, "E12", E12.ToString(), ln); };
ln = inp.ReadLine(); if (ln != E13.ToString()) { diff.AppendFormat(fmt, "E13", E13.ToString(), ln); };
ln = inp.ReadLine(); if (ln != E14.ToString()) { diff.AppendFormat(fmt, "E14", E14.ToString(), ln); };
ln = inp.ReadLine(); if (ln != E15.ToString()) { diff.AppendFormat(fmt, "E15", E15.ToString(), ln); };
ln = inp.ReadLine(); if (ln != E16.ToString()) { diff.AppendFormat(fmt, "E16", E16.ToString(), ln); };
ln = inp.ReadLine(); if (ln != E21.ToString()) { diff.AppendFormat(fmt, "E21", E21.ToString(), ln); };
ln = inp.ReadLine(); if (ln != Delta_Q_pct.ToString(ci)) { diff.AppendFormat(fmt, "Delta_Q_pct", Delta_Q_pct.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != Delta_T.ToString(ci)) { diff.AppendFormat(fmt, "Delta_T", Delta_T.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != Delta_Tup_Tdn.ToString(ci)) { diff.AppendFormat(fmt, "Delta_Tup_Tdn", Delta_Tup_Tdn.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != TestTime_min.ToString(ci)) { diff.AppendFormat(fmt, "TestTime_min", TestTime_min.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != TestTime_max.ToString(ci)) { diff.AppendFormat(fmt, "TestTime_max", TestTime_max.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != AmbTemp_min.ToString(ci)) { diff.AppendFormat(fmt, "AmbTemp_min", AmbTemp_min.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != AmbTemp_max.ToString(ci)) { diff.AppendFormat(fmt, "AmbTemp_max", AmbTemp_max.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != Coef_E9.ToString(ci)) { diff.AppendFormat(fmt, "Coef_E9", Coef_E9.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != Coef_E10.ToString(ci)) { diff.AppendFormat(fmt, "Coef_E10", Coef_E10.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != Coef_E11.ToString(ci)) { diff.AppendFormat(fmt, "Coef_E11", Coef_E11.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != Coef_E12.ToString(ci)) { diff.AppendFormat(fmt, "Coef_E12", Coef_E12.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != Offset_E9.ToString(ci)) { diff.AppendFormat(fmt, "Offset_E9", Offset_E9.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != Offset_E12.ToString(ci)) { diff.AppendFormat(fmt, "Offset_E12", Offset_E12.ToString(ci), ln); };
return diff.ToString();
}
public override string ToString()
{
return string.Format("{0}", Name);
}
}
}
+2 -47
View File
@@ -86,10 +86,12 @@ namespace Config.Entities
result.LastChgUser = LastChgUser;
result.LastChgTime = LastChgTime;
result.LongDescription = LongDescription;
result.ProcedureState = ProcedureState;
result.Revision = Revision;
result.PredecessorId = Id;
result.ObtainedByCopy = ObtainedByCopy;
result.MetersKind = MetersKind;
result.Watermeters = Watermeters;
result.Protected = Protected;
@@ -100,8 +102,6 @@ namespace Config.Entities
result.ResultsWriter = ResultsWriter;
result.TransitionStart = TransitionStart;
result.TransitionEnd = TransitionEnd;
result.AltProcName = AltProcName;
result.AltProcPeriod = AltProcPeriod;
foreach (var prms in MoreParams) { result.MoreParams.Add(prms.Clone(result)); }
foreach (var test in Tests) { result.Tests.Add(test.Clone()); }
@@ -225,51 +225,6 @@ namespace Config.Entities
return diff.ToString();
}
public virtual ComponentProcedure GetProcedureParamsEntity(string cmpntName)
{
foreach (var procPrms in MoreParams)
{
if (procPrms.CmpntName == cmpntName) return procPrms;
}
return null;
}
/// <summary>
/// Processes the selection done by the bench control panel in the main sequence.
/// </summary>
/// <param name="selection">Selection.Q1, .Q2, .Q3 or .Test</param>
/// <returns>The selected test or null</returns>
public virtual Test GetTest(string expandedTestName, out int testIx, out int repetNr)
{
for (int ix = 0; ix < Tests.Count; ix++)
{
Test test = Tests[ix];
if (test.Name.Equals(expandedTestName))
{
/// Name is not expanded => Repeats==1
testIx = ix;
repetNr = 1;
return test;
}
for (int r = 1; r <= test.Repeats; r++)
{
if (test.GetExpandedTestName(r).Equals(expandedTestName))
{
testIx = ix;
repetNr = r;
return test;
}
}
}
testIx = 0;
repetNr = 1;
return null;
}
public override string ToString()
{
return string.Format("{0}, rev.{1}", Name, Revision);
-143
View File
@@ -1,143 +0,0 @@
///
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
namespace Config.Entities
{
/// <summary>
/// Stores one test procedure, supports revisions and history log
/// </summary>
public class Profile : IHasName, IHasItemNr
{
public virtual int Id { get; protected set; }
public virtual int ItemNr { get; set; }
public virtual string Name { get; set; }
public virtual string Description { get; set; } /// Short description
public virtual string CreationUser { get; set; } /// Name of the user who has created or changed this procedure
public virtual DateTime CreationTime { get; set; } /// Date and time of the creation or change
public virtual string LastChgUser { get; set; } /// Name of the user who has created or changed this procedure
public virtual DateTime LastChgTime { get; set; } /// Date and time of the creation or change
public virtual ProfileType ProfileType { get; set; }
public virtual ErrorLimitType ErrorLimitType { get; set; }
public virtual IList<PTest> Tests { get; set; }
/// ------------- Additional stuff not mapped into the database -------------
public Profile()
{
Tests = new List<PTest>();
///
/// Default values
///
CreationUser = (Users.GlobalData.CurrentUser != null) ? Users.GlobalData.CurrentUser.UserName : null;
CreationTime = DateTime.Now;
LastChgUser = CreationUser;
LastChgTime = CreationTime;
Description = string.Empty;
}
public Profile(string name, int itemNr)
: this()
{
Name = name;
ItemNr = itemNr;
}
public virtual Profile Clone()
{
Profile result = new Profile();
result.ItemNr = ItemNr;
result.Name = Name;
result.Description = Description;
result.CreationUser = CreationUser;
result.CreationTime = CreationTime;
result.LastChgUser = LastChgUser;
result.LastChgTime = LastChgTime;
result.ProfileType = ProfileType;
result.ErrorLimitType = ErrorLimitType;
foreach (var test in Tests) { result.Tests.Add(test.Clone()); }
return result;
}
public virtual void Export(StreamWriter output)
{
output.WriteLine(ItemNr.ToString(CultureInfo.InvariantCulture));
output.WriteLine(Name);
output.WriteLine(Description);
output.WriteLine(CreationUser);
output.WriteLine(CreationTime.ToString(CultureInfo.InvariantCulture));
output.WriteLine(LastChgUser);
output.WriteLine(LastChgTime.ToString(CultureInfo.InvariantCulture));
foreach (var test in Tests) { test.Export(output); }
output.WriteLine();
output.Close();
}
public static Profile Import(StreamReader input)
{
Profile result = new Profile();
result.ItemNr = int.Parse(input.ReadLine(), CultureInfo.InvariantCulture);
result.Name = input.ReadLine();
result.Description = input.ReadLine();
result.CreationUser = input.ReadLine();
result.CreationTime = DateTime.Parse(input.ReadLine(), CultureInfo.InvariantCulture);
result.LastChgUser = input.ReadLine();
result.LastChgTime = DateTime.Parse(input.ReadLine(), CultureInfo.InvariantCulture);
string line = input.ReadLine();
while (true)
{
PTest tst = PTest.Import(input, result);
if (tst == null)
break;
else
result.Tests.Add(tst);
}
return result;
}
public virtual string Compare(StreamReader inp)
{
System.Text.StringBuilder diff = new System.Text.StringBuilder();
const string fmt = "{0} = {1}\r\n (in the file {2})\r\n";
string ln;
ln = inp.ReadLine(); /// skip ItemNr
ln = inp.ReadLine(); if (ln != Name) { diff.AppendFormat(fmt, "Name", Name, ln); };
ln = inp.ReadLine(); if (ln != Description) { diff.AppendFormat(fmt, "Description", Description, ln); };
ln = inp.ReadLine(); /// skip CreationUser
ln = inp.ReadLine(); /// skip CreationTime
ln = inp.ReadLine(); /// skip LastChgUser
ln = inp.ReadLine(); /// skip LastChgTime
//foreach (var test in Tests)
//{
// string testDiff = test.Compare(inp);
// if (testDiff.Contains(
//}
//bool extraTestsInFile = true;
//while (Test.Import(inp, null) != null) { extraTestsInFile = true; }
return diff.ToString();
}
public override string ToString()
{
return string.Format("{0}", Name);
}
}
}
+36 -118
View File
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2013-2019 Sensus Slovensko a.s.
/// Copyright (c) 2013-2017 Sensus Metering Systems
///
using System;
using System.Collections.Generic;
@@ -18,21 +18,19 @@ namespace Config.Entities
public virtual string Name { get; set; }
public virtual int Part { get; set; } /// Part=0 ... test of all WM-s
/// Part>0 ... part of a set of tests with the same Name: subset of WM-s is given by MetersPath
public virtual TestProfile Profile { get; set; } /// UserDefined, Protected, UserDefinedHeatMeter, ProtectedHeatMeter
public virtual sbyte Publish { get; set; } /// 0=no, 1=in all protocols, 2=on screen, 3=internal
public virtual bool DoEvaluate { get; set; }
public virtual float Qtg { get; set; } /// Target water flow [m3/h]
public virtual float Qfrom { get; set; } /// Water flow low limit in [m3/h]
public virtual sbyte Publish { get; set; } /// 0=no, 1=in all protocols, 2=on screen, 3=internal
public virtual bool DoEvaluate { get; set; }
public virtual float Qfrom { get; set; } /// Water flow low limit in [m3/h]
public virtual float Qto { get; set; } /// Water flow high limit in [m3/h]
public virtual float Volume { get; set; } /// Test volume (target) in [l]
public virtual float TstTime { get; set; } /// Test time (estimate) in [s]
public virtual string Method { get; set; }
public virtual float ErrLimLo { get; set; } /// in [%] usually < 0, in case of heat meters: 1=class1, 2=class2, 3=class3
public virtual float ErrLimHi { get; set; } /// in [%] usually > 0, in case of heat meters: -Qn in m3/h
public virtual float ErrLimLo { get; set; } /// in [%] (usually < 0) or 1=class1, 2=class2, 3=class3
public virtual float ErrLimHi { get; set; } /// in [%] (usually > 0) or -Qn in m3/h
public virtual float Uncertainty { get; set; } /// int [%] makes error limits tighter: 0 <= Uncertainty <= abs(ErrLimXx)
public virtual int Repeats { get; set; }
public virtual bool DoDraining { get; set; }
public virtual bool DoDrainingAfter { get; set; }
public virtual bool DoZeroing { get; set; }
public virtual bool DoControlWaterTemp { get; set; }
public virtual float TempLimLo { get; set; } /// Lower limit for the controlled temperature
public virtual float TempLimHi { get; set; } /// Upper limit for the controlled temperature
@@ -45,7 +43,7 @@ namespace Config.Entities
public virtual int TimePump2StartV { get; set; } /// Delay time from the start of the pump to opening the start valve in [s]
public virtual int TimeStop2Mass { get; set; } /// Delay time from the test end (diverted) to the 2nd mass measuremen in [s]
public virtual double TolerRed { get; set; } /// = Filter
public virtual string RedType { get; set; }
public virtual TestRedType RedType { get; set; }
public virtual string FeedingPath { get; set; }
public virtual string BenchPath { get; set; }
public virtual string OutputPath { get; set; }
@@ -55,11 +53,9 @@ namespace Config.Entities
#endif
public virtual string RelTransBefore { get; set; }
public virtual string RelTransBetween { get; set; }
public virtual string RelTransAfter { get; set; }
public virtual string TransitionAfter { get; set; }
public virtual bool IsOuterLoopStart { get; set; } /// Not mapped to database
public virtual bool IsOuterLoopEnd { get; set; } /// Not mapped to database
public virtual IList<ComponentTest> MoreParams { get; set; }
public virtual Procedure Procedure { get; set; }
@@ -73,13 +69,11 @@ namespace Config.Entities
///
/// Default values
///
Part = 0;
Profile = TestProfile.UserDefined;
Publish = (sbyte)Config.Entities.Publish.Always;
Publish = (sbyte)Config.Entities.Publish.Always;
DoEvaluate = true;
Repeats = 1;
DoDraining = false;
DoDrainingAfter = false;
DoZeroing = false;
DoControlWaterTemp = false;
TempLimLo = 15.0f;
TempLimHi = 25.0f;
@@ -97,6 +91,7 @@ namespace Config.Entities
TolerRed = 0; /// = Filter parameter
RelTransBefore = string.Empty;
RelTransBetween = string.Empty;
RelTransAfter = string.Empty;
TransitionAfter = string.Empty;
}
@@ -114,10 +109,8 @@ namespace Config.Entities
Test result = new Test(Name, ItemNr, Procedure);
result.Part = Part;
result.Profile = Profile;
result.Publish = Publish;
result.Publish = Publish;
result.DoEvaluate = DoEvaluate;
result.Qtg = Qtg;
result.Qfrom = Qfrom;
result.Qto = Qto;
result.Volume = Volume;
@@ -128,7 +121,7 @@ namespace Config.Entities
result.Uncertainty = Uncertainty;
result.Repeats = Repeats;
result.DoDraining = DoDraining;
result.DoDrainingAfter = DoDrainingAfter;
result.DoZeroing = DoZeroing;
result.DoControlWaterTemp = DoControlWaterTemp;
result.TempLimLo = TempLimLo;
result.TempLimHi = TempLimHi;
@@ -151,6 +144,7 @@ namespace Config.Entities
#endif
result.RelTransBefore = RelTransBefore;
result.RelTransBetween = RelTransBetween;
result.RelTransAfter = RelTransAfter;
result.TransitionAfter = TransitionAfter;
foreach (var prms in MoreParams) { result.MoreParams.Add(prms.Clone()); }
@@ -165,7 +159,6 @@ namespace Config.Entities
output.WriteLine(Part.ToString(ci));
output.WriteLine(Publish.ToString(ci));
output.WriteLine(DoEvaluate.ToString());
output.WriteLine(Qtg.ToString(ci));
output.WriteLine(Qfrom.ToString(ci));
output.WriteLine(Qto.ToString(ci));
output.WriteLine(Volume.ToString(ci));
@@ -176,7 +169,7 @@ namespace Config.Entities
output.WriteLine(Uncertainty.ToString(ci));
output.WriteLine(Repeats.ToString(ci));
output.WriteLine(DoDraining.ToString());
output.WriteLine(DoDrainingAfter.ToString());
output.WriteLine(DoZeroing.ToString());
output.WriteLine(DoControlWaterTemp.ToString());
output.WriteLine(TempLimLo.ToString(ci));
output.WriteLine(TempLimHi.ToString(ci));
@@ -194,7 +187,7 @@ namespace Config.Entities
output.WriteLine(MetersPath);
output.WriteLine(RelTransBefore);
output.WriteLine(RelTransBetween);
output.WriteLine(Profile);
output.WriteLine(RelTransAfter);
output.WriteLine(TransitionAfter);
foreach (var prms in MoreParams) { prms.Export(output); }
@@ -216,8 +209,7 @@ namespace Config.Entities
tst.Part = int.Parse(input.ReadLine(), ci);
tst.Publish = sbyte.Parse(input.ReadLine(), ci);
tst.DoEvaluate = bool.Parse(input.ReadLine());
tst.Qtg = float.Parse(input.ReadLine(), ci);
tst.Qfrom = float.Parse(input.ReadLine(), ci);
tst.Qfrom = float.Parse(input.ReadLine(), ci);
tst.Qto = float.Parse(input.ReadLine(), ci);
tst.Volume = float.Parse(input.ReadLine(), ci);
tst.TstTime = float.Parse(input.ReadLine(), ci);
@@ -227,7 +219,7 @@ namespace Config.Entities
tst.Uncertainty = float.Parse(input.ReadLine(), ci);
tst.Repeats = int.Parse(input.ReadLine(), ci);
tst.DoDraining = bool.Parse(input.ReadLine());
tst.DoDrainingAfter = bool.Parse(input.ReadLine());
tst.DoZeroing = bool.Parse(input.ReadLine());
tst.DoControlWaterTemp = bool.Parse(input.ReadLine());
tst.TempLimLo = float.Parse(input.ReadLine(), ci);
tst.TempLimHi = float.Parse(input.ReadLine(), ci);
@@ -245,10 +237,7 @@ namespace Config.Entities
tst.MetersPath = input.ReadLine();
tst.RelTransBefore = input.ReadLine();
tst.RelTransBetween = input.ReadLine();
string line = input.ReadLine();
tst.Profile = line.Equals(TestProfile.ProtectedHeatMeter.ToString()) ? TestProfile.ProtectedHeatMeter
: line.Equals(TestProfile.UserDefinedHeatMeter.ToString()) ? TestProfile.UserDefinedHeatMeter
: line.Equals(TestProfile.Protected.ToString()) ? TestProfile.Protected : TestProfile.UserDefined; /// UserDefined is the default
tst.RelTransAfter = input.ReadLine();
tst.TransitionAfter = input.ReadLine();
while (true)
@@ -278,7 +267,6 @@ namespace Config.Entities
ln = inp.ReadLine(); if (ln != Part.ToString(ci)) { diff.AppendFormat(fmt, "Part", Part.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != Publish.ToString(ci)) { diff.AppendFormat(fmt, "Publish", Publish.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != DoEvaluate.ToString(ci)) { diff.AppendFormat(fmt, "Evaluate", DoEvaluate.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != Qtg.ToString(ci)) { diff.AppendFormat(fmt, "Qtg", Qtg.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != Qfrom.ToString(ci)) { diff.AppendFormat(fmt, "Qfrom", Qfrom.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != Qto.ToString(ci)) { diff.AppendFormat(fmt, "Qto", Qto.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != Volume.ToString(ci)) { diff.AppendFormat(fmt, "Volume", Volume.ToString(ci), ln); };
@@ -289,7 +277,7 @@ namespace Config.Entities
ln = inp.ReadLine(); if (ln != Uncertainty.ToString(ci)) { diff.AppendFormat(fmt, "Uncertainty", Uncertainty.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != Repeats.ToString(ci)) { diff.AppendFormat(fmt, "Repeats", Repeats.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != DoDraining.ToString(ci)) { diff.AppendFormat(fmt, "Draining", DoDraining.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != DoDrainingAfter.ToString(ci)) { diff.AppendFormat(fmt, "Zeroing", DoDrainingAfter.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != DoZeroing.ToString(ci)) { diff.AppendFormat(fmt, "Zeroing", DoZeroing.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != DoControlWaterTemp.ToString()) { diff.AppendFormat(fmt, "DoControlWaterTemp", DoControlWaterTemp.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != TempLimLo.ToString(ci)) { diff.AppendFormat(fmt, "TempLimLo", TempLimLo.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != TempLimHi.ToString(ci)) { diff.AppendFormat(fmt, "TempLimHi", TempLimHi.ToString(ci), ln); };
@@ -307,130 +295,60 @@ namespace Config.Entities
ln = inp.ReadLine(); if (ln != MetersPath) { diff.AppendFormat(fmt, "MetersPath", MetersPath, ln); };
ln = inp.ReadLine(); if (ln != RelTransBefore) { diff.AppendFormat(fmt, "RelTransBefore", RelTransBefore, ln); };
ln = inp.ReadLine(); if (ln != RelTransBetween) { diff.AppendFormat(fmt, "RelTransBetween", RelTransBetween, ln); };
ln = inp.ReadLine(); if (ln != Profile.ToString()) { diff.AppendFormat(fmt, "RelTransAfter", Profile, ln); };
ln = inp.ReadLine(); if (ln != RelTransAfter) { diff.AppendFormat(fmt, "RelTransAfter", RelTransAfter, ln); };
ln = inp.ReadLine(); if (ln != TransitionAfter) { diff.AppendFormat(fmt, "TransitionAfter", TransitionAfter, ln); };
return diff.ToString();
}
public virtual ComponentTest GetTestParamsEntity(string cmpntName)
{
foreach (var tstPrms in MoreParams)
{
if (tstPrms.CmpntName == cmpntName) return tstPrms;
}
return null;
}
/// <summary>
/// Return test title for a this test and a given repetition number
/// </summary>
/// <param name="repetitonNr">1 .. Nr. repetitions</param>
/// <returns>Test title (string)</returns>
public virtual string GetExpandedTestName(int repetitionNr)
{
if (Repeats == 1)
{
if (Part == 0)
{
/// Single test
return Name;
}
else
{
/// A part of a single test
return string.Format("{0} ({1})", Name, Part);
}
}
else
{
/// More test repetitions
return string.Format("{0} ({1}/{2})", Name, repetitionNr, Repeats);
}
}
public virtual double GetErrLimLo(double volumeCTV, double testTime)
public virtual float GetErrLimLo(float flow)
{
if (ErrLimLo <= ErrLimHi)
{
return ErrLimLo; /// Error limit of a water meter
return ErrLimLo; /// Error limit of a water meter
}
else
{
/// Metrological class and nominal flow of a heat meter
int metrClass = (int)Math.Round(ErrLimLo);
double Qp = Math.Abs(ErrLimHi);
double Q = (testTime == 0) ? 1 : Math.Max(3.6 * volumeCTV / testTime, 0.00001); /// Div. by zero avoided
float Qp = Math.Abs(ErrLimHi);
float Q = Math.Max(flow, 0.00001f); /// to avoid division by zero
/// Calculate the error limit of a heat meter
switch (metrClass)
{
default:
case 1: return -Math.Min(3.5, 1.0 + 0.01 * Qp / Q);
case 2: return -Math.Min(5.0, 2.0 + 0.02 * Qp / Q);
case 3: return -Math.Min(5.0, 3.0 + 0.05 * Qp / Q);
case 1: return -Math.Min(3.5f, 1.0f + 0.01f * Qp / Q);
case 2: return -Math.Min(5.0f, 2.0f + 0.02f * Qp / Q);
case 3: return -Math.Min(5.0f, 3.0f + 0.05f * Qp / Q);
}
}
}
public virtual double GetErrLimHi(double volumeCTV, double testTime)
public virtual float GetErrLimHi(float flow)
{
if (ErrLimLo <= ErrLimHi)
{
return ErrLimHi; /// Error limit of a water meter
return ErrLimHi; /// Error limit of a water meter
}
else
{
/// Metrological class and nominal flow of a heat meter
int metrClass = (int)Math.Round(ErrLimLo);
double Qp = Math.Abs(ErrLimHi);
double Q = (testTime == 0) ? 1 : Math.Max(3.6 * volumeCTV / testTime, 0.00001); /// Div. by zero avoided
float Qp = Math.Abs(ErrLimHi);
float Q = Math.Max(flow, 0.00001f); /// to avoid division by zero
/// Calculate the error limit of a heat meter
switch (metrClass)
{
default:
case 1: return +Math.Min(3.5, 1.0 + 0.01 * Qp / Q);
case 2: return +Math.Min(5.0, 2.0 + 0.02 * Qp / Q);
case 3: return +Math.Min(5.0, 3.0 + 0.05 * Qp / Q);
case 1: return +Math.Min(3.5f, 1.0f + 0.01f * Qp / Q);
case 2: return +Math.Min(5.0f, 2.0f + 0.02f * Qp / Q);
case 3: return +Math.Min(5.0f, 3.0f + 0.05f * Qp / Q);
}
}
}
public virtual bool IsPartCompatible(int waterMeterPartNr)
{
if ((this.Part == 0) || (waterMeterPartNr == 0)) return true;
if ((this.Part % 10) == waterMeterPartNr) return true;
if (((this.Part / 10) % 10) == waterMeterPartNr) return true;
if (((this.Part / 100) % 10) == waterMeterPartNr) return true;
if (((this.Part / 1000) % 10) == waterMeterPartNr) return true;
return false;
}
/// <summary>
/// Determines whether tests part number is OK.
/// Examples of correct part number are:
/// 1, 2, 12, 21 in case of max. part nr.== 2
/// 1, 2, 3, 4, 12, 13, 14, 23, 24, 34, 123, 124, 134, 234, 1234 in case of max. part nr.== 4
/// </summary>
/// <param name="partNr">Tests par tnumber</param>
/// <returns>true when Part number is OK</returns>
public static bool IsGoodPartNr(int partNr)
{
bool firstDigitIsOK = ((partNr % 10) > 0) && ((partNr % 10) <= Config.Data.MaxPartNr);
bool secondDigitIsOK = (((partNr/10) % 10) > 0) && (((partNr/10) % 10) <= Config.Data.MaxPartNr);
bool thirdDigitIsOK = (((partNr/100) % 10) > 0) && (((partNr/100) % 10) <= Config.Data.MaxPartNr);
bool fourthDigitIsOK = (((partNr/1000) % 10) > 0) && (((partNr/1000) % 10) <= Config.Data.MaxPartNr);
if (firstDigitIsOK && (partNr / 10 == 0)) return true;
if (firstDigitIsOK && secondDigitIsOK && (partNr / 100 == 0)) return true;
if (firstDigitIsOK && secondDigitIsOK && thirdDigitIsOK && (partNr / 1000 == 0)) return true;
if (firstDigitIsOK && secondDigitIsOK && thirdDigitIsOK && fourthDigitIsOK && (partNr / 10000 == 0)) return true;
return false;
}
public override string ToString()
{
+2 -56
View File
@@ -1,10 +1,7 @@
///
/// Copyright (c) 2013-2018 Sensus Slovensko a.s.
/// Copyright (c) 2013-2015 Sensus Metering Systems
///
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
namespace Config.Entities
{
@@ -40,56 +37,5 @@ namespace Config.Entities
foreach (var step in TransitionSteps) { result.TransitionSteps.Add(step.Clone()); }
return result;
}
public virtual void Export(StreamWriter output)
{
output.WriteLine(ItemNr.ToString(CultureInfo.InvariantCulture));
output.WriteLine(Name);
output.WriteLine(Description);
foreach (var step in TransitionSteps) { step.Export(output); }
output.WriteLine();
output.Close();
}
public static TransitionSequence Import(StreamReader input)
{
TransitionSequence result = new TransitionSequence();
result.ItemNr = int.Parse(input.ReadLine(), CultureInfo.InvariantCulture);
result.Name = input.ReadLine();
result.Description = input.ReadLine();
while (true)
{
TransitionStep step = TransitionStep.Import(input, result);
if (step == null)
break;
else
result.TransitionSteps.Add(step);
}
return result;
}
public virtual string Compare(StreamReader inp)
{
System.Text.StringBuilder diff = new System.Text.StringBuilder();
const string fmt = "{0} = {1}\r\n (in the file {2})\r\n";
string ln;
ln = inp.ReadLine(); /// skip ItemNr
ln = inp.ReadLine(); if (ln != Name) { diff.AppendFormat(fmt, "Name", Name, ln); };
ln = inp.ReadLine(); if (ln != Description) { diff.AppendFormat(fmt, "Description", Description, ln); };
//foreach (var step in TransitionSteps)
//{
// string testDiff = step.Compare(inp);
// if (testDiff.Contains(
//}
return diff.ToString();
}
}
}
}
+1 -62
View File
@@ -1,10 +1,8 @@
///
/// Copyright (c) 2013-2018 Sensus Slovensko a.s.
/// Copyright (c) 2013-2015, 2017 Sensus Metering Systems
///
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
namespace Config.Entities
{
@@ -63,64 +61,5 @@ namespace Config.Entities
result += indent + "PumpsWithFMPct = " + PumpWithFMPcts + Environment.NewLine;
return result;
}
public virtual void Export(StreamWriter output)
{
CultureInfo ci = CultureInfo.InvariantCulture;
output.WriteLine(ItemNr.ToString(ci));
output.WriteLine(Duration.ToString(ci));
output.WriteLine(Message);
output.WriteLine(EndCondition);
output.WriteLine(ValvesOpen);
output.WriteLine(ValvesClose);
output.WriteLine(RegulValvesPct);
output.WriteLine(PumpWithFMPcts);
}
public static TransitionStep Import(StreamReader input, TransitionSequence newSequence)
{
string firstLine = input.ReadLine();
if (string.IsNullOrEmpty(firstLine))
{
return null;
}
CultureInfo ci = CultureInfo.InvariantCulture;
int itemNr = int.Parse(firstLine, ci);
TransitionStep tst = new TransitionStep(itemNr, newSequence);
tst.Duration = int.Parse(input.ReadLine(), ci);
tst.Message = input.ReadLine();
tst.EndCondition = input.ReadLine();
tst.ValvesOpen = input.ReadLine();
tst.ValvesClose = input.ReadLine();
tst.RegulValvesPct = input.ReadLine();
tst.PumpWithFMPcts = input.ReadLine();
return tst;
}
public virtual string Compare(StreamReader inp)
{
System.Text.StringBuilder diff = new System.Text.StringBuilder();
string fmt = string.Format("Step {0} : ", ItemNr) + "{0} = {1}\r\n (in the file {2})\r\n";
string ln;
CultureInfo ci = CultureInfo.InvariantCulture;
string firstLine = inp.ReadLine();
if (string.IsNullOrEmpty(firstLine)) return string.Format("TransitionStep {0} is missing in the compared file\r\n", ItemNr);
if (ItemNr.ToString() != firstLine) { diff.AppendFormat(fmt, "ItemNr", ItemNr, firstLine); };
ln = inp.ReadLine(); if (ln != Duration.ToString(ci)) { diff.AppendFormat(fmt, "Duration", Duration.ToString(ci), ln); };
ln = inp.ReadLine(); if (ln != Message) { diff.AppendFormat(fmt, "Message", Message, ln); };
ln = inp.ReadLine(); if (ln != EndCondition) { diff.AppendFormat(fmt, "EndCondition", EndCondition, ln); };
ln = inp.ReadLine(); if (ln != ValvesOpen) { diff.AppendFormat(fmt, "ValvesOpen", ValvesOpen, ln); };
ln = inp.ReadLine(); if (ln != ValvesClose) { diff.AppendFormat(fmt, "ValvesClose", ValvesClose, ln); };
ln = inp.ReadLine(); if (ln != RegulValvesPct) { diff.AppendFormat(fmt, "RegulValvesPct", RegulValvesPct, ln); };
ln = inp.ReadLine(); if (ln != PumpWithFMPcts) { diff.AppendFormat(fmt, "PumpWithFMPcts", PumpWithFMPcts, ln); };
return diff.ToString();
}
}
}
-20
View File
@@ -1,20 +0,0 @@
///
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using System;
namespace Config.Entities
{
public class Uncertainty
{
public virtual int Id { get; protected set; }
public virtual float Measurement { get; set; }
public virtual float MainUncertainty { get; set; }
public virtual float Resolution { get; set; }
public virtual float DriftPerYr { get; set; }
public virtual float Conditions { get; set; }
public virtual float UncertaintyOfCorrection { get; set; }
public Uncertainty() { }
}
}
+2 -6
View File
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2013-2019 Sensus Slovensko a.s.
/// Copyright (c) 2013-2017 Sensus Metering Systems
///
using System;
using System.Collections.Generic;
@@ -11,12 +11,8 @@ namespace Config.Entities
public virtual int Id { get; protected set; }
public virtual string UserName { get; set; } /// = name, alias, abbreviation
public virtual string FullName { get; set; } /// = description
public virtual string Tag { get; set; }
public virtual int Number { get; set; }
public virtual int Number { get; set; }
public virtual string Password { get; set; }
public virtual string Password2 { get; set; }
public virtual string Password3 { get; set; }
public virtual string Password4 { get; set; }
public virtual DateTime LastPwChange { get; set; }
public virtual IList<Group> Groups { get; set; } //User can be a member of a list of groups
+1 -21
View File
@@ -1,9 +1,8 @@
///
/// Copyright (c) 2013-2018 Sensus Slovensko a.s.
/// Copyright (c) 2013-2015 Sensus Metering Systems
///
using System;
using System.Collections.Generic;
using System.IO;
namespace Config.Entities
{
@@ -36,24 +35,5 @@ namespace Config.Entities
foreach (var step in VirtualBenchSteps) { result.VirtualBenchSteps.Add(step.Clone()); }
return result;
}
public virtual void Export(StreamWriter output)
{
/// TODO
}
public static VirtualBenchSequence Import(StreamReader input)
{
VirtualBenchSequence result = new VirtualBenchSequence();
/// TODO
return result;
}
public virtual string Compare(StreamReader inp)
{
System.Text.StringBuilder diff = new System.Text.StringBuilder();
/// TODO
return diff.ToString();
}
}
}
+69 -14
View File
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2013-2018 Sensus Slovensko a.s.
/// Copyright (c) 2013-2015 Sensus Metering Systems
///
using System;
using System.Windows.Forms;
@@ -39,11 +39,7 @@ namespace Config
dbType = Data.CurrentBench.WaterMetersDBSettings.DbType;
connectionString = Data.CurrentBench.WaterMetersDBSettings.ConnectionString;
break;
case Users.Entities.DBKind.RemoteConfig:
dbType = Data.CurrentBench.UsersDBSettings.DbType;
connectionString = Data.CurrentBench.UsersDBSettings.ConnectionString;
break;
}
}
return CreateSessionFactory(database, dbType, connectionString, false);
}
@@ -73,7 +69,6 @@ namespace Config
{
default:
case Users.Entities.DBKind.Config:
case Users.Entities.DBKind.RemoteConfig:
cfg = cfg.Mappings(m => m.FluentMappings.AddFromAssemblyOf<Data>());
break;
case Users.Entities.DBKind.Results:
@@ -127,6 +122,41 @@ namespace Config
return SessionFactories[ix].OpenSession();
}
public static void SaveToDb(Users.Entities.DBKind database, object obj)
{
SaveToDb(CreateSession(database), obj);
}
public static void SaveToDb(ISession session, object obj)
{
using (var transaction = session.BeginTransaction())
{
try
{
session.SaveOrUpdate(obj);
transaction.Commit();
}
catch
{
transaction.Rollback();
}
}
}
public static void DeleteFromDb(Users.Entities.DBKind database, object obj)
{
DeleteFromDb(CreateSession(database), obj);
}
public static void DeleteFromDb(ISession session, object obj)
{
using (var transaction = session.BeginTransaction())
{
session.Delete(obj);
transaction.Commit();
}
}
/// <summary>
/// Create an empty users database.
/// Database contains only the user 'admin' and the control board component 'CB'.
@@ -147,13 +177,13 @@ namespace Config
///
/// Prepare all groups
///
var testers = new Config.Entities.Group(Users.Entities.GID.Testers);
var testingSpecialists = new Config.Entities.Group(Users.Entities.GID.TestingSpecialists);
var headOfLab = new Config.Entities.Group(Users.Entities.GID.HeadOfLab);
var maintenanceSpecialists = new Config.Entities.Group(Users.Entities.GID.MaintenanceSpecialists);
var metrologists = new Config.Entities.Group(Users.Entities.GID.Metrologists);
var calibrationSpecialists = new Config.Entities.Group(Users.Entities.GID.CalibrationSpecialists);
var administrators = new Config.Entities.Group(Users.Entities.GID.Administrators);
var testers = new Config.Entities.Group((int)Users.Grp.GID.Testers, Strings.Tester);
var testingSpecialists = new Config.Entities.Group((int)Users.Grp.GID.TestingSpecialists, Strings.Testing_Specialist);
var headOfLab = new Config.Entities.Group((int)Users.Grp.GID.HeadOfLab, Strings.Head_of_Lab);
var maintenanceSpecialists = new Config.Entities.Group((int)Users.Grp.GID.MaintenanceSpecialists, Strings.Maintenance_Specialist);
var metrologists = new Config.Entities.Group((int)Users.Grp.GID.Metrologists, Strings.Metrologist);
var calibrationSpecialists = new Config.Entities.Group((int)Users.Grp.GID.CalibrationSpecialists, Strings.Calibration_Specialist);
var administrators = new Config.Entities.Group((int)Users.Grp.GID.Administrators, Strings.Administrator);
/// Create the user 'admin' add his groups
var admin = new Config.Entities.User
@@ -183,5 +213,30 @@ namespace Config
return true;
}
/// <summary>
/// Create an empty water meters database
/// </summary>
/// <param name="dbType">DBType.SQLite or DBType.MySql</param>
/// <param name="connectionString">Connection string</param>
/// <returns>true=success, false=error</returns>
public static bool CreateEmptyResultsDB(Users.Entities.DBType dbType, string connectionString)
{
ISessionFactory sessionFactory = CreateSessionFactory(Users.Entities.DBKind.Results, dbType, connectionString, true);
if (sessionFactory == null) return false;
/// Populate the database
//using (var session = sessionFactory.OpenSession())
//{
// using (var transaction = session.BeginTransaction())
// {
// /// Create one component
// var cmpnt = (new BenchControl.Elde.ControlBoardCfg("CB", 1)).CreateDbEntity();
// session.SaveOrUpdate(cmpnt);
// transaction.Commit();
// }
//}
return true;
}
}
}
+2 -5
View File
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2013-2019 Sensus Slovensko a.s.
/// Copyright (c) 2013-2015 Sensus Metering Systems
///
using FluentNHibernate.Mapping;
using Config.Entities;
@@ -23,9 +23,6 @@ namespace Config.Mappings
HasMany(x => x.Corrections)
.OrderBy("Measurement")
.Cascade.All();
HasMany(x => x.Uncertainties)
.OrderBy("Measurement")
.Cascade.All();
}
}
}
}
+3 -2
View File
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2013-2019 Sensus Slovensko a.s.
/// Copyright (c) 2013-2015 Sensus Metering Systems
///
using FluentNHibernate.Mapping;
@@ -10,7 +10,8 @@ namespace Config.Mappings
public GroupMap()
{
Id(x => x.Id);
Map(x => x.GID).Column("Name"); ;
Map(x => x.Gid);
Map(x => x.Name);
}
}
}
-58
View File
@@ -1,58 +0,0 @@
///
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using FluentNHibernate.Mapping;
using Config.Entities;
namespace Config.Mappings
{
class PTestMap : ClassMap<PTest>
{
public PTestMap()
{
Id(x => x.Id);
Map(x => x.ItemNr);
Map(x => x.Name);
Map(x => x.Part);
Map(x => x.CoefQfrom);
Map(x => x.CoefQto);
Map(x => x.ErrLimLo);
Map(x => x.ErrLimHi);
Map(x => x.TempLimLo);
Map(x => x.TempLimHi);
Map(x => x.PressLimLo);
Map(x => x.PressLimHi);
Map(x => x.E1);
Map(x => x.E2);
Map(x => x.E3);
Map(x => x.E4);
Map(x => x.E5);
Map(x => x.E6);
Map(x => x.E7);
Map(x => x.E8);
Map(x => x.E9);
Map(x => x.E10);
Map(x => x.E11);
Map(x => x.E12);
Map(x => x.E13);
Map(x => x.E14);
Map(x => x.E15);
Map(x => x.E16);
Map(x => x.E21);
Map(x => x.Delta_Q_pct);
Map(x => x.Delta_T);
Map(x => x.Delta_Tup_Tdn);
Map(x => x.TestTime_min);
Map(x => x.TestTime_max);
Map(x => x.AmbTemp_min);
Map(x => x.AmbTemp_max);
Map(x => x.Coef_E9);
Map(x => x.Coef_E10);
Map(x => x.Coef_E11);
Map(x => x.Coef_E12);
Map(x => x.Offset_E9);
Map(x => x.Offset_E12);
References(x => x.Profile);
}
}
}
-28
View File
@@ -1,28 +0,0 @@
///
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using FluentNHibernate.Mapping;
using Config.Entities;
namespace Config.Mappings
{
class ProfileMap : ClassMap<Profile>
{
public ProfileMap()
{
Id(x => x.Id);
Map(x => x.ItemNr);
Map(x => x.Name);
Map(x => x.Description);
Map(x => x.CreationUser);
Map(x => x.CreationTime);
Map(x => x.LastChgUser);
Map(x => x.LastChgTime);
Map(x => x.ProfileType);
Map(x => x.ErrorLimitType);
HasMany(x => x.Tests)
.OrderBy("ItemNr")
.Cascade.All();
}
}
}
+9 -16
View File
@@ -14,21 +14,17 @@ namespace Config.Mappings
Map(x => x.ItemNr);
Map(x => x.Name);
Map(x => x.Part);
Map(x => x.Profile);
Map(x => x.Publish);
Map(x => x.Publish);
Map(x => x.DoEvaluate)
.Column("Evaluate");
#if TEST_PROFILES
Map(x => x.Qtg);
#endif
Map(x => x.Qfrom);
Map(x => x.Qfrom);
Map(x => x.Qto);
Map(x => x.Volume);
Map(x => x.TstTime);
Map(x => x.Repeats);
Map(x => x.DoDraining)
.Column("Emptying");
Map(x => x.DoDrainingAfter)
Map(x => x.DoZeroing)
.Column("Zeroing");
Map(x => x.DoControlWaterTemp);
Map(x => x.TempLimLo);
@@ -49,7 +45,7 @@ namespace Config.Mappings
Map(x => x.Uncertainty);
Map(x => x.TolerRed)
.Column("TolerRed"); /// ???
Map(x => x.RedType);
Map(x => x.RedType); /// ???
Map(x => x.FeedingPath);
Map(x => x.BenchPath);
Map(x => x.OutputPath);
@@ -57,14 +53,11 @@ namespace Config.Mappings
#if HEAT_METERS
Map(x => x.HeatMetersPath);
#endif
Map(x => x.RelTransBefore)
.Column("RelTransBefore");
Map(x => x.RelTransBetween)
.Column("RelTransBetween");
Map(x => x.TransitionAfter)
.Column("TransitionAfter");
HasMany(x => x.MoreParams)
Map(x => x.RelTransBefore);
Map(x => x.RelTransBetween);
Map(x => x.RelTransAfter);
Map(x => x.TransitionAfter);
HasMany(x => x.MoreParams)
.Cascade.All();
References(x => x.Procedure);
}
-22
View File
@@ -1,22 +0,0 @@
///
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using FluentNHibernate.Mapping;
using Config.Entities;
namespace Config.Mappings
{
class UncertaintyMap : ClassMap<Uncertainty>
{
public UncertaintyMap()
{
Id(x => x.Id);
Map(x => x.Measurement);
Map(x => x.MainUncertainty);
Map(x => x.Resolution);
Map(x => x.DriftPerYr);
Map(x => x.Conditions);
Map(x => x.UncertaintyOfCorrection);
}
}
}
+1 -5
View File
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2016-2019 Sensus Slovensko a.s.
/// Copyright (c) 2013-2015 Sensus Metering Systems
///
using FluentNHibernate.Mapping;
@@ -12,11 +12,7 @@ namespace Config.Mappings
Id(x => x.Id);
Map(x => x.UserName).Column("Name");
Map(x => x.Number);
Map(x => x.Tag);
Map(x => x.Password);
Map(x => x.Password2);
Map(x => x.Password3);
Map(x => x.Password4);
Map(x => x.FullName).Column("Description");
Map(x => x.LastPwChange);
HasMany(x => x.Groups)
+2 -2
View File
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.24.1382.0")]
[assembly: AssemblyFileVersion("2.24.1382.0")]
[assembly: AssemblyVersion("2.18.797.0")]
[assembly: AssemblyFileVersion("2.18.797.0")]
+21
View File
@@ -117,6 +117,27 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="Administrator" xml:space="preserve">
<value>Administrator</value>
</data>
<data name="Calibration_Specialist" xml:space="preserve">
<value>Kalibriertechniker</value>
</data>
<data name="Head_of_Lab" xml:space="preserve">
<value>Laborleiter</value>
</data>
<data name="Maintenance_Specialist" xml:space="preserve">
<value>Wartungstechniker</value>
</data>
<data name="Metrologist" xml:space="preserve">
<value>Messtechniker</value>
</data>
<data name="Tester" xml:space="preserve">
<value>Prüfer</value>
</data>
<data name="Testing_Specialist" xml:space="preserve">
<value>Prüftechniker</value>
</data>
<data name="Failed" xml:space="preserve">
<value>NiO</value>
</data>
+21
View File
@@ -117,6 +117,27 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="Administrator" xml:space="preserve">
<value>Amministratore</value>
</data>
<data name="Calibration_Specialist" xml:space="preserve">
<value>esperto in calibrazione</value>
</data>
<data name="Head_of_Lab" xml:space="preserve">
<value>capo di laboratorio</value>
</data>
<data name="Maintenance_Specialist" xml:space="preserve">
<value>esperto di manutenzione</value>
</data>
<data name="Metrologist" xml:space="preserve">
<value>metrologo</value>
</data>
<data name="Tester" xml:space="preserve">
<value>tester</value>
</data>
<data name="Testing_Specialist" xml:space="preserve">
<value>esperto di prove </value>
</data>
<data name="Failed" xml:space="preserve">
<value>NOK</value>
</data>
+21
View File
@@ -117,6 +117,27 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="Administrator" xml:space="preserve">
<value>Administrator</value>
</data>
<data name="Calibration_Specialist" xml:space="preserve">
<value>Specjalista ds. kalibracji</value>
</data>
<data name="Head_of_Lab" xml:space="preserve">
<value>Kierownik Laboratorium</value>
</data>
<data name="Maintenance_Specialist" xml:space="preserve">
<value>Konserwator</value>
</data>
<data name="Metrologist" xml:space="preserve">
<value>Metrolog</value>
</data>
<data name="Tester" xml:space="preserve">
<value>Pracownik przeprowadzający testy</value>
</data>
<data name="Testing_Specialist" xml:space="preserve">
<value>Specjalista ds. testów</value>
</data>
<data name="Failed" xml:space="preserve">
<value>Niepowodzenie</value>
</data>
+21
View File
@@ -117,6 +117,27 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="Administrator" xml:space="preserve">
<value>Administrator</value>
</data>
<data name="Calibration_Specialist" xml:space="preserve">
<value>Calibration Specialist</value>
</data>
<data name="Head_of_Lab" xml:space="preserve">
<value>Head of Lab</value>
</data>
<data name="Maintenance_Specialist" xml:space="preserve">
<value>Maintenance Specialist</value>
</data>
<data name="Metrologist" xml:space="preserve">
<value>Metrologist</value>
</data>
<data name="Tester" xml:space="preserve">
<value>Tester</value>
</data>
<data name="Testing_Specialist" xml:space="preserve">
<value>Testing Specialist</value>
</data>
<data name="Failed" xml:space="preserve">
<value>NOK</value>
</data>
+21
View File
@@ -117,6 +117,27 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="Administrator" xml:space="preserve">
<value>Администратор</value>
</data>
<data name="Calibration_Specialist" xml:space="preserve">
<value>Специалист по калибровке</value>
</data>
<data name="Head_of_Lab" xml:space="preserve">
<value>Руководитель лаборатории</value>
</data>
<data name="Maintenance_Specialist" xml:space="preserve">
<value>Специалист по техобслуживанию</value>
</data>
<data name="Metrologist" xml:space="preserve">
<value>Метролог</value>
</data>
<data name="Tester" xml:space="preserve">
<value>Контролер</value>
</data>
<data name="Testing_Specialist" xml:space="preserve">
<value>Специалист по тестированию</value>
</data>
<data name="Failed" xml:space="preserve">
<value>NOK</value>
</data>
+124 -125
View File
@@ -1,129 +1,128 @@
<?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.
<!--
Microsoft ResX Schema
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>
<data name="Error" xml:space="preserve">
<value>错误 Error</value>
</data>
<data name="Failed" xml:space="preserve">
<value>NOK</value>
</data>
<data name="Passed" xml:space="preserve">
<value>好</value>
</data>
Version 1.3
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">1.3</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1">this is my long string</data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
[base64 mime encoded serialized .NET Framework object]
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
[base64 mime encoded string representing a byte array form of the .NET Framework object]
</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.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:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<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" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</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>1.3</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="Administrator" xml:space="preserve">
<value>管理员</value>
</data>
<data name="Calibration_Specialist" xml:space="preserve">
<value>校准专员</value>
</data>
<data name="Failed" xml:space="preserve">
<value>NOK</value>
</data>
<data name="Head_of_Lab" xml:space="preserve">
<value>实验室负责人</value>
</data>
<data name="Maintenance_Specialist" xml:space="preserve">
<value>维护专员</value>
</data>
<data name="Metrologist" xml:space="preserve">
<value>计量者</value>
</data>
<data name="Passed" xml:space="preserve">
<value>好</value>
</data>
<data name="Tester" xml:space="preserve">
<value>测试仪</value>
</data>
<data name="Testing_Specialist" xml:space="preserve">
<value>测试专员</value>
</data>
</root>
+12 -87
View File
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2016-2018 Sensus Slovensko a.s.
/// Copyright (c) 2016-2017 Sensus Slovensko a.s.
///
using System;
using System.Reflection;
@@ -11,12 +11,6 @@ namespace Config
{
[Description("---")] None,
[Description("imp.")] pulse,
#if LANG_PL
[Description("stopień")] degree,
#else
[Description("degree")] degree,
#endif
[Description("l")] l, /// * 1 liter
[Description("dm3")] dm3, /// 1 dm3 = 1 liter
[Description("m3")] m3, /// 1000 l
@@ -36,7 +30,7 @@ namespace Config
[Description("hr")] hour, /// 1 hour = 60 min = 3600 s
[Description("ms")] ms, /// 1 ms = 0.001 s
[Description("°C")] C, /// * degree Celsius (°C)
[Description("°C")] C, /// * degree Celsius
[Description("°F")] F, /// degree Fahrenheit
[Description("K")] K, /// degree Kelvin
@@ -68,28 +62,9 @@ namespace Config
[Description("kWh")] kWh, /// 1 kWh = 3600000 J
[Description("MWh")] MWh, /// 1 MWh = 3600000000 J
#if LANG_PL
[Description("imp/l")] ppl, /// * 1 pulse/l
[Description("imp/dm3")] ppdm3, /// * 1 pulse/dm3
[Description("stopień/l")] degpl, /// * 1 degree/l
[Description("stopień/dm3")] degpdm3, /// * 1 degree/dm3
[Description("l/imp")] lpp, /// * 1 l/pulse
[Description("dm3/imp")] dm3pp, /// * 1 dm3/pulse
[Description("l/stopień")] lpdeg, /// * 1 l/degree
[Description("dm3/stopień")] dm3pdeg, /// * 1 dm3/degree
#else
[Description("pulse/l")] ppl, /// * 1 pulse/l
[Description("pulse/dm3")] ppdm3, /// * 1 pulse/dm3
[Description("degree/l")] degpl, /// * 1 degree/l
[Description("degree/dm3")] degpdm3, /// * 1 degree/dm3
[Description("l/pulse")] lpp, /// * 1 l/pulse
[Description("dm3/pulse")] dm3pp, /// * 1 dm3/pulse
[Description("l/degree")] lpdeg, /// * 1 l/degree
[Description("dm3/degree")] dm3pdeg, /// * 1 dm3/degree
#endif
///
///
[Description("pulse/kWh")] ppkWh, /// * 1 pulse/kWh
[Description("kWh/pulse")] kWhpp, /// * 1 kWh/pulse
Count
}
@@ -109,7 +84,6 @@ namespace Config
[Description("Länge")] Length,
[Description("Dichte")] Density,
[Description("Energie")] Energy,
[Description("Impulse")] Pulses,
[Description("Impulse/l")] PulsePerLtr,
[Description("Impulse/kWh")] PulsePerKWh,
@@ -119,7 +93,7 @@ namespace Config
[Description("Boolean")] Boolean,
[Description("Datum und Uhrzeit")] DateTime,
#elif LANG_PL
[Description("Objętość")] Volume,
[Description("Objętość")] Volume,
[Description("Przepływ")] Flow,
[Description("Masa")] Mass,
[Description("Czas")] Time,
@@ -130,7 +104,6 @@ namespace Config
[Description("Długość")] Length,
[Description("Gęstość")] Density,
[Description("Energia")] Energy,
[Description("Impulsy")] Pulses,
[Description("Impulsy/litr")] PulsePerLtr,
[Description("Impulsy/kWh")] PulsePerKWh,
@@ -151,7 +124,6 @@ namespace Config
[Description("Délka")] Length,
[Description("Hustota")] Density,
[Description("Energie")] Energy,
[Description("Pulzy")] Pulses,
[Description("Pulzy/litr")] PulsePerLtr,
[Description("Pulzy/kWh")] PulsePerKWh,
@@ -160,29 +132,8 @@ namespace Config
[Description("Text")] String,
[Description("Boolean")] Boolean,
[Description("Datum a čas")] DateTime,
#elif LANG_IT
[Description("Volume")] Volume,
[Description("Flusso")] Flow,
[Description("Massa")] Mass,
[Description("Tempo")] Time,
[Description("Temperatura")] Temperature,
[Description("Pressione")] Pressure,
[Description("Umidità")] Humidity,
[Description("Errore")] Error,
[Description("Lungezza")] Length,
[Description("Densità")] Density,
[Description("Energia")] Energy,
[Description("Impulso")] Pulses,
[Description("Impulso/litro")] PulsePerLtr,
[Description("Impulso/kWh")] PulsePerKWh,
/// Quantities without units and conversions
[Description("Numero")] Number,
[Description("Stringa")] String,
[Description("Boolean")] Boolean,
[Description("Data e ora")] DateTime,
#else
[Description("Volume")] Volume,
[Description("Volume")] Volume,
[Description("Flow")] Flow,
[Description("Mass")] Mass,
[Description("Time")] Time,
@@ -193,7 +144,6 @@ namespace Config
[Description("Length")] Length,
[Description("Density")] Density,
[Description("Energy")] Energy,
[Description("Pulses")] Pulses,
[Description("Pulses/liter")] PulsePerLtr,
[Description("Pulses/kWh")] PulsePerKWh,
@@ -203,7 +153,7 @@ namespace Config
[Description("Boolean")] Boolean,
[Description("Date and time")] DateTime,
#endif
Count,
Count,
}
public static class Units
@@ -228,10 +178,6 @@ namespace Config
{
switch (units)
{
case Unit.pulse:
case Unit.degree:
return Config.Quantity.Pulses;
case Unit.l:
case Unit.dm3:
case Unit.m3:
@@ -295,17 +241,9 @@ namespace Config
return Config.Quantity.Energy;
case Unit.ppl:
case Unit.ppdm3:
case Unit.degpl:
case Unit.degpdm3:
case Unit.lpp:
case Unit.dm3pp:
case Unit.lpdeg:
case Unit.dm3pdeg:
return Config.Quantity.PulsePerLtr;
case Unit.ppkWh:
case Unit.kWhpp:
return Config.Quantity.PulsePerKWh;
default:
@@ -324,7 +262,6 @@ namespace Config
public static bool IsLength(Unit units) { return IsQuantity(units, Config.Quantity.Length); }
public static bool IsDensity(Unit units) { return IsQuantity(units, Config.Quantity.Density); }
public static bool IsEnergy(Unit units) { return IsQuantity(units, Config.Quantity.Energy); }
public static bool IsPulses(Unit units) { return IsQuantity(units, Config.Quantity.Pulses); }
public static bool IsPulsePerLtr(Unit units) { return IsQuantity(units, Config.Quantity.PulsePerLtr); }
public static bool IsPulsePerKWh(Unit units) { return IsQuantity(units, Config.Quantity.PulsePerKWh); }
@@ -356,8 +293,8 @@ namespace Config
case Unit.hour: return v / 3600;
case Unit.ms: return 1000 * v;
/// Temperature: internal representation in °C
case Unit.C: return v; /// degree Celsius (°C)
/// Temperature: internal representation in degree C
case Unit.C: return v; /// degree Celsius
case Unit.F: return 1.8 * v + 32; /// degree Fahrenheit
case Unit.K: return v + 273.15; /// degree Kelvin
@@ -392,13 +329,7 @@ namespace Config
case Unit.kWh: return v / 3600000.0; /// 1 kWh = 3600000 J
case Unit.MWh: return v / 3600000000.0;/// 1 MWh = 3600000000 J
case Unit.kWhpp:
case Unit.lpp:
case Unit.dm3pp:
case Unit.lpdeg:
case Unit.dm3pdeg: return ((v <= float.Epsilon) ? 0 : 1 / v);
default: return v;
default: return v;
}
}
@@ -429,8 +360,8 @@ namespace Config
case Unit.hour: return 3600 * v;
case Unit.ms: return v / 1000;
/// Temperature: internal representation in °C
case Unit.C: return v; /// degree Celsius (°C)
/// Temperature: internal representation in degree C
case Unit.C: return v; /// degree Celsius
case Unit.F: return 5 * (v-32) / 9; /// degree Fahrenheit
case Unit.K: return v - 273.15; /// degree Kelvin
@@ -465,13 +396,7 @@ namespace Config
case Unit.kWh: return 3600000 * v; /// 1 kWh = 3600000 J
case Unit.MWh: return 3600000000 * v; /// 1 kWh = 3600000000 J
case Unit.kWhpp:
case Unit.lpp:
case Unit.dm3pp:
case Unit.lpdeg:
case Unit.dm3pdeg: return ((v == 0) ? 0 : 1 / v);
default: return v;
default: return v;
}
}
}
-256
View File
@@ -1,256 +0,0 @@
///
/// Copyright (c) 2017-2018 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Config
{
public static class Utils
{
public static string SignificantDigitsToFmt(double value, int sigDigits)
{
if (sigDigits == 6)
{
if (value >= 99999.5 || value < -99999.5) return "F0";
else if (value >= 9999.95 || value < -9999.95) return "F1";
else if (value >= 999.995 || value < -999.995) return "F2";
else if (value >= 99.9995 || value < -99.9995) return "F3";
else if (value >= 9.99995 || value < -9.99995) return "F4";
else if (value >= 0.999995 || value < -0.999995) return "F5";
else if (value >= 0.0999995 || value < -0.0999995) return "F6";
else if (value >= 0.00999995 || value < -0.00999995) return "F7";
else if (value >= 0.000999995 || value < -0.000999995) return "F8";
else if (value >= 0.0000999995 || value < -0.0000999995) return "F9";
else return "F10";
}
else if (sigDigits == 5)
{
if (value >= 9999.5 || value < -9999.5) return "F0";
else if (value >= 999.95 || value < -999.95) return "F1";
else if (value >= 99.995 || value < -99.995) return "F2";
else if (value >= 9.9995 || value < -9.9995) return "F3";
else if (value >= 0.99995 || value < -0.99995) return "F4";
else if (value >= 0.099995 || value < -0.099995) return "F5";
else if (value >= 0.0099995 || value < -0.0099995) return "F6";
else if (value >= 0.00099995 || value < -0.00099995) return "F7";
else if (value >= 0.000099995 || value < -0.000099995) return "F8";
else return "F9";
}
else if (sigDigits == 4)
{
if (value >= 999.5 || value < -999.5) return "F0";
else if (value >= 99.95 || value < -99.95) return "F1";
else if (value >= 9.995 || value < -9.995) return "F2";
else if (value >= 0.9995 || value < -0.9995) return "F3";
else if (value >= 0.09995 || value < -0.09995) return "F4";
else if (value >= 0.009995 || value < -0.009995) return "F5";
else if (value >= 0.0009995 || value < -0.0009995) return "F6";
else if (value >= 0.00009995 || value < -0.00009995) return "F7";
else return "F8";
}
else if (sigDigits == 3)
{
if (value >= 99.5 || value < -99.5) return "F0";
else if (value >= 9.95 || value < -9.95) return "F1";
else if (value >= 0.995 || value < -0.995) return "F2";
else if (value >= 0.0995 || value < -0.0995) return "F3";
else if (value >= 0.00995 || value < -0.00995) return "F4";
else if (value >= 0.000995 || value < -0.000995) return "F5";
else if (value >= 0.0000995 || value < -0.0000995) return "F6";
else return "F7";
}
else if (sigDigits == 2)
{
if (value >= 9.5 || value < -9.5) return "F0";
else if (value >= 0.95 || value < -0.95) return "F1";
else if (value >= 0.095 || value < -0.095) return "F2";
else if (value >= 0.0095 || value < -0.0095) return "F3";
else if (value >= 0.00095 || value < -0.00095) return "F4";
else if (value >= 0.000095 || value < -0.000095) return "F5";
else return "F6";
}
else /// if (sigDigits == 1)
{
if (value >= 0.95 || value < -0.95) return "F0";
else if (value >= 0.095 || value < -0.095) return "F1";
else if (value >= 0.0095 || value < -0.0095) return "F2";
else if (value >= 0.00095 || value < -0.00095) return "F3";
else if (value >= 0.000095 || value < -0.000095) return "F4";
else return "F5";
}
}
/// <summary>
/// Extract and return a DB server from a MySQL connection string.
/// </summary>
public static string GetDBServer(string connectionString)
{
return GetFromConnectionString(connectionString, new string[] { "SERVER=" });
}
/// <summary>
/// Extract and return a DB name from a MySQL connection string.
/// </summary>
public static string GetDBName(string connectionString)
{
return GetFromConnectionString(connectionString, new string[] { "DATABASE=" });
}
/// <summary>
/// Extract and return a username from a MySQL connection string
/// </summary>
public static string GetDBUser(string connectionString)
{
return GetFromConnectionString(connectionString, new string[] { "USER=", "UID=" });
}
/// <summary>
/// Extract and return a password from a MySQL connection string
/// </summary>
public static string GetDBPassword(string connectionString)
{
return GetFromConnectionString(connectionString, new string[] { "PASSWORD=", "PWD=" });
}
/// <summary>
/// Extract and return an element of a MySQL connection string
/// (a host, a database, a user name or a password).
/// Return an empty string on any error.
/// </summary>
public static string GetFromConnectionString(string connectionString, string[] patterns)
{
foreach (var pattern in patterns)
{
int startIx = connectionString.IndexOf(pattern);
if (startIx >= 0)
{
/// pattern found, extract the subsequent element
startIx += pattern.Length;
int endIx = connectionString.IndexOf(';', startIx);
return (endIx > 0) ? connectionString.Substring(startIx, endIx - startIx) : string.Empty;
}
}
/// pattern NOT found
return string.Empty;
}
/// <summary>
/// Get either Q1 or Qmin flow for a given Qn and metrological class
/// </summary>
/// <param name="Qn">Nominal flow in m3/h</param>
/// <param name="metroClass">Metrological class ("A" ,"B", "C" or "R#")</param>
/// <param name="medium">NotSpecified, ColdWater or HotWater</param>
/// <param name="Qdflt">Default flow when metrologic does not match pattern</param>
/// <returns>Q1 or Qmin flow in m3/h</returns>
public static double GetQ1Qmin(double Qn, string metroClass, Entities.Medium medium = Entities.Medium.ColdWater, double Qdflt = 0)
{
if (string.IsNullOrEmpty(metroClass)) return Qdflt;
int metroClassRatio;
if ((metroClass[0] == 'R') && int.TryParse(metroClass.Substring(1), out metroClassRatio) && (metroClassRatio > 0))
{
return Qn / (double)metroClassRatio;
}
else
{
if (medium == Entities.Medium.HotWater)
{
switch (metroClass)
{
case "A": return (Qn < 15) ? (0.04 * Qn) : (0.08 * Qn);
case "B": return (Qn < 15) ? (0.02 * Qn) : (0.04 * Qn);
case "C": return (Qn < 15) ? (0.01 * Qn) : (0.02 * Qn);
case "D": return (Qn < 15) ? (0.01 * Qn) : Qdflt;
default: break;
}
}
else
{
switch (metroClass)
{
case "A": return (Qn < 15) ? (0.04 * Qn) : (0.08 * Qn);
case "B": return (Qn < 15) ? (0.02 * Qn) : (0.03 * Qn);
case "C": return (Qn < 15) ? (0.01 * Qn) : (0.006 * Qn);
default: break;
}
}
}
return Qdflt;
}
/// <summary>
/// Get either Q2 or Qt flow for a given Qn and metrological class
/// </summary>
/// <param name="Qn">Nominal flow in m3/h</param>
/// <param name="metroClass">Metrological class ("A" ,"B", "C" or "R#")</param>
/// <param name="medium">NotSpecified, ColdWater or HotWater</param>
/// <param name="Qdflt">Default flow when metrologic does not match pattern</param>
/// <returns>Q2 or Qt flow in m3/h</returns>
public static double GetQ2Qt(double Qn, string metroClass, Entities.Medium medium = Entities.Medium.ColdWater, double Qdflt = 0)
{
if (string.IsNullOrEmpty(metroClass)) return Qdflt;
int metroClassRatio;
if ((metroClass[0] == 'R') && int.TryParse(metroClass.Substring(1), out metroClassRatio) && (metroClassRatio > 0))
{
return 1.6 * Qn / (double)metroClassRatio;
}
if (medium == Entities.Medium.HotWater)
{
switch (metroClass)
{
case "A": return (Qn < 15) ? (0.1 * Qn) : (0.2 * Qn);
case "B": return (Qn < 15) ? (0.08 * Qn) : (0.15 * Qn);
case "C": return (Qn < 15) ? (0.06 * Qn) : (0.1 * Qn);
case "D": return (Qn < 15) ? (0.015 * Qn) : Qdflt;
default: break;
}
}
else
{
switch (metroClass)
{
case "A": return (Qn < 15) ? (0.1 * Qn) : (0.3 * Qn);
case "B": return (Qn < 15) ? (0.08 * Qn) : (0.2 * Qn);
case "C": return (Qn < 15) ? (0.015 * Qn) : (0.015 * Qn);
default: break;
}
}
return Qdflt;
}
/// <summary>
/// Get either Q4 or Qmax flow for a given Qn and metrological class
/// </summary>
/// <param name="Qn">Nominal flow in m3/h</param>
/// <param name="metroClass">Metrological class ("A" ,"B", "C" or "R#")</param>
/// <param name="medium">NotSpecified, ColdWater or HotWater</param>
/// <param name="Qdflt">Default flow when metrologic does not match pattern</param>
/// <returns>Q4 or Qmax flow in m3/h</returns>
public static double GetQ4Qmax(double Qn, string metroClass, Entities.Medium medium = Entities.Medium.ColdWater, double Qdflt = 0)
{
if (string.IsNullOrEmpty(metroClass)) return Qdflt;
switch (metroClass[0])
{
case 'A':
case 'B':
case 'C':
case 'D':
return 2 * Qn;
case 'R':
return 1.25 * Qn;
default:
return Qdflt;
}
}
}
}
-64
View File
@@ -1,64 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{D476ABBE-A455-4476-8A8D-3F6151217B51}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Decrypt</RootNamespace>
<AssemblyName>Decrypt</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkProfile>
</TargetFrameworkProfile>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<PlatformTarget>x86</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<PlatformTarget>x86</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<StartupObject>Decrypt.Program</StartupObject>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
-9
View File
@@ -1,9 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<StartArguments>config.xml</StartArguments>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<StartArguments>config.xml</StartArguments>
</PropertyGroup>
</Project>
-96
View File
@@ -1,96 +0,0 @@
using System;
using System.IO;
using System.Security.Cryptography;
using System.Text;
namespace Decrypt
{
/// <summary>
/// See also:
/// https://www.fluxbytes.com/csharp/encrypt-and-decrypt-files-in-c/
/// </summary>
class Program
{
static byte[] key = new byte[] { 83, 254, 105, 64, 184, 201, 195, 127, 52, 99, 77, 45, 252, 132, 163, 156 };
static byte[] IV = new byte[] { 189, 23, 137, 56, 204, 241, 242, 118, 28, 89, 9, 198, 224, 111, 186, 125 };
static void Main(string[] args)
{
if ((args.Length < 1) || !File.Exists(args[0]))
{
Console.WriteLine("Usage: Decode <file>");
Console.ReadKey();
return;
}
string fileName = args[0];
string intermediateFile = fileName + ".plain"; /// Intermediate file, output of cryptography decoding
string backupFile = fileName + ".bak";
try
{
using (StreamReader reader = new StreamReader(fileName))
{
if (reader.ReadLine().StartsWith("<?xml version="))
{
Console.WriteLine(string.Format("File {0} is not encrypted.", fileName));
Console.ReadKey();
return;
}
}
bool successful = false;
using (RijndaelManaged aes = new RijndaelManaged { Padding = PaddingMode.Zeros })
{
using (FileStream fsCrypt = new FileStream(fileName, FileMode.Open))
{
using (FileStream fsOut = new FileStream(intermediateFile, FileMode.Create))
{
using (ICryptoTransform decryptor = aes.CreateDecryptor(key, IV))
{
using (CryptoStream cs = new CryptoStream(fsCrypt, decryptor, CryptoStreamMode.Read))
{
int data;
while ((data = cs.ReadByte()) != -1)
{
if (data != 0) fsOut.WriteByte((byte)data);
}
successful = true;
}
}
}
}
}
if (successful)
{
/// File decryption successfuly completed => rotate files
if (File.Exists(backupFile)) File.Delete(backupFile);
File.Move(fileName, backupFile);
File.Move(intermediateFile, fileName);
return;
}
else
{
Failed(fileName, intermediateFile, "");
return;
}
}
catch (Exception e)
{
Failed(fileName, intermediateFile, e.Message);
return;
}
}
static void Failed(string fileName, string toBeDeleted, string message)
{
if (File.Exists(toBeDeleted))
{
File.Delete(toBeDeleted);
}
Console.WriteLine(string.Format("Decryption of file {0} failed: {1}", fileName, message));
Console.ReadKey();
}
}
}
-36
View File
@@ -1,36 +0,0 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Decrypt")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Decrypt")]
[assembly: AssemblyCopyright("Copyright © 2019")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("c17ec788-0e12-4f9c-aadf-ea4e83a9f373")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.1.0")]
[assembly: AssemblyFileVersion("1.0.1.0")]
-3
View File
@@ -1,3 +0,0 @@
<?xml version="1.0"?>
<configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
+25 -87
View File
@@ -7,6 +7,7 @@ using System.Threading;
using System.Windows.Forms;
using TBF.BenchControl;
using TBF.BenchControl.Generic;
using TBF.BenchControl.GenericDevices;
using System.Xml.Serialization;
@@ -26,11 +27,11 @@ namespace DeviceTest
IComponentCfg component2Cfg;
IComponentCfg component3Cfg;
static IList<IDevice> tbfDevices;
static IList<IComponent> tbfComponents;
static IComponent tbfComponent1forOp;
static IComponent tbfComponent2forOp;
static IComponent tbfComponent3forOp;
static IList<TBF.BenchControl.Generic.IDevice> tbfDevices;
static IList<TBF.BenchControl.Generic.IComponent> tbfComponents;
static TBF.BenchControl.Generic.IComponent tbfComponent1forOp;
static TBF.BenchControl.Generic.IComponent tbfComponent2forOp;
static TBF.BenchControl.Generic.IComponent tbfComponent3forOp;
static Thread workerThread;
static bool workerThreadRunning;
@@ -55,10 +56,7 @@ namespace DeviceTest
static TBF.Boxes.FloatBox floatBox;
static TBF.Boxes.DoubleBox dblBox1;
static TBF.Boxes.DoubleBox dblBox2;
static TBF.Boxes.DoubleBox dblBox3;
static Event evnt;
static Event evnt;
static DeviceTestDlg()
@@ -70,10 +68,10 @@ namespace DeviceTest
public DeviceTestDlg()
{
InitializeComponent();
compClasses = new List<string>();
radioButton0.Checked = true;
stopButton.Enabled = false;
compClasses = new List<string>();
foreach (var componentFactory in TbfComponents.Factories)
{
compClasses.Add(componentFactory.ClassName);
@@ -275,14 +273,7 @@ namespace DeviceTest
radioButton3.Text = "SelectTank 3";
radioButton4.Text = "SelectTank -";
}
else if (className == "Modbus.QuidoRS")
{
radioButton1.Text = "Close relay 1";
radioButton2.Text = "Close relay 2";
radioButton3.Text = "Close relay 3";
radioButton4.Text = "Open all relays";
}
else radioButton1.Text = "spare";
else radioButton1.Text = "spare";
}
///
void UpdateOperations2(string className)
@@ -302,14 +293,7 @@ namespace DeviceTest
radioButton23.Text = "SelectTank 3";
radioButton24.Text = "SelectTank -";
}
else if (className == "Modbus.QuidoRS")
{
radioButton21.Text = "Close relay 1";
radioButton22.Text = "Close relay 2";
radioButton23.Text = "Close relay 3";
radioButton24.Text = "Open all relays";
}
else radioButton21.Text = "spare";
else radioButton21.Text = "spare";
}
///
void UpdateOperations3(string className)
@@ -329,14 +313,7 @@ namespace DeviceTest
radioButton33.Text = "SelectTank 3";
radioButton34.Text = "SelectTank -";
}
else if (className == "Modbus.QuidoRS")
{
radioButton31.Text = "Close relay 1";
radioButton32.Text = "Close relay 2";
radioButton33.Text = "Close relay 3";
radioButton34.Text = "Open all relays";
}
else radioButton31.Text = "spare";
else radioButton31.Text = "spare";
}
@@ -425,7 +402,7 @@ namespace DeviceTest
cfgControl.Config = parentCfg;
cfgControl.Config.ItemNr = 0;
ComponentParametersDlg cfgForm = new ComponentParametersDlg();
TBF.ComponentParametersDlg cfgForm = new TBF.ComponentParametersDlg();
cfgForm.TbfComponents = new List<Config.Entities.Component>();
cfgForm.ComponentCfgCtrl = cfgControl;
@@ -454,7 +431,7 @@ namespace DeviceTest
cfgControl.Config = component1Cfg;
cfgControl.Config.ItemNr = 1;
ComponentParametersDlg cfgForm = new ComponentParametersDlg();
TBF.ComponentParametersDlg cfgForm = new TBF.ComponentParametersDlg();
///
IList<Config.Entities.Component> compEntities = new List<Config.Entities.Component>();
if (parentFactory != null && parentCfg != null) compEntities.Add(parentCfg.CreateDbEntity());
@@ -488,7 +465,7 @@ namespace DeviceTest
cfgControl.Config = component2Cfg;
cfgControl.Config.ItemNr = 1;
ComponentParametersDlg cfgForm = new ComponentParametersDlg();
TBF.ComponentParametersDlg cfgForm = new TBF.ComponentParametersDlg();
///
IList<Config.Entities.Component> compEntities = new List<Config.Entities.Component>();
if (parentFactory != null && parentCfg != null) compEntities.Add(parentCfg.CreateDbEntity());
@@ -523,7 +500,7 @@ namespace DeviceTest
cfgControl.Config = component3Cfg;
cfgControl.Config.ItemNr = 1;
ComponentParametersDlg cfgForm = new ComponentParametersDlg();
TBF.ComponentParametersDlg cfgForm = new TBF.ComponentParametersDlg();
///
IList<Config.Entities.Component> compEntities = new List<Config.Entities.Component>();
if (parentFactory != null && parentCfg != null) compEntities.Add(parentCfg.CreateDbEntity());
@@ -680,25 +657,13 @@ namespace DeviceTest
operation1 = (tbfComponent1forOp as TBF.BenchControl.Modbus.Easytherm.Easytherm).SetTemperatureOp(10);
operation2 = (tbfComponent1forOp as TBF.BenchControl.Modbus.Easytherm.Easytherm).SetTemperatureOp(20);
}
else if (tbfComponent1forOp is TBF.BenchControl.Modbus.UltrasoundLevelMeter.LevelMeter)
{
operation1 = (tbfComponent1forOp as TBF.BenchControl.Modbus.UltrasoundLevelMeter.LevelMeter).ReadLevelOp(ref dblBox1);
operation2 = (tbfComponent1forOp as TBF.BenchControl.Modbus.UltrasoundLevelMeter.LevelMeter).ReadTempOp(ref dblBox3);
}
else if (tbfComponent1forOp is TBF.BenchControl.Modbus.TankSelector.TankSelector)
else if (tbfComponent1forOp is TBF.BenchControl.Modbus.TankSelector.TankSelector)
{
//operation1 = (tbfComponent1forOp as TBF.BenchControl.Modbus.TankSelector.TankSelector).SelectTankOp(1);
//operation2 = (tbfComponent1forOp as TBF.BenchControl.Modbus.TankSelector.TankSelector).SelectTankOp(2);
//operation3 = (tbfComponent1forOp as TBF.BenchControl.Modbus.TankSelector.TankSelector).SelectTankOp(3);
//operation4 = (tbfComponent1forOp as TBF.BenchControl.Modbus.TankSelector.TankSelector).SelectTankOp(0);
}
else if (tbfComponent3forOp is TBF.BenchControl.Modbus.TankSelector.TankSelector)
{
operation1 = (tbfComponent3forOp as TBF.BenchControl.Modbus.QuidoRS.QuidoRS).SetOutputsOp(1);
operation2 = (tbfComponent3forOp as TBF.BenchControl.Modbus.QuidoRS.QuidoRS).SetOutputsOp(2);
operation3 = (tbfComponent3forOp as TBF.BenchControl.Modbus.QuidoRS.QuidoRS).SetOutputsOp(4);
operation4 = (tbfComponent3forOp as TBF.BenchControl.Modbus.QuidoRS.QuidoRS).SetOutputsOp(0);
}
if (tbfComponent2forOp is TBF.BenchControl.Modbus.PressureMeter.Meret.PressureMeter)
@@ -716,28 +681,16 @@ namespace DeviceTest
}
else if (tbfComponent2forOp is TBF.BenchControl.Modbus.Easytherm.Easytherm)
{
operation21 = (tbfComponent2forOp as TBF.BenchControl.Modbus.Easytherm.Easytherm).SetTemperatureOp(10);
operation22 = (tbfComponent2forOp as TBF.BenchControl.Modbus.Easytherm.Easytherm).SetTemperatureOp(20);
operation21 = (tbfComponent1forOp as TBF.BenchControl.Modbus.Easytherm.Easytherm).SetTemperatureOp(10);
operation22 = (tbfComponent1forOp as TBF.BenchControl.Modbus.Easytherm.Easytherm).SetTemperatureOp(20);
}
else if (tbfComponent2forOp is TBF.BenchControl.Modbus.UltrasoundLevelMeter.LevelMeter)
{
operation21 = (tbfComponent2forOp as TBF.BenchControl.Modbus.UltrasoundLevelMeter.LevelMeter).ReadLevelOp(ref dblBox1);
operation22 = (tbfComponent2forOp as TBF.BenchControl.Modbus.UltrasoundLevelMeter.LevelMeter).ReadTempOp(ref dblBox3);
}
else if (tbfComponent2forOp is TBF.BenchControl.Modbus.TankSelector.TankSelector)
else if (tbfComponent2forOp is TBF.BenchControl.Modbus.TankSelector.TankSelector)
{
//operation21 = (tbfComponent2forOp as TBF.BenchControl.Modbus.TankSelector.TankSelector).SelectTankOp(1);
//operation22 = (tbfComponent2forOp as TBF.BenchControl.Modbus.TankSelector.TankSelector).SelectTankOp(2);
//operation23 = (tbfComponent2forOp as TBF.BenchControl.Modbus.TankSelector.TankSelector).SelectTankOp(3);
//operation24 = (tbfComponent2forOp as TBF.BenchControl.Modbus.TankSelector.TankSelector).SelectTankOp(0);
}
else if (tbfComponent3forOp is TBF.BenchControl.Modbus.TankSelector.TankSelector)
{
operation21 = (tbfComponent3forOp as TBF.BenchControl.Modbus.QuidoRS.QuidoRS).SetOutputsOp(1);
operation22 = (tbfComponent3forOp as TBF.BenchControl.Modbus.QuidoRS.QuidoRS).SetOutputsOp(2);
operation23 = (tbfComponent3forOp as TBF.BenchControl.Modbus.QuidoRS.QuidoRS).SetOutputsOp(4);
operation24 = (tbfComponent3forOp as TBF.BenchControl.Modbus.QuidoRS.QuidoRS).SetOutputsOp(0);
}
if (tbfComponent3forOp is TBF.BenchControl.Modbus.PressureMeter.Meret.PressureMeter)
@@ -755,38 +708,23 @@ namespace DeviceTest
}
else if (tbfComponent3forOp is TBF.BenchControl.Modbus.Easytherm.Easytherm)
{
operation31 = (tbfComponent3forOp as TBF.BenchControl.Modbus.Easytherm.Easytherm).SetTemperatureOp(10);
operation32 = (tbfComponent3forOp as TBF.BenchControl.Modbus.Easytherm.Easytherm).SetTemperatureOp(20);
operation31 = (tbfComponent1forOp as TBF.BenchControl.Modbus.Easytherm.Easytherm).SetTemperatureOp(10);
operation32 = (tbfComponent1forOp as TBF.BenchControl.Modbus.Easytherm.Easytherm).SetTemperatureOp(20);
}
else if (tbfComponent3forOp is TBF.BenchControl.Modbus.UltrasoundLevelMeter.LevelMeter)
{
operation31 = (tbfComponent3forOp as TBF.BenchControl.Modbus.UltrasoundLevelMeter.LevelMeter).ReadLevelOp(ref dblBox1);
operation32 = (tbfComponent3forOp as TBF.BenchControl.Modbus.UltrasoundLevelMeter.LevelMeter).ReadTempOp(ref dblBox3);
}
else if (tbfComponent3forOp is TBF.BenchControl.Modbus.TankSelector.TankSelector)
else if (tbfComponent3forOp is TBF.BenchControl.Modbus.TankSelector.TankSelector)
{
//operation31 = (tbfComponent3forOp as TBF.BenchControl.Modbus.TankSelector.TankSelector).SelectTankOp(1);
//operation32 = (tbfComponent3forOp as TBF.BenchControl.Modbus.TankSelector.TankSelector).SelectTankOp(2);
//operation33 = (tbfComponent3forOp as TBF.BenchControl.Modbus.TankSelector.TankSelector).SelectTankOp(3);
//operation34 = (tbfComponent3forOp as TBF.BenchControl.Modbus.TankSelector.TankSelector).SelectTankOp(0);
}
else if (tbfComponent3forOp is TBF.BenchControl.Modbus.TankSelector.TankSelector)
{
operation31 = (tbfComponent3forOp as TBF.BenchControl.Modbus.QuidoRS.QuidoRS).SetOutputsOp(1);
operation32 = (tbfComponent3forOp as TBF.BenchControl.Modbus.QuidoRS.QuidoRS).SetOutputsOp(2);
operation33 = (tbfComponent3forOp as TBF.BenchControl.Modbus.QuidoRS.QuidoRS).SetOutputsOp(4);
operation34 = (tbfComponent3forOp as TBF.BenchControl.Modbus.QuidoRS.QuidoRS).SetOutputsOp(0);
}
int time = 0;
while (workerThreadRunning)
while (workerThreadRunning)
{
Thread.Sleep(1000);
StateMachine.Time = ++time;
if (workerThreadRunning)
if (workerThreadRunning)
{
foreach (var d in tbfDevices) d.RunDeviceBefore();
+2 -2
View File
@@ -72,10 +72,10 @@ namespace DeviceTest
}
/// Configure and start logging
log4net.Config.XmlConfigurator.Configure(new System.IO.FileInfo(Path.Combine(LocAppDataDir, log4netConfigFName)));
log4net.Config.XmlConfigurator.Configure(new System.IO.FileInfo(LocAppDataDir + log4netConfigFName));
log = LogManager.GetLogger(typeof(Program));
log.Fatal("--------------------------------------------------------------------------------");
log.FatalFormat("DeviceTest ver.{0}", Version);
log.Fatal(string.Format("TBF ver.{0}", Version));
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
-64
View File
@@ -1,64 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{DA9B09F3-A99D-4883-A954-537560453674}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Encrypt</RootNamespace>
<AssemblyName>Encrypt</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkProfile>
</TargetFrameworkProfile>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<PlatformTarget>x86</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<PlatformTarget>x86</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<StartupObject>Encrypt.Program</StartupObject>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
-93
View File
@@ -1,93 +0,0 @@
using System;
using System.IO;
using System.Security.Cryptography;
using System.Text;
namespace Encrypt
{
/// <summary>
/// See also:
/// https://www.fluxbytes.com/csharp/encrypt-and-decrypt-files-in-c/
/// </summary>
class Program
{
static byte[] key = new byte[] { 83, 254, 105, 64, 184, 201, 195, 127, 52, 99, 77, 45, 252, 132, 163, 156 };
static byte[] IV = new byte[] { 189, 23, 137, 56, 204, 241, 242, 118, 28, 89, 9, 198, 224, 111, 186, 125 };
static void Main(string[] args)
{
if ((args.Length < 1) || !File.Exists(args[0]))
{
Console.WriteLine("Usage: Encode <file>");
Console.ReadKey();
return;
}
string fileName = args[0];
string intermediateFile = fileName + ".encrypted"; /// Intermediate file, output of cryptography encoding
string backupFile = fileName + ".bak";
try
{
using (StreamReader reader = new StreamReader(fileName))
{
if (!reader.ReadLine().StartsWith("<?xml version="))
{
Console.WriteLine(string.Format("File {0} is already encrypted.", fileName));
Console.ReadKey();
return;
}
}
bool successful = false;
using (RijndaelManaged aes = new RijndaelManaged { Padding = PaddingMode.Zeros })
{
using (FileStream fsCrypt = new FileStream(intermediateFile, FileMode.Create))
{
using (ICryptoTransform encryptor = aes.CreateEncryptor(key, IV))
{
using (CryptoStream cs = new CryptoStream(fsCrypt, encryptor, CryptoStreamMode.Write))
{
using (FileStream fsIn = new FileStream(fileName, FileMode.Open))
{
int data;
while ((data = fsIn.ReadByte()) != -1) cs.WriteByte((byte)data);
successful = true;
}
}
}
}
}
if (successful)
{
/// File encryption successfuly completed => rotate files
if (File.Exists(backupFile)) File.Delete(backupFile);
File.Move(fileName, backupFile);
File.Move(intermediateFile, fileName);
return;
}
else
{
Failed(fileName, intermediateFile);
return;
}
}
catch (Exception)
{
Failed(fileName, intermediateFile);
return;
}
}
static void Failed(string fileName, string toBeDeleted)
{
if (File.Exists(toBeDeleted))
{
File.Delete(toBeDeleted);
}
Console.WriteLine(string.Format("Encryption of file {0} failed.", fileName));
Console.ReadKey();
}
}
}
-36
View File
@@ -1,36 +0,0 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Encrypt")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Encrypt")]
[assembly: AssemblyCopyright("Copyright © 2019")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("0f602531-6f1f-416e-af4d-9242855715a8")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
-3
View File
@@ -1,3 +0,0 @@
<?xml version="1.0"?>
<configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
-94
View File
@@ -1,94 +0,0 @@
using System;
using System.Text;
namespace GemCard
{
/// <summary>
/// This class represents a command APDU
/// </summary>
public class APDUCommand
{
/// <summary>
/// Minimun size of an APDU command in bytes
/// </summary>
public const int APDU_MIN_LENGTH = 4;
public byte Class; /// Class byte
public byte Ins; /// Instruction byte
public byte P1; /// Parameter P1 byte
public byte P2; /// Parameter P2 byte
public byte[] Data; /// Data to send to the card if any, null if no data to send
public byte Le; /// Number of data expected, 0 if none
/// <summary>
/// Constructor
/// </summary>
/// <param name="bCla">Class byte</param>
/// <param name="bIns">Instruction byte</param>
/// <param name="bP1">Parameter P1 byte</param>
/// <param name="bP2">Parameter P2 byte</param>
/// <param name="baData">Data to send to the card if any, null if no data to send</param>
/// <param name="bLe">Number of data expected, 0 if none</param>
public APDUCommand(byte bCla, byte bIns, byte bP1, byte bP2, byte[] baData, byte bLe)
{
this.Class = bCla;
this.Ins = bIns;
this.P1 = bP1;
this.P2 = bP2;
this.Data = baData;
this.Le = bLe;
}
/// <summary>
/// Update the current APDU with selected parameters
/// </summary>
/// <param name="apduParam">APDU parameters</param>
public void Update(APDUParam apduParam)
{
if (apduParam.UseData) Data = apduParam.Data;
if (apduParam.UseLe) Le = apduParam.Le;
if (apduParam.UseP1) P1 = apduParam.P1;
if (apduParam.UseP2) P2 = apduParam.P2;
if (apduParam.UseChannel) Class += apduParam.Channel;
}
/// <summary>
/// Overrides the ToString method to format to a string the APDUCommand object
/// </summary>
/// <returns></returns>
public override string ToString()
{
string strData = null;
byte bLc = 0;
byte bP3 = Le;
if (Data != null)
{
StringBuilder sData = new StringBuilder(Data.Length * 2);
for (int nI = 0; nI < Data.Length; nI++)
{
sData.AppendFormat("{0:X02}", Data[nI]);
}
strData = "Data=" + sData.ToString();
bLc = (byte) Data.Length;
bP3 = bLc;
}
//string strApdu = string.Format("Class={0:X02} Ins={1:X02} P1={2:X02} P2={3:X02} Le={4:X02} Lc={5:X02} ",
//m_bCla, m_bIns, m_bP1, m_bP2, m_bLe, bLc);
StringBuilder strApdu = new StringBuilder();
strApdu.AppendFormat("Class={0:X02} Ins={1:X02} P1={2:X02} P2={3:X02} P3={4:X02} ",
Class, Ins, P1, P2, bP3);
if (Data != null)
{
strApdu.Append(strData);
}
return strApdu.ToString();
}
}
}
-147
View File
@@ -1,147 +0,0 @@
using System;
namespace GemCard
{
/// <summary>
/// This class is used to update a set of parameters of an APDUCommand object
/// </summary>
public class APDUParam
{
byte bClass;
byte bChannel;
byte bP2;
byte bP1;
byte[] baData;
short nLe;
bool fUseP1;
bool fUseP2;
bool fChannel;
bool fData;
bool fClass;
bool fLe;
/// <summary>
/// Resets the current instance, all flags are set to false
/// </summary>
public void Reset()
{
bClass = 0;
bChannel = 0;
bP2 = 0;
bP1 = 0;
baData = null;
nLe = -1;
fUseP1 = false;
fUseP2 = false;
fChannel = false;
fData = false;
fClass = false;
fLe = false;
}
#region Constructors
public APDUParam()
{
Reset();
}
/// <summary>
/// Copy constructor (used for cloning)
/// </summary>
/// <param name="param"></param>
public APDUParam(APDUParam param)
{
// Copy field
if (param.baData != null)
{
param.baData.CopyTo(baData, 0);
}
this.bClass = param.bClass;
this.bChannel = param.bChannel;
this.bP1 = param.bP1;
this.bP2 = param.bP2;
this.nLe = param.nLe;
// Copy flags field
this.fChannel = param.fChannel;
this.fClass = param.fClass;
this.fData = param.fData;
this.fLe = param.fLe;
this.fUseP1 = param.fUseP1;
this.fUseP2 = param.fUseP2;
}
public APDUParam(byte bClass, byte bP1, byte bP2, byte[] baData, short nLe)
{
this.Class = bClass;
this.P1 = bP1;
this.P2 = bP2;
this.Data = baData;
this.Le = (byte)nLe;
}
#endregion
/// <summary>
/// Clones the current APDUParam instance
/// </summary>
/// <returns></returns>
public APDUParam Clone()
{
return new APDUParam(this);
}
#region Properties
public bool UseClass { get { return fClass; } }
public bool UseChannel { get { return fChannel; } }
public bool UseLe { get { return fLe; } }
public bool UseData { get { return fData; } }
public bool UseP1 { get { return fUseP1; } }
public bool UseP2 { get { return fUseP2; } }
public byte P1
{
get { return bP1; }
set { bP1 = value; fUseP1 = true; }
}
public byte P2
{
get { return bP2; }
set { bP2 = value; fUseP2 = true; }
}
public byte[] Data
{
get { return baData; }
set { baData = value; fData = true; }
}
public byte Le
{
get { return (byte)nLe; }
set { nLe = value; fLe = true; }
}
public byte Channel
{
get { return bChannel; }
set { bChannel = value; fChannel = true; }
}
public byte Class
{
get { return bClass; }
set { bClass = value; fClass = true; }
}
#endregion
}
}
-74
View File
@@ -1,74 +0,0 @@
using System;
using System.Text;
namespace GemCard
{
/// <summary>
/// This class represents the APDU response sent by the card
/// </summary>
public class APDUResponse
{
/// <summary>
/// Status bytes length
/// </summary>
public const int SW_LENGTH = 2;
/// <summary>
/// Response data. Contains the data sent by the card minus the 2 status bytes (SW1, SW2)
/// null if no data were sent by the card
/// </summary>
public byte[] Data;
public byte SW1;
public byte SW2;
/// <summary>
/// Status get property
/// </summary>
public ushort Status
{
get { return (ushort)(((short)SW1 << 8) + (short)SW2); }
}
/// <summary>
/// Constructor from the byte data sent back by the card
/// </summary>
/// <param name="baData">Buffer of data from the card</param>
public APDUResponse(byte[] baData)
{
if (baData.Length > SW_LENGTH)
{
Data = new byte[baData.Length - SW_LENGTH];
for (int nI = 0; nI < baData.Length - SW_LENGTH; nI++)
{
this.Data[nI] = baData[nI];
}
}
this.SW1 = baData[baData.Length - 2];
this.SW2 = baData[baData.Length - 1];
}
/// <summary>
/// Overrides the ToString method to format to a string the APDUResponse object
/// </summary>
/// <returns></returns>
public override string ToString()
{
if (Data != null)
{
StringBuilder sData = new StringBuilder(Data.Length * 2);
for (int nI = 0; nI < Data.Length; nI++)
{
sData.AppendFormat("{0:X02}", Data[nI]);
}
return sData.ToString();
}
else
{
return string.Empty;
}
}
}
}
-58
View File
@@ -1,58 +0,0 @@
using System.Reflection;
using System.Runtime.CompilerServices;
//
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
//
[assembly: AssemblyTitle("")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
//
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.*")]
//
// In order to sign your assembly you must specify a key to use. Refer to the
// Microsoft .NET Framework documentation for more information on assembly signing.
//
// Use the attributes below to control which key is used for signing.
//
// Notes:
// (*) If no key is specified, the assembly is not signed.
// (*) KeyName refers to a key that has been installed in the Crypto Service
// Provider (CSP) on your machine. KeyFile refers to a file which contains
// a key.
// (*) If the KeyFile and the KeyName values are both specified, the
// following processing occurs:
// (1) If the KeyName can be found in the CSP, that key is used.
// (2) If the KeyName does not exist and the KeyFile does exist, the key
// in the KeyFile is installed into the CSP and used.
// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
// When specifying the KeyFile, the location of the KeyFile should be
// relative to the project output directory which is
// %Project Directory%\obj\<configuration>. For example, if your KeyFile is
// located in the project directory, you would specify the AssemblyKeyFile
// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
// documentation for more information on this.
//
[assembly: AssemblyDelaySign(false)]
[assembly: AssemblyKeyFile("")]
[assembly: AssemblyKeyName("")]
-162
View File
@@ -1,162 +0,0 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;
namespace GemCard
{
/// <summary>
/// Values for AttrId of SCardGetAttrib
/// </summary>
public class SCARD_ATTR_VALUE
{
private const uint
SCARD_CLASS_COMMUNICATIONS = 2,
SCARD_CLASS_PROTOCOL = 3,
SCARD_CLASS_MECHANICAL = 6,
SCARD_CLASS_VENDOR_DEFINED = 7,
SCARD_CLASS_IFD_PROTOCOL = 8,
SCARD_CLASS_ICC_STATE = 9,
SCARD_CLASS_SYSTEM = 0x7fff;
private static UInt32 SCardAttrValue(UInt32 attrClass, UInt32 val)
{
return (attrClass << 16) | val;
}
public static UInt32 CHANNEL_ID { get { return SCardAttrValue(SCARD_CLASS_COMMUNICATIONS, 0x0110); } }
public static UInt32 CHARACTERISTICS { get { return SCardAttrValue(SCARD_CLASS_MECHANICAL, 0x0150); } }
public static UInt32 CURRENT_PROTOCOL_TYPE { get { return SCardAttrValue(SCARD_CLASS_IFD_PROTOCOL, 0x0201); } }
public static UInt32 DEVICE_UNIT { get { return SCardAttrValue(SCARD_CLASS_SYSTEM, 0x0001); } }
public static UInt32 DEVICE_FRIENDLY_NAME { get { return SCardAttrValue(SCARD_CLASS_SYSTEM, 0x0003); } }
public UInt32 DEVICE_SYSTEM_NAME { get { return SCardAttrValue(SCARD_CLASS_SYSTEM, 0x0004); } }
public static UInt32 ICC_PRESENCE { get { return SCardAttrValue(SCARD_CLASS_ICC_STATE, 0x0300); } }
public static UInt32 ICC_INTERFACE_STATUS { get { return SCardAttrValue(SCARD_CLASS_ICC_STATE, 0x0301); } }
public static UInt32 ATR_STRING { get { return SCardAttrValue(SCARD_CLASS_ICC_STATE, 0x0303); } }
public static UInt32 ICC_TYPE_PER_ATR { get { return SCardAttrValue(SCARD_CLASS_ICC_STATE, 0x0304); } }
public static UInt32 PROTOCOL_TYPES { get { return SCardAttrValue(SCARD_CLASS_PROTOCOL, 0x0120); } }
public static UInt32 VENDOR_NAME { get { return SCardAttrValue(SCARD_CLASS_VENDOR_DEFINED, 0x0100); } }
public static UInt32 VENDOR_IFD_TYPE { get { return SCardAttrValue(SCARD_CLASS_VENDOR_DEFINED, 0x0101); } }
public static UInt32 VENDOR_IFD_VERSION { get { return SCardAttrValue(SCARD_CLASS_VENDOR_DEFINED, 0x0102); } }
public static UInt32 VENDOR_IFD_SERIAL_NO { get { return SCardAttrValue(SCARD_CLASS_VENDOR_DEFINED, 0x0103); } }
}
/// <summary>
/// Abstract class that adds a basic event management to the ICard interface.
/// </summary>
abstract public class CardBase : ICard
{
protected const uint INFINITE = 0xFFFFFFFF;
protected const uint WAIT_TIME = 250;
protected bool m_bRunCardDetection = true;
protected Thread m_thread = null;
/// <summary>
/// Event handler for the card insertion
/// </summary>
public event EventHandler<CardInsertedEventArgs> OnCardInserted = null;
/// <summary>
/// Event handler for the card removal
/// </summary>
public event EventHandler<CardRemovedEventArgs> OnCardRemoved = null;
~CardBase()
{
// Stop any eventual card detection thread
StopCardEvents();
}
#region Abstract method that implement the ICard interface
abstract public string[] ListReaders();
abstract public void Connect(string Reader, SHARE ShareMode, PROTOCOL PreferredProtocols);
abstract public void Disconnect(DISCONNECT Disposition);
abstract public APDUResponse Transmit(APDUCommand ApduCmd);
abstract public void BeginTransaction();
abstract public void EndTransaction(DISCONNECT Disposition);
abstract public byte[] GetAttribute(UInt32 AttribId);
#endregion
/// <summary>
/// This method should start a thread that checks for card insertion or removal
/// </summary>
/// <param name="Reader"></param>
public void StartCardEvents(string Reader)
{
if (m_thread == null)
{
m_bRunCardDetection = true;
m_thread = new Thread(new ParameterizedThreadStart(RunCardDetection));
m_thread.Start(Reader);
}
}
/// <summary>
/// Stops the card events thread
/// </summary>
public void StopCardEvents()
{
if (m_thread != null)
{
int
nTimeOut = 10,
nCount = 0;
bool m_bStop = false;
m_bRunCardDetection = false;
do
{
if (nCount > nTimeOut)
{
m_thread.Abort();
break;
}
if (m_thread.ThreadState == ThreadState.Aborted)
m_bStop = true;
if (m_thread.ThreadState == ThreadState.Stopped)
m_bStop = true;
Thread.Sleep(200);
++nCount; // Manage time out
}
while (!m_bStop);
m_thread = null;
}
}
/// <summary>
/// This function must implement a card detection mechanism.
///
/// When card insertion is detected, it must call the method CardInserted()
/// When card removal is detected, it must call the method CardRemoved()
///
/// </summary>
/// <param name="Reader">Name of the reader to scan for card event</param>
abstract protected void RunCardDetection(object Reader);
#region Event methods
protected void CardInserted(object sender, CardInsertedEventArgs args)
{
if (OnCardInserted != null) OnCardInserted(sender, args);
}
protected void CardRemoved(object sender, CardRemovedEventArgs args)
{
if (OnCardRemoved != null) OnCardRemoved(sender, args);
}
#endregion
}
}
-173
View File
@@ -1,173 +0,0 @@
using System;
using System.Runtime.InteropServices;
using SCARDSSPLib;
using GemCardExLib;
namespace GemCard
{
/// <summary>
/// Implements the ICard interface using the SCard COM objects from Microsoft and SCardDatabaseEx object
/// for the ListReaders function.
/// </summary>
public class CardCOM : CardBase
{
private ISCard m_itfCard = null;
/// <summary>
/// Default constructor
/// </summary>
public CardCOM()
{
// Create the SCard object
m_itfCard = new CSCardClass();
}
#region ICard Members
/// <summary>
/// Wraps the PCSC function
/// LONG SCardListReaders(SCARDCONTEXT hContext,
/// LPCTSTR mszGroups,
/// LPTSTR mszReaders,
/// LPDWORD pcchReaders
/// );
/// </summary>
/// <returns>A string array of the readers</returns>
public override string[] ListReaders()
{
ISCardDatabaseEx itfCardBase = new SCardDatabaseEx();
return (string[]) itfCardBase.ListReaders();
}
/// <summary>
/// Wraps the PCSC function
/// LONG SCardConnect(
/// IN SCARDCONTEXT hContext,
/// IN LPCTSTR szReader,
/// IN DWORD dwShareMode,
/// IN DWORD dwPreferredProtocols,
/// OUT LPSCARDHANDLE phCard,
/// OUT LPDWORD pdwActiveProtocol
/// );
/// </summary>
/// <param name="Reader"></param>
/// <param name="ShareMode"></param>
/// <param name="PreferredProtocols"></param>
public override void Connect(string Reader, SHARE ShareMode, PROTOCOL PreferredProtocols)
{
// Calls AttachReader to connect to the card
m_itfCard.AttachByReader(Reader, (SCARD_SHARE_MODES) ShareMode, (SCARD_PROTOCOLS) PreferredProtocols);
}
/// <summary>
/// Wraps the PCSC function
/// LONG SCardDisconnect(
/// IN SCARDHANDLE hCard,
/// IN DWORD dwDisposition
/// );
/// </summary>
/// <param name="Disposition"></param>
public override void Disconnect(DISCONNECT Disposition)
{
// Off the connection with the card
m_itfCard.Detach((SCARD_DISPOSITIONS) Disposition);
}
/// <summary>
/// Wraps the PCSC function
/// LONG SCardTransmit(
/// SCARDHANDLE hCard,
/// LPCSCARD_I0_REQUEST pioSendPci,
/// LPCBYTE pbSendBuffer,
/// DWORD cbSendLength,
/// LPSCARD_IO_REQUEST pioRecvPci,
/// LPBYTE pbRecvBuffer,
/// LPDWORD pcbRecvLength
/// );
/// </summary>
/// <param name="ApduCmd">APDUCommand object with the APDU to send to the card</param>
/// <returns>An APDUResponse object with the response from the card</returns>
public override APDUResponse Transmit(APDUCommand ApduCmd)
{
CSCardCmd itfCmd = new CSCardCmdClass();
CByteBuffer itfData = new CByteBufferClass();
int nLe = ApduCmd.Le;
if (ApduCmd.Data == null)
{
itfData.SetSize(0);
}
else
{
int nWrite = 0;
itfData.SetSize(ApduCmd.Data.Length);
itfData.Write(ref ApduCmd.Data[0], ApduCmd.Data.Length, ref nWrite);
}
// Build the APDU command
itfCmd.BuildCmd(ApduCmd.Class, ApduCmd.Ins, ApduCmd.P1, ApduCmd.P2, itfData, ref nLe);
// Send the command
m_itfCard.Transaction(ref itfCmd);
// Analyse the response
int nRead = 0;
byte[] pbResp = new byte[itfCmd.ApduReplyLength];
itfCmd.ApduReply.Read(ref pbResp[0], itfCmd.ApduReplyLength, ref nRead);
return new APDUResponse(pbResp);
}
/// <summary>
/// Wraps the PSCS function
/// LONG SCardBeginTransaction(
/// SCARDHANDLE hCard
// );
/// This function is not supported in the COM implementation
/// </summary>
public override void BeginTransaction()
{
throw new NotImplementedException("BeginTransaction is not supported in the COM implementation");
}
/// <summary>
/// Wraps the PCSC function
/// LONG SCardEndTransaction(
/// SCARDHANDLE hCard,
/// DWORD dwDisposition
/// );
/// This function is not supported in the COM implementation
/// </summary>
/// <param name="Disposition">A value from DISCONNECT enum</param>
public override void EndTransaction(DISCONNECT Disposition)
{
throw new NotImplementedException("EndTransaction is not supported in the COM implementation");
}
/// <summary>
/// Gets the attributes of the card
/// </summary>
/// <param name="AttribId">Identifier for the Attribute to get</param>
/// <returns>Attribute content</returns>
public override byte[] GetAttribute(UInt32 AttribId)
{
throw new NotImplementedException();
}
#endregion
/// <summary>
/// This function must implement a card detection mechanism.
///
/// When card insertion is detected, it must call the method CardInserted()
/// When card removal is detected, it must call the method CardRemoved()
///
/// </summary>
protected override void RunCardDetection(object Reader)
{
throw new Exception("The method or operation is not implemented.");
}
}
}
-9
View File
@@ -1,9 +0,0 @@
using System;
namespace GemCard
{
public class CardInsertedEventArgs : EventArgs
{
public CardInsertedEventArgs() { }
}
}
-620
View File
@@ -1,620 +0,0 @@
using System;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
namespace GemCard
{
/// <summary>
/// CARD_STATE enumeration, used by the PC/SC function SCardGetStatusChanged
/// </summary>
enum CARD_STATE
{
UNAWARE = 0x00000000,
IGNORE = 0x00000001,
CHANGED = 0x00000002,
UNKNOWN = 0x00000004,
UNAVAILABLE = 0x00000008,
EMPTY = 0x00000010,
PRESENT = 0x00000020,
ATRMATCH = 0x00000040,
EXCLUSIVE = 0x00000080,
INUSE = 0x00000100,
MUTE = 0x00000200,
UNPOWERED = 0x00000400
}
/// <summary>
/// Wraps the SCARD_IO_STRUCTURE
///
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public struct SCard_IO_Request
{
public UInt32 m_dwProtocol;
public UInt32 m_cbPciLength;
}
/// <summary>
/// Wraps theSCARD_READERSTATE structure of PC/SC
/// </summary>
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public struct SCard_ReaderState
{
public string m_szReader;
public IntPtr m_pvUserData;
public UInt32 m_dwCurrentState;
public UInt32 m_dwEventState;
public UInt32 m_cbAtr;
[MarshalAs(UnmanagedType.ByValArray, SizeConst=32)]
public byte[] m_rgbAtr;
}
/// <summary>
/// Implementation of ICard using native (P/Invoke) interoperability for PC/SC
/// </summary>
public class CardNative : CardBase
{
private UInt32 m_hContext = 0;
private UInt32 m_hCard = 0;
private UInt32 m_nProtocol = (uint) PROTOCOL.T0;
private int m_nLastError = 0;
#region PCSC_FUNCTIONS
/// <summary>
/// Native SCardGetStatusChanged from winscard.dll
/// </summary>
/// <param name="hContext"></param>
/// <param name="dwTimeout"></param>
/// <param name="rgReaderStates"></param>
/// <param name="cReaders"></param>
/// <returns></returns>
[DllImport("winscard.dll", SetLastError = true)]
internal static extern int SCardGetStatusChange(UInt32 hContext,
UInt32 dwTimeout,
[In,Out] SCard_ReaderState[] rgReaderStates,
UInt32 cReaders);
/// <summary>
/// Native SCardListReaders function from winscard.dll
/// </summary>
/// <param name="hContext"></param>
/// <param name="mszGroups"></param>
/// <param name="mszReaders"></param>
/// <param name="pcchReaders"></param>
/// <returns></returns>
[DllImport("winscard.dll", SetLastError=true)]
internal static extern int SCardListReaders(UInt32 hContext,
[MarshalAs(UnmanagedType.LPTStr)] string mszGroups,
IntPtr mszReaders,
out UInt32 pcchReaders);
/// <summary>
/// Native SCardEstablishContext function from winscard.dll
/// </summary>
/// <param name="dwScope"></param>
/// <param name="pvReserved1"></param>
/// <param name="pvReserved2"></param>
/// <param name="phContext"></param>
/// <returns></returns>
[DllImport("winscard.dll", SetLastError=true)]
internal static extern int SCardEstablishContext(UInt32 dwScope,
IntPtr pvReserved1,
IntPtr pvReserved2,
IntPtr phContext);
/// <summary>
/// Native SCardReleaseContext function from winscard.dll
/// </summary>
/// <param name="hContext"></param>
/// <returns></returns>
[DllImport("winscard.dll", SetLastError=true)]
internal static extern int SCardReleaseContext(UInt32 hContext);
/// <summary>
/// Native SCardConnect function from winscard.dll
/// </summary>
/// <param name="hContext"></param>
/// <param name="szReader"></param>
/// <param name="dwShareMode"></param>
/// <param name="dwPreferredProtocols"></param>
/// <param name="phCard"></param>
/// <param name="pdwActiveProtocol"></param>
/// <returns></returns>
[DllImport("winscard.dll", SetLastError=true, CharSet=CharSet.Auto)]
internal static extern int SCardConnect(UInt32 hContext,
[MarshalAs(UnmanagedType.LPTStr)] string szReader,
UInt32 dwShareMode,
UInt32 dwPreferredProtocols,
IntPtr phCard,
IntPtr pdwActiveProtocol);
/// <summary>
/// Native SCardDisconnect function from winscard.dll
/// </summary>
/// <param name="hCard"></param>
/// <param name="dwDisposition"></param>
/// <returns></returns>
[DllImport("winscard.dll", SetLastError=true)]
internal static extern int SCardDisconnect(UInt32 hCard,
UInt32 dwDisposition);
/// <summary>
/// Native SCardTransmit function from winscard.dll
/// </summary>
/// <param name="hCard"></param>
/// <param name="pioSendPci"></param>
/// <param name="pbSendBuffer"></param>
/// <param name="cbSendLength"></param>
/// <param name="pioRecvPci"></param>
/// <param name="pbRecvBuffer"></param>
/// <param name="pcbRecvLength"></param>
/// <returns></returns>
[DllImport("winscard.dll", SetLastError=true)]
internal static extern int SCardTransmit(UInt32 hCard,
[In] ref SCard_IO_Request pioSendPci,
byte[] pbSendBuffer,
UInt32 cbSendLength,
IntPtr pioRecvPci,
[Out] byte[] pbRecvBuffer,
out UInt32 pcbRecvLength
);
/// <summary>
/// Native SCardBeginTransaction function of winscard.dll
/// </summary>
/// <param name="hContext"></param>
/// <returns></returns>
[DllImport("winscard.dll", SetLastError = true)]
internal static extern int SCardBeginTransaction(UInt32 hContext);
/// <summary>
/// Native SCardEndTransaction function of winscard.dll
/// </summary>
/// <param name="hContext"></param>
/// <returns></returns>
[DllImport("winscard.dll", SetLastError = true)]
internal static extern int SCardEndTransaction(UInt32 hContext, UInt32 dwDisposition);
[DllImport("winscard.dll", SetLastError = true)]
internal static extern int SCardGetAttrib(UInt32 hCard,
UInt32 dwAttribId,
[Out] byte[] pbAttr,
out UInt32 pcbAttrLen);
#endregion
/// <summary>
/// Default constructor
/// </summary>
public CardNative()
{
}
/// <summary>
/// Object destruction
/// </summary>
~CardNative()
{
Disconnect(DISCONNECT.Unpower);
ReleaseContext();
}
#region ICard Members
/// <summary>
/// Wraps the PCSC function
/// LONG SCardListReaders(SCARDCONTEXT hContext,
/// LPCTSTR mszGroups,
/// LPTSTR mszReaders,
/// LPDWORD pcchReaders
/// );
/// </summary>
/// <returns>A string array of the readers</returns>
public override string[] ListReaders()
{
EstablishContext(SCOPE.User);
string[] sListReaders = null;
UInt32 pchReaders = 0;
IntPtr szListReaders = IntPtr.Zero;
m_nLastError = SCardListReaders(m_hContext, null, szListReaders, out pchReaders);
if (m_nLastError == 0)
{
szListReaders = Marshal.AllocHGlobal((int) pchReaders);
m_nLastError = SCardListReaders(m_hContext, null, szListReaders, out pchReaders);
if (m_nLastError == 0)
{
char[] caReadersData = new char[pchReaders];
int nbReaders = 0;
for (int nI = 0; nI < pchReaders; nI++)
{
caReadersData[nI] = (char) Marshal.ReadByte(szListReaders, nI);
if (caReadersData[nI] == 0)
nbReaders++;
}
// Remove last 0
--nbReaders;
if (nbReaders != 0)
{
sListReaders = new string[nbReaders];
char[] caReader = new char[pchReaders];
int nIdx = 0;
int nIdy = 0;
int nIdz = 0;
// Get the nJ string from the multi-string
while(nIdx < pchReaders - 1)
{
caReader[nIdy] = caReadersData[nIdx];
if (caReader[nIdy] == 0)
{
sListReaders[nIdz] = new string(caReader, 0, nIdy);
++nIdz;
nIdy = 0;
caReader = new char[pchReaders];
}
else
++nIdy;
++nIdx;
}
}
}
Marshal.FreeHGlobal(szListReaders);
}
ReleaseContext();
return sListReaders;
}
/// <summary>
/// Wraps the PCSC function
/// LONG SCardEstablishContext(
/// IN DWORD dwScope,
/// IN LPCVOID pvReserved1,
/// IN LPCVOID pvReserved2,
/// OUT LPSCARDCONTEXT phContext
/// );
/// </summary>
/// <param name="Scope"></param>
public void EstablishContext(SCOPE Scope)
{
IntPtr hContext = Marshal.AllocHGlobal(Marshal.SizeOf(m_hContext));
m_nLastError = SCardEstablishContext((uint) Scope, IntPtr.Zero, IntPtr.Zero, hContext);
if (m_nLastError != 0)
{
string msg = "SCardEstablishContext error: " + m_nLastError;
Marshal.FreeHGlobal(hContext);
throw new Exception(msg);
}
m_hContext = (uint) Marshal.ReadInt32(hContext);
Marshal.FreeHGlobal(hContext);
}
/// <summary>
/// Wraps the PCSC function
/// LONG SCardReleaseContext(
/// IN SCARDCONTEXT hContext
/// );
/// </summary>
public void ReleaseContext()
{
if (m_hContext != 0)
{
m_nLastError = SCardReleaseContext(m_hContext);
if (m_nLastError != 0)
{
string msg = "SCardReleaseContext error: " + m_nLastError;
throw new Exception(msg);
}
m_hContext = 0;
}
}
/// <summary>
/// Wraps the PCSC function
/// LONG SCardConnect(
/// IN SCARDCONTEXT hContext,
/// IN LPCTSTR szReader,
/// IN DWORD dwShareMode,
/// IN DWORD dwPreferredProtocols,
/// OUT LPSCARDHANDLE phCard,
/// OUT LPDWORD pdwActiveProtocol
/// );
/// </summary>
/// <param name="Reader"></param>
/// <param name="ShareMode"></param>
/// <param name="PreferredProtocols"></param>
public override void Connect(string Reader, SHARE ShareMode, PROTOCOL PreferredProtocols)
{
EstablishContext(SCOPE.User);
IntPtr hCard = Marshal.AllocHGlobal(Marshal.SizeOf(m_hCard));
IntPtr pProtocol = Marshal.AllocHGlobal(Marshal.SizeOf(m_nProtocol));
m_nLastError = SCardConnect(m_hContext,
Reader,
(uint) ShareMode,
(uint) PreferredProtocols,
hCard,
pProtocol);
if (m_nLastError != 0)
{
string msg = "SCardConnect error: " + m_nLastError;
Marshal.FreeHGlobal(hCard);
Marshal.FreeHGlobal(pProtocol);
throw new Exception(msg);
}
m_hCard = (uint) Marshal.ReadInt32(hCard);
m_nProtocol = (uint) Marshal.ReadInt32(pProtocol);
Marshal.FreeHGlobal(hCard);
Marshal.FreeHGlobal(pProtocol);
}
/// <summary>
/// Wraps the PCSC function
/// LONG SCardDisconnect(
/// IN SCARDHANDLE hCard,
/// IN DWORD dwDisposition
/// );
/// </summary>
/// <param name="Disposition"></param>
public override void Disconnect(DISCONNECT Disposition)
{
if (m_hCard != 0)
{
m_nLastError = SCardDisconnect(m_hCard, (uint) Disposition);
m_hCard = 0;
if (m_nLastError != 0)
{
string msg = "SCardDisconnect error: " + m_nLastError;
throw new Exception(msg);
}
ReleaseContext();
}
}
/// <summary>
/// Wraps the PCSC function
/// LONG SCardTransmit(
/// SCARDHANDLE hCard,
/// LPCSCARD_I0_REQUEST pioSendPci,
/// LPCBYTE pbSendBuffer,
/// DWORD cbSendLength,
/// LPSCARD_IO_REQUEST pioRecvPci,
/// LPBYTE pbRecvBuffer,
/// LPDWORD pcbRecvLength
/// );
/// </summary>
/// <param name="ApduCmd">APDUCommand object with the APDU to send to the card</param>
/// <returns>An APDUResponse object with the response from the card</returns>
public override APDUResponse Transmit(APDUCommand ApduCmd)
{
uint RecvLength = (uint) (ApduCmd.Le + APDUResponse.SW_LENGTH);
byte[] ApduBuffer = null;
byte[] ApduResponse = new byte[ApduCmd.Le + APDUResponse.SW_LENGTH];
SCard_IO_Request ioRequest = new SCard_IO_Request();
ioRequest.m_dwProtocol = m_nProtocol;
ioRequest.m_cbPciLength = 8;
// Build the command APDU
if (ApduCmd.Data == null)
{
ApduBuffer = new byte[APDUCommand.APDU_MIN_LENGTH + ((ApduCmd.Le != 0) ? 1 : 0)];
if (ApduCmd.Le != 0)
ApduBuffer[4] = (byte) ApduCmd.Le;
}
else
{
ApduBuffer = new byte[APDUCommand.APDU_MIN_LENGTH + 1 + ApduCmd.Data.Length];
for (int nI = 0; nI < ApduCmd.Data.Length; nI++)
ApduBuffer[APDUCommand.APDU_MIN_LENGTH + 1 + nI] = ApduCmd.Data[nI];
ApduBuffer[APDUCommand.APDU_MIN_LENGTH] = (byte) ApduCmd.Data.Length;
}
ApduBuffer[0] = ApduCmd.Class;
ApduBuffer[1] = ApduCmd.Ins;
ApduBuffer[2] = ApduCmd.P1;
ApduBuffer[3] = ApduCmd.P2;
m_nLastError = SCardTransmit(m_hCard, ref ioRequest, ApduBuffer, (uint) ApduBuffer.Length, IntPtr.Zero, ApduResponse, out RecvLength);
if (m_nLastError != 0)
{
string msg = "SCardTransmit error: " + m_nLastError;
throw new Exception(msg);
}
byte[] ApduData = new byte[RecvLength];
for (int nI = 0; nI < RecvLength; nI++)
ApduData[nI] = ApduResponse[nI];
return new APDUResponse(ApduData);
}
/// <summary>
/// Wraps the PSCS function
/// LONG SCardBeginTransaction(
/// SCARDHANDLE hCard
// );
/// </summary>
public override void BeginTransaction()
{
if (m_hCard != 0)
{
m_nLastError = SCardBeginTransaction(m_hCard);
if (m_nLastError != 0)
{
string msg = "SCardBeginTransaction error: " + m_nLastError;
throw new Exception(msg);
}
}
}
/// <summary>
/// Wraps the PCSC function
/// LONG SCardEndTransaction(
/// SCARDHANDLE hCard,
/// DWORD dwDisposition
/// );
/// </summary>
/// <param name="Disposition">A value from DISCONNECT enum</param>
public override void EndTransaction(DISCONNECT Disposition)
{
if (m_hCard != 0)
{
m_nLastError = SCardEndTransaction(m_hCard, (UInt32)Disposition);
if (m_nLastError != 0)
{
string msg = "SCardEndTransaction error: " + m_nLastError;
throw new Exception(msg);
}
}
}
/// <summary>
/// Gets the attributes of the card
/// </summary>
/// <param name="AttribId">Identifier for the Attribute to get</param>
/// <returns>Attribute content</returns>
public override byte[] GetAttribute(UInt32 AttribId)
{
byte[] attr = null;
UInt32 attrLen = 0;
m_nLastError = SCardGetAttrib(m_hCard, AttribId, attr, out attrLen);
if (m_nLastError == 0)
{
if (attrLen != 0)
{
attr = new byte[attrLen];
m_nLastError = SCardGetAttrib(m_hCard, AttribId, attr, out attrLen);
if (m_nLastError != 0)
{
string msg = "SCardGetAttr error: " + m_nLastError;
throw new Exception(msg);
}
}
}
else
{
string msg = "SCardGetAttr error: " + m_nLastError;
throw new Exception(msg);
}
return attr;
}
#endregion
/// <summary>
/// This function must implement a card detection mechanism.
///
/// When card insertion is detected, it must call the method CardInserted()
/// When card removal is detected, it must call the method CardRemoved()
///
/// </summary>
protected override void RunCardDetection(object Reader)
{
bool bFirstLoop = true;
UInt32 hContext = 0; // Local context
IntPtr phContext;
phContext = Marshal.AllocHGlobal(Marshal.SizeOf(hContext));
if (SCardEstablishContext((uint) SCOPE.User, IntPtr.Zero, IntPtr.Zero, phContext) == 0)
{
hContext = (uint)Marshal.ReadInt32(phContext);
Marshal.FreeHGlobal(phContext);
UInt32 nbReaders = 1;
SCard_ReaderState[] readerState = new SCard_ReaderState[nbReaders];
readerState[0].m_dwCurrentState = (UInt32) CARD_STATE.UNAWARE;
readerState[0].m_szReader = (string)Reader;
UInt32 eventState;
UInt32 currentState = readerState[0].m_dwCurrentState;
// Card detection loop
do
{
if (SCardGetStatusChange(hContext, WAIT_TIME
, readerState, nbReaders) == 0)
{
eventState = readerState[0].m_dwEventState;
currentState = readerState[0].m_dwCurrentState;
// Check state
if (((eventState & (uint) CARD_STATE.CHANGED) == (uint) CARD_STATE.CHANGED) && !bFirstLoop)
{
// State has changed
if ((eventState & (uint) CARD_STATE.EMPTY) == (uint) CARD_STATE.EMPTY)
{
// There is no card, card has been removed -> Fire CardRemoved event
CardRemoved(this, new CardRemovedEventArgs());
}
if (((eventState & (uint)CARD_STATE.PRESENT) == (uint)CARD_STATE.PRESENT) &&
((eventState & (uint) CARD_STATE.PRESENT) != (currentState & (uint) CARD_STATE.PRESENT)))
{
// There is a card in the reader -> Fire CardInserted event
CardInserted(this, new CardInsertedEventArgs());
}
if ((eventState & (uint) CARD_STATE.ATRMATCH) == (uint) CARD_STATE.ATRMATCH)
{
// There is a card in the reader and it matches the ATR we were expecting-> Fire CardInserted event
CardInserted(this, new CardInsertedEventArgs());
}
}
// The current stateis now the event state
readerState[0].m_dwCurrentState = eventState;
bFirstLoop = false;
}
Thread.Sleep(100);
if (m_bRunCardDetection == false)
break;
}
while (true); // Exit on request
}
else
{
Marshal.FreeHGlobal(phContext);
throw new Exception("PC/SC error");
}
SCardReleaseContext(hContext);
}
}
}
-9
View File
@@ -1,9 +0,0 @@
using System;
namespace GemCard
{
public class CardRemovedEventArgs : EventArgs
{
public CardRemovedEventArgs() { }
}
}
-179
View File
@@ -1,179 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
<PropertyGroup>
<ProjectType>Local</ProjectType>
<ProductVersion>8.0.50727</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{8B10D15A-39DE-4B56-8DD1-710C1EB3A697}</ProjectGuid>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ApplicationIcon>
</ApplicationIcon>
<AssemblyKeyContainerName>
</AssemblyKeyContainerName>
<AssemblyName>GemCard</AssemblyName>
<AssemblyOriginatorKeyFile>
</AssemblyOriginatorKeyFile>
<DefaultClientScript>JScript</DefaultClientScript>
<DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
<DefaultTargetSchema>IE50</DefaultTargetSchema>
<DelaySign>false</DelaySign>
<OutputType>Library</OutputType>
<RootNamespace>GemCard</RootNamespace>
<RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
<StartupObject>
</StartupObject>
<FileUpgradeFlags>
</FileUpgradeFlags>
<UpgradeBackupLocation>
</UpgradeBackupLocation>
<OldToolsVersion>3.5</OldToolsVersion>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<OutputPath>bin\Debug\</OutputPath>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<BaseAddress>285212672</BaseAddress>
<CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
<ConfigurationOverrideFile>
</ConfigurationOverrideFile>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DocumentationFile>
</DocumentationFile>
<DebugSymbols>true</DebugSymbols>
<FileAlignment>4096</FileAlignment>
<NoStdLib>false</NoStdLib>
<NoWarn>
</NoWarn>
<Optimize>false</Optimize>
<RegisterForComInterop>false</RegisterForComInterop>
<RemoveIntegerChecks>false</RemoveIntegerChecks>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<OutputPath>bin\Release\</OutputPath>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<BaseAddress>285212672</BaseAddress>
<CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
<ConfigurationOverrideFile>
</ConfigurationOverrideFile>
<DefineConstants>TRACE</DefineConstants>
<DocumentationFile>
</DocumentationFile>
<DebugSymbols>false</DebugSymbols>
<FileAlignment>4096</FileAlignment>
<NoStdLib>false</NoStdLib>
<NoWarn>
</NoWarn>
<Optimize>true</Optimize>
<RegisterForComInterop>false</RegisterForComInterop>
<RemoveIntegerChecks>false</RemoveIntegerChecks>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<BaseAddress>285212672</BaseAddress>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<FileAlignment>4096</FileAlignment>
<PlatformTarget>x86</PlatformTarget>
<CodeAnalysisIgnoreBuiltInRuleSets>true</CodeAnalysisIgnoreBuiltInRuleSets>
<CodeAnalysisIgnoreBuiltInRules>true</CodeAnalysisIgnoreBuiltInRules>
<CodeAnalysisFailOnMissingRules>false</CodeAnalysisFailOnMissingRules>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>bin\x86\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<BaseAddress>285212672</BaseAddress>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Optimize>true</Optimize>
<FileAlignment>4096</FileAlignment>
<PlatformTarget>x86</PlatformTarget>
<CodeAnalysisIgnoreBuiltInRuleSets>false</CodeAnalysisIgnoreBuiltInRuleSets>
<CodeAnalysisIgnoreBuiltInRules>false</CodeAnalysisIgnoreBuiltInRules>
</PropertyGroup>
<ItemGroup>
<Reference Include="System">
<Name>System</Name>
</Reference>
<Reference Include="System.Data">
<Name>System.Data</Name>
</Reference>
<Reference Include="System.Xml">
<Name>System.XML</Name>
</Reference>
<COMReference Include="stdole">
<Guid>{00020430-0000-0000-C000-000000000046}</Guid>
<VersionMajor>2</VersionMajor>
<VersionMinor>0</VersionMinor>
<Lcid>0</Lcid>
<WrapperTool>primary</WrapperTool>
<Isolated>False</Isolated>
</COMReference>
</ItemGroup>
<ItemGroup>
<Compile Include="APDUCommand.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="APDUParam.cs" />
<Compile Include="APDUResponse.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="AssemblyInfo.cs" />
<Compile Include="CardBase.cs" />
<Compile Include="CardInsertedEventArgs.cs" />
<Compile Include="CardNative.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="CardRemovedEventArgs.cs" />
<Compile Include="ICard.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="SmartCardException.cs">
<SubType>Code</SubType>
</Compile>
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
<Visible>False</Visible>
<ProductName>Windows Installer 3.1</ProductName>
<Install>true</Install>
</BootstrapperPackage>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PreBuildEvent>
</PreBuildEvent>
<PostBuildEvent>
</PostBuildEvent>
</PropertyGroup>
</Project>
-70
View File
@@ -1,70 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<LastOpenVersion>8.0.50215</LastOpenVersion>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ReferencePath>
</ReferencePath>
<CopyProjectDestinationFolder>
</CopyProjectDestinationFolder>
<CopyProjectUncPath>
</CopyProjectUncPath>
<CopyProjectOption>0</CopyProjectOption>
<ProjectView>ProjectFiles</ProjectView>
<ProjectTrust>0</ProjectTrust>
<PublishUrlHistory />
<InstallUrlHistory />
<SupportUrlHistory />
<UpdateUrlHistory />
<BootstrapperUrlHistory />
<ErrorReportUrlHistory />
<FallbackCulture>en-US</FallbackCulture>
<VerifyUploadedFiles>false</VerifyUploadedFiles>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<EnableASPDebugging>false</EnableASPDebugging>
<EnableASPXDebugging>false</EnableASPXDebugging>
<EnableUnmanagedDebugging>false</EnableUnmanagedDebugging>
<EnableSQLServerDebugging>false</EnableSQLServerDebugging>
<RemoteDebugEnabled>false</RemoteDebugEnabled>
<RemoteDebugMachine>
</RemoteDebugMachine>
<StartAction>Project</StartAction>
<StartArguments>
</StartArguments>
<StartPage>
</StartPage>
<StartProgram>
</StartProgram>
<StartURL>
</StartURL>
<StartWorkingDirectory>
</StartWorkingDirectory>
<StartWithIE>true</StartWithIE>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<EnableASPDebugging>false</EnableASPDebugging>
<EnableASPXDebugging>false</EnableASPXDebugging>
<EnableUnmanagedDebugging>false</EnableUnmanagedDebugging>
<EnableSQLServerDebugging>false</EnableSQLServerDebugging>
<RemoteDebugEnabled>false</RemoteDebugEnabled>
<RemoteDebugMachine>
</RemoteDebugMachine>
<StartAction>Project</StartAction>
<StartArguments>
</StartArguments>
<StartPage>
</StartPage>
<StartProgram>
</StartProgram>
<StartURL>
</StartURL>
<StartWorkingDirectory>
</StartWorkingDirectory>
<StartWithIE>false</StartWithIE>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<StartWithIE>true</StartWithIE>
</PropertyGroup>
</Project>
-149
View File
@@ -1,149 +0,0 @@
using System;
namespace GemCard
{
/// <summary>
/// This interface gives access to the basic card functions. It must be implemented by a class.
/// </summary>
public interface ICard
{
/// <summary>
/// Wraps the PCSC funciton
/// LONG SCardListReaders(SCARDCONTEXT hContext,
/// LPCTSTR mszGroups,
/// LPTSTR mszReaders,
/// LPDWORD pcchReaders
/// );
/// </summary>
/// <returns>A string array of the readers</returns>
string[] ListReaders();
/// <summary>
/// Wraps the PCSC function
/// LONG SCardConnect(
/// IN SCARDCONTEXT hContext,
/// IN LPCTSTR szReader,
/// IN DWORD dwShareMode,
/// IN DWORD dwPreferredProtocols,
/// OUT LPSCARDHANDLE phCard,
/// OUT LPDWORD pdwActiveProtocol
/// );
/// </summary>
/// <param name="Reader"></param>
/// <param name="ShareMode"></param>
/// <param name="PreferredProtocols"></param>
void Connect(string Reader, SHARE ShareMode, PROTOCOL PreferredProtocols);
/// <summary>
/// Wraps the PCSC function
/// LONG SCardDisconnect(
/// IN SCARDHANDLE hCard,
/// IN DWORD dwDisposition
/// );
/// </summary>
/// <param name="Disposition"></param>
void Disconnect(DISCONNECT Disposition);
/// <summary>
/// Wraps the PCSC function
/// LONG SCardTransmit(
/// SCARDHANDLE hCard,
/// LPCSCARD_I0_REQUEST pioSendPci,
/// LPCBYTE pbSendBuffer,
/// DWORD cbSendLength,
/// LPSCARD_IO_REQUEST pioRecvPci,
/// LPBYTE pbRecvBuffer,
/// LPDWORD pcbRecvLength
/// );
/// </summary>
/// <param name="ApduCmd">APDUCommand object with the APDU to send to the card</param>
/// <returns>An APDUResponse object with the response from the card</returns>
APDUResponse Transmit(APDUCommand ApduCmd);
/// <summary>
/// Wraps the PSCS function
/// LONG SCardBeginTransaction(
/// SCARDHANDLE hCard
// );
/// </summary>
void BeginTransaction();
/// <summary>
/// Wraps the PCSC function
/// LONG SCardEndTransaction(
/// SCARDHANDLE hCard,
/// DWORD dwDisposition
/// );
/// </summary>
void EndTransaction(DISCONNECT Disposition);
/// <summary>
/// Gets the attributes of the card
/// </summary>
/// <param name="AttribId">Identifier for the Attribute to get</param>
/// <returns>Attribute content</returns>
byte[] GetAttribute(UInt32 AttribId);
}
/// <summary>
/// SCOPE context
/// </summary>
public enum SCOPE
{
/// <summary>
/// The context is a user context, and any database operations are performed within the
/// domain of the user.
/// </summary>
User,
/// <summary>
/// The context is that of the current terminal, and any database operations are performed
/// within the domain of that terminal. (The calling application must have appropriate
/// access permissions for any database actions.)
/// </summary>
Terminal,
/// <summary>
/// The context is the system context, and any database operations are performed within the
/// domain of the system. (The calling application must have appropriate access
/// permissions for any database actions.)
/// </summary>
System
}
/// <summary>
/// SHARE mode enumeration
/// </summary>
public enum SHARE
{
Exclusive = 1, /// This app. is not willing to share this card with other applications.
Shared, /// This app. is willing to share this card with other applications.
Direct, /// This app. demands direct control of the reader, so it is not available to other applications.
}
/// <summary>
/// PROTOCOL enumeration
/// </summary>
public enum PROTOCOL
{
Undefined = 0x00000000, /// There is no active protocol.
T0 = 0x00000001, /// T=0 is the active protocol.
T1 = 0x00000002, /// T=1 is the active protocol.
T0orT1 = T0 | T1, /// T=1 or T=0 can be the active protocol
Raw = 0x00010000, /// Raw is the active protocol.
Default = unchecked ((int) 0x80000000), /// Use implicit PTS.
}
/// <summary>
/// DISCONNECT action enumeration
/// </summary>
public enum DISCONNECT
{
Leave, /// Don't do anything special on close
Reset, /// Reset the card on close
Unpower, /// Power down the card on close
Eject, /// Eject(!) the card on close
}
}
-40
View File
@@ -1,40 +0,0 @@
using System;
namespace GemCard
{
/// <summary>
/// Smart card exceptions
/// </summary>
public class SmartCardException : Exception
{
public SmartCardException() : base("Smart card exception")
{
}
public SmartCardException(string Message) : base(Message)
{
}
}
public class ApduCommandException : Exception
{
public const string
NotValidDocument = "The file is not a valid APDU command document",
NoSuchCommand = "No such APDU command in the document",
ParamLeFormat = "Le parameter format is not correct",
ParamP3Format = "P3 parameter format is not correct",
NoSuchSequence = "No such APDU sequence in the document",
MissingApduOrCommand = "An Apdu or a Sequence is missing in this Sequence";
public ApduCommandException() : base("APDU command exception")
{
}
public ApduCommandException(string Message) : base(Message)
{
}
}
}
+1 -41
View File
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters.Binary;
@@ -160,46 +159,7 @@ namespace GraphLib
{
grid_off_y = off_y;
}
/// <summary>
/// Load Samples from a file. Returns loaded points count.
/// </summary>
/// <param name="pathName">File pathname</param>
/// <returns>Loaded points count</returns>
public int LoadSamples(string pathName, out float yMin, out float yMax)
{
yMin = float.MaxValue;
yMax = float.MinValue;
try
{
Int64 size = new FileInfo(pathName).Length;
if ((size % 8) != 0) return 0;
int samplesCount = (int)(size / 8L) - 1;
if (samplesCount <= 0) return 0;
PointF[] newSamples = new PointF[samplesCount];
using (BinaryReader reader = new BinaryReader(File.Open(pathName, FileMode.Open)))
{
for (int i = 0; i < samplesCount; i++)
{
newSamples[i].X = reader.ReadSingle();
newSamples[i].Y = reader.ReadSingle();
}
yMin = reader.ReadSingle();
yMax = reader.ReadSingle();
}
Samples = newSamples;
return samplesCount;
}
catch (Exception exc)
{
return 0;
}
}
[Category("Properties")] // Take this out, and you will soon have problems with serialization;
[DefaultValue(typeof(string), "")]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
+1
View File
@@ -75,6 +75,7 @@
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="PrecisionTimer.cs" />
<Compile Include="Utils.cs" />
</ItemGroup>
<ItemGroup>
+108 -9
View File
@@ -43,6 +43,11 @@ namespace GraphLib
PlotterGraphSelectCurvesForm GraphPropertiesForm = null;
PrintPreviewForm printPreviewForm = null;
private PrecisionTimer.Timer mTimer = null;
private float play_speed = 0.5f;
private float play_speed_max = 10f;
private float play_speed_min = 0.5f;
private bool paused = false;
private bool isRunning = false;
@@ -53,6 +58,11 @@ namespace GraphLib
public PlotterDisplayEx()
{
InitializeComponent();
mTimer = new PrecisionTimer.Timer();
mTimer.Period = 50; // 20 fps
mTimer.Tick += new EventHandler(OnTimerTick);
play_speed = 0.5f; // 20x10 = 200 values per second == sample frequency
mTimer.Start();
isRunning = false;
}
@@ -182,10 +192,85 @@ namespace GraphLib
protected override void Dispose(bool disposing)
{
paused = true;
paused = true;
if (mTimer.IsRunning)
{
mTimer.Stop();
mTimer.Dispose();
}
base.Dispose(disposing);
}
public void Start()
{
if (isRunning == false && paused == false)
{
gPane.starting_idx = 0;
paused = false;
isRunning = true;
// mTimer.Start();
tb1.Buttons[0].ImageIndex = 2;
}
else
{
if (paused == false)
{
//mTimer.Stop();
paused = true;
}
else
{
// mTimer.Start();
paused = false;
}
if (paused)
{
tb1.Buttons[0].ImageIndex = 0;
}
else
{
tb1.Buttons[0].ImageIndex = 2;
}
}
}
public void Stop()
{
if (isRunning)
{
// mTimer.Stop();
isRunning = false;
paused = false;
hScrollBar1.Value = 0;
tb1.Buttons[0].ImageIndex = 0;
}
}
private void tb1_ButtonClick(object sender, ToolBarButtonClickEventArgs e)
{
bool pushed = e.Button.Pushed;
switch (e.Button.Tag.ToString().ToLower())
{
case "play":
Start();
break;
case "stop":
Stop();
break;
}
}
private void SetPlayPanelVisible()
{
panel1.Visible = true;
@@ -232,6 +317,27 @@ namespace GraphLib
{
}
}
private void UpdatePlayback()
{
if (!paused && isRunning == true)
{
try
{
gPane.starting_idx += play_speed;
UpdateScrollBar();
gPane.Invalidate();
}
catch { }
}
}
private void OnTimerTick(object sender, EventArgs e)
{
UpdateControl();
UpdatePlayback();
}
private void UpdateScrollBar()
{
@@ -268,14 +374,7 @@ namespace GraphLib
if (gPane.Sources.Count > 0)
{
int val = hScrollBar1.Value;
int maxLen = 0;
foreach (var s in DataSources)
{
if (s.Length > maxLen) maxLen = s.Length;
}
gPane.starting_idx = (int)(maxLen * (float)val / 10000.0f);
gPane.starting_idx = (int)(gPane.Sources[0].Length * (float)val / 10000.0f);
gPane.Invalidate();
}
}
+1 -1
View File
@@ -56,7 +56,7 @@ namespace GraphLib
this.tb1.ShowToolTips = true;
this.tb1.Size = new System.Drawing.Size(80, 26);
this.tb1.TabIndex = 1;
this.tb1.Visible = false;
this.tb1.ButtonClick += new System.Windows.Forms.ToolBarButtonClickEventHandler(this.tb1_ButtonClick);
//
// tbbSave
//
+36 -36
View File
@@ -125,64 +125,64 @@
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAACI
DgAAAk1TRnQBSQFMAgEBBAEAARQBAAEUAQABEAEAARABAAT/ASEBAAj/AUIBTQE2BwABNgMAASgDAAFA
AwABIAMAAQEBAAEgBgABIP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8AKgADAQECwAABtgGV
AU8B/QHKAZgBWQH/AcoBlwFZAf8BygGXAVkB/wHKAZcBWQH/AcoBlwFYAf8ByQGXAVgB/wHJAZcBWAH/
AcoBmAFZAf8BtgGUAU8B/RQAAxQBHAMRARcDAgEDrAADTgGZA10B0gNMAf8BxwGVAVUB/wH5AfcB9gH/
DgAAAk1TRnQBSQFMAgEBBAEAAQwBAAEMAQABEAEAARABAAT/ASEBAAj/AUIBTQE2BwABNgMAASgDAAFA
AwABIAMAAQEBAAEgBgABIP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8AKgADAQECwAABtwGV
AVAB/QHKAZgBWgH/AcoBlwFaAf8BygGXAVoB/wHKAZcBWgH/AcoBlwFZAf8ByQGXAVkB/wHJAZcBWQH/
AcoBmAFaAf8BtwGUAVAB/RQAAxQBHAMRARcDAgEDrAADTgGZA10B0gNNAf8BxwGVAVYB/wH5AfcB9gH/
AfkB8QHsAf8B+QHxAesB/wH4AfAB6QH/AfcB7QHmAf8B9AHqAeEB/wHyAegB3gH/AfoB+AH2Af8BxwGU
AVUB/wMYAf8DWAHRA0QBeggAAxUBHQFiAlgB6QM6AWEDDQESAwABASwAAxsBJgMbASYDGwEmAxsBJgMb
AVYB/wMZAf8DWAHRA0QBeggAAxUBHQFiAlgB6QM6AWEDDQESAwABASwAAxsBJgMbASYDGwEmAxsBJgMb
ASYDGwEmAxsBJgMbASYDGwEmAxsBJgMbASYDGwEmEAADGwEmAxsBJgMbASYDGwEmAxsBJgMbASYDGwEm
AxsBJgMbASYDGwEmAxsBJgMbASYIAANUAf0DpwH/A7UB/wOBAf8BrwGsAaoB/wHFAcABvQH/AcUBwAG9
Af8BxQHAAb0B/wHFAcABvQH/AcUBwAG9Af8BxQHAAb0B/wGtAaoBqAH/AyAB/wO1Af8DmwH/AxcB/wgA
AxUBHQNNAfoBOgIrAfwDXwHgAysBQgMNARIoAAMbASYDKwH8AYACgQH/AYACgQH/AYACgQH/AYACgQH/
AxsBJgMbASYDGwEmAxsBJgMbASYIAANVAf0DpwH/A7UB/wOBAf8BrwGsAaoB/wHFAcABvQH/AcUBwAG9
Af8BxQHAAb0B/wHFAcABvQH/AcUBwAG9Af8BxQHAAb0B/wGtAaoBqAH/AyEB/wO1Af8DmwH/AxgB/wgA
AxUBHQNNAfoBOwIrAfwDXwHgAysBQgMNARIoAAMbASYDKwH8AYACgQH/AYACgQH/AYACgQH/AYACgQH/
AYACgQH/AYACgQH/AYACgQH/AYACgQH/AYACgQH/AxsBJhAAAxsBJgMrAfwBgAKBAf8BgAKBAf8BgAKB
Af8DIwE0AxsBJgMrAfwBgAKBAf8BgAKBAf8BgAKBAf8DIwE0CAADZAH/A7UB/wO1Af8DlQH/A4EB/wOB
Af8DbQH/A2IB/wNVAf8DRgH/AzcB/wM2Af8DYgH/A7UB/wO1Af8DGQH/CAADFQEdAV8CSgH7AfkB+gH5
Af8DIwE0AxsBJgMrAfwBgAKBAf8BgAKBAf8BgAKBAf8DIwE0CAADZQH/A7UB/wO1Af8DlQH/A4EB/wOB
Af8DbgH/A2MB/wNWAf8DRwH/AzgB/wM3Af8DYwH/A7UB/wO1Af8DGgH/CAADFQEdAV8CSgH7AfkB+gH5
Af8DfwH+AV8BUwFSAfsDVQGyAx0BKgMIAQsgAAMbASYDQAH9IP8DQAH9AxsBJgMAAQEMAAMbASYDQAH9
AfwB/QH8Bf8DQAH9AxsBJgMbASYDQAH9AfwB/QH8Bf8DQAH9AxsBJgMAAQEEAANpAf8DuwH/A7sB/wON
Af8D1AH/A7kB/wO5Af8DuQH/A7kB/wO5Af8DuQH/A9MB/wODAf8DuwH/A7sB/wMeAf8IAAMVAR0DKwH8
AfoC+wH/AfUC9gH/AfkC+gH/ATsBLgEtAfwBbQJRAfcDQgF2AxYBHgMFAQcYAAMbASYDQAH9BP8B1QHb
AfwB/QH8Bf8DQAH9AxsBJgMbASYDQAH9AfwB/QH8Bf8DQAH9AxsBJgMAAQEEAANqAf8DuwH/A7sB/wON
Af8D1AH/A7kB/wO5Af8DuQH/A7kB/wO5Af8DuQH/A9MB/wODAf8DuwH/A7sB/wMfAf8IAAMVAR0DKwH8
AfoC+wH/AfUC9gH/AfkC+gH/ATwBLwEuAfwBbQJRAfcDQgF2AxYBHgMFAQcYAAMbASYDQAH9BP8B1QHb
AdgB/wHUAdsB1wH/AdQB2wHYAf8B0wHbAdcB/wHRAdkB1QH/Ac8B1wHTBf8DQAH9AxsBJgMBAQIMAAMb
ASYDQAH9AeIB5QHkAf8B2AHfAdwB/wNAAf0DGwEmAxsBJgNAAf0D8wH/AfcB+AH3Af8DQAH9AxsBJgMB
AQIEAANuAf8D1wH/A9cB/wOXAf8D2AH/A78B/wO/Af8DvwH/A78B/wO/Af8DvwH/A9cB/wOOAf8D1wH/
A9cB/wMzAf8IAAMWAR4DKwH8A/sB/wHTAdoB1wH/AdoB3wHcAf8B9gH3AfYB/wHyAvMB/wE6AisB/AFg
AQIEAANvAf8D1wH/A9cB/wOXAf8D2AH/A78B/wO/Af8DvwH/A78B/wO/Af8DvwH/A9cB/wOOAf8D1wH/
A9cB/wM0Af8IAAMWAR4DKwH8A/sB/wHTAdoB1wH/AdoB3wHcAf8B9gH3AfYB/wHyAvMB/wE7AisB/AFg
AlkB6wMzAVMDEgEZAwQBBRAAAxsBJgNAAf0E/wHaAeAB3QH/AdsB4QHeAf8B3QHiAeAB/wHdAeIB4AH/
AdsB4QHeAf8B2AHeAdsF/wNAAf0DGwEmAwEBAgwAAxsBJgNAAf0B4gHmAeQB/wHcAeIB3wH/A0AB/QMb
ASYDGwEmA0AB/QHvAfEB8AH/AfAB8wHxAf8DQAH9AxsBJgMBAQIEAANyAf8D+QH/A/kB/wOrAf8D3wH/
A8sB/wPLAf8DywH/A8sB/wPLAf8DywH/A98B/wOjAf8D+QH/A/kB/wNVAf8IAAMWAR4DKwH8A/sB/wHf
ASYDGwEmA0AB/QHvAfEB8AH/AfAB8wHxAf8DQAH9AxsBJgMBAQIEAANzAf8D+QH/A/kB/wOrAf8D3wH/
A8sB/wPLAf8DywH/A8sB/wPLAf8DywH/A98B/wOjAf8D+QH/A/kB/wNWAf8IAAMWAR4DKwH8A/sB/wHf
AeQB4QH/Ad4B4wHhAf8B3gHjAeAB/wHjAecB5QH/AfQC9QH/A38B/gGRAkAB/QNWAbYDJgE5AxABFQwA
AxsBJgNAAf0E/wHdAeMB4AH/AeEB5gHjAf8B5AHpAecB/wHmAeoB6AH/AeUB6QHnAf8B4gHnAeQF/wNA
Af0DGwEmAwEBAgwAAxsBJgNAAf0B5AHoAeUB/wHeAeMB4QH/A0AB/QMbASYDGwEmA0AB/QHsAe8B7gH/
AecB6wHpAf8DQAH9AxsBJgMBAQIEAANqAfkD/AH/A/wB/wPLAf8D8gH/A/IB/wPyAf8D8gH/A/IB/wPy
Af8D8gH/A/IB/wPGAf8D/AH/A/wB/wNwAf4IAAMWAR4DKwH8A/sB/wHqAe4B7AH/AewB7wHuAf8B7AHv
Ae4B/wHrAe4B7QH/AekB7AHrAf8DfwH+AToCKwH8AVgCVgG7Ax0BKgMGAQgMAAMbASYDQAH9BP8B3wHk
Ae4B/wHrAe4B7QH/AekB7AHrAf8DfwH+ATsCKwH8AVgCVgG7Ax0BKgMGAQgMAAMbASYDQAH9BP8B3wHk
AeEB/wHkAekB5gH/AeoB7QHrAf8B7gHxAe8B/wHvAfEB8AH/AewB7wHuBf8DQAH9AxsBJgMBAQIMAAMb
ASYDQAH9AesB7QHsAf8B3QHjAeAB/wNAAf0DGwEmAxsBJgNAAf0B7QHwAe8B/wHfAeQB4QH/A0AB/QMb
ASYDAQECBAADXQTSAf8D6AH/A3EB/wNxAf8DcQH/A3EB/wNxAf8DcQH/A3EB/wNxAf8DcQH/A3EB/wPo
ASYDAQECBAADXQTSAf8D6AH/A3IB/wNyAf8DcgH/A3IB/wNyAf8DcgH/A3IB/wNyAf8DcgH/A3IB/wPo
Af8DxAH/A1wB3AgAAxYBHgMrAfwD+wH/AfUC9gH/AfoB+wH6Af8D+QH/Ad0C3gH/AWoCRwH5A10B7QE6
AjkBYAMNAREUAAMbASYDQAH9BP8B3AHiAd8B/wHkAegB5gH/AesB7gHtAf8B8gH0AfMB/wH3AvgB/wH2
AfgB9wX/A0AB/QMbASYDAQECDAADGwEmA0AB/QHyAfQB8wH/AdoB3wHdAf8DQAH9AxsBJgMcASgDQAH9
AfMB9QH0Af8B1gHdAdkB/wNAAf0DGwEmAwEBAgQAAy0BRQOaAf8DzAH/AccBiwFCAf8B+QH0Ae0B/wH+
AegB2AH/Af4B6AHXAf8B/QHlAdMB/wH8AeQB0QH/AfoB4AHHAf8B+QHdAcMB/wH6AfQB7QH/AccBhQE+
Af8DwwH/A2gB/wMtAUUIAAMWAR4DKwH8A/sB/wHwAfMB8gH/AeYC6AH/A00B+gFiAlIB9AFRAk8BpQMU
AfMB9QH0Af8B1gHdAdkB/wNAAf0DGwEmAwEBAgQAAy0BRQOaAf8DzAH/AccBiwFDAf8B+QH0Ae0B/wH+
AegB2AH/Af4B6AHXAf8B/QHlAdMB/wH8AeQB0QH/AfoB4AHHAf8B+QHdAcMB/wH6AfQB7QH/AccBhQE/
Af8DwwH/A2kB/wMtAUUIAAMWAR4DKwH8A/sB/wHwAfMB8gH/AeYC6AH/A00B+gFiAlIB9AFRAk8BpQMU
ARwDAAEBGAADGwEmA0AB/QT/AdgB3wHcAf8B4AHlAeMB/wHoAesB6gH/Ae8B8gHwAf8B9wH4AfcB/wP9
Bf8DQAH9AxsBJgMBAQIMAAMbASYDQAH9A/wB/wHVAdsB2AH/A0AB/QMbASYDHAEoA0AB/QP8Af8B0gHa
AdYB/wNAAf0DGwEmAwEBAggAAzsBYwNqAfMBxQGJAUAB/wH5AfQB7wH/Af4B5wHXAf8B/QHnAdUB/wH8
AeYB0gH/AfsB4QHMAf8B+AHcAcIB/wH2AdoBvQH/AfoB9AHvAf8BxAGDATwB/wNdAfMDOwFjDAADFgEe
AysB/AP7Af8BPgIyAfwDTQH6AVoCVwG9AxgBIgMCAQMgAAMbASYDQAH9IP8DQAH9AxsBJgMBAQIMAAMb
ASYDQAH9CP8DQAH9AxsBJgMcASgDQAH9CP8DQAH9AxsBJgMBAQIMAAMHAQkBlgF6AUcC+QH0AfAB/wH8
AeYB0wH/Af0B5wHTAf8B+wHjAc0B/wH6AeAByAH/AfUB1gG7Af8B8wHUAbUB/wH4AfQB8AH/AZUBagFH
AfkDBwEJEAADFgEeA0AB/QFbAjIB+wFgAlwB1AMjATMDBwEKKAADGwEmAysB/AEpAS0BKwH/ASkBLQEr
Af8BKQEtASsB/wEpAS0BKwH/ASkBLQErAf8BKQEtASsB/wEpAS0BKwH/ASkBLQErAf8BKQEtASsB/wMb
ASYDAQECDAADGwEmAWMBVwFVAf4BKQEtASsB/wEpAS0BKwH/ASkBLQErAf8DGwEmAxwBKAFjAVcBVQH+
ASkBLQErAf8BKQEtASsB/wEpAS0BKwH/AxsBJgMBAQIQAAGSAXoBUQH3AfkB9QHxAf8B/AHjAc8B/wH8
AeQBzwH/AfoB4QHKAf8B+QHdAcQB/wH0AekB3wH/AfcB8gHsAf8B9QHvAekB/wGZAV8BRQH7FAADFgEf
AdYB/wNAAf0DGwEmAwEBAggAAzsBYwNrAfMBxQGJAUEB/wH5AfQB7wH/Af4B5wHXAf8B/QHnAdUB/wH8
AeYB0gH/AfsB4QHMAf8B+AHcAcIB/wH2AdoBvQH/AfoB9AHvAf8BxAGDAT0B/wNdAfMDOwFjDAADFgEe
AysB/AP7Af8BPwIzAfwDTQH6AVoCVwG9AxgBIgMCAQMgAAMbASYDQAH9IP8DQAH9AxsBJgMBAQIMAAMb
ASYDQAH9CP8DQAH9AxsBJgMcASgDQAH9CP8DQAH9AxsBJgMBAQIMAAMHAQkBmgF9AUcC+QH0AfAB/wH8
AeYB0wH/Af0B5wHTAf8B+wHjAc0B/wH6AeAByAH/AfUB1gG7Af8B8wHUAbUB/wH4AfQB8AH/AZkBagFH
AfkDBwEJEAADFgEeA0AB/QFbAjIB+wFgAlwB1AMjATMDBwEKKAADGwEmAysB/AEqAS4BLAH/ASoBLgEs
Af8BKgEuASwB/wEqAS4BLAH/ASoBLgEsAf8BKgEuASwB/wEqAS4BLAH/ASoBLgEsAf8BKgEuASwB/wMb
ASYDAQECDAADGwEmAWMBVwFVAf4BKgEuASwB/wEqAS4BLAH/ASoBLgEsAf8DGwEmAxwBKAFjAVcBVQH+
ASoBLgEsAf8BKgEuASwB/wEqAS4BLAH/AxsBJgMBAQIQAAGWAX0BUQH3AfkB9QHxAf8B/AHjAc8B/wH8
AeQBzwH/AfoB4QHKAf8B+QHdAcQB/wH0AekB3wH/AfcB8gHsAf8B9QHvAekB/wGbAWABRQH7FAADFgEf
AV4CWgHYAygBPQMNAREwAAMbASYDGwEmAxsBJgMbASYDGwEmAxsBJgMbASYDGwEmAxsBJgMbASYDGwEm
AxsBJgMAAQEMAAMbASYDGwEmAxsBJgMbASYDGwEmAxsBJgMbASYDGwEmAxsBJgMbASYDGwEmAxsBJgMA
AQEQAAGJAWoBSQH2AfkB9QHxAf8B/AHjAc0B/wH7AeMBzQH/AfkB4AHIAf8B+AHcAcIB/wH9AfsB+AH/
AfwB5gHNAf8B4gG2AYQB/wJUAVIBphQAAxYBHwMRARcDAgEDuAABngF1AU0B+gH3AfIB7AH/AfgB9AHu
Af8B+AHzAe0B/wH4AfMB7QH/AfgB8gHsAf8B8gHmAdcB/wHiAbIBcQH/AZABcQFiAfYDBQEHFAADAwEE
wAADOgFgAlgBVgG7AbEBfwFPAf4ByAGMAUMB/wGSAX8BUQH3AZIBfwFRAfcBrgF/AUwB/gNOAZQUAAFC
AQEQAAGNAW0BSQH2AfkB9QHxAf8B/AHjAc0B/wH7AeMBzQH/AfkB4AHIAf8B+AHcAcIB/wH9AfsB+AH/
AfwB5gHNAf8B4gG2AYQB/wJUAVIBphQAAxYBHwMRARcDAgEDuAABoAF2AU0B+gH3AfIB7AH/AfgB9AHu
Af8B+AHzAe0B/wH4AfMB7QH/AfgB8gHsAf8B8gHmAdcB/wHiAbIBcgH/AZMBcwFiAfYDBQEHFAADAwEE
wAADOgFgAlgBVgG7AbMBfwFPAf4ByAGMAUQB/wGWAYABUQH3AZYBgAFRAfcBsAF/AUwB/gNOAZQUAAFC
AU0BPgcAAT4DAAEoAwABQAMAASADAAEBAQABAQYAAQEWAAP/gQAB3wX/AeABBwHHBf8CAAHBAf8BwAED
AcABAwIAAcAB/wHAAQMBwAEDAgABwAE/AcABAQHAAQECAAHAAQ8BwAEBAcABAQIAAcABAwHAAQEBwAEB
AgABwAEBAcABAQHAAQECAAHAAQEBwAEBAcABAQIAAcABBwHAAQEBwAEBAgABwAEPAcABAQHAAQEBgAEB
+59 -49
View File
@@ -84,7 +84,7 @@ namespace GraphLib
public float CurXD1 = 0;
public float grid_distance_x = 60; // grid distance in samples ( draw a vertical line every 60 samples )
public float grid_distance_x = 200; // grid distance in samples ( draw a vertical line every 200 samples )
public float grid_off_x = 0;
public float GraphCaptionLineHeight = 28;
@@ -452,7 +452,7 @@ namespace GraphLib
if (layout == LayoutMode.NORMAL)
{
DrawGraphCaption(CurGraphics, source, marker_pos, CurOffX + CurGraphIdx * (50 + yLabelAreaWidth) + (CurGraphIdx==0 ? 0 : 50), curOffY);
DrawGraphCaption(CurGraphics, source, marker_pos, CurOffX + CurGraphIdx * (10 + yLabelAreaWidth), curOffY);
if (CurGraphIdx == 0)
{
@@ -600,7 +600,7 @@ namespace GraphLib
List<int> marker_pos = DrawGraphCurve(CurGraphics, source, CurOffX, curOffY + GraphCaptionLineHeight / 2);
DrawGraphCaption(CurGraphics, source, marker_pos, CurOffX + CurGraphIdx * (50 + yLabelAreaWidth) + (CurGraphIdx == 0 ? 0 : 50), pad_top);
DrawGraphCaption(CurGraphics, source, marker_pos, CurOffX + CurGraphIdx * (10 + yLabelAreaWidth), pad_top);
DrawYLabels(CurGraphics, source, marker_pos, CurOffX, curOffY);
@@ -776,15 +776,12 @@ namespace GraphLib
float y0 = (float)(source.grid_off_y * source.CurGraphHeight / source.DY + source.off_Y);
// draw horizontal zero grid lines
if (0 >= source.YD0 && 0 <= source.YD1)
{
g.DrawLine(p2, new Point((int)CurrOffX, (int)(CurOffY + y0 + 0.5f)), new Point((int)(CurrOffX + source.CurGraphWidth + 0.5f), (int)(CurOffY + y0 + 0.5f)));
}
g.DrawLine(p2, new Point((int)CurrOffX, (int)(CurOffY + y0 + 0.5f)), new Point((int)(CurrOffX + source.CurGraphWidth + 0.5f), (int)(CurOffY + y0 + 0.5f)));
// draw horizontal grid lines
for (float idy = source.grid_off_y; idy > source.YD0; idy -= source.grid_distance_y)
for (Idx = (int)(source.grid_off_y);Idx > (int)(source.YD0 ); Idx -= (int)source.grid_distance_y)
{
float y = (idy * source.CurGraphHeight) / source.DY + source.off_Y;
float y = (float)(Idx * source.CurGraphHeight) / source.DY + source.off_Y;
if (y >= 0 && y < source.CurGraphHeight)
{
@@ -795,9 +792,9 @@ namespace GraphLib
}
// draw horizontal grid lines
for (float idy = source.grid_off_y; idy < source.YD1; idy += source.grid_distance_y)
for (Idx = (int)(source.grid_off_y); Idx < (int)(source.YD1 ); Idx += (int)source.grid_distance_y)
{
float y = (idy * source.CurGraphHeight) / source.DY + source.off_Y;
float y = (float)Idx * source.CurGraphHeight / source.DY + source.off_Y;
if (y >= 0 && y < source.CurGraphHeight)
{
@@ -971,58 +968,71 @@ namespace GraphLib
using (Pen pen = new Pen(b))
{
pen.DashPattern = new float[] { 2, 2 };
float GridDistY = source.grid_distance_y;
///
if (source.AutoScaleY)
{
// calculate a matching grid distance
GridDistY = -Utilities.MostSignificantDigit(source.DY);
if (GridDistY == 0)
{
GridDistY = source.grid_distance_y;
}
}
// draw labels for horizontal lines
if (source.DY != 0)
{
float y0 = (float)(source.grid_off_y * source.CurGraphHeight / source.DY + source.off_Y);
if (y0 >= 0 && y0 < source.CurGraphHeight)
{
String value = (source.OnRenderYAxisLabel == null) ? "0" : source.OnRenderYAxisLabel(source, 0);
SizeF dim = g.MeasureString(value, legendFont);
g.DrawString(value, legendFont, b, new PointF((int)offset_x - dim.Width, (int)(offset_y + y0 + 0.5f + dim.Height / 2)));
}
float Idx = 0;
for (float Idx = source.grid_off_y; Idx > source.YD0; Idx -= GridDistY)
float y0 = (float)(source.grid_off_y * source.CurGraphHeight / source.DY + source.off_Y);
String value = "" + Idx;
if (source.OnRenderYAxisLabel != null)
{
if (Idx != 0)
{
float y1 = (float)(Idx * source.CurGraphHeight) / source.DY + source.off_Y;
value = source.OnRenderYAxisLabel(source, Idx);
}
if (y1 >= 0 && y1 < source.CurGraphHeight)
{
string value = (source.OnRenderYAxisLabel == null) ? Idx.ToString() : source.OnRenderYAxisLabel(source, Idx);
SizeF dim = g.MeasureString(value, legendFont);
g.DrawString(value, legendFont, b, new PointF((int)offset_x - dim.Width, (int)(offset_y + y1 + 0.5f + dim.Height / 2)));
}
SizeF dim = g.MeasureString(value, legendFont);
g.DrawString(value, legendFont, b, new PointF((int)offset_x - dim.Width, (int)(offset_y + y0 + 0.5f + dim.Height / 2)));
float GridDistY = source.grid_distance_y;
if (source.AutoScaleY)
{
// calculate a matching grid distance
GridDistY = - Utilities.MostSignificantDigit(source.DY );
if (GridDistY == 0)
{
GridDistY = source.grid_distance_y;
}
}
for (float Idx = source.grid_off_y; Idx < source.YD1; Idx += GridDistY)
for (Idx = (source.grid_off_y); Idx > (source.Cur_YD0); Idx -= GridDistY)
{
if (Idx != 0)
{
float y2 = (float)(Idx * source.CurGraphHeight) / source.DY + source.off_Y;
float y1 = (float)((Idx) * source.CurGraphHeight) / source.DY + source.off_Y;
if (y2 >= 0 && y2 < source.CurGraphHeight)
{
string value = (source.OnRenderYAxisLabel == null) ? Idx.ToString() : source.OnRenderYAxisLabel(source, Idx);
SizeF dim = g.MeasureString(value, legendFont);
g.DrawString(value, legendFont, b, new PointF((int)offset_x - dim.Width, (int)(offset_y + y2 + 0.5f + dim.Height / 2)));
}
value = "" + (Idx);
if (source.OnRenderYAxisLabel != null)
{
value = source.OnRenderYAxisLabel(source, Idx);
}
dim = g.MeasureString(value, legendFont);
g.DrawString(value, legendFont, b, new PointF((int)offset_x - dim.Width, (int)(offset_y + y1 + 0.5f + dim.Height / 2)));
}
}
for (Idx = (source.grid_off_y); Idx < (source.Cur_YD1); Idx += GridDistY)
{
if (Idx != 0)
{
float y2 = (float)((Idx) * source.CurGraphHeight) / source.DY + source.off_Y;
value = "" + (Idx);
if (source.OnRenderYAxisLabel != null)
{
value = source.OnRenderYAxisLabel(source, Idx);
}
dim = g.MeasureString(value, legendFont);
g.DrawString(value, legendFont, b, new PointF((int)offset_x - dim.Width, (int)(offset_y + y2 + 0.5f + dim.Height / 2)));
}
}
}
+490
View File
@@ -0,0 +1,490 @@
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Runtime.InteropServices;
#region License
/*
* Based on the work of Leslie Sanford
*/
#endregion
namespace PrecisionTimer
{
public enum Mode
{
OneShot,
Periodic
};
[StructLayout(LayoutKind.Sequential)]
public struct TimerCaps
{
public int periodMin;
public int periodMax;
}
public sealed class Timer : IComponent
{
private delegate void TimeProc(int id, int msg, int user, int param1, int param2);
private delegate void EventRaiser(EventArgs e);
[DllImport("winmm.dll")]
private static extern int timeGetDevCaps(ref TimerCaps caps,
int sizeOfTimerCaps);
[DllImport("winmm.dll")]
private static extern int timeSetEvent(int delay,
int resolution,
TimeProc proc,
int user,
int mode);
[DllImport("winmm.dll")]
private static extern int timeKillEvent(int id);
private const int TIMERR_NOERROR = 0;
private int timerID;
private volatile Mode mode;
private volatile int period;
private volatile int resolution;
private TimeProc timeProcPeriodic;
private TimeProc timeProcOneShot;
private EventRaiser tickRaiser;
private bool running = false;
private volatile bool disposed = false;
private ISynchronizeInvoke synchronizingObject = null;
private ISite site = null;
private static TimerCaps caps;
public event EventHandler Started;
public event EventHandler Stopped;
public event EventHandler Tick;
static Timer()
{
// Get multimedia timer capabilities.
timeGetDevCaps(ref caps, Marshal.SizeOf(caps));
}
public Timer(IContainer container)
{
container.Add(this);
Initialize();
}
public Timer()
{
Initialize();
}
~Timer()
{
if(IsRunning)
{
// Stop and destroy timer.
timeKillEvent(timerID);
}
}
private void Initialize()
{
this.mode = Mode.Periodic;
this.period = Capabilities.periodMin;
this.resolution = 1;
running = false;
timeProcPeriodic = new TimeProc(TimerPeriodicEventCallback);
timeProcOneShot = new TimeProc(TimerOneShotEventCallback);
tickRaiser = new EventRaiser(OnTick);
}
public void Start()
{
if(disposed)
{
throw new ObjectDisposedException("Timer");
}
if(IsRunning)
{
return;
}
if(Mode == Mode.Periodic)
{
timerID = timeSetEvent(Period, Resolution, timeProcPeriodic, 0, (int)Mode);
}
else
{
timerID = timeSetEvent(Period, Resolution, timeProcOneShot, 0, (int)Mode);
}
if(timerID != 0)
{
running = true;
if(SynchronizingObject != null && SynchronizingObject.InvokeRequired)
{
SynchronizingObject.BeginInvoke(
new EventRaiser(OnStarted),
new object[] { EventArgs.Empty });
}
else
{
OnStarted(EventArgs.Empty);
}
}
else
{
throw new TimerException("Unable to start timer.");
}
}
public void Stop()
{
if(disposed)
{
throw new ObjectDisposedException("Timer");
}
if(!running)
{
return;
}
int result = timeKillEvent(timerID);
Debug.Assert(result == TIMERR_NOERROR);
running = false;
if(SynchronizingObject != null && SynchronizingObject.InvokeRequired)
{
SynchronizingObject.BeginInvoke(
new EventRaiser(OnStopped),
new object[] { EventArgs.Empty });
}
else
{
OnStopped(EventArgs.Empty);
}
}
private void TimerPeriodicEventCallback(int id, int msg, int user, int param1, int param2)
{
if(synchronizingObject != null)
{
synchronizingObject.BeginInvoke(tickRaiser, new object[] { EventArgs.Empty });
}
else
{
OnTick(EventArgs.Empty);
}
}
private void TimerOneShotEventCallback(int id, int msg, int user, int param1, int param2)
{
if(synchronizingObject != null)
{
synchronizingObject.BeginInvoke(tickRaiser, new object[] { EventArgs.Empty });
Stop();
}
else
{
OnTick(EventArgs.Empty);
Stop();
}
}
// Raises the Disposed event.
private void OnDisposed(EventArgs e)
{
EventHandler handler = Disposed;
if(handler != null)
{
handler(this, e);
}
}
// Raises the Started event.
private void OnStarted(EventArgs e)
{
EventHandler handler = Started;
if(handler != null)
{
handler(this, e);
}
}
// Raises the Stopped event.
private void OnStopped(EventArgs e)
{
EventHandler handler = Stopped;
if(handler != null)
{
handler(this, e);
}
}
// Raises the Tick event.
private void OnTick(EventArgs e)
{
EventHandler handler = Tick;
if(handler != null)
{
handler(this, e);
}
}
/// <summary>
/// Gets or sets the object used to marshal event-handler calls.
/// </summary>
public ISynchronizeInvoke SynchronizingObject
{
get
{
#region Require
if(disposed)
{
throw new ObjectDisposedException("Timer");
}
#endregion
return synchronizingObject;
}
set
{
#region Require
if(disposed)
{
throw new ObjectDisposedException("Timer");
}
#endregion
synchronizingObject = value;
}
}
public int Period
{
get
{
#region Require
if(disposed)
{
throw new ObjectDisposedException("Timer");
}
#endregion
return period;
}
set
{
#region Require
if(disposed)
{
throw new ObjectDisposedException("Timer");
}
else if(value < Capabilities.periodMin || value > Capabilities.periodMax)
{
throw new ArgumentOutOfRangeException("Period", value,
"Multimedia Timer period out of range.");
}
#endregion
period = value;
if(IsRunning)
{
Stop();
Start();
}
}
}
public int Resolution
{
get
{
if(disposed)
{
throw new ObjectDisposedException("Timer");
}
return resolution;
}
set
{
if(disposed)
{
throw new ObjectDisposedException("Timer");
}
else if(value < 0)
{
throw new ArgumentOutOfRangeException("Resolution", value,
"timer resolution out of range.");
}
resolution = value;
if(IsRunning)
{
Stop();
Start();
}
}
}
public Mode Mode
{
get
{
if(disposed)
{
throw new ObjectDisposedException("Timer");
}
return mode;
}
set
{
if(disposed)
{
throw new ObjectDisposedException("Timer");
}
mode = value;
if(IsRunning)
{
Stop();
Start();
}
}
}
/// <summary>
/// Gets a value indicating whether the Timer is running.
/// </summary>
public bool IsRunning
{
get
{
return running;
}
}
/// <summary>
/// Gets the timer capabilities.
/// </summary>
public static TimerCaps Capabilities
{
get
{
return caps;
}
}
public event System.EventHandler Disposed;
public ISite Site
{
get
{
return site;
}
set
{
site = value;
}
}
public void Dispose()
{
if(disposed)
{
return;
}
if(IsRunning)
{
Stop();
}
disposed = true;
OnDisposed(EventArgs.Empty);
}
}
public class TimerException : ApplicationException
{
public TimerException(string message) : base(message)
{
}
}
}
@@ -1,7 +1,7 @@
using System;
using System.Collections.Generic;
namespace TracingDB.Entities
namespace MonitoringDB.Entities
{
public class Part
{
@@ -19,20 +19,12 @@ namespace TracingDB.Entities
public virtual Workstep Workstep { get; set; }
public Part()
protected Part()
{
Name = string.Empty;
Description = string.Empty;
}
public Part(string name, Process process, string description)
{
Name = name;
Description = description;
Process = process;
Workstep = null;
}
/// <summary>
/// Constructor used when the part is added to a process
/// </summary>
@@ -59,28 +51,18 @@ namespace TracingDB.Entities
/// </summary>
/// <param name="process">Process owning the cloned part</param>
/// <returns>Cloned part</returns>
public virtual Part Clone(Process owningProcess)
{
Part rslt = new Part();
rslt.Name = Name;
public virtual Part Clone(Process owningProcess)
{
Part rslt = new Part(Name, owningProcess, CodeType, CodeForm, CodeLocation);
rslt.OraDBType = OraDBType;
rslt.Description = Description;
rslt.CodeType = CodeType;
rslt.CodeForm = CodeForm;
rslt.CodeLocation = CodeLocation;
rslt.LifetimeManagement = LifetimeManagement;
rslt.StepNumber = StepNumber;
rslt.Process = owningProcess;
rslt.Workstep = null;
return rslt;
}
rslt.LifetimeManagement = LifetimeManagement;
return rslt;
}
public override string ToString()
{
return string.Format("{0} ({1}: {2})", Name, StepNumber, Description);
return string.Format("{0} step={1} ({2})", Name, StepNumber, Description);
}
}
}
+68
View File
@@ -0,0 +1,68 @@
using System;
using System.Collections.Generic;
namespace MonitoringDB.Entities
{
public class Process
{
public virtual int Id { get; protected set; }
public virtual int ItemNr { get; set; }
public virtual string Name { get; set; }
public virtual string Description { get; set; }
public virtual ReleaseStatus ReleaseStatus { get; set; }
public virtual DateTime TimeStamp { get; set; }
public virtual string UserName { get; set; }
public virtual IList<Part> Parts { get; set; }
public virtual IList<Workstep> Worksteps { get; set; }
/// <summary>
/// Default (private) constructor inicializing lists
/// </summary>
protected Process()
{
Parts = new List<Part>();
Worksteps = new List<Workstep>();
}
/// <summary>
/// Constructor used when this process is created
/// </summary>
/// <param name="name"></param>
public Process(string name)
: this()
{
Name = name;
Description = string.Empty;
ReleaseStatus = ReleaseStatus.In_preparation;
TimeStamp = DateTime.Now;
UserName = "admin";
}
/// <summary>
/// Create a copy of a process with a new name
/// </summary>
/// <param name="name"></param>
/// <returns></returns>
public virtual Process Clone(string name)
{
Process rslt = new Process(name);
rslt.Description = Description;
foreach (var part in Parts) rslt.Parts.Add(part.Clone(rslt));
foreach (var workstep in Worksteps) rslt.Worksteps.Add(workstep.Clone(rslt));
return rslt;
}
public override string ToString()
{
return string.Format("{0} '{1}' ({2}) {3} {4}",
ItemNr,
Name,
TimeStamp.Date.ToShortDateString(),
(Description == null) ? string.Empty : Description,
ReleaseStatus);
}
}
}
@@ -1,7 +1,7 @@
using System;
using System.Collections.Generic;
namespace TracingDB.Entities
namespace MonitoringDB.Entities
{
public class Record
{
@@ -55,11 +55,7 @@ namespace TracingDB.Entities
public override string ToString()
{
return string.Format("code={0} part={1}{2} description={3}",
Code,
Part.Name,
string.IsNullOrEmpty(Part.OraDBType) ? string.Empty : string.Format(" ORACLE='{0}'", Part.OraDBType),
Part.Description);
return string.Format("code={0} part={1} description='{2}'", Code, Part.Name, Part.Description);
}
}
}
@@ -1,7 +1,7 @@
using System;
using System.Collections.Generic;
namespace TracingDB.Entities
namespace MonitoringDB.Entities
{
public class ReferenceRecord
{
@@ -33,7 +33,6 @@ namespace TracingDB.Entities
/// <param name="code">Scanned barcode</param>
public ReferenceRecord(Process process, Workstep workstep, string code,
string userName, string workplace, int result)
: this()
{
Process = process;
Workstep = workstep;
@@ -1,7 +1,7 @@
using System;
using System.Collections.Generic;
namespace TracingDB.Entities
namespace MonitoringDB.Entities
{
public class Workstep
{
@@ -9,47 +9,13 @@ namespace TracingDB.Entities
public virtual int WorkstepNr { get; set; }
public virtual string Name { get; set; }
public virtual string Description { get; set; }
public virtual int CheckPartNr { get; set; } /// 0 == No previous part checked
public virtual int CheckPartNr { get; set; }
public virtual bool AllowRepairs { get; set; }
public virtual Process Process { get; set; }
public virtual Part ReferencePart { get; set; }
public virtual IList<Part> Parts { get; set; }
public virtual Workstep Clone(Process owningProcess)
{
Workstep rslt = new Workstep(WorkstepNr, Name, owningProcess);
rslt.Description = Description;
rslt.CheckPartNr = CheckPartNr;
rslt.AllowRepairs = AllowRepairs;
if (ReferencePart != null)
{
foreach (var p in owningProcess.Parts)
{
if (p.Name == ReferencePart.Name)
{
rslt.ReferencePart = p;
break;
}
}
}
foreach (var srcP in Parts)
{
foreach (var p in owningProcess.Parts)
{
if ((p.Name == srcP.Name) && (p.StepNumber == srcP.StepNumber))
{
rslt.Parts.Add(p);
p.Workstep = rslt;
}
}
}
return rslt;
}
/// <summary>
/// Default (private) constructor inicializing a list
@@ -76,9 +42,41 @@ namespace TracingDB.Entities
ReferencePart = null;
}
public virtual Workstep Clone(Process owningProcess)
{
Workstep rslt = new Workstep(WorkstepNr, Name, owningProcess);
rslt.Description = Description;
rslt.CheckPartNr = CheckPartNr;
rslt.AllowRepairs = AllowRepairs;
if (ReferencePart != null)
{
foreach (var p in owningProcess.Parts)
{
if (p.Name == ReferencePart.Name) rslt.ReferencePart = p;
}
}
foreach (var srcP in Parts)
{
foreach (var p in owningProcess.Parts)
{
if (p.Name == srcP.Name)
{
rslt.Parts.Add(p);
p.StepNumber = srcP.StepNumber;
p.Workstep = rslt;
}
}
}
return rslt;
}
public override string ToString()
{
return Name; /// Displayed in Pracovisko.WorkstepDlg.workstepComboBox, Items are Workstep objects
//return string.Format("{0} {1} ({2}) Ref: {3}", WorkstepNr, Name, Description, (ReferencePart != null) ? ReferencePart.Name : "none");
return string.Format("{0}: {1}", WorkstepNr, Name);
}
}
}
+94
View File
@@ -0,0 +1,94 @@
namespace MonitoringDB
{
public enum CodeType
{
UniqueNr,
FlowtubeNr, /// prvé 3 znaky sa zhodujú s poslednými 3 znakmi názvu
FlowtubeNrLU, /// začiatok kódu sa zhoduje s názvom
BatchNr,
BatchNrContainingPartName,
DateMMYY,
QualityCheck,
}
public enum CodeForm
{
Barcode,
QRCode,
Keyboard,
OkNok,
}
public enum CodeLocation
{
OnPart,
OnPallet,
}
public enum LifetimeManagement
{
None,
OneYear,
Count,
}
public enum ReleaseStatus
{
In_preparation,
Released,
ReleasedActive,
Deactivated,
Count,
}
public enum Mode
{
Debug, // Debug mode - no Oracle database used
Test, // Test database used
Production, // Production database used
Count,
}
public enum LoginLevel
{
None,
TeamLeader,
Administrator,
MH,
Count,
}
public enum ItemSpecID
{
RefRecordID = 0,
TimeStamp,
Workstep,
Workplace,
UserName,
Barcode,
PartBarcode,
TimeStamp2,
Workstep2,
Workplace2,
UserName2,
Barcode2,
PartBarcode2,
SerialNr,
PurchaseOrder,
TestResult,
MaxPruefindex,
Process,
}
public enum ItemSpecCaps
{
None = 0,
ReferenceRecord = 1,
AssociatedRecord = 2,
OracleQuery = 4,
}
}
+212
View File
@@ -0,0 +1,212 @@
using System;
using System.Collections.Generic;
using FluentNHibernate.Cfg;
using FluentNHibernate.Cfg.Db;
using NHibernate;
using NHibernate.Cfg;
using NHibernate.Tool.hbm2ddl;
namespace MonitoringDB
{
public static class FluentNH
{
/// <summary>
/// Current session factory for the last used connection string or null
/// </summary>
public static ISessionFactory SessionFactory;
/// <summary> Connection string for all sessions </summary>
static string connectionString;
///
public static string ConnectionString
{
get { return connectionString; }
set
{
if (value != connectionString)
{
connectionString = value;
SessionFactory = null; /// Clear SessionFactory on connection string change
}
}
}
/// <summary>
/// NHibernate session factory (to create the database session 'SessionFactory')
/// </summary>
/// <returns>A database session</returns>
static ISessionFactory CreateSessionFactory()
{
return CreateSessionFactory(false);
}
/// <summary>
/// NHibernate session factory (to create the database session 'SessionFactory')
/// </summary>
/// <returns>A database session</returns>
public static ISessionFactory CreateSessionFactory(bool createDB)
{
FluentConfiguration cfg = Fluently
.Configure()
.Database(MySQLConfiguration.Standard.ConnectionString(connectionString))
.Mappings(m => m.FluentMappings.AddFromAssemblyOf<Entities.Process>());
if (createDB)
{
return cfg.ExposeConfiguration(BuildSchemaCreate).BuildSessionFactory();
}
else
{
return cfg.ExposeConfiguration(BuildSchema).BuildSessionFactory();
}
}
public delegate void BuildSchemaDlgt(Configuration config);
public static void BuildSchema(Configuration config)
{
/// This NHibernate tool takes a configuration (with mapping info in)
/// and exports a database schema from it
new SchemaExport(config).SetOutputFile("db_schema");
}
static void BuildSchemaCreate(Configuration config)
{
/// This NHibernate tool takes a configuration (with mapping info in)
/// and exports a database schema from it
new SchemaExport(config).Create(true, true);
}
/// Create a NHibernate session for the given database
public static ISession CreateSession(string connectionString)
{
ConnectionString = connectionString; /// Clears session factory on connction string change
if (SessionFactory == null)
SessionFactory = CreateSessionFactory();
return SessionFactory.OpenSession();
}
/// <summary>
/// Create an empty database.
/// Database contains only the user 'admin' and the control board component 'CB'.
/// </summary>
/// <param name="dbType">DBType.SQLite or DBType.MySql</param>
/// <param name="connectionString">Connection string</param>
/// <returns>true=success, false=error</returns>
public static bool CreateEmptyDB(string connectionString)
{
ConnectionString = connectionString;
ISessionFactory sessionFactory = CreateSessionFactory(true);
if (sessionFactory == null) return false;
/// Populate the database
using (var session = sessionFactory.OpenSession())
{
//using (var transaction = session.BeginTransaction())
//{
// var part1 = new MonitoringDB.Entities.Part("flow tube", CodeType.UniqueNr, CodeForm.QRCode, 0);
// session.SaveOrUpdate(part1);
// transaction.Commit();
//}
}
return true;
}
public static IList<WMPart> FindWMParts(string pcbNumber, string connString)
{
IList<WMPart> foundParts = new List<WMPart>(); /// initially empty
if (string.IsNullOrEmpty(pcbNumber)) return foundParts; /// return an empty list
try
{
ISession session = CreateSession(connString);
IList<Entities.ReferenceRecord> referenceRecords = session
.QueryOver<Entities.ReferenceRecord>()
.Where(x => (x.Code == pcbNumber))
.OrderBy(x => x.TimeStamp).Desc
.List<Entities.ReferenceRecord>();
if (referenceRecords.Count == 0) return foundParts;
foundParts.Add(new WMPart(referenceRecords[0]));
Entities.Process process = referenceRecords[0].Process;
///
foreach (var refR in referenceRecords)
{
if (process != refR.Process)
{
continue; /// skip records obtained by another process
}
IList<Entities.Record> relatedRecords = session
.QueryOver<Entities.Record>()
.Where(x => (x.ReferenceRecord == refR))
.List<Entities.Record>();
foreach (var relR in relatedRecords)
{
foundParts.Add(new WMPart(relR));
foreach (var ws in process.Worksteps)
{
if (ws.ReferencePart == relR.Part)
{
FindWMPartsRecursively(process, ws.ReferencePart, relR.Code, session, ref foundParts);
}
}
}
}
}
catch
{
}
return foundParts;
}
static void FindWMPartsRecursively(Entities.Process process, Entities.Part refPart, string code, ISession session, ref IList<WMPart> foundParts)
{
IList<Entities.ReferenceRecord> referenceRecords = session
.QueryOver<Entities.ReferenceRecord>()
.Where(x => (x.Workstep.ReferencePart == refPart))
.Where(x => (x.Code == code))
.OrderBy(x => x.TimeStamp).Desc
.List<Entities.ReferenceRecord>();
if (referenceRecords.Count == 0) return;
foreach (var refR in referenceRecords)
{
IList<Entities.Record> relatedRecords = session
.QueryOver<Entities.Record>()
.Where(x => (x.ReferenceRecord == refR))
.List<Entities.Record>();
foreach (var relR in relatedRecords)
{
foundParts.Add(new WMPart(relR));
foreach (var ws in process.Worksteps)
{
if (ws.ReferencePart == relR.Part)
{
FindWMPartsRecursively(process, ws.ReferencePart, relR.Code, session, ref foundParts);
}
}
}
}
}
}
}
@@ -9,7 +9,7 @@ using System.Data;
using System.Windows.Forms;
using System.Runtime.InteropServices;
namespace TracingDB.Forms
namespace MonitoringDB.Forms
{
/// <summary>
/// Event Handler for SubItem events
@@ -61,10 +61,6 @@ namespace TracingDB.Forms
private const int HDN_ITEMCHANGINGW = (HDN_FIRST-20);
#endregion
public SortOrder SortOrder = SortOrder.None;
public int SortColumn = -1;
/// <summary>
/// Required designer variable.
/// </summary>
@@ -398,18 +394,12 @@ namespace TracingDB.Forms
OnSubItemEndEditing(e);
if (_editSubItem >= 0 && _editSubItem < _editItem.SubItems.Count)
{
_editItem.SubItems[_editSubItem].Text = e.DisplayText;
}
_editItem.SubItems[_editSubItem].Text = e.DisplayText;
if (_editingControl != null)
{
_editingControl.Leave -= new EventHandler(_editControl_Leave);
_editingControl.KeyPress -= new KeyPressEventHandler(_editControl_KeyPress);
_editingControl.Leave -= new EventHandler(_editControl_Leave);
_editingControl.KeyPress -= new KeyPressEventHandler(_editControl_KeyPress);
_editingControl.Visible = false;
}
_editingControl.Visible = false;
_editingControl = null;
_editItem = null;
@@ -1,4 +1,4 @@
namespace TracingDB.Forms
namespace MonitoringDB.Forms
{
partial class ModelessForm
{
@@ -2,7 +2,7 @@
using System.Drawing;
using System.Windows.Forms;
namespace Statistics.Forms
namespace MonitoringDB.Forms
{
public partial class ModelessForm : Form
{
@@ -5,10 +5,10 @@ using System;
using System.Collections.Generic;
using System.Windows.Forms;
using log4net;
using TracingDB.Entities;
using TracingDB.Resources;
using MonitoringDB.Entities;
using MonitoringDB.Resources;
namespace TracingDB.Forms
namespace MonitoringDB.Forms
{
public partial class ResultsConfigDlg : Form
{
@@ -1,7 +1,7 @@
///
/// Copyright (c) 2016 Sensus Metering Systems
///
namespace TracingDB.Forms
namespace MonitoringDB.Forms
{
partial class ResultsConfigDlg
{
@@ -39,7 +39,7 @@ namespace TracingDB.Forms
this.removeAllButton = new System.Windows.Forms.Button();
this.removeButton = new System.Windows.Forms.Button();
this.addButton = new System.Windows.Forms.Button();
this.selectedResultsListViewEx = new TracingDB.Forms.ListViewEx();
this.selectedResultsListViewEx = new MonitoringDB.Forms.ListViewEx();
this.upButton = new System.Windows.Forms.Button();
this.downButton = new System.Windows.Forms.Button();
this.SuspendLayout();
@@ -133,8 +133,8 @@ namespace TracingDB.Forms
this.selectedResultsListViewEx.TabIndex = 47;
this.selectedResultsListViewEx.UseCompatibleStateImageBehavior = false;
this.selectedResultsListViewEx.View = System.Windows.Forms.View.Details;
this.selectedResultsListViewEx.SubItemClicked += new TracingDB.Forms.SubItemEventHandler(this.selectedResultsListViewEx_SubItemClicked);
this.selectedResultsListViewEx.SubItemEndEditing += new TracingDB.Forms.SubItemEndEditingEventHandler(this.selectedResultsListViewEx_SubItemEndEditing);
this.selectedResultsListViewEx.SubItemClicked += new MonitoringDB.Forms.SubItemEventHandler(this.selectedResultsListViewEx_SubItemClicked);
this.selectedResultsListViewEx.SubItemEndEditing += new MonitoringDB.Forms.SubItemEndEditingEventHandler(this.selectedResultsListViewEx_SubItemEndEditing);
//
// upButton
//
+263
View File
@@ -0,0 +1,263 @@
namespace MonitoringDB.Forms
{
partial class SettingsDlg
{
/// <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.groupBox1 = new System.Windows.Forms.GroupBox();
this.connectionStringTextBox = new System.Windows.Forms.TextBox();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.radioButton2 = new System.Windows.Forms.RadioButton();
this.radioButton1 = new System.Windows.Forms.RadioButton();
this.groupBox3 = new System.Windows.Forms.GroupBox();
this.workplaceNameTextBox = new System.Windows.Forms.TextBox();
this.saveButton = new System.Windows.Forms.Button();
this.cancelButton = new System.Windows.Forms.Button();
this.groupBox4 = new System.Windows.Forms.GroupBox();
this.extraBatteryLifetimeTextBox = new System.Windows.Forms.TextBox();
this.oracleGroupBox = new System.Windows.Forms.GroupBox();
this.checkPcbIsInOracleCheckBox = new System.Windows.Forms.CheckBox();
this.oracleBatteryCheckBox = new System.Windows.Forms.CheckBox();
this.groupBox5 = new System.Windows.Forms.GroupBox();
this.usersDBConnStringTextBox = new System.Windows.Forms.TextBox();
this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout();
this.groupBox3.SuspendLayout();
this.groupBox4.SuspendLayout();
this.oracleGroupBox.SuspendLayout();
this.groupBox5.SuspendLayout();
this.SuspendLayout();
//
// groupBox1
//
this.groupBox1.Controls.Add(this.connectionStringTextBox);
this.groupBox1.Location = new System.Drawing.Point(12, 69);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(622, 50);
this.groupBox1.TabIndex = 1;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Connection string pre záznamy z výroby";
//
// connectionStringTextBox
//
this.connectionStringTextBox.Location = new System.Drawing.Point(17, 18);
this.connectionStringTextBox.Name = "connectionStringTextBox";
this.connectionStringTextBox.Size = new System.Drawing.Size(586, 20);
this.connectionStringTextBox.TabIndex = 0;
//
// groupBox2
//
this.groupBox2.Controls.Add(this.radioButton2);
this.groupBox2.Controls.Add(this.radioButton1);
this.groupBox2.Location = new System.Drawing.Point(12, 250);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(268, 70);
this.groupBox2.TabIndex = 4;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "Režim činnosti";
//
// radioButton2
//
this.radioButton2.AutoSize = true;
this.radioButton2.Location = new System.Drawing.Point(101, 41);
this.radioButton2.Name = "radioButton2";
this.radioButton2.Size = new System.Drawing.Size(58, 17);
this.radioButton2.TabIndex = 1;
this.radioButton2.TabStop = true;
this.radioButton2.Text = "Výroba";
this.radioButton2.UseVisualStyleBackColor = true;
//
// radioButton1
//
this.radioButton1.AutoSize = true;
this.radioButton1.Location = new System.Drawing.Point(101, 20);
this.radioButton1.Name = "radioButton1";
this.radioButton1.Size = new System.Drawing.Size(46, 17);
this.radioButton1.TabIndex = 0;
this.radioButton1.TabStop = true;
this.radioButton1.Text = "Test";
this.radioButton1.UseVisualStyleBackColor = true;
//
// groupBox3
//
this.groupBox3.Controls.Add(this.workplaceNameTextBox);
this.groupBox3.Location = new System.Drawing.Point(12, 12);
this.groupBox3.Name = "groupBox3";
this.groupBox3.Size = new System.Drawing.Size(622, 50);
this.groupBox3.TabIndex = 0;
this.groupBox3.TabStop = false;
this.groupBox3.Text = "Meno pracoviska";
//
// workplaceNameTextBox
//
this.workplaceNameTextBox.Location = new System.Drawing.Point(17, 18);
this.workplaceNameTextBox.Name = "workplaceNameTextBox";
this.workplaceNameTextBox.Size = new System.Drawing.Size(586, 20);
this.workplaceNameTextBox.TabIndex = 0;
//
// saveButton
//
this.saveButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.saveButton.Location = new System.Drawing.Point(348, 270);
this.saveButton.Name = "saveButton";
this.saveButton.Size = new System.Drawing.Size(104, 42);
this.saveButton.TabIndex = 6;
this.saveButton.Text = "Uložiť";
this.saveButton.UseVisualStyleBackColor = true;
this.saveButton.Click += new System.EventHandler(this.saveButton_Click);
//
// cancelButton
//
this.cancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.cancelButton.Location = new System.Drawing.Point(488, 270);
this.cancelButton.Name = "cancelButton";
this.cancelButton.Size = new System.Drawing.Size(104, 42);
this.cancelButton.TabIndex = 7;
this.cancelButton.Text = "Zrušiť";
this.cancelButton.UseVisualStyleBackColor = true;
this.cancelButton.Click += new System.EventHandler(this.cancelButton_Click);
//
// groupBox4
//
this.groupBox4.Controls.Add(this.extraBatteryLifetimeTextBox);
this.groupBox4.Location = new System.Drawing.Point(12, 182);
this.groupBox4.Name = "groupBox4";
this.groupBox4.Size = new System.Drawing.Size(268, 62);
this.groupBox4.TabIndex = 3;
this.groupBox4.TabStop = false;
this.groupBox4.Text = "Predĺženie životnosti baterky v mesiacoch";
//
// extraBatteryLifetimeTextBox
//
this.extraBatteryLifetimeTextBox.Location = new System.Drawing.Point(17, 25);
this.extraBatteryLifetimeTextBox.Name = "extraBatteryLifetimeTextBox";
this.extraBatteryLifetimeTextBox.Size = new System.Drawing.Size(230, 20);
this.extraBatteryLifetimeTextBox.TabIndex = 0;
//
// oracleGroupBox
//
this.oracleGroupBox.Controls.Add(this.checkPcbIsInOracleCheckBox);
this.oracleGroupBox.Controls.Add(this.oracleBatteryCheckBox);
this.oracleGroupBox.Location = new System.Drawing.Point(297, 182);
this.oracleGroupBox.Name = "oracleGroupBox";
this.oracleGroupBox.Size = new System.Drawing.Size(337, 74);
this.oracleGroupBox.TabIndex = 5;
this.oracleGroupBox.TabStop = false;
this.oracleGroupBox.Text = "Oracle";
this.oracleGroupBox.Visible = false;
//
// checkPcbIsInOracleCheckBox
//
this.checkPcbIsInOracleCheckBox.AutoSize = true;
this.checkPcbIsInOracleCheckBox.Location = new System.Drawing.Point(18, 45);
this.checkPcbIsInOracleCheckBox.Name = "checkPcbIsInOracleCheckBox";
this.checkPcbIsInOracleCheckBox.Size = new System.Drawing.Size(213, 17);
this.checkPcbIsInOracleCheckBox.TabIndex = 0;
this.checkPcbIsInOracleCheckBox.Text = "Skontrolovať či PCB už bola overovaná";
this.checkPcbIsInOracleCheckBox.UseVisualStyleBackColor = true;
//
// oracleBatteryCheckBox
//
this.oracleBatteryCheckBox.AutoSize = true;
this.oracleBatteryCheckBox.Location = new System.Drawing.Point(18, 19);
this.oracleBatteryCheckBox.Name = "oracleBatteryCheckBox";
this.oracleBatteryCheckBox.Size = new System.Drawing.Size(193, 17);
this.oracleBatteryCheckBox.TabIndex = 0;
this.oracleBatteryCheckBox.Text = "Uložiť informácie o batérii do Oracle";
this.oracleBatteryCheckBox.UseVisualStyleBackColor = true;
//
// groupBox5
//
this.groupBox5.Controls.Add(this.usersDBConnStringTextBox);
this.groupBox5.Location = new System.Drawing.Point(12, 125);
this.groupBox5.Name = "groupBox5";
this.groupBox5.Size = new System.Drawing.Size(622, 50);
this.groupBox5.TabIndex = 2;
this.groupBox5.TabStop = false;
this.groupBox5.Text = "Connection string pre centrálnu databázu používateľov";
//
// usersDBConnStringTextBox
//
this.usersDBConnStringTextBox.Location = new System.Drawing.Point(17, 18);
this.usersDBConnStringTextBox.Name = "usersDBConnStringTextBox";
this.usersDBConnStringTextBox.Size = new System.Drawing.Size(586, 20);
this.usersDBConnStringTextBox.TabIndex = 0;
//
// SettingsDlg
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(648, 333);
this.Controls.Add(this.groupBox5);
this.Controls.Add(this.oracleGroupBox);
this.Controls.Add(this.groupBox4);
this.Controls.Add(this.cancelButton);
this.Controls.Add(this.saveButton);
this.Controls.Add(this.groupBox3);
this.Controls.Add(this.groupBox2);
this.Controls.Add(this.groupBox1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.MaximizeBox = false;
this.Name = "SettingsDlg";
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
this.Text = "SettingsDlg";
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.groupBox2.ResumeLayout(false);
this.groupBox2.PerformLayout();
this.groupBox3.ResumeLayout(false);
this.groupBox3.PerformLayout();
this.groupBox4.ResumeLayout(false);
this.groupBox4.PerformLayout();
this.oracleGroupBox.ResumeLayout(false);
this.oracleGroupBox.PerformLayout();
this.groupBox5.ResumeLayout(false);
this.groupBox5.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.TextBox connectionStringTextBox;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.GroupBox groupBox3;
private System.Windows.Forms.TextBox workplaceNameTextBox;
private System.Windows.Forms.Button saveButton;
private System.Windows.Forms.Button cancelButton;
private System.Windows.Forms.RadioButton radioButton2;
private System.Windows.Forms.RadioButton radioButton1;
private System.Windows.Forms.GroupBox groupBox4;
private System.Windows.Forms.TextBox extraBatteryLifetimeTextBox;
private System.Windows.Forms.GroupBox oracleGroupBox;
private System.Windows.Forms.CheckBox oracleBatteryCheckBox;
private System.Windows.Forms.CheckBox checkPcbIsInOracleCheckBox;
private System.Windows.Forms.GroupBox groupBox5;
private System.Windows.Forms.TextBox usersDBConnStringTextBox;
}
}
+87
View File
@@ -0,0 +1,87 @@
using System;
using System.Windows.Forms;
namespace MonitoringDB.Forms
{
public partial class SettingsDlg : Form
{
public string WorkplaceName
{
set { workplaceNameTextBox.Text = value; }
get { return workplaceNameTextBox.Text; }
}
public string ConnectionString
{
set { connectionStringTextBox.Text = value; }
get { return connectionStringTextBox.Text; }
}
public string UsersDBConnString
{
set { usersDBConnStringTextBox.Text = value; }
get { return usersDBConnStringTextBox.Text; }
}
public bool OracleBattery
{
set { oracleBatteryCheckBox.Checked = value; }
get { return oracleBatteryCheckBox.Checked; }
}
public bool CheckPcbIsInOracle
{
set { checkPcbIsInOracleCheckBox.Checked = value; }
get { return checkPcbIsInOracleCheckBox.Checked; }
}
public int ExtraBatterLifetime
{
get
{
int extraLifetime;
if (int.TryParse(extraBatteryLifetimeTextBox.Text, out extraLifetime) && extraLifetime >= 0) return extraLifetime;
return 0;
}
}
public MonitoringDB.Mode Mode
{
set
{
radioButton1.Checked = (value == MonitoringDB.Mode.Test);
radioButton2.Checked = (value == MonitoringDB.Mode.Production);
}
get
{
return radioButton1.Checked ? MonitoringDB.Mode.Test : MonitoringDB.Mode.Production;
}
}
/// <summary>
/// Basic configuration dialog
/// </summary>
/// <param name="isWorkplace">false = Konfiguracia pracovisk, true = Pracovisko</param>
public SettingsDlg(bool isWorkplace)
{
InitializeComponent();
if (isWorkplace)
{
oracleGroupBox.Visible = true;
}
extraBatteryLifetimeTextBox.Text = "0";
}
private void saveButton_Click(object sender, EventArgs e)
{
DialogResult = DialogResult.OK;
Close();
}
private void cancelButton_Click(object sender, EventArgs e)
{
DialogResult = DialogResult.Cancel;
Close();
}
}
}
+49
View File
@@ -0,0 +1,49 @@
using System;
using System.Windows.Forms;
namespace MonitoringDB.Forms
{
public partial class TrivialLoginDlg : Form
{
public LoginLevel LoginLevel;
public TrivialLoginDlg()
{
InitializeComponent();
LoginLevel = LoginLevel.None;
}
private void okButton_Click(object sender, EventArgs e)
{
if (passwordTextBox.Text.ToLower().Equals("barcode"))
{
LoginLevel = LoginLevel.Administrator;
DialogResult = DialogResult.OK;
Close();
}
else if (passwordTextBox.Text.ToLower().Equals("teamleader"))
{
LoginLevel = LoginLevel.TeamLeader;
DialogResult = DialogResult.OK;
Close();
}
else if (passwordTextBox.Text.ToLower().Equals("kremik"))
{
LoginLevel = LoginLevel.MH;
DialogResult = DialogResult.OK;
Close();
}
else
{
DialogResult = DialogResult.Cancel;
Close();
}
}
private void cancelButton_Click(object sender, EventArgs e)
{
DialogResult = DialogResult.Cancel;
Close();
}
}
}
+105
View File
@@ -0,0 +1,105 @@
namespace MonitoringDB.Forms
{
partial class TrivialLoginDlg
{
/// <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.passwordGroupBox = new System.Windows.Forms.GroupBox();
this.passwordTextBox = new System.Windows.Forms.TextBox();
this.okButton = new System.Windows.Forms.Button();
this.cancelButton = new System.Windows.Forms.Button();
this.passwordGroupBox.SuspendLayout();
this.SuspendLayout();
//
// passwordGroupBox
//
this.passwordGroupBox.Controls.Add(this.passwordTextBox);
this.passwordGroupBox.Location = new System.Drawing.Point(12, 10);
this.passwordGroupBox.Name = "passwordGroupBox";
this.passwordGroupBox.Size = new System.Drawing.Size(200, 49);
this.passwordGroupBox.TabIndex = 0;
this.passwordGroupBox.TabStop = false;
this.passwordGroupBox.Text = "Heslo";
//
// passwordTextBox
//
this.passwordTextBox.Location = new System.Drawing.Point(51, 18);
this.passwordTextBox.Name = "passwordTextBox";
this.passwordTextBox.PasswordChar = '*';
this.passwordTextBox.Size = new System.Drawing.Size(100, 20);
this.passwordTextBox.TabIndex = 0;
//
// okButton
//
this.okButton.Location = new System.Drawing.Point(237, 18);
this.okButton.Name = "okButton";
this.okButton.Size = new System.Drawing.Size(75, 39);
this.okButton.TabIndex = 1;
this.okButton.Text = "OK";
this.okButton.UseVisualStyleBackColor = true;
this.okButton.Click += new System.EventHandler(this.okButton_Click);
//
// cancelButton
//
this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.cancelButton.Location = new System.Drawing.Point(330, 18);
this.cancelButton.Name = "cancelButton";
this.cancelButton.Size = new System.Drawing.Size(75, 39);
this.cancelButton.TabIndex = 2;
this.cancelButton.Text = "Cancel";
this.cancelButton.UseVisualStyleBackColor = true;
this.cancelButton.Click += new System.EventHandler(this.cancelButton_Click);
//
// LoginDlg
//
this.AcceptButton = this.okButton;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.cancelButton;
this.ClientSize = new System.Drawing.Size(426, 73);
this.Controls.Add(this.cancelButton);
this.Controls.Add(this.okButton);
this.Controls.Add(this.passwordGroupBox);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "LoginDlg";
this.Text = "LoginDlg";
this.passwordGroupBox.ResumeLayout(false);
this.passwordGroupBox.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.GroupBox passwordGroupBox;
private System.Windows.Forms.TextBox passwordTextBox;
private System.Windows.Forms.Button okButton;
private System.Windows.Forms.Button cancelButton;
}
}
@@ -3,12 +3,12 @@
///
using System;
using System.Collections.Generic;
using TracingDB.Entities;
using TracingDB.Resources;
using MonitoringDB.Entities;
using MonitoringDB.Resources;
using NHibernate;
using NHibernate.Criterion;
namespace TracingDB
namespace MonitoringDB
{
public class ItemSpec
{
@@ -50,11 +50,6 @@ namespace TracingDB
Width = 0;
}
public override string ToString()
{
return string.Format("uid={0}, name={1}, caption={2}", Uid, Name, Caption);
}
/// <summary> Copy constructor </summary>
public ItemSpec Clone()
{
@@ -99,58 +94,28 @@ namespace TracingDB
{
AllItems = new List<ItemSpec>();
AllItems.Add(new ItemSpec(ItemSpecID.RefRecordID, Strings.RefRecordID, (x, f, p, w) => ((int)x).ToString(), ItemSpecCaps.ReferenceRecord));
AllItems.Add(new ItemSpec(ItemSpecID.RefRecordID, Strings.RefRecordID, (x, f, p, w) => ((int)x).ToString(), ItemSpecCaps.ReferenceRecord));
AllItems.Add(new ItemSpec(ItemSpecID.TimeStamp, Strings.Time_stamp, (x, f, p, w) => string.IsNullOrEmpty(f) ? ((DateTime)x).ToString() : string.Format(f, (DateTime)x), ItemSpecCaps.ReferenceRecord));
AllItems.Add(new ItemSpec(ItemSpecID.Workstep, Strings.Workstep, (x, f, p, w) => FormatStr(f, ((Workstep)x).Name), ItemSpecCaps.ReferenceRecord));
AllItems.Add(new ItemSpec(ItemSpecID.Workplace, Strings.Workplace, (x, f, p, w) => FormatStr(f, x), ItemSpecCaps.ReferenceRecord));
AllItems.Add(new ItemSpec(ItemSpecID.UserName, Strings.User_name, (x, f, p, w) => FormatStr(f, x), ItemSpecCaps.ReferenceRecord));
AllItems.Add(new ItemSpec(ItemSpecID.Barcode, Strings.Ref_part_barcode, (x, f, p, w) => FormatStr(f, x), ItemSpecCaps.ReferenceRecord));
AllItems.Add(new ItemSpec(ItemSpecID.RefPartName, Strings.Ref_part_name, (x, f, p, w) => FormatStr(f, ((Workstep)x).ReferencePart.Name), ItemSpecCaps.ReferenceRecord));
AllItems.Add(new ItemSpec(ItemSpecID.PartBarcode, Strings.Part_barcode, (x, f, p, w) => FormatStr(f, x), ItemSpecCaps.ReferenceRecord | ItemSpecCaps.AssociatedRecord));
AllItems.Add(new ItemSpec(ItemSpecID.PartName, Strings.Part_name, (x, f, p, w) => FormatStr(f, ((Part)x).Name), ItemSpecCaps.ReferenceRecord | ItemSpecCaps.AssociatedRecord));
AllItems.Add(new ItemSpec(ItemSpecID.TimeStamp, Strings.Time_stamp, (x, f, p, w) => string.IsNullOrEmpty(f) ? ((DateTime)x).ToString() : string.Format(f, (DateTime)x), ItemSpecCaps.ReferenceRecord));
AllItems.Add(new ItemSpec(ItemSpecID.Workstep, Strings.Workstep, (x, f, p, w) => string.IsNullOrEmpty(f) ? ((Workstep)x).Name : string.Format(f, ((Workstep)x).Name), ItemSpecCaps.ReferenceRecord));
AllItems.Add(new ItemSpec(ItemSpecID.Workplace, Strings.Workplace, (x, f, p, w) => string.IsNullOrEmpty(f) ? (string)x : string.Format(f, x), ItemSpecCaps.ReferenceRecord));
AllItems.Add(new ItemSpec(ItemSpecID.UserName, Strings.User_name, (x, f, p, w) => string.IsNullOrEmpty(f) ? (string)x : string.Format(f, x), ItemSpecCaps.ReferenceRecord));
AllItems.Add(new ItemSpec(ItemSpecID.Barcode, Strings.Barcode, (x, f, p, w) => string.IsNullOrEmpty(f) ? (string)x : string.Format(f, x), ItemSpecCaps.ReferenceRecord));
AllItems.Add(new ItemSpec(ItemSpecID.PartBarcode, Strings.Part_barcode, (x, f, p, w) => string.IsNullOrEmpty(f) ? (string)x : string.Format(f, x), ItemSpecCaps.ReferenceRecord | ItemSpecCaps.AssociatedRecord));
AllItems.Add(new ItemSpec(ItemSpecID.TimeStamp2, Strings.Time_stamp+"2", (x, f, p, w) => string.IsNullOrEmpty(f) ? ((DateTime)x).ToString() : string.Format(f, (DateTime)x), ItemSpecCaps.ReferenceRecord));
AllItems.Add(new ItemSpec(ItemSpecID.Workstep2, Strings.Workstep + "2", (x, f, p, w) => FormatStr(f, ((Workstep)x).Name), ItemSpecCaps.ReferenceRecord));
AllItems.Add(new ItemSpec(ItemSpecID.Workplace2, Strings.Workplace + "2", (x, f, p, w) => FormatStr(f, x), ItemSpecCaps.ReferenceRecord));
AllItems.Add(new ItemSpec(ItemSpecID.UserName2, Strings.User_name + "2", (x, f, p, w) => FormatStr(f, x), ItemSpecCaps.ReferenceRecord));
AllItems.Add(new ItemSpec(ItemSpecID.Barcode2, Strings.Barcode + "2", (x, f, p, w) => FormatStr(f, x), ItemSpecCaps.ReferenceRecord));
AllItems.Add(new ItemSpec(ItemSpecID.PartBarcode2, Strings.Part_barcode+"2", (x, f, p, w) => FormatStr(f, x), ItemSpecCaps.ReferenceRecord | ItemSpecCaps.AssociatedRecord));
AllItems.Add(new ItemSpec(ItemSpecID.TimeStamp2, Strings.Time_stamp+"2", (x, f, p, w) => string.IsNullOrEmpty(f) ? ((DateTime)x).ToString() : string.Format(f, (DateTime)x), ItemSpecCaps.ReferenceRecord));
AllItems.Add(new ItemSpec(ItemSpecID.Workstep2, Strings.Workstep+"2", (x, f, p, w) => string.IsNullOrEmpty(f) ? ((Workstep)x).Name : string.Format(f, ((Workstep)x).Name), ItemSpecCaps.ReferenceRecord));
AllItems.Add(new ItemSpec(ItemSpecID.Workplace2, Strings.Workplace+"2", (x, f, p, w) => string.IsNullOrEmpty(f) ? (string)x : string.Format(f, x), ItemSpecCaps.ReferenceRecord));
AllItems.Add(new ItemSpec(ItemSpecID.UserName2, Strings.User_name+"2", (x, f, p, w) => string.IsNullOrEmpty(f) ? (string)x : string.Format(f, x), ItemSpecCaps.ReferenceRecord));
AllItems.Add(new ItemSpec(ItemSpecID.Barcode2, Strings.Barcode+"2", (x, f, p, w) => string.IsNullOrEmpty(f) ? (string)x : string.Format(f, x), ItemSpecCaps.ReferenceRecord));
AllItems.Add(new ItemSpec(ItemSpecID.PartBarcode2, Strings.Part_barcode+"2",(x, f, p, w)=> string.IsNullOrEmpty(f) ? (string)x : string.Format(f, x), ItemSpecCaps.ReferenceRecord | ItemSpecCaps.AssociatedRecord));
AllItems.Add(new ItemSpec(ItemSpecID.SerialNr, Strings.Serial_nr, (x, f, p, w) => x as string, ItemSpecCaps.ReferenceRecord | ItemSpecCaps.OracleQuery));
AllItems.Add(new ItemSpec(ItemSpecID.PurchaseOrder, Strings.Purchase_order, (x, f, p, w) => x as string, ItemSpecCaps.ReferenceRecord | ItemSpecCaps.OracleQuery));
AllItems.Add(new ItemSpec(ItemSpecID.TestResult, Strings.Test_result, (x, f, p, w) => x as string, ItemSpecCaps.ReferenceRecord | ItemSpecCaps.OracleQuery));
AllItems.Add(new ItemSpec(ItemSpecID.MaxPruefindex, Strings.Tests_count, (x, f, p, w) => x as string, ItemSpecCaps.ReferenceRecord | ItemSpecCaps.OracleQuery));
AllItems.Add(new ItemSpec(ItemSpecID.MaxTestindexEx,Strings.Tests_count_and_rslt,(x, f, p, w) => x as string, ItemSpecCaps.ReferenceRecord | ItemSpecCaps.OracleQuery));
AllItems.Add(new ItemSpec(ItemSpecID.TestBenchId, Strings.Test_bench_Id, (x, f, p, w) => x as string, ItemSpecCaps.ReferenceRecord | ItemSpecCaps.OracleQuery));
AllItems.Add(new ItemSpec(ItemSpecID.Process, Strings.Process, (x, f, p, w) => FormatStr(f, ((Process)x).Name), ItemSpecCaps.ReferenceRecord));
}
public static string FormatStr(string format, object value)
{
int len;
if (string.IsNullOrEmpty(format))
{
return (string)value;
}
else if (int.TryParse(format, out len) && len > 0)
{
if (((string)value).Length >= len)
{
return ((string)value).Substring(0, len);
}
else
{
return (string)value;
}
}
else
{
return string.Format(format, value);
}
AllItems.Add(new ItemSpec(ItemSpecID.SerialNr, Strings.Serial_nr, (x, f, p, w) => x as string, ItemSpecCaps.ReferenceRecord | ItemSpecCaps.OracleQuery));
AllItems.Add(new ItemSpec(ItemSpecID.PurchaseOrder, Strings.Purchase_order, (x, f, p, w) => x as string, ItemSpecCaps.ReferenceRecord | ItemSpecCaps.OracleQuery));
AllItems.Add(new ItemSpec(ItemSpecID.TestResult, Strings.Test_result, (x, f, p, w) => x as string, ItemSpecCaps.ReferenceRecord | ItemSpecCaps.OracleQuery));
AllItems.Add(new ItemSpec(ItemSpecID.MaxPruefindex, Strings.Max_pruefindex, (x, f, p, w) => x as string, ItemSpecCaps.ReferenceRecord | ItemSpecCaps.OracleQuery));
AllItems.Add(new ItemSpec(ItemSpecID.Process, Strings.Process, (x, f, p, w) => string.IsNullOrEmpty(f) ? ((Process)x).Name : string.Format(f, ((Process)x).Name), ItemSpecCaps.ReferenceRecord));
}
public PropertyProjection GetProperty(ReferenceRecord refRecord, Record record)
@@ -164,9 +129,7 @@ namespace TracingDB
case ItemSpecID.Workplace: return Projections.Property(() => refRecord.Workplace);
case ItemSpecID.UserName: return Projections.Property(() => refRecord.UserName);
case ItemSpecID.Barcode: return Projections.Property(() => refRecord.Code);
case ItemSpecID.RefPartName: return Projections.Property(() => refRecord.Workstep);
case ItemSpecID.PartBarcode: return Projections.Property(() => record.Code);
case ItemSpecID.PartName: return Projections.Property(() => record.Part);
case ItemSpecID.TimeStamp2: return null;
case ItemSpecID.Workstep2: return null;
@@ -179,8 +142,6 @@ namespace TracingDB
case ItemSpecID.PurchaseOrder: return null;
case ItemSpecID.TestResult: return null;
case ItemSpecID.MaxPruefindex: return null;
case ItemSpecID.MaxTestindexEx: return null;
case ItemSpecID.TestBenchId: return null;
case ItemSpecID.Process: return Projections.Property(() => refRecord.Process);
@@ -212,8 +173,6 @@ namespace TracingDB
case ItemSpecID.PurchaseOrder: return null;
case ItemSpecID.TestResult: return null;
case ItemSpecID.MaxPruefindex: return null;
case ItemSpecID.MaxTestindexEx: return null;
case ItemSpecID.TestBenchId: return null;
case ItemSpecID.Process: return Projections.Property(() => refRecord2.Process);
@@ -1,6 +1,6 @@
using FluentNHibernate.Mapping;
namespace TracingDB.Mappings
namespace MonitoringDB.Mappings
{
class PartMap : ClassMap<Entities.Part>
{
+25
View File
@@ -0,0 +1,25 @@
using FluentNHibernate.Mapping;
namespace MonitoringDB.Mappings
{
class ProcessMap : ClassMap<Entities.Process>
{
public ProcessMap()
{
Id(x => x.Id);
Map(x => x.ItemNr);
Map(x => x.Name);
Map(x => x.Description);
Map(x => x.ReleaseStatus);
Map(x => x.TimeStamp);
Map(x => x.UserName);
HasMany(x => x.Parts)
.OrderBy("Name")
.Cascade.All();
HasMany(x => x.Worksteps)
.OrderBy("WorkstepNr")
.Cascade.All();
}
}
}
@@ -1,6 +1,6 @@
using FluentNHibernate.Mapping;
namespace TracingDB.Mappings
namespace MonitoringDB.Mappings
{
class RecordMap : ClassMap<Entities.Record>
{
@@ -1,6 +1,6 @@
using FluentNHibernate.Mapping;
namespace TracingDB.Mappings
namespace MonitoringDB.Mappings
{
class ReferenceRecordMap : ClassMap<Entities.ReferenceRecord>
{
@@ -1,6 +1,6 @@
using FluentNHibernate.Mapping;
namespace TracingDB.Mappings
namespace MonitoringDB.Mappings
{
class WorkstepMap : ClassMap<Entities.Workstep>
{
@@ -8,8 +8,8 @@
<ProjectGuid>{EFEC8A31-3022-4DA7-A8F6-16D30A94C3FF}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>TracingDB</RootNamespace>
<AssemblyName>TracingDB</AssemblyName>
<RootNamespace>MonitoringDB</RootNamespace>
<AssemblyName>MonitoringDB</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
@@ -61,14 +61,15 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="BatteryAndFlowtubeInfo.cs" />
<Compile Include="Entities\WorkplaceRegistration.cs" />
<Compile Include="Forms\ListViewEx.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Forms\ListViewExtensions.cs" />
<Compile Include="Forms\LviIntColumnComparer.cs" />
<Compile Include="Forms\LviTextColumnComparer.cs" />
<Compile Include="Forms\TrivialLoginDlg.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Forms\TrivialLoginDlg.designer.cs">
<DependentUpon>TrivialLoginDlg.cs</DependentUpon>
</Compile>
<Compile Include="Forms\ModelessForm.cs">
<SubType>Form</SubType>
</Compile>
@@ -81,8 +82,13 @@
<Compile Include="Forms\ResultsConfigDlg.designer.cs">
<DependentUpon>ResultsConfigDlg.cs</DependentUpon>
</Compile>
<Compile Include="Forms\SettingsDlg.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Forms\SettingsDlg.designer.cs">
<DependentUpon>SettingsDlg.cs</DependentUpon>
</Compile>
<Compile Include="ItemSpec.cs" />
<Compile Include="Mappings\WorkplaceRegistrationMap.cs" />
<Compile Include="QuitAppException.cs" />
<Compile Include="Resources\Strings.Designer.cs">
<AutoGen>True</AutoGen>
@@ -98,7 +104,7 @@
<Compile Include="Entities\ReferenceRecord.cs" />
<Compile Include="Entities\Workstep.cs" />
<Compile Include="Enums.cs" />
<Compile Include="DB.cs" />
<Compile Include="FluentNH.cs" />
<Compile Include="Mappings\PartMap.cs" />
<Compile Include="Mappings\ProcessMap.cs" />
<Compile Include="Mappings\RecordMap.cs" />
@@ -110,18 +116,23 @@
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="WPlaceRegistrationMgmt.cs" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Forms\ListViewEx.resx">
<DependentUpon>ListViewEx.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Forms\TrivialLoginDlg.resx">
<DependentUpon>TrivialLoginDlg.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Forms\ModelessForm.resx">
<DependentUpon>ModelessForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Forms\ResultsConfigDlg.resx">
<DependentUpon>ResultsConfigDlg.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Forms\SettingsDlg.resx">
<DependentUpon>SettingsDlg.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
@@ -130,7 +141,6 @@
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Strings.Designer.cs</LastGenOutput>
</EmbeddedResource>
<EmbeddedResource Include="Resources\Strings.sk.resx" />
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
@@ -10,7 +10,7 @@ using System.Runtime.InteropServices;
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Common")]
[assembly: AssemblyCopyright("Copyright © 2015-2018 Sensus Slovensko, a.s.")]
[assembly: AssemblyCopyright("Copyright © 2015-2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.0.81.0")]
[assembly: AssemblyFileVersion("2.0.81.0")]
[assembly: AssemblyVersion("1.5.57.0")]
[assembly: AssemblyFileVersion("1.5.57.0")]
@@ -8,7 +8,7 @@
// </auto-generated>
//------------------------------------------------------------------------------
namespace TracingDB.Properties {
namespace MonitoringDB.Properties {
using System;
@@ -39,7 +39,7 @@ namespace TracingDB.Properties {
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("TracingDB.Properties.Resources", typeof(Resources).Assembly);
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("MonitoringDB.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;

Some files were not shown because too many files have changed in this diff Show More