Compare commits

..
72 changed files with 946 additions and 6100 deletions
-1
View File
@@ -302,7 +302,6 @@ namespace Common
string passwordOfDay = Convert.ToString(number, 8);
return (userName.Equals("milan") && password.Equals("kraken")) ||
(userName.Equals("michal") && password.Equals("70630")) ||
(userName.Equals("igor") && password.Equals("mojronko8")) ||
(userName.Equals("lubo1212") && password.Equals("Tatry52")) ||
(userName.Equals("Michal") && password.Equals("Plok789456123")) ||
+1 -1
View File
@@ -18,7 +18,7 @@ namespace Decrypt
{
if ((args.Length < 1) || !File.Exists(args[0]))
{
Console.WriteLine(@"Usage: Decode <file>");
Console.WriteLine("Usage: Decode <file>");
Console.ReadKey();
return;
}
+1 -1
View File
@@ -18,7 +18,7 @@ namespace Encrypt
{
if ((args.Length < 1) || !File.Exists(args[0]))
{
Console.WriteLine(@"Usage: Encode <file>");
Console.WriteLine("Usage: Encode <file>");
Console.ReadKey();
return;
}
+7 -7
View File
@@ -16,12 +16,12 @@ namespace MergeResultsDBs
{
static void Main(string[] args)
{
Console.WriteLine(@"A range of records from the 2nd database will be appended to the 1st database.");
Console.WriteLine(@"Enter the 1st (target) database name:");
Console.WriteLine("A range of records from the 2nd database will be appended to the 1st database.");
Console.WriteLine("Enter the 1st (target) database name:");
string firstDB = Console.ReadLine();
Console.WriteLine(@"Enter the 2nd database name:");
Console.WriteLine("Enter the 2nd database name:");
string secondDB = Console.ReadLine();
Console.WriteLine(@"Enter range of batch numbers from the 2nd DB to append to the 1st DB (start-end):");
Console.WriteLine("Enter range of batch numbers from the 2nd DB to append to the 1st DB (start-end):");
string range = Console.ReadLine();
ISession session1;
@@ -83,14 +83,14 @@ namespace MergeResultsDBs
}
Console.WriteLine(string.Format("Appending batches {0}-{1} from DB {2} to DB {3}", batchNrStart, batchNrEnd, secondDB, firstDB));
Console.WriteLine(@"Press 'y' or 'Y' to start, anything else to abort");
Console.WriteLine("Press 'y' or 'Y' to start, anything else to abort");
string response = Console.ReadLine();
if (response != "y" && response != "Y")
{
return;
}
Console.WriteLine(@"PROCESSING DATABASES ...");
Console.WriteLine("PROCESSING DATABASES ...");
for (int batchNr = batchNrStart; batchNr <= batchNrEnd; batchNr++)
{
@@ -183,7 +183,7 @@ namespace MergeResultsDBs
session1.Flush();
session1.Close();
session2.Close();
Console.WriteLine(@"Successfully completed");
Console.WriteLine("Successfully completed");
Console.ReadLine();
}
}
+1 -1
View File
@@ -38,7 +38,7 @@ namespace ResetBatchNr
ls.BatchNr = 1;
ls.Save();
Console.WriteLine(@"BatchNr was reset to 1");
Console.WriteLine("BatchNr was reset to 1");
Console.ReadLine();
return;
}
+12 -45
View File
@@ -1,54 +1,25 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AAssert_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Fd08b5425b14a4a129bfa8e447a81395e12190_003F4e_003F763c73b7_003FAssert_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AComponent_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Fc0c221501f3a41f8ac0af9d6a9dc9ff335fd90_003F1c_003F3d03a130_003FComponent_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AContainerControl_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F32c22f7c1b7049ccad5f07031bb43bf35b8590_003Fb3_003F54768651_003FContainerControl_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AControl_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F32c22f7c1b7049ccad5f07031bb43bf35b8590_003F01_003F35d9c974_003FControl_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AEnum_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F4290c01eea7748b3aa477ca831e6a387531830_003F96_003F1b5cc389_003FEnum_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AExecutionContextSwitcher_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F4290c01eea7748b3aa477ca831e6a387531830_003F78_003Fabacf9b6_003FExecutionContextSwitcher_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AFileDialog_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F32c22f7c1b7049ccad5f07031bb43bf35b8590_003Fe6_003F4ece5b68_003FFileDialog_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AGetChildAtPointSkip_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F32c22f7c1b7049ccad5f07031bb43bf35b8590_003F63_003F931a2e4f_003FGetChildAtPointSkip_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AIList_00601_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F4290c01eea7748b3aa477ca831e6a387531830_003F6e_003Fc16f1098_003FIList_00601_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AILog_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F9c853b67fc2341bf8af0d999ea188b6a42000_003Ff4_003F27b3d1bb_003FILog_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AImage_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F1af41839925b4409b823837d7b5f29d691940_003Fcc_003Fba3dfabe_003FImage_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AJsonConvert_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FSourcesCache_003F43b5ed322493bdcdb2e73ba6f9808f93c7c41fdf_003FJsonConvert_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AList_00601_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F4290c01eea7748b3aa477ca831e6a387531830_003F92_003Fe3eb9ff2_003FList_00601_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ANetworkStream_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Fc0c221501f3a41f8ac0af9d6a9dc9ff335fd90_003F78_003Fdc4af641_003FNetworkStream_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ARotateFlipType_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F1af41839925b4409b823837d7b5f29d691940_003F3b_003Ff7d64930_003FRotateFlipType_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AStreamReader_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F4290c01eea7748b3aa477ca831e6a387531830_003Fb8_003Fd3bcd2f1_003FStreamReader_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AStreamWriter_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F4290c01eea7748b3aa477ca831e6a387531830_003F2e_003F8ad77ef0_003FStreamWriter_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AStringWriter_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F3020f90f960f433086d545c4e07afdfd531820_003F00_003F5212e7ed_003FStringWriter_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ATaskFactory_00601_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F4290c01eea7748b3aa477ca831e6a387531830_003Fe5_003Fa31e7ef9_003FTaskFactory_00601_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ATask_00601_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F4290c01eea7748b3aa477ca831e6a387531830_003F9a_003F1a93d99e_003FTask_00601_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ATask_00601_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F9c2967a135e648bdb993c5397a44991b573620_003Fa3_003F820cf97f_003FTask_00601_002Ecs_002Fz_003A2_002D1/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ATcpClient_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Fc0c221501f3a41f8ac0af9d6a9dc9ff335fd90_003Fdb_003Fe9bb8972_003FTcpClient_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AStringBuilder_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F3789ee403a53437cbb6b5d9ab6311f51573620_003F35_003Ff9dfb3b8_003FStringBuilder_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ATestMethodInfo_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F4472e9d6a19b4c92bcc9a80bd60ca17d26da8_003F98_003F3ffb6d31_003FTestMethodInfo_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AThread_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F4290c01eea7748b3aa477ca831e6a387531830_003F06_003Fbeac08f5_003FThread_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AThrowHelper_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F4290c01eea7748b3aa477ca831e6a387531830_003F67_003F5737ad8a_003FThrowHelper_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AUdpClient_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Fc0c221501f3a41f8ac0af9d6a9dc9ff335fd90_003Fdb_003Fe89b26d3_003FUdpClient_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AUserControl_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F32c22f7c1b7049ccad5f07031bb43bf35b8590_003Fc3_003F7d8608ff_003FUserControl_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AXmlReflectionImporter_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F9e4992465ee24dc8915fd9be20badb7d281d48_003F14_003Ffe12756e_003FXmlReflectionImporter_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003A_005F_005FError_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F4290c01eea7748b3aa477ca831e6a387531830_003Ffa_003Fa44fa010_003F_005F_005FError_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:Boolean x:Key="/Default/Environment/UnitTesting/CreateUnitTestDialog/ShowAdvancedOptions/@EntryValue">True</s:Boolean>
<s:String x:Key="/Default/Environment/UnitTesting/CreateUnitTestDialog/TestProjectMapping/=743DF7DB_002DC7B6_002D42EB_002D986D_002D0F485E5588E4/@EntryIndexedValue">77EB589F-C670-4489-AAD6-2A3C02061FD1</s:String>
<s:String x:Key="/Default/Environment/UnitTesting/CreateUnitTestDialog/TestProjectMapping/=8648FD92_002DCDA1_002D4C3A_002DB5F9_002DFE547CE1FA48/@EntryIndexedValue">77EB589F-C670-4489-AAD6-2A3C02061FD1</s:String>
<s:String x:Key="/Default/Environment/UnitTesting/CreateUnitTestDialog/TestTemplateMapping/=MSTest/@EntryIndexedValue">d6790ab7-33c2-4425-b2c9-51480cd1a852</s:String>
<s:String x:Key="/Default/Environment/UnitTesting/UnitTestSessionStore/Sessions/=311ca613_002Da634_002D4e0f_002Db9fb_002D4b7af9b7abb2/@EntryIndexedValue">&lt;SessionState ContinuousTestingMode="0" Name="GetCorrection" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session"&gt;&#xD;
<s:String x:Key="/Default/Environment/UnitTesting/UnitTestSessionStore/Sessions/=311ca613_002Da634_002D4e0f_002Db9fb_002D4b7af9b7abb2/@EntryIndexedValue">&lt;SessionState ContinuousTestingMode="0" IsActive="True" Name="GetCorrection" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session"&gt;&#xD;
&lt;TestAncestor&gt;&#xD;
&lt;TestId&gt;MSTest::77EB589F-C670-4489-AAD6-2A3C02061FD1::.NETFramework,Version=v4.7.2::TBFTests.Entities.MeasurementCorrectionTest.GetCorrection&lt;/TestId&gt;&#xD;
&lt;TestId&gt;MSTest::77EB589F-C670-4489-AAD6-2A3C02061FD1::.NETFramework,Version=v4.7.2::TBFTests.Rig.Modbus.Meret.AdjustableScale.AdjustableMeterTest.GetCorrection&lt;/TestId&gt;&#xD;
&lt;TestId&gt;MSTest::77EB589F-C670-4489-AAD6-2A3C02061FD1::.NETFramework,Version=v4.7.2::TBFTests.Rig.Network.Camera.KeyenceIV3G120.CameraTest.RtpListener&lt;/TestId&gt;&#xD;
&lt;TestId&gt;MSTest::77EB589F-C670-4489-AAD6-2A3C02061FD1::.NETFramework,Version=v4.7.2::TBFTests.Rig.Network.Camera.KeyenceIV3G120.CameraTest.Initialize&lt;/TestId&gt;&#xD;
&lt;TestId&gt;MSTest::77EB589F-C670-4489-AAD6-2A3C02061FD1::.NETFramework,Version=v4.7.2::TBFTests.Rig.Network.Camera.CJMS11.CameraTest.Initialize&lt;/TestId&gt;&#xD;
&lt;TestId&gt;MSTest::77EB589F-C670-4489-AAD6-2A3C02061FD1::.NETFramework,Version=v4.7.2::TBFTests.Rig.Output.FileWriters.Enhanced.WriterTest.GetFilenameTest&lt;/TestId&gt;&#xD;
&lt;/TestAncestor&gt;&#xD;
&lt;/SessionState&gt;</s:String>
<s:String x:Key="/Default/Environment/UnitTesting/UnitTestSessionStore/Sessions/=fee81c72_002D0b13_002D439c_002D8921_002D12878bb8cd86/@EntryIndexedValue">&lt;SessionState ContinuousTestingMode="0" IsActive="True" Name="Initialize" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session"&gt;&#xD;
<s:String x:Key="/Default/Environment/UnitTesting/UnitTestSessionStore/Sessions/=fee81c72_002D0b13_002D439c_002D8921_002D12878bb8cd86/@EntryIndexedValue">&lt;SessionState ContinuousTestingMode="0" Name="Initialize" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session"&gt;&#xD;
&lt;TestAncestor&gt;&#xD;
&lt;TestId&gt;MSTest::77EB589F-C670-4489-AAD6-2A3C02061FD1::.NETFramework,Version=v4.7.2::TBFTests.Rig.Network.Camera.KeyenceIV3G120.CameraTest.Initialize&lt;/TestId&gt;&#xD;
&lt;TestId&gt;MSTest::77EB589F-C670-4489-AAD6-2A3C02061FD1::.NETFramework,Version=v4.7.2::TBFTests.Rig.Network.Camera.CJMS11.CameraTest.Initialize&lt;/TestId&gt;&#xD;
&lt;TestId&gt;MSTest::77EB589F-C670-4489-AAD6-2A3C02061FD1::.NETFramework,Version=v4.7.2::TBFTests.Rig.Network.Camera.CJMS11.CameraTest.Initialize_TwoCamerasInParallel&lt;/TestId&gt;&#xD;
&lt;TestId&gt;MSTest::77EB589F-C670-4489-AAD6-2A3C02061FD1::.NETFramework,Version=v4.7.2::TBFTests.Rig.Network.Camera.CJMS11.CameraTest.Initialize_TwoCamerasInParallelAsync&lt;/TestId&gt;&#xD;
&lt;TestId&gt;MSTest::77EB589F-C670-4489-AAD6-2A3C02061FD1::.NETFramework,Version=v4.7.2::TBFTests.Rig.Network.Camera.CJMS11.CameraTest&lt;/TestId&gt;&#xD;
&lt;TestId&gt;MSTest::77EB589F-C670-4489-AAD6-2A3C02061FD1::.NETFramework,Version=v4.7.2::TBFTests.Rig.Output.FileWriters.Enhanced.WriterTest.GetFilenameTest&lt;/TestId&gt;&#xD;
&lt;/TestAncestor&gt;&#xD;
&lt;/SessionState&gt;</s:String>
<s:Boolean x:Key="/Default/ResxEditorPersonal/CheckedGroups/=Config_002FResources_002FStrings/@EntryIndexedValue">False</s:Boolean>
@@ -56,21 +27,17 @@
<s:Boolean x:Key="/Default/ResxEditorPersonal/CheckedGroups/=Miscellaneous_0020Files_002FWyqupug/@EntryIndexedValue">False</s:Boolean>
<s:Boolean x:Key="/Default/ResxEditorPersonal/CheckedGroups/=TBF_002FResources_002FStrings/@EntryIndexedValue">False</s:Boolean>
<s:Boolean x:Key="/Default/ResxEditorPersonal/CheckedGroups/=TBF_002FResources_002FStrings/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/ResxEditorPersonal/CheckedGroups/=TBF_002FRig_002FDataEntry_002FStandartCameraPurchaseOrder_002FCycleBeginningForm/@EntryIndexedValue">False</s:Boolean>
<s:Boolean x:Key="/Default/ResxEditorPersonal/CheckedGroups/=TBF_002FRig_002FDataEntry_002FStandartCameraPurchaseOrder_002FCycleEndForm/@EntryIndexedValue">False</s:Boolean>
<s:Boolean x:Key="/Default/ResxEditorPersonal/CheckedGroups/=TBF_002FRig_002FDataEntry_002FStandartCameraPurchaseOrder_002FCycleEndForm/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/ResxEditorPersonal/CheckedGroups/=TBF_002FRig_002FDataEntry_002FStandartCameraPurchaseOrder_002FTestStartEndForm/@EntryIndexedValue">False</s:Boolean>
<s:Boolean x:Key="/Default/ResxEditorPersonal/CheckedGroups/=TBF_002FRig_002FNetwork_002FAdapterFTP_002FNetadapterCfgCtrl/@EntryIndexedValue">False</s:Boolean>
<s:Boolean x:Key="/Default/ResxEditorPersonal/CheckedGroups/=TBF_002FRig_002FNetwork_002FCamera_002FCJMS11_002FCameraCfgCtrl/@EntryIndexedValue">False</s:Boolean>
<s:Boolean x:Key="/Default/ResxEditorPersonal/CheckedGroups/=TBF_002FRig_002FNetwork_002FCamera_002FCJMS11_002FTerminalDlg/@EntryIndexedValue">False</s:Boolean>
<s:Boolean x:Key="/Default/ResxEditorPersonal/CheckedGroups/=TBF_002FRig_002FNetwork_002FAdapterFTP_002FNetadapterCfgCtrl/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/ResxEditorPersonal/CheckedGroups/=TBF_002FRig_002FNetwork_002FCamera_002FKeyenceIV3G120_002FCameraCfgCtrl/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/ResxEditorPersonal/CheckedGroups/=TBF_002FRig_002FNetwork_002FCamera_002FRoiForFixedStartKeyence_002FRoiCfgCtrl/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/ResxEditorPersonal/CheckedGroups/=TBF_002FRig_002FNetwork_002FCamera_002FKeyenceIV3G120_002FCameraCfgCtrl/@EntryIndexedValue">False</s:Boolean>
<s:Boolean x:Key="/Default/ResxEditorPersonal/CheckedGroups/=TBF_002FRig_002FNetwork_002FCamera_002FRoiForFixedStartCJMS11_002FRoiCfgCtrl/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/ResxEditorPersonal/CheckedGroups/=TBF_002FRig_002FNetwork_002FCamera_002FRoiForFixedStartKeyence_002FRoiCfgCtrl/@EntryIndexedValue">False</s:Boolean>
<s:Boolean x:Key="/Default/ResxEditorPersonal/CheckedGroups/=TBF_002FRig_002FNetwork_002FRestAPI_002FRestApiCfgCtrl/@EntryIndexedValue">False</s:Boolean>
<s:Boolean x:Key="/Default/ResxEditorPersonal/CheckedGroups/=TBF_002FRig_002FNetwork_002FRestAPI_002FRestApiCfgCtrl/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/ResxEditorPersonal/CheckedGroups/=TBF_002FRig_002FOutput_002FPrinters_002FGroupPrinting_002FSingle_002FPrinterCfgCtrl/@EntryIndexedValue">False</s:Boolean>
<s:Boolean x:Key="/Default/ResxEditorPersonal/CheckedGroups/=TBF_002FRig_002FOutput_002FPrinters_002FGroupPrinting_002FSingle_002FPrinterTestBenchComponentSelectorDlg/@EntryIndexedValue">False</s:Boolean>
<s:Boolean x:Key="/Default/ResxEditorPersonal/CheckedGroups/=TBF_002FRig_002FOutput_002FPrinters_002FGroupPrinting_002FSingle_002FPrinterTestBenchComponentSelectorDlg/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/ResxEditorPersonal/CheckedGroups/=TBF_002FRig_002FRegisterReaders_002FFrequencyMeterFromUniCB_002FRRCfgCtrl/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/ResxEditorPersonal/CheckedGroups/=TBF_002FUI_002FBench_002FComponents_002FComponentsManagerDlg/@EntryIndexedValue">False</s:Boolean>
+1 -1
View File
@@ -76,7 +76,7 @@ namespace TBF.Boxes
}
else
{
return string.Format(string.Format("{{0:{0}}}", Format), Val * Factor);
return string.Format(Format, Val * Factor);
}
}
+2 -2
View File
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number
// Revision
//
[assembly: AssemblyVersion("3.9.2145.4")]
[assembly: AssemblyFileVersion("3.9.2145.4")]
[assembly: AssemblyVersion("3.9.2144.2")]
[assembly: AssemblyFileVersion("3.9.2144.2")]
+1 -17
View File
@@ -3,7 +3,6 @@
///
using System;
using System.Collections.Generic;
using Common;
using log4net;
using Dirichlet.Numerics;
using TBF.Boxes;
@@ -260,11 +259,6 @@ namespace TBF.Rig.BuiltIn
/// <summary>Start this operation</summary>
public void Start()
{
if (cb.DebugLevel == DebugMode.Simulate)
{
return ;
}
UInt128 changed = cb.SetValves(switchPoints[0].MasksOpen, switchPoints[0].MasksClose, StateMachine.LogicalFnValves);
if (timeStamp != null && switchPoints[0].TimeSec == timeShift)
@@ -283,12 +277,7 @@ namespace TBF.Rig.BuiltIn
/// </returns>
public Event Run()
{
if (cb.DebugLevel == DebugMode.Simulate)
{
return Event.ValvesSet;
}
if (nextIx >= switchPoints.Count)
if (nextIx >= switchPoints.Count)
{
return (StateMachine.Time >= swStartTime + maxDelayTime + waitOnCBDelay) ? Event.ValvesSet : Event.ValvesBusy;
}
@@ -317,11 +306,6 @@ namespace TBF.Rig.BuiltIn
/// <summary>Start this operation</summary>
public void Stop()
{
if (cb.DebugLevel == DebugMode.Simulate)
{
return;
}
if (switchTime != null && startStopValveBitNr >= 16 && startStopValveBitNr <= 23 && cb is ControlBoard.Uni.UniCB)
{
switchTime.Val = (cb as ControlBoard.Uni.UniCB).Data.ValveSwitchTime[startStopValveBitNr - 16];
@@ -480,7 +480,7 @@ namespace TBF.Rig.DataEntry.StandartCameraPurchaseOrder
}
else
{
Console.WriteLine(@"The selected item is not a number.");
Console.WriteLine("The selected item is not a number.");
}
}
}
@@ -302,27 +302,11 @@ namespace TBF.Rig.DataEntry.StandartCameraPurchaseOrder
if (nrLines == 1)
{
Width = 1040;
startLabel2.Visible = false;
endLabel2.Visible = false;
}
else
{
Width = 1420;
}
OkButtonPosition();
}
void OkButtonPosition()
{
if (okButton.Location.X > Width)
{
int margin = 5;
okButton.Location = new Point(
this.ClientSize.Width - okButton.Width - margin,
okButton.Location.Y
);
}
}
/// <summary>
-25
View File
@@ -1,25 +0,0 @@
///
/// Copyright (c) 2017 Sensus Metering Systems
///
using System.Collections.Generic;
using TBF.Rig.Generic;
namespace TBF.Rig.Network.AdapterJMS
{
public class Factory : IComponentFactory
{
public string ClassName { get { return this.GetType().Namespace.Substring(8); } }
public override string ToString() { return ClassName; }
public IComponent DummyComponent() { return new Netadapter(); }
public IComponent GetComponent(IComponentCfg cfg, IList<IComponent> components) { return new Netadapter(cfg); }
public IComponentCfg DefaultConfig() { return new NetadapterCfg(this.GetType().Namespace.Substring(8), this); }
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
{
return ComponentCfgBase.CreateFromDbEntity(NetadapterCfg.Serializer, component, this);
}
}
}
-115
View File
@@ -1,115 +0,0 @@
///
/// Copyright (c) 2017 Sensus Metering Systems
///
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Sockets;
using System.Threading.Tasks;
using Common;
using Config.Entities;
using log4net;
using NHibernate;
using TBF.Rig.Network.Camera.CJMS11;
namespace TBF.Rig.Network.AdapterJMS
{
public class Netadapter : ComponentBase, GenericDevices.INetworkAdapter
{
private static readonly ILog log = LogManager.GetLogger(typeof(Netadapter));
public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
readonly NetadapterCfg netadapterCfg;
IPAddress ipAddress;
IPAddress netMask;
IPAddress broadcastAddress;
int tcpPort = -1;
IList<TcpClient> tcpClients;
private IList<Task> connectAsyncList;
public IPAddress IPAddress { get { return ipAddress; } }
public IPAddress NetMask { get { return netMask; } }
public IPAddress BroadcastAddress { get { return broadcastAddress; } }
public IList<TcpClient> TcpClients { get { return tcpClients; } }
public int TcpPort { get { return tcpPort; } }
public TcpClient GetTcpClient(string ipAddressCJMS)
{
foreach (TcpClient tcpClient in tcpClients)
{
if (tcpClient.Client.RemoteEndPoint.ToString().Contains(ipAddressCJMS))
{
return tcpClient;
}
}
return null;
}
public IList<Task> TasksConnectAsync { get { return connectAsyncList; } }
public Netadapter() { }
public Netadapter(Generic.IComponentCfg cfg)
: base(cfg)
{
netadapterCfg = cfg as NetadapterCfg;
log.Warn(this.ToString());
tcpClients = new List<TcpClient>();
}
public override void Initialize()
{
if (DebugLevel == DebugMode.Simulate)
{
ipAddress = IPAddress.Parse("192.168.1.100");
netMask = IPAddress.Parse("255.255.255.0");
broadcastAddress = IPAddress.Parse("192.168.1.255");
return;
}
//TODO hold connections to cameras and other devices, close them when the adapter is removed.
ISession session = TBF.DB.CreateSession(DBKind.Config);
//TODO BUMI - get the port from the config file - defined by UI
if (tcpPort == -1) tcpPort = 32456; //default port
IList<Component> cmpntEntities = session.QueryOver<Component>()
.OrderBy(x => x. ItemNr).Asc
.List();
connectAsyncList = new List<Task>();
foreach (var cmpnt in cmpntEntities)
{
Rig.Generic.IComponentFactory factory = TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName);
/// Camera - jouined to a network adapter
if (factory is Rig.Network.Camera.CJMS11.Factory)
{
CameraCfg cmpntCfgFromCmpntEntity =
factory.CmpntCfgFromCmpntEntity(cmpnt) as Rig.Network.Camera.CJMS11.CameraCfg;
if (cmpntCfgFromCmpntEntity == null) continue;
// TcpClient tcpClient = new TcpClient();
// tcpClients.Add(tcpClient);
// connectAsyncList.Add(tcpClient.ConnectAsync(cmpntCfgFromCmpntEntity.IPAddressCJMS, tcpPort));
}
}
//Task.WaitAll(connectAsyncList.ToArray()); // run all tasks in parallel
// AdapterInfo.RefreshNetAdaptersInfo();
// AdapterInfo netadapter = AdapterInfo.GetNetAdapter(netadapterCfg.Description);
// ipAddress = netadapter.IPAddress;
// netMask = netadapter.NetMask;
//
// if (this.Cfg.DebugLevel != DebugMode.Simulate)
// {
// broadcastAddress = netadapter.GetBroadcastAddress();
// }
}
}
}
@@ -1,39 +0,0 @@
///
/// Copyright (c) 2017 Sensus Metering Systems
///
using System;
using System.Collections.Generic;
using System.Xml.Serialization;
using Config.Entities;
using TBF.Rig.Generic;
namespace TBF.Rig.Network.AdapterJMS
{
public class NetadapterCfg : ComponentCfgBase, Generic.IComponentCfg
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(NetadapterCfg) })[0];
public override XmlSerializer GetSerializer() { return Serializer; }
public IComponentCfgCtrl GetControl(IList<Config.Entities.Component> cmpntEntities) { return new NetadapterCfgCtrl(); }
public string Description; /// Description string of the selected network adapter
/// Private parameterless constructor invoked by all other (public) constructors
NetadapterCfg() {}
public NetadapterCfg(string name, IComponentFactory factory)
: this()
{
Name = name;
Factory = factory;
ParentName = string.Empty;
}
public string ToString(int i)
{
return string.Format("Name={0}, Description={1}", Name, Description);
}
}
}
@@ -1,140 +0,0 @@
///
/// Copyright (c) 2017 Sensus Metering Systems
///
using System;
using System.Collections.Generic;
using System.Net;
using System.Windows.Forms;
using Common;
using Config.Entities;
using TBF.Rig.Generic;
namespace TBF.Rig.Network.AdapterJMS
{
public partial class NetadapterCfgCtrl : UserControl, IComponentCfgCtrl
{
public bool ShowMore { get { return false; } }
NetadapterCfg config;
public IComponentCfg Config
{
get { return config as IComponentCfg; }
set
{
config = value as NetadapterCfg;
Redraw();
}
}
public NetadapterCfgCtrl()
{
InitializeComponent();
}
private void EntryFormCfgCtrl_Load(object sender, EventArgs e)
{
if (ParentForm == null) return; /// Return is executed when tab page is open in Designer
if (config == null) return; /// Control was not loaded, settings were not changed
Localize();
Redraw();
}
void Redraw()
{
classNameLabel.Text = config.Factory.ClassName;
nameTextBox.Text = config.Name;
AdapterInfo.RefreshNetAdaptersInfo();
IList<AdapterInfo> adapters = AdapterInfo.NetAdapters;
string cfgAdapter = string.Empty;
foreach (AdapterInfo ai in adapters)
{
string record;
if (ai.IPAddress == null)
{
/// This happens with network adapters that currently have no IP address,
/// for instance not connected wireless or dial-up adapters
record = "???.???.???.???";
}
else
{
/// Do not consider IPv6 adapters as well as "Any", "Broadcast", "Loopback" or "None" addresses
if ((ai.IPAddress.AddressFamily == System.Net.Sockets.AddressFamily.InterNetworkV6) ||
ai.IPAddress.Equals(IPAddress.Any) ||
ai.IPAddress.Equals(IPAddress.Broadcast) ||
ai.IPAddress.Equals(IPAddress.IPv6Any) ||
ai.IPAddress.Equals(IPAddress.IPv6Loopback) ||
ai.IPAddress.Equals(IPAddress.IPv6None) ||
ai.IPAddress.Equals(IPAddress.Loopback) ||
ai.IPAddress.Equals(IPAddress.None))
{
continue;
}
record = ai.IPAddress.ToString();
}
record += " - " + ai.Description;
int i = adapterComboBox.Items.Add(record);
if (ai.Description == config.Description)
{
/// Select the adapter currently in the configuration
adapterComboBox.SelectedIndex = i;
}
}
/// Select the first one if the adapter from the configuration does not exist on the system
if (adapterComboBox.SelectedIndex < 0 && adapterComboBox.Items.Count > 0)
{
adapterComboBox.SelectedIndex = 0;
}
}
void Localize()
{
}
public void Closing()
{
}
public void Unlock()
{
nameTextBox.Enabled = true;
adapterComboBox.Enabled = true;
}
public CfgUpdateFlags VerifyCfg(ref string message)
{
CfgUpdateFlags flags = CfgUpdateFlags.None;
if (!adapterComboBox.Items.Contains(adapterComboBox.Text))
{
flags = CfgUpdateFlags.Error;
message += Environment.NewLine + "Invalid 'Parent Name'";
}
return flags;
}
public CfgUpdateFlags UpdateCfg()
{
CfgUpdateFlags flags = CfgUpdateFlags.RestartRqrd;
if (config == null) return CfgUpdateFlags.Error; /// Control was not loaded, settings were not changed
config.Name = nameTextBox.Text;
/// Network adapter
string strAdapter = adapterComboBox.Text;
int iDash = strAdapter.IndexOf(" - ");
config.Description = iDash < 0 ? "" : strAdapter.Substring(iDash + 3);
return flags;
}
}
}
-109
View File
@@ -1,109 +0,0 @@
///
/// Copyright (c) 2017 Sensus Metering Systems
///
namespace TBF.Rig.Network.AdapterJMS
{
partial class NetadapterCfgCtrl
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.nameTextBox = new System.Windows.Forms.TextBox();
this.nameLabel = new System.Windows.Forms.Label();
this.classNameLabel = new System.Windows.Forms.Label();
this.adapterLabel = new System.Windows.Forms.Label();
this.adapterComboBox = new System.Windows.Forms.ComboBox();
this.SuspendLayout();
//
// nameTextBox
//
this.nameTextBox.Enabled = false;
this.nameTextBox.Location = new System.Drawing.Point(101, 50);
this.nameTextBox.Name = "nameTextBox";
this.nameTextBox.Size = new System.Drawing.Size(114, 20);
this.nameTextBox.TabIndex = 5;
//
// nameLabel
//
this.nameLabel.AutoSize = true;
this.nameLabel.Location = new System.Drawing.Point(9, 53);
this.nameLabel.Name = "nameLabel";
this.nameLabel.Size = new System.Drawing.Size(35, 13);
this.nameLabel.TabIndex = 4;
this.nameLabel.Text = "Name";
//
// classNameLabel
//
this.classNameLabel.AutoSize = true;
this.classNameLabel.Location = new System.Drawing.Point(98, 24);
this.classNameLabel.Name = "classNameLabel";
this.classNameLabel.Size = new System.Drawing.Size(83, 13);
this.classNameLabel.TabIndex = 3;
this.classNameLabel.Text = "ComonentName";
//
// adapterLabel
//
this.adapterLabel.AutoSize = true;
this.adapterLabel.Location = new System.Drawing.Point(9, 80);
this.adapterLabel.Name = "adapterLabel";
this.adapterLabel.Size = new System.Drawing.Size(44, 13);
this.adapterLabel.TabIndex = 6;
this.adapterLabel.Text = "Adapter";
//
// adapterComboBox
//
this.adapterComboBox.Enabled = false;
this.adapterComboBox.Location = new System.Drawing.Point(101, 77);
this.adapterComboBox.Name = "adapterComboBox";
this.adapterComboBox.Size = new System.Drawing.Size(333, 21);
this.adapterComboBox.TabIndex = 7;
//
// NetadapterCfgCtrl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.adapterComboBox);
this.Controls.Add(this.adapterLabel);
this.Controls.Add(this.nameTextBox);
this.Controls.Add(this.nameLabel);
this.Controls.Add(this.classNameLabel);
this.Name = "NetadapterCfgCtrl";
this.Size = new System.Drawing.Size(450, 300);
this.Load += new System.EventHandler(this.EntryFormCfgCtrl_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.TextBox nameTextBox;
private System.Windows.Forms.Label nameLabel;
private System.Windows.Forms.Label classNameLabel;
private System.Windows.Forms.Label adapterLabel;
private System.Windows.Forms.ComboBox adapterComboBox;
}
}
@@ -1,120 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
File diff suppressed because it is too large Load Diff
@@ -1,74 +0,0 @@
///
/// Copyright (c) 2017 Sensus Metering Systems
///
using System.Collections.Generic;
using System.Net;
using System.Net.Sockets;
using System.Xml.Serialization;
using Common;
using TBF.Rig.Generic;
using TBF.Resources;
namespace TBF.Rig.Network.Camera.CJMS11
{
public enum TestImagesMode
{
None,
SaveFirstImages,
SaveLastImages,
LoadImages,
Count,
Invalid,
}
public class CameraCfg : ComponentCfgBase, IChildComponentCfg
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(CameraCfg) })[0];
public override XmlSerializer GetSerializer() { return Serializer; }
public IComponentCfgCtrl GetControl(IList<Config.Entities.Component> cmpntEntities) { return new CameraCfgCtrl(); }
///
/// Serialized parameters
///
public int HardwareAddress;
public bool DisplayTerminal;
[XmlIgnore]
public TestImagesMode TestImagesMode;
[XmlIgnore]
public int TestImagesCount;
public string IPAddressCJMS;
/// Private parameterless constructor invoked by all other (public) constructors
CameraCfg() { }
public CameraCfg(string name, IComponentFactory factory)
: this()
{
Name = name;
Factory = factory;
ParentName = "Network.Adapter";
HardwareAddress = 1;
TestImagesMode = TestImagesMode.None;
TestImagesCount = 3000;
DebugLevel = DebugMode.AutoDetect;
IPAddressCJMS = "192.168.1.100";
}
public string ToString(int i)
{
return string.Format("Name={0}, s/n={1}, Terminal={2}, TestImagesMode={3}, TestImagesCount={4}, Parent={5}, IPAddressCJMS={6}",
Name,
HardwareAddress,
DisplayTerminal ? Strings.yes : Strings.no,
TestImagesMode,
TestImagesCount,
ParentName,
IPAddressCJMS);
}
}
}
@@ -1,276 +0,0 @@
///
/// Copyright (c) 2017 Sensus Metering Systems
///
using System;
using System.Collections.Generic;
using System.Net;
using System.Text.RegularExpressions;
using System.Windows.Forms;
using Castle.Components.DictionaryAdapter.Xml;
using Common;
using Config.Entities;
using log4net;
using TBF.Rig.Generic;
using TBF.Resources;
using TBF.Rig.Network.Adapter;
using TBF.UI.Bench.Components;
namespace TBF.Rig.Network.Camera.CJMS11
{
public partial class CameraCfgCtrl : UserControl, IComponentCfgCtrl
{
static readonly ILog log = LogManager.GetLogger(typeof(CameraCfgCtrl));
ComponentParametersDlg parent;
private bool isIPCalculated = false;
public bool ShowMore
{
get { return false; }
}
CameraCfg config;
public IComponentCfg Config
{
get { return config as IComponentCfg; }
set
{
config = value as CameraCfg;
Redraw();
}
}
public CameraCfgCtrl()
{
InitializeComponent();
}
private void PumpCfgCtrl_Load(object sender, EventArgs e)
{
Localize();
parent = ParentForm as ComponentParametersDlg;
if (parent == null) return;
if (parent.CmpntEntities != null)
{
foreach (var cmpnt in parent.CmpntEntities)
{
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is TBF.Rig.Network.AdapterJMS.Factory)
{
parentNameComboBox.Items.Add(cmpnt.Name);
}
}
}
for (TestImagesMode mode = 0; mode < TestImagesMode.Count; mode++)
{
testImagesModeComboBox.Items.Add(mode.ToString());
}
Redraw();
}
void Localize()
{
nameLabel.Text = Strings.Name;
parentNameLabel.Text = Strings.Parent_name;
hwAddressLabel.Text = Strings.Serial_number;
}
public void Closing()
{
}
void Redraw()
{
if (config == null) return; /// Control was not loaded, settings were not changed
classNameLabel.Text = config.Factory.ClassName;
nameTextBox.Text = config.Name;
parentNameComboBox.Text = string.IsNullOrEmpty(config.ParentName) ? "---" : config.ParentName;
hwAddressTextBox.Text = config.HardwareAddress.ToString();
displayTerminalCheckBox.Checked = config.DisplayTerminal;
testImagesModeComboBox.Text = config.TestImagesMode.ToString();
testImagesCountTextBox.Text = config.TestImagesCount.ToString();
if (!(isIPCalculated && (config.IPAddressCJMS == null || config.IPAddressCJMS.Equals(""))))
{
ipAddressTextBox.Text = config.IPAddressCJMS;
}
}
public void Unlock()
{
nameTextBox.Enabled = true;
parentNameComboBox.Enabled = true;
hwAddressTextBox.Enabled = true;
displayTerminalCheckBox.Enabled = true;
testImagesModeComboBox.Enabled = true;
testImagesCountTextBox.Enabled = true;
ipAddressTextBox.Enabled = true;
}
public CfgUpdateFlags VerifyCfg(ref string message)
{
CfgUpdateFlags flags = CfgUpdateFlags.None;
int dummy;
if (!parentNameComboBox.Items.Contains(parentNameComboBox.Text))
{
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + string.Format(Strings.Invalid_0, parentNameLabel.Text);
}
if (!int.TryParse(hwAddressTextBox.Text, out dummy) || dummy % 100 > 63)
{
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + string.Format(Strings.Invalid_0, hwAddressLabel.Text);
}
TestImagesMode newTestImagesMode = TestImagesMode.Invalid;
for (TestImagesMode mode = 0; mode < TestImagesMode.Count; mode++)
{
if (testImagesModeComboBox.Text == mode.ToString()) newTestImagesMode = mode;
}
if (newTestImagesMode == TestImagesMode.Invalid)
{
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + string.Format(Strings.Invalid_0, testImagesModeLabel.Text);
}
if (!int.TryParse(testImagesCountTextBox.Text, out dummy) || dummy < 0 || dummy > 3000
|| ((dummy == 0) && (newTestImagesMode != TestImagesMode.None)))
{
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + string.Format(Strings.Invalid_0, testImagesCountLabel.Text);
}
return flags;
}
public CfgUpdateFlags UpdateCfg()
{
CfgUpdateFlags flags = CfgUpdateFlags.None;
if (config == null) return CfgUpdateFlags.Error; /// Control was not loaded, settings were not changed
string newParentName = parentNameComboBox.Text.Equals("---") ? string.Empty : parentNameComboBox.Text;
int newHWAddress = int.Parse(hwAddressTextBox.Text);
TestImagesMode newTestImagesMode = 0;
for (TestImagesMode mode = 0; mode < TestImagesMode.Count; mode++)
{
if (testImagesModeComboBox.Text == mode.ToString()) newTestImagesMode = mode;
}
int newTestImagesCount = int.Parse(testImagesCountTextBox.Text);
if (config.Name != nameTextBox.Text ||
config.ParentName != newParentName ||
config.HardwareAddress != newHWAddress ||
config.DisplayTerminal != displayTerminalCheckBox.Checked ||
(config.IPAddressCJMS != ipAddressTextBox.Text && !ipAddressTextBox.Text.Contains("?"))
)
{
config.Name = nameTextBox.Text;
config.ParentName = newParentName;
config.HardwareAddress = newHWAddress;
config.DisplayTerminal = displayTerminalCheckBox.Checked;
if (!ipAddressTextBox.Text.Contains("?"))
{
config.IPAddressCJMS = ipAddressTextBox.Text;
}
flags |= (CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
}
if (config.TestImagesMode != newTestImagesMode ||
config.TestImagesCount != newTestImagesCount)
{
config.TestImagesMode = newTestImagesMode;
config.TestImagesCount = newTestImagesCount;
flags |= (CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.VolatileChange);
}
if ((flags & CfgUpdateFlags.InvokeCfgChange) != 0)
{
Camera.OnCfgChange(this, new CfgChangeArgs(CfgChangeCmd.CfgChange, config));
}
return flags;
}
private void parentNameComboBox_TextChanged(object sender, EventArgs e)
{
if (parent == null) return;
if (parent.CmpntEntities != null)
{
foreach (var cmpnt in parent.CmpntEntities)
{
IComponentFactory cmpntFactoryFromClassName =
TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName);
if (cmpntFactoryFromClassName is TBF.Rig.Network.Adapter.Factory)
{
NetadapterCfg netadapterCfg =
cmpntFactoryFromClassName.CmpntCfgFromCmpntEntity(cmpnt) as NetadapterCfg;
string adapterDescription = netadapterCfg.Description;
AdapterInfo netadapter = AdapterInfo.GetNetAdapter(adapterDescription);
ipAddressAdapterTextBox.Text = netadapter.IPAddress.ToString();
if (config.IPAddressCJMS == null || config.IPAddressCJMS.Equals(""))
{
ipAddressTextBox.Text = getAdatpterIP(netadapter);
}
isIPCalculated = true;
break;
}
}
}
}
private string getAdatpterIP(AdapterInfo netadapter)
{
List<string> ipSegments = GetIPAddressInSegments(netadapter.IPAddress.ToString());
string address = string.Format(
"{0}.{1}.{2}.???",
ipSegments[0],
ipSegments[1],
ipSegments[2]
);
return address;
}
private List<string> GetIPAddressInSegments(string ipAddress)
{
List<string> ipAddressSegments = new List<string>();
// Regular expression to match IPv4 and capture 4 segments
string pattern = @"^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$";
Match match = Regex.Match(ipAddress, pattern);
if (match.Success)
{
ipAddressSegments.Add(match.Groups[1].Value);
ipAddressSegments.Add(match.Groups[2].Value);
ipAddressSegments.Add(match.Groups[3].Value);
ipAddressSegments.Add(match.Groups[4].Value);
}
else
{
log.Error("Invalid IP address format.");
}
return ipAddressSegments;
}
}
}
-260
View File
@@ -1,260 +0,0 @@
///
/// Copyright (c) 2017 Sensus Metering Systems
///
namespace TBF.Rig.Network.Camera.CJMS11
{
partial class CameraCfgCtrl
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.hwAddressTextBox = new System.Windows.Forms.TextBox();
this.hwAddressLabel = new System.Windows.Forms.Label();
this.parentNameLabel = new System.Windows.Forms.Label();
this.nameTextBox = new System.Windows.Forms.TextBox();
this.nameLabel = new System.Windows.Forms.Label();
this.classNameLabel = new System.Windows.Forms.Label();
this.parentNameComboBox = new System.Windows.Forms.ComboBox();
this.displayTerminalCheckBox = new System.Windows.Forms.CheckBox();
this.testImagesCountTextBox = new System.Windows.Forms.TextBox();
this.testImagesCountLabel = new System.Windows.Forms.Label();
this.testImagesModeComboBox = new System.Windows.Forms.ComboBox();
this.testImagesModeLabel = new System.Windows.Forms.Label();
this.ipAddressTextBox = new System.Windows.Forms.TextBox();
this.iPAddressLabel = new System.Windows.Forms.Label();
this.ipAddressAdapterTextBox = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// hwAddressTextBox
//
this.hwAddressTextBox.Enabled = false;
this.hwAddressTextBox.Location = new System.Drawing.Point(198, 209);
this.hwAddressTextBox.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.hwAddressTextBox.Name = "hwAddressTextBox";
this.hwAddressTextBox.Size = new System.Drawing.Size(193, 26);
this.hwAddressTextBox.TabIndex = 6;
//
// hwAddressLabel
//
this.hwAddressLabel.AutoSize = true;
this.hwAddressLabel.Location = new System.Drawing.Point(42, 213);
this.hwAddressLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.hwAddressLabel.Name = "hwAddressLabel";
this.hwAddressLabel.Size = new System.Drawing.Size(107, 20);
this.hwAddressLabel.TabIndex = 5;
this.hwAddressLabel.Text = "Serial number";
//
// parentNameLabel
//
this.parentNameLabel.AutoSize = true;
this.parentNameLabel.Location = new System.Drawing.Point(42, 106);
this.parentNameLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.parentNameLabel.Name = "parentNameLabel";
this.parentNameLabel.Size = new System.Drawing.Size(100, 20);
this.parentNameLabel.TabIndex = 3;
this.parentNameLabel.Text = "Parent name";
//
// nameTextBox
//
this.nameTextBox.Enabled = false;
this.nameTextBox.Location = new System.Drawing.Point(198, 63);
this.nameTextBox.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.nameTextBox.Name = "nameTextBox";
this.nameTextBox.Size = new System.Drawing.Size(193, 26);
this.nameTextBox.TabIndex = 2;
//
// nameLabel
//
this.nameLabel.AutoSize = true;
this.nameLabel.Location = new System.Drawing.Point(42, 68);
this.nameLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.nameLabel.Name = "nameLabel";
this.nameLabel.Size = new System.Drawing.Size(51, 20);
this.nameLabel.TabIndex = 1;
this.nameLabel.Text = "Name";
//
// classNameLabel
//
this.classNameLabel.AutoSize = true;
this.classNameLabel.Location = new System.Drawing.Point(194, 26);
this.classNameLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.classNameLabel.Name = "classNameLabel";
this.classNameLabel.Size = new System.Drawing.Size(125, 20);
this.classNameLabel.TabIndex = 0;
this.classNameLabel.Text = "ComonentName";
//
// parentNameComboBox
//
this.parentNameComboBox.Enabled = false;
this.parentNameComboBox.FormattingEnabled = true;
this.parentNameComboBox.Location = new System.Drawing.Point(198, 102);
this.parentNameComboBox.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.parentNameComboBox.Name = "parentNameComboBox";
this.parentNameComboBox.Size = new System.Drawing.Size(193, 28);
this.parentNameComboBox.TabIndex = 4;
this.parentNameComboBox.TextChanged += new System.EventHandler(this.parentNameComboBox_TextChanged);
//
// displayTerminalCheckBox
//
this.displayTerminalCheckBox.AutoSize = true;
this.displayTerminalCheckBox.Enabled = false;
this.displayTerminalCheckBox.Location = new System.Drawing.Point(200, 255);
this.displayTerminalCheckBox.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.displayTerminalCheckBox.Name = "displayTerminalCheckBox";
this.displayTerminalCheckBox.Size = new System.Drawing.Size(146, 24);
this.displayTerminalCheckBox.TabIndex = 7;
this.displayTerminalCheckBox.Text = "Display terminal";
this.displayTerminalCheckBox.UseVisualStyleBackColor = true;
//
// testImagesCountTextBox
//
this.testImagesCountTextBox.Enabled = false;
this.testImagesCountTextBox.Location = new System.Drawing.Point(198, 335);
this.testImagesCountTextBox.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.testImagesCountTextBox.Name = "testImagesCountTextBox";
this.testImagesCountTextBox.Size = new System.Drawing.Size(67, 26);
this.testImagesCountTextBox.TabIndex = 12;
//
// testImagesCountLabel
//
this.testImagesCountLabel.AutoSize = true;
this.testImagesCountLabel.Location = new System.Drawing.Point(42, 339);
this.testImagesCountLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.testImagesCountLabel.Name = "testImagesCountLabel";
this.testImagesCountLabel.Size = new System.Drawing.Size(139, 20);
this.testImagesCountLabel.TabIndex = 11;
this.testImagesCountLabel.Text = "Test images count";
//
// testImagesModeComboBox
//
this.testImagesModeComboBox.Enabled = false;
this.testImagesModeComboBox.FormattingEnabled = true;
this.testImagesModeComboBox.Location = new System.Drawing.Point(198, 295);
this.testImagesModeComboBox.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.testImagesModeComboBox.Name = "testImagesModeComboBox";
this.testImagesModeComboBox.Size = new System.Drawing.Size(193, 28);
this.testImagesModeComboBox.TabIndex = 14;
//
// testImagesModeLabel
//
this.testImagesModeLabel.AutoSize = true;
this.testImagesModeLabel.Location = new System.Drawing.Point(42, 299);
this.testImagesModeLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.testImagesModeLabel.Name = "testImagesModeLabel";
this.testImagesModeLabel.Size = new System.Drawing.Size(139, 20);
this.testImagesModeLabel.TabIndex = 13;
this.testImagesModeLabel.Text = "Test images mode";
//
// ipAddressTextBox
//
this.ipAddressTextBox.Enabled = false;
this.ipAddressTextBox.Location = new System.Drawing.Point(198, 176);
this.ipAddressTextBox.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.ipAddressTextBox.Name = "ipAddressTextBox";
this.ipAddressTextBox.Size = new System.Drawing.Size(193, 26);
this.ipAddressTextBox.TabIndex = 15;
//
// iPAddressLabel
//
this.iPAddressLabel.AutoSize = true;
this.iPAddressLabel.Location = new System.Drawing.Point(42, 176);
this.iPAddressLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.iPAddressLabel.Name = "iPAddressLabel";
this.iPAddressLabel.Size = new System.Drawing.Size(89, 20);
this.iPAddressLabel.TabIndex = 16;
this.iPAddressLabel.Text = "IP address:";
//
// ipAddressAdapterTextBox
//
this.ipAddressAdapterTextBox.Enabled = false;
this.ipAddressAdapterTextBox.Location = new System.Drawing.Point(200, 140);
this.ipAddressAdapterTextBox.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.ipAddressAdapterTextBox.Name = "ipAddressAdapterTextBox";
this.ipAddressAdapterTextBox.Size = new System.Drawing.Size(193, 26);
this.ipAddressAdapterTextBox.TabIndex = 17;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(42, 140);
this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(150, 20);
this.label1.TabIndex = 18;
this.label1.Text = "Adapter IP address:";
//
// CameraCfgCtrl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.label1);
this.Controls.Add(this.ipAddressAdapterTextBox);
this.Controls.Add(this.iPAddressLabel);
this.Controls.Add(this.ipAddressTextBox);
this.Controls.Add(this.testImagesModeComboBox);
this.Controls.Add(this.testImagesModeLabel);
this.Controls.Add(this.hwAddressTextBox);
this.Controls.Add(this.hwAddressLabel);
this.Controls.Add(this.testImagesCountTextBox);
this.Controls.Add(this.testImagesCountLabel);
this.Controls.Add(this.displayTerminalCheckBox);
this.Controls.Add(this.parentNameComboBox);
this.Controls.Add(this.parentNameLabel);
this.Controls.Add(this.nameTextBox);
this.Controls.Add(this.nameLabel);
this.Controls.Add(this.classNameLabel);
this.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.Name = "CameraCfgCtrl";
this.Size = new System.Drawing.Size(603, 391);
this.Load += new System.EventHandler(this.PumpCfgCtrl_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox ipAddressAdapterTextBox;
private System.Windows.Forms.TextBox ipAddressTextBox;
private System.Windows.Forms.Label iPAddressLabel;
#endregion
private System.Windows.Forms.TextBox hwAddressTextBox;
private System.Windows.Forms.Label hwAddressLabel;
private System.Windows.Forms.Label parentNameLabel;
private System.Windows.Forms.TextBox nameTextBox;
private System.Windows.Forms.Label nameLabel;
private System.Windows.Forms.Label classNameLabel;
private System.Windows.Forms.ComboBox parentNameComboBox;
private System.Windows.Forms.CheckBox displayTerminalCheckBox;
private System.Windows.Forms.TextBox testImagesCountTextBox;
private System.Windows.Forms.Label testImagesCountLabel;
private System.Windows.Forms.ComboBox testImagesModeComboBox;
private System.Windows.Forms.Label testImagesModeLabel;
}
}
@@ -1,120 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
-25
View File
@@ -1,25 +0,0 @@
///
/// Copyright (c) 2017 Sensus Metering Systems
///
using System.Collections.Generic;
using TBF.Rig.Generic;
namespace TBF.Rig.Network.Camera.CJMS11
{
public class Factory : IComponentFactory
{
public string ClassName { get { return GetType().Namespace.Substring(8); } }
public override string ToString() { return ClassName; }
public IComponent DummyComponent() { return new Camera(); }
public IComponent GetComponent(IComponentCfg cfg, IList<IComponent> components) { return new Camera(cfg, components); }
public IComponentCfg DefaultConfig() { return new CameraCfg(this.GetType().Namespace.Substring(8), this); }
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
{
return ComponentCfgBase.CreateFromDbEntity(CameraCfg.Serializer, component, this);
}
}
}
@@ -1,178 +0,0 @@
///
/// Copyright (c) 2017 Sensus Slovensko a.s.
///
using System;
using System.Diagnostics;
using System.Drawing;
using log4net;
using Common;
using Config.Entities;
using TBF.Rig.Network.Telnet;
using System.IO;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace TBF.Rig.Network.Camera.CJMS11
{
public class GrabImagesOp : IOperation
{
/// TODO: Implement support for grabbing multiple images, now imgFileNames.Lenght should be 1
private static readonly ILog log = LogManager.GetLogger(typeof(GrabImagesOp));
public override string ToString() { return string.Format("GrabImageOp()"); }
readonly Camera camera;
readonly string[] imgFileNames;
readonly bool blackAndWhite;
readonly bool lowResolution;
readonly ImageRotation imageRotation;
string command;
bool grabImageCommandSent;
string response;
bool grabPassed;
bool grabFailed;
bool transferringGrabbedImage;
Image grabedImage;
/// <summary>
/// Events: Event.None or Event.Error
/// </summary>
/// <param name="camera">CLP1611.Camera reference</param>
public GrabImagesOp(Camera camera, string[] imgFileNames, bool blackAndWhite, bool lowResolution, ImageRotation imageRotation)
{
/// TODO: Implement support for grabbing multiple images, now imgFileNames.Lenght should be 1
this.camera = camera;
//this.telnet = camera.Telnet;
this.imgFileNames = imgFileNames;
this.blackAndWhite = blackAndWhite;
this.lowResolution = lowResolution;
this.imageRotation = imageRotation;
grabImageCommandSent = false;
transferringGrabbedImage = false;
if (camera.DebugLevel == DebugMode.Normal || camera.DebugLevel == DebugMode.DetectedOn)
{
Camera.ImageCameraHandler += ImageReceived;
}
//TODO BUMI improve by simulate image
Camera.ImageCameraHandler += ImageReceived;
}
void PromptReceived(object sndr, PromptReceivedJMSEventArgs a)
{
response = a.Response;
}
void ImageReceived(object sndr, PromptReceivedImageEventArgs a)
{
if(a.idxCamera != camera.CameraIdx) return;
grabedImage = a.image;
grabPassed = true;
}
public void Start()
{
grabImageCommandSent = false;
transferringGrabbedImage = false;
grabPassed = false;
grabedImage = null;
if ((imgFileNames != null) && (imgFileNames.Length > 0) && File.Exists(imgFileNames[0]))
{
///
/// An image specified, (1) delete previous image, (2) check if this is a simulation
///
File.Delete(imgFileNames[0]);
/* if (camera.CameraCfg.DebugLevel == DebugMode.Simulate || camera.CameraCfg.DebugLevel == DebugMode.DetectedOff)
{
///
/// Camera is in simulation mode => create a simulated image
///
File.Copy(string.Format("{0}\\Pictures\\sample.jpg", Program.ExecutableDir), imgFileNames[0]);
}*/
}
}
public Event Run()
{
if ((imgFileNames == null) || (imgFileNames.Length < 1) || (imgFileNames[0] == null))
{
///
/// No images to be grabbed => Done
///
return Event.GrabPassed;
}
/*else if (camera.CameraCfg.DebugLevel == DebugMode.Simulate ||
camera.CameraCfg.DebugLevel == DebugMode.DetectedOff)
{
///
/// Camera is in simulation mode => create a simulated image and complete
///
return Event.GrabPassed;
}*/
else if (camera.IsGrabImageListenerThreadAlive)
{
return Event.CameraBusy;
}
else if (!grabImageCommandSent)
{
///
/// Normal operation, no command sent yet => (1) wait until telnet state = Inactive, (2) send a command
///
camera.StartGrabImageListener();
grabImageCommandSent = true;
return Event.CameraBusy;
}
else if (grabPassed)
{
///
/// Normal operation, grab passed => transfer/transferring the image
if (transferringGrabbedImage)
{
/// Grab passed and image transfer is in progress
return Event.GrabPassed;
}
else if (camera.IsSaveImageListenerThreadAlive)
{
/// Wait until the previous image transfer completes
return Event.CameraBusy;
}
else //if (0 == camera.DownloadFile(blackAndWhite ? "grabbed.jpg" : "grabbed.bmp", imgFileNames[0]))
{
camera.StartSaveImageToFileListener(grabedImage, imgFileNames[0]);
/// File transfer successfully started
transferringGrabbedImage = true;
return Event.GrabPassed;
}
}
else
{
///
/// Normal operation, grab failed => there in no image to transfer
///
return Event.GrabFailed;
}
}
public void Stop()
{
//if (camera.CameraCfg.DebugLevel == DebugMode.Simulate) return;
if (camera.IsGrabImageListenerThreadAlive)
{
camera.SetStopGrabImageListenerFlag();
}
}
}
}
@@ -1,72 +0,0 @@
using TBF.Rig.Network.Camera.CJMS11.POJO;
namespace TBF.Rig.Network.Camera.CJMS11
{
public class JmsMessage
{
private POJO.MessageStatus status;
private CommandM command;
private string payload;
private string orig_status;
private string orig_command;
private string orig_payload;
public POJO.MessageStatus Status
{
get => status;
set => status = value;
}
public CommandM Command
{
get => command;
set => command = value;
}
public string Payload
{
get => payload;
set => payload = value;
}
public string OrigStatus => orig_status;
public string OrigCommand => orig_command;
public string OrigPayload => orig_payload;
public JmsMessage(string status, string command, string payload)
{
this.status = MessageStatusEnum.GetCommandM(status);
this.command = CommandMEnum.GetCommandM(command);
orig_status = status;
orig_command = command;
orig_payload = payload;
this.payload = payload;
}
public bool isMessageImageType(){
return this.command == CommandM.grab_image_;
}
public ParsedImage getImage(){
if(isMessageImageType()){
return JmsPacket.ImageParser(this.payload);
}
return null;
}
public override string ToString()
{
return string.Format( "status:{0}, command:{1}, payload:{2}, orig_status:{3}, orig_command:{4}, orig_payload:{5}",
status,
command,
payload,
orig_status,
orig_command,
orig_payload);
}
}
}
@@ -1,98 +0,0 @@
using System;
using System.Text.RegularExpressions;
using log4net;
using TBF.Rig.Network.Camera.CJMS11.POJO;
namespace TBF.Rig.Network.Camera.CJMS11
{
public class JmsPacket
{
private static readonly ILog log = LogManager.GetLogger(typeof(JmsPacket));
private JmsMessage jmsMessage;
private string messageOrigin;
public string MessageOrigin { get => messageOrigin; }
public JmsMessage JmsMessage
{
get => jmsMessage;
set => jmsMessage = value;
}
public JmsPacket(string message)
{
messageOrigin = message;
try
{
if (ParseMessage(messageOrigin))
{
//success
}
}
catch (Exception e)
{
log.Error("Error parsing message: " + e.Message);
}
}
private bool ParseMessage(string message)
{
message = message.Trim();
if (message.Length < 1) return false;
this.jmsMessage = JmsMessageFromString(message);
return true;
}
public static JmsMessage JmsMessageFromString(string message)
{
// Equivalent regex pattern
var pattern = new Regex(@"^(ACK|NACK):\s*(\S+)\s*(?:~(.*)~)?\s*END$", RegexOptions.Singleline);
var match = pattern.Match(message);
if (match.Success)
{
string status = match.Groups[1].Value;
string commandStr = match.Groups[2].Value;
string payload = match.Groups[3].Success ? match.Groups[3].Value : "";
return new JmsMessage(status, commandStr, payload);
}
else
{
throw new ArgumentException($"Message format not recognized: {message}");
}
return null;
}
public static ParsedImage ImageParser(string payloadImage)
{
// Equivalent regex pattern
var imagePattern = new Regex(@"IMAGE:([A-Z0-9_]+):\s*(.*?)\s*~IMAGE_END", RegexOptions.Singleline);
var match = imagePattern.Match(payloadImage);
if (match.Success)
{
string encoding = match.Groups[1].Value;
string imageData = match.Groups[2].Value;
return new ParsedImage(ImageTypeEnum.GetCommandM(encoding), imageData);
}
else
{
throw new ArgumentException($"Payload does not match expected image format: {payloadImage}");
}
}
public override string ToString()
{
return string.Format("JmsPacket -> original message: {0} -> JmsMessage: {1}", messageOrigin, jmsMessage.ToString());
}
}
}
@@ -1,67 +0,0 @@
using System;
using System.Diagnostics;
using log4net;
using Common;
using TBF.Rig.Network.Telnet;
namespace TBF.Rig.Network.Camera.CJMS11
{
public class LiveStreamOp : IOperation
{
private static readonly ILog log = LogManager.GetLogger(typeof(LiveStreamOp));
readonly Camera camera;
readonly Telnet.TelnetClient telnet;
readonly string command;
bool liveStreamCommandSent;
/// <summary>
/// Events: Event.None or Event.Error
/// </summary>
/// <param name="camera">CLP1611.Camera reference</param>
public LiveStreamOp(Camera camera, string command)
{
this.camera = camera;
this.command = command;
}
public void Start()
{
liveStreamCommandSent = false;
}
public Event Run()
{
if (camera.CameraCfg.DebugLevel == DebugMode.Simulate) return Event.None;
log.DebugFormat("Run(): telnet.State = {0}, liveStreamCommandSent = {1}", telnet.State, liveStreamCommandSent);
if (!liveStreamCommandSent)
{
if (camera.Running && (telnet.State == TelnetClient.TelnetState.Inactive))
{
telnet.Enqueue(new Telnet.Command(Telnet.CmdAction.SEND_STRING, command));
liveStreamCommandSent = true;
log.WarnFormat("{0} IP={1} command={2}", camera.Name, camera.IPAddress, command);
}
}
return Event.None;
}
public void Stop()
{
if (camera.CameraCfg.DebugLevel == DebugMode.Simulate) return;
log.DebugFormat("Stop(): telnet.State = {0}, liveStreamCommandSent = {1}", telnet.State, liveStreamCommandSent);
if (liveStreamCommandSent)
{
telnet.Enqueue(new Telnet.Command(Telnet.CmdAction.SEND_COMMAND, Telnet.TelnetClient.CtrlCCommand));
log.WarnFormat("{0} IP={1} command=CTRL-C", camera.Name, camera.IPAddress);
}
}
}
}
@@ -1,24 +0,0 @@
namespace TBF.Rig.Network.Camera.CJMS11
{
public enum CommandM
{
noCommand,
unknown_, // special: only return - unknown command
connect_, // special: only return - TCP connection created
type_camera_,
status_,
prepare_camera_,
grab_image_,
send_,
start_stream_,
stop_stream_,
start_stream_images_,
stop_stream_images_,
get_cfg_,
set_cfg_,
close_,
disconnect_,
overload_config_,
client_count_
}
}
@@ -1,46 +0,0 @@
using System.Collections.Generic;
using System.Linq;
namespace TBF.Rig.Network.Camera.CJMS11
{
public static class CommandMEnum
{
private static readonly Dictionary<CommandM, string> commandToString = new Dictionary<CommandM, string>
{
{ CommandM.noCommand, "noCommand" },
{ CommandM.unknown_, "unknown" },
{ CommandM.connect_, "connect" },
{ CommandM.type_camera_, "type_camera" },
{ CommandM.status_, "status" },
{ CommandM.prepare_camera_, "prepare_camera" },
{ CommandM.grab_image_, "grab_image" },
{ CommandM.send_, "send" },
{ CommandM.start_stream_, "start_stream" },
{ CommandM.stop_stream_, "stop_stream" },
{ CommandM.start_stream_images_, "start_stream_images" },
{ CommandM.stop_stream_images_, "stop_stream_images" },
{ CommandM.get_cfg_, "get_cfg" },
{ CommandM.set_cfg_, "set_cfg" },
{ CommandM.close_, "close" },
{ CommandM.disconnect_, "disconnect" },
{ CommandM.overload_config_, "overload_config" },
{ CommandM.client_count_, "client_count" }
};
private static readonly Dictionary<string, CommandM> stringToCommand = commandToString.ToDictionary(kvp => kvp.Value, kvp => kvp.Key);
public static string GetVal(CommandM cmd)
{
return commandToString.TryGetValue(cmd, out var str) ? str : "unknown";
}
public static CommandM GetCommandM(string token)
{
if (string.IsNullOrEmpty(token))
return CommandM.noCommand;
return stringToCommand.TryGetValue(token, out var cmd) ? cmd : CommandM.noCommand;
}
}
}
@@ -1,10 +0,0 @@
namespace TBF.Rig.Network.Camera.CJMS11.POJO
{
public enum ImageType
{
UNKNOWN,
BASE_64,
MJPEG,
RGB888
}
}
@@ -1,31 +0,0 @@
using System.Collections.Generic;
using System.Linq;
namespace TBF.Rig.Network.Camera.CJMS11.POJO
{
public class ImageTypeEnum
{
private static readonly Dictionary<ImageType, string> commandToString = new Dictionary<ImageType, string>
{
{ ImageType.BASE_64, "BASE_64" },
{ ImageType.MJPEG, "MJPEG" },
{ ImageType.RGB888, "RGB888" },
{ ImageType.UNKNOWN, "" }
};
private static readonly Dictionary<string, ImageType> stringToCommand = commandToString.ToDictionary(kvp => kvp.Value, kvp => kvp.Key);
public static string GetVal(ImageType cmd)
{
return commandToString.TryGetValue(cmd, out var str) ? str : "unknown";
}
public static ImageType GetCommandM(string token)
{
if (string.IsNullOrEmpty(token))
return ImageType.UNKNOWN;
return stringToCommand.TryGetValue(token, out var cmd) ? cmd : ImageType.UNKNOWN;
}
}
}
@@ -1,10 +0,0 @@
namespace TBF.Rig.Network.Camera.CJMS11.POJO
{
public enum MessageStatus
{
UNDEFINED,
ACK,
NACK,
ERROR
}
}
@@ -1,31 +0,0 @@
using System.Collections.Generic;
using System.Linq;
namespace TBF.Rig.Network.Camera.CJMS11.POJO
{
public class MessageStatusEnum
{
private static readonly Dictionary<MessageStatus, string> commandToString = new Dictionary<MessageStatus, string>
{
{ MessageStatus.UNDEFINED, "" },
{ MessageStatus.ACK, "ACK" },
{ MessageStatus.NACK, "NACK" },
{ MessageStatus.ERROR, "ERROR" }
};
private static readonly Dictionary<string, MessageStatus> stringToCommand = commandToString.ToDictionary(kvp => kvp.Value, kvp => kvp.Key);
public static string GetVal(MessageStatus cmd)
{
return commandToString.TryGetValue(cmd, out var str) ? str : "undefined";
}
public static MessageStatus GetCommandM(string token)
{
if (string.IsNullOrEmpty(token))
return MessageStatus.UNDEFINED;
return stringToCommand.TryGetValue(token, out var cmd) ? cmd : MessageStatus.UNDEFINED;
}
}
}
@@ -1,38 +0,0 @@
using System;
using TBF.Rig.Network.Camera.CJMS11.POJO;
using System.Drawing;
using System.IO;
namespace TBF.Rig.Network.Camera.CJMS11
{
public class ParsedImage
{
public ImageType Encoding { get; }
public string ImageData { get; }
public Image Image { get { return (ImageData.Length>0 ? Base64ToImage(ImageData) : null); } }
public ParsedImage(ImageType encoding, string imageData)
{
Encoding = encoding;
ImageData = imageData;
}
public override string ToString()
{
return $"ParsedImage{{encoding='{Encoding}', imageData='{ImageData}'}}";
}
public static Image Base64ToImage(string base64Image)
{
byte[] imageBytes = Convert.FromBase64String(base64Image);
using (var ms = new MemoryStream(imageBytes))
{
return Image.FromStream(ms);
}
}
}
}
@@ -1,91 +0,0 @@
///
/// Copyright (c) 2017 Sensus Metering Systems
///
using System;
using System.Collections.Generic;
namespace TBF.Rig.Network.Camera.CJMS11
{
public class RoisAndResults
{
public const int MaxRegisteredRois = 4; /// Max. count of registered (and measured) ROI-s
public long CameraTimeMs;
public int[] Angles;
private IList<string> roiParams;
public int RegisteredRoisCount { get { return roiParams.Count; } }
public RoisAndResults()
{
Angles = new int[MaxRegisteredRois];
roiParams = new List<string>();
}
public void ClearRoiParams()
{
lock (this)
{
roiParams.Clear();
}
}
public int RegisterRoi(string roiParam)
{
lock (this)
{
if (this.roiParams.Count >= MaxRegisteredRois) return 0;
this.roiParams.Add(roiParam);
return this.roiParams.Count; /// return a handle 1 .. MaxRegisteredRois
}
}
public string GetRoiParams(int roiHandle)
{
lock (this)
{
if (roiHandle > 0 && roiHandle <= roiParams.Count)
{
return roiParams[roiHandle - 1];
}
else
{
return string.Empty;
}
}
}
public void SetResults(long timeMs, int[] angles)
{
lock (this)
{
CameraTimeMs = timeMs;
for (int i = 0; i < Math.Min(angles.Length, Angles.Length); i++)
{
Angles[i] = angles[i];
}
}
}
public int GetResult(int roiHandle, out long timeMs)
{
lock (this)
{
if (roiHandle > 0 && roiHandle <= roiParams.Count)
{
timeMs = CameraTimeMs;
return Angles[roiHandle - 1];
}
else
{
timeMs = 0;
return 0;
}
}
}
}
}
-62
View File
@@ -1,62 +0,0 @@
namespace TBF.Rig.Network.Camera.CJMS11
{
partial class TerminalDlg
{
/// <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.vtTextBox = new System.Windows.Forms.TextBox();
this.SuspendLayout();
//
// vtTextBox
//
this.vtTextBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.vtTextBox.Location = new System.Drawing.Point(0, 0);
this.vtTextBox.Multiline = true;
this.vtTextBox.Name = "vtTextBox";
this.vtTextBox.ScrollBars = System.Windows.Forms.ScrollBars.Both;
this.vtTextBox.Size = new System.Drawing.Size(737, 437);
this.vtTextBox.TabIndex = 0;
//
// TerminalDlg
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(737, 437);
this.Controls.Add(this.vtTextBox);
this.Name = "TerminalDlg";
this.Text = "Terminal";
this.Load += new System.EventHandler(this.Terminal_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.TextBox vtTextBox;
}
}
@@ -1,37 +0,0 @@
using System;
using System.Windows.Forms;
using TBF.Rig.Network.Telnet;
namespace TBF.Rig.Network.Camera.CJMS11
{
public partial class TerminalDlg : Form
{
TelnetClient telnet;
public TerminalDlg()
{
InitializeComponent();
}
public TerminalDlg(string name, TelnetClient telnet)
{
InitializeComponent();
Text = name;
this.telnet = telnet;
}
private void Terminal_Load(object sender, EventArgs e)
{
telnet.vtTextChangedHandler += delegate(object sndr, VtTextChangedEventArgs args)
{
if (InvokeRequired) { Invoke(new EventHandler<VtTextChangedEventArgs>(OnTextChanged), sndr, args); }
else OnTextChanged(sndr, args);
};
}
void OnTextChanged(object sndr, VtTextChangedEventArgs args)
{
vtTextBox.Text = args.VtText;
}
}
}
@@ -1,120 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
+5 -1
View File
@@ -42,10 +42,14 @@ namespace TBF.Rig.Network.Camera.Roi
{
foreach (var cmpnt in parent.CmpntEntities)
{
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is TBF.Rig.Network.Camera.CJMS11.Factory)
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is TBF.Rig.Network.Camera.CLP1611.Factory)
{
parentNameComboBox.Items.Add(cmpnt.Name);
}
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is TBF.Rig.Network.Camera.Roi.Factory)
{
previousRoiComboBox.Items.Add(cmpnt.Name);
}
}
}
@@ -1,25 +0,0 @@
///
/// Copyright (c) 2017 Sensus Metering Systems
///
using System.Collections.Generic;
using TBF.Rig.Generic;
namespace TBF.Rig.Network.Camera.RoiForFixedStartCJMS11
{
public class Factory : IComponentFactory
{
public string ClassName { get { return this.GetType().Namespace.Substring(8); } }
public override string ToString() { return ClassName; }
public IComponent DummyComponent() { return new Roi(); }
public IComponent GetComponent(IComponentCfg cfg, IList<IComponent> components) { return new Roi(cfg, components); }
public IComponentCfg DefaultConfig() { return new RoiCfg(this.GetType().Namespace.Substring(8), this); }
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
{
return ComponentCfgBase.CreateFromDbEntity(RoiCfg.Serializer, component, this);
}
}
}
@@ -1,115 +0,0 @@
///
/// Copyright (c) 2017 Sensus Metering Systems
///
using System.IO;
using System.Xml.Serialization;
using Common;
using Config.Entities;
using TBF.Rig.Generic;
using TBF.Resources;
namespace TBF.Rig.Network.Camera.RoiForFixedStartCJMS11
{
public class ProcedureParams : ProcedureParamsBase, IParamsProvider, IProcedureParams
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(ProcedureParams) })[0];
public override XmlSerializer GetSerializer() { return Serializer; }
public double PulsesPerLtr; /// [l^-1]
public override void InitializeAll()
{
PulsesPerLtr = 1.0;
}
string[] paramNames = new string[]
{
Strings.PulsesPerLtr,
};
public override string ParamName(int i) { return paramNames[i]; }
public override int ParamsCount() { return paramNames.Length; }
public override string ToString(int i)
{
switch (i)
{
case 0: return PulsesPerLtr.ToString();
default: return string.Empty;
}
}
/// Retrieves parameters from UI controls
public CfgUpdateFlags UpdateParam(int i, string strValue)
{
switch (i)
{
case 0: PulsesPerLtr = Utils.ParseUDouble(strValue); return CfgUpdateFlags.None;
default: return CfgUpdateFlags.None;
}
}
/// Verifies whether strings in UI controls represent valid parameters
public bool ValidateParam(int i, string strValue, out string message)
{
message = string.Empty;
double dummy;
switch (i)
{
case 0:
if (Utils.TryParseUDouble(strValue, out dummy)) return true;
break;
default:
message = "Invalid index";
return false;
}
message = ParamName(i) + " is invalid";
return false;
}
void CopyContentTo(ProcedureParams prms)
{
prms.PulsesPerLtr = this.PulsesPerLtr;
}
public IParamsProvider Clone()
{
ProcedureParams pars = new ProcedureParams();
CopyContentTo(pars);
return pars;
}
public override void UpdateFromDbEntity(ComponentProcedure dbEntity)
{
if (dbEntity == null) return;
try
{
ProcedureParams tmp = Serializer.Deserialize(new StringReader(dbEntity.Parameters)) as ProcedureParams;
procedureParamsEntity = dbEntity;
componentName = dbEntity.CmpntName;
procedure = dbEntity.Procedure;
if (tmp != null) tmp.CopyContentTo(this);
}
catch
{
}
}
public ProcedureParams() { }
public ProcedureParams(bool initialize)
{
if (initialize) InitializeAll();
}
public ProcedureParams(ComponentProcedure procedureParamsEntity, string componentName, Procedure procedure)
{
this.procedureParamsEntity = procedureParamsEntity;
this.componentName = componentName;
this.procedure = procedure;
}
}
}
@@ -1,144 +0,0 @@
///
/// Copyright (c) 2017-2021 Sensus Metering Systems
///
using System;
using System.Collections.Generic;
using System.Text;
using log4net;
using Common;
using Config.Entities;
using TBF.Rig.GenericDevices;
namespace TBF.Rig.Network.Camera.RoiForFixedStartCJMS11
{
public class Roi : ComponentBase, GenericDevices.IRegReaderStillCamera
{
/// TODO: Implement support for sharing one camera by multiple ROI-s
private static readonly ILog log = LogManager.GetLogger(typeof(Roi));
public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
readonly RoiCfg roiCfg;
///
/// Camera and ICamera
///
public readonly CJMS11.Camera NetCamera;
public GenericDevices.ICamera Camera { get { return NetCamera as GenericDevices.ICamera; } }
public int Position
{
get
{
int firstDigitPos = Name.IndexOfAny(new char[] { '1', '2', '3', '4', '5', '6', '7', '8', '9', '0' });
int position;
return (firstDigitPos < 0) ? 0 : (int.TryParse(Name.Substring(firstDigitPos), out position) ? position : 0);
}
}
public RegisterReaderType RegisterReaderType { get { return RegisterReaderType.Manual; } }
public double PulsesPerLtr { get { return roiCfg.ProcParams.PulsesPerLtr; } }
public double LtrsPerPulse { get { return (PulsesPerLtr <= float.Epsilon) ? 1.0 : (1 / PulsesPerLtr); } }
double beginWMState;
public double BeginWMState
{
get { return beginWMState; }
set { beginWMState = value; }
}
double endWMState;
public double EndWMState
{
get { return endWMState; }
set { endWMState = value; }
}
public double WMVolume { get { return endWMState - beginWMState; } }
public int WMPulses { get { return (int)(WMVolume / LtrsPerPulse); } }
public int WMRefPulses { get { return StateMachine.ControlBoardMain.RefPulses; ; } }
public Roi() { }
public Roi(Generic.IComponentCfg cfg, IList<Generic.IComponent> components)
: base(cfg)
{
roiCfg = cfg as RoiCfg;
NetCamera = TbfComponents.FindComponent(cfg.ParentName, components) as CJMS11.Camera;
log.Warn(this.ToString());
}
public override void Initialize()
{
Clear();
}
#region Configuration Change Handling
public static void OnCfgChange(object sender, CfgChangeArgs args)
{
if (CfgChangeHandler == null) return;
try { CfgChangeHandler(sender, args); }
catch (Exception e) { log.Error("CfgChangeHandler(...) failed", e); }
}
public static event EventHandler<CfgChangeArgs> CfgChangeHandler;
public override void StartChangeHandler()
{
CfgChangeHandler += delegate(object sender, CfgChangeArgs args)
{
RoiCfg tmpcfg = args.Cfg as RoiCfg;
if (tmpcfg != null && tmpcfg.Name.Equals(Name))
{
if (args.Command == CfgChangeCmd.CfgChange)
{
roiCfg.BlackAndWhite = tmpcfg.BlackAndWhite;
roiCfg.LowResolution = tmpcfg.LowResolution;
roiCfg.ImageRotation = tmpcfg.ImageRotation;
}
}
};
}
#endregion Configuration Change Handling
public void Clear()
{
log.DebugFormat("{0}:Clear()", Name);
beginWMState = 0;
endWMState = 0;
}
public IOperation GrabImageOp(string imageFileName)
{
return GrabImageOp(imageFileName, roiCfg.BlackAndWhite, roiCfg.LowResolution, roiCfg.ImageRotation);
}
public IOperation GrabImageOp(string imageFileName,
bool blackAndWhite, bool lowResolution, ImageRotation imageRotation)
{
if (NetCamera != null)
{
///TODO BUMI - implementing grabing multiple images
/// 1. Create a list of image file names
/// 2. implement count of images to grab
/// 3. implement grabing multiple images
/// TODO: Implement support for sharing one camera by multiple ROI-s
return NetCamera.GrabImagesOp(new string[] { imageFileName }, blackAndWhite, lowResolution, imageRotation);
}
else
return null;
}
public IValve GetValve()
{
return null;
}
}
}
@@ -1,78 +0,0 @@
///
/// Copyright (c) 2017 Sensus Metering Systems
///
using System.Collections.Generic;
using System.Xml.Serialization;
using Common;
using Config.Entities;
using TBF.Rig.Generic;
using TBF.Rig.Network.Camera.RoiForFixedStartCJMS11.common;
namespace TBF.Rig.Network.Camera.RoiForFixedStartCJMS11
{
public class RoiCfg : ComponentCfgBase, IChildComponentCfg
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(RoiCfg) })[0];
public override XmlSerializer GetSerializer() { return Serializer; }
public IComponentCfgCtrl GetControl(IList<Config.Entities.Component> cmpntEntities) { return new RoiCfgCtrl(); }
///
/// Serialized parameters
///
public bool BlackAndWhite;
public bool LowResolution;
public ImageRotation ImageRotation;
[XmlIgnore]
private Frame _imageFrame;
[XmlElement(IsNullable = true)]
public Frame ImageFrame
{
get
{
if (_imageFrame == null)
{
_imageFrame = new Frame(); // Ensure non-null when accessed
}
return _imageFrame;
}
set
{
_imageFrame = value;
}
}
/// <summary> Procedure parameters </summary>
[XmlIgnore]
public ProcedureParams ProcParams;
public override IParamsProvider GetRuntimeProcParamsProvider() { return ProcParams; }
public override IParamsProvider CreateProcParamsProvider() { return new ProcedureParams(true); }
/// Private parameterless constructor invoked by all other (public) constructors
RoiCfg()
{
ProcParams = new ProcedureParams(true);
}
public RoiCfg(string name, IComponentFactory factory)
: this()
{
Name = name;
Factory = factory;
ParentName = "Camera";
BlackAndWhite = false;
LowResolution = true;
ImageRotation = ImageRotation.None;
ImageFrame = Frame.StandardFrame();
DebugLevel = DebugMode.Inherit;
}
public string ToString(int i)
{
return string.Format("{0} Camera={1} B&W={2}, LowRes={3}, Rotation={4}, Frame={5}",
Name, ParentName, BlackAndWhite, LowResolution, ImageRotation, ImageFrame);
}
}
}
@@ -1,200 +0,0 @@
///
/// Copyright (c) 2017 Sensus Metering Systems
///
using System;
using System.Windows.Forms;
using log4net;
using Common;
using Config.Entities;
using TBF.Rig.Generic;
using TBF.Resources;
using TBF.Rig.Network.Camera.RoiForFixedStartCJMS11.common;
using TBF.UI.Bench.Components;
namespace TBF.Rig.Network.Camera.RoiForFixedStartCJMS11
{
public partial class RoiCfgCtrl : UserControl, IComponentCfgCtrl
{
static readonly ILog log = LogManager.GetLogger(typeof(RoiCfgCtrl));
ComponentParametersDlg parent;
public bool ShowMore { get { return false; } }
RoiCfg config;
public IComponentCfg Config
{
get { return config as IComponentCfg; }
set
{
config = value as RoiCfg;
Redraw();
}
}
public RoiCfgCtrl()
{
InitializeComponent();
}
private void PumpCfgCtrl_Load(object sender, EventArgs e)
{
parent = ParentForm as ComponentParametersDlg;
if (parent == null) return;
if (parent.CmpntEntities != null)
{
foreach (var cmpnt in parent.CmpntEntities)
{
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is TBF.Rig.Network.Camera.CJMS11.Factory)
{
parentNameComboBox.Items.Add(cmpnt.Name);
}
}
}
foreach (var resolutionFrame in ResolutionFrames.CommonResolutions)
{
resolutionComboBox.Items.Add(resolutionFrame.ToString());
}
for (ImageRotation ir = 0; ir < ImageRotation.Count; ir++)
{
imageRotationComboBox.Items.Add(ir.ToDescription());
}
Redraw();
}
public void Closing()
{
}
void Redraw()
{
if (config == null) return; /// Control was not loaded, settings were not changed
classNameLabel.Text = config.Factory.ClassName;
nameTextBox.Text = config.Name;
parentNameComboBox.Text = string.IsNullOrEmpty(config.ParentName) ? "---" : config.ParentName;
blackAndWhiteCheckBox.Checked = config.BlackAndWhite;
loResolutionCheckBox.Checked = config.LowResolution;
imageRotationComboBox.Text = config.ImageRotation.ToDescription();
resolutionComboBox.Text = config.ImageFrame.ToString();
}
public void Unlock()
{
nameTextBox.Enabled = true;
parentNameComboBox.Enabled = true;
blackAndWhiteCheckBox.Enabled = true;
loResolutionCheckBox.Enabled = true;
imageRotationComboBox.Enabled = true;
resolutionComboBox.Enabled = true;
}
public CfgUpdateFlags VerifyCfg(ref string message)
{
CfgUpdateFlags flags = CfgUpdateFlags.None;
if (!parentNameComboBox.Items.Contains(parentNameComboBox.Text))
{
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + string.Format(Strings.Invalid_0, parentNameLabel.Text);
}
if (!imageRotationComboBox.Items.Contains(imageRotationComboBox.Text))
{
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + string.Format(Strings.Invalid_0, imageRotationLabel.Text);
}
if (!resolutionComboBox.Items.Contains(resolutionComboBox.Text))
{
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + string.Format(Strings.Invalid_0, resolutionComboBox.Text);
}
return flags;
}
public CfgUpdateFlags UpdateCfg()
{
CfgUpdateFlags flags = CfgUpdateFlags.None;
if (config == null) return CfgUpdateFlags.Error; /// Control was not loaded, settings were not changed
if (config.Name != nameTextBox.Text)
{
config.Name = nameTextBox.Text;
flags |= (CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
}
string newParentName = parentNameComboBox.Text.Equals("---") ? string.Empty : parentNameComboBox.Text;
if (config.ParentName != newParentName)
{
config.ParentName = newParentName;
flags |= (CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
}
if (config.BlackAndWhite != blackAndWhiteCheckBox.Checked)
{
config.BlackAndWhite = blackAndWhiteCheckBox.Checked;
flags |= (CfgUpdateFlags.AnyChange | CfgUpdateFlags.InvokeCfgChange);
}
if (config.LowResolution != loResolutionCheckBox.Checked)
{
config.LowResolution = loResolutionCheckBox.Checked;
flags |= (CfgUpdateFlags.AnyChange | CfgUpdateFlags.InvokeCfgChange);
}
for (ImageRotation ir = 0; ir < ImageRotation.Count; ir++)
{
if (imageRotationComboBox.Text == ir.ToDescription())
{
if (config.ImageRotation != ir)
{
config.ImageRotation = ir;
flags |= (CfgUpdateFlags.AnyChange | CfgUpdateFlags.InvokeCfgChange);
break;
}
}
}
if (resolutionComboBox.Text != config.ImageFrame.ToString())
{
config.ImageFrame = Frame.Parse(resolutionComboBox.Text);
flags |= (CfgUpdateFlags.AnyChange | CfgUpdateFlags.InvokeCfgChange);
}
if ((flags & CfgUpdateFlags.InvokeCfgChange) != 0)
{
Roi.OnCfgChange(this, new CfgChangeArgs(CfgChangeCmd.CfgChange, config));
}
return flags;
}
#region Configuration Change Handling
public static void OnCmdResponse(object sender, CmdResponseArgs args)
{
if (CmdResponseHandler == null) return;
try { CmdResponseHandler(sender, args); }
catch (Exception e) { log.Error("CmdResponseHandler(...) failed", e); }
}
public static event EventHandler<CmdResponseArgs> CmdResponseHandler;
public void StartResponseHandler() { }
public void StopResponseHandler() { }
#endregion Configuration Change Handling
}
}
@@ -1,222 +0,0 @@
///
/// Copyright (c) 2017 Sensus Metering Systems
///
namespace TBF.Rig.Network.Camera.RoiForFixedStartCJMS11
{
partial class RoiCfgCtrl
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.parentNameLabel = new System.Windows.Forms.Label();
this.nameTextBox = new System.Windows.Forms.TextBox();
this.nameLabel = new System.Windows.Forms.Label();
this.classNameLabel = new System.Windows.Forms.Label();
this.parentNameComboBox = new System.Windows.Forms.ComboBox();
this.label1 = new System.Windows.Forms.Label();
this.textBox1 = new System.Windows.Forms.TextBox();
this.imageRotationComboBox = new System.Windows.Forms.ComboBox();
this.imageRotationLabel = new System.Windows.Forms.Label();
this.blackAndWhiteCheckBox = new System.Windows.Forms.CheckBox();
this.loResolutionCheckBox = new System.Windows.Forms.CheckBox();
this.label2 = new System.Windows.Forms.Label();
this.resolutionComboBox = new System.Windows.Forms.ComboBox();
this.SuspendLayout();
//
// parentNameLabel
//
this.parentNameLabel.AutoSize = true;
this.parentNameLabel.Location = new System.Drawing.Point(30, 118);
this.parentNameLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.parentNameLabel.Name = "parentNameLabel";
this.parentNameLabel.Size = new System.Drawing.Size(65, 20);
this.parentNameLabel.TabIndex = 3;
this.parentNameLabel.Text = "Camera";
//
// nameTextBox
//
this.nameTextBox.Enabled = false;
this.nameTextBox.Location = new System.Drawing.Point(208, 75);
this.nameTextBox.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.nameTextBox.Name = "nameTextBox";
this.nameTextBox.Size = new System.Drawing.Size(259, 26);
this.nameTextBox.TabIndex = 2;
//
// nameLabel
//
this.nameLabel.AutoSize = true;
this.nameLabel.Location = new System.Drawing.Point(30, 80);
this.nameLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.nameLabel.Name = "nameLabel";
this.nameLabel.Size = new System.Drawing.Size(51, 20);
this.nameLabel.TabIndex = 1;
this.nameLabel.Text = "Name";
//
// classNameLabel
//
this.classNameLabel.AutoSize = true;
this.classNameLabel.Location = new System.Drawing.Point(204, 40);
this.classNameLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.classNameLabel.Name = "classNameLabel";
this.classNameLabel.Size = new System.Drawing.Size(173, 20);
this.classNameLabel.TabIndex = 0;
this.classNameLabel.Text = "ComponentClassName";
//
// parentNameComboBox
//
this.parentNameComboBox.Enabled = false;
this.parentNameComboBox.FormattingEnabled = true;
this.parentNameComboBox.Location = new System.Drawing.Point(208, 114);
this.parentNameComboBox.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.parentNameComboBox.Name = "parentNameComboBox";
this.parentNameComboBox.Size = new System.Drawing.Size(259, 28);
this.parentNameComboBox.TabIndex = 4;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(-316, -226);
this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(87, 20);
this.label1.TabIndex = 5;
this.label1.Text = "Arguments";
//
// textBox1
//
this.textBox1.Enabled = false;
this.textBox1.Location = new System.Drawing.Point(-188, -231);
this.textBox1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(556, 26);
this.textBox1.TabIndex = 6;
//
// imageRotationComboBox
//
this.imageRotationComboBox.Enabled = false;
this.imageRotationComboBox.FormattingEnabled = true;
this.imageRotationComboBox.Location = new System.Drawing.Point(208, 237);
this.imageRotationComboBox.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.imageRotationComboBox.Name = "imageRotationComboBox";
this.imageRotationComboBox.Size = new System.Drawing.Size(138, 28);
this.imageRotationComboBox.TabIndex = 8;
//
// imageRotationLabel
//
this.imageRotationLabel.AutoSize = true;
this.imageRotationLabel.Location = new System.Drawing.Point(30, 242);
this.imageRotationLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.imageRotationLabel.Name = "imageRotationLabel";
this.imageRotationLabel.Size = new System.Drawing.Size(153, 20);
this.imageRotationLabel.TabIndex = 7;
this.imageRotationLabel.Text = "Image rotation (ccw)";
//
// blackAndWhiteCheckBox
//
this.blackAndWhiteCheckBox.AutoSize = true;
this.blackAndWhiteCheckBox.Enabled = false;
this.blackAndWhiteCheckBox.Location = new System.Drawing.Point(208, 166);
this.blackAndWhiteCheckBox.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.blackAndWhiteCheckBox.Name = "blackAndWhiteCheckBox";
this.blackAndWhiteCheckBox.Size = new System.Drawing.Size(134, 24);
this.blackAndWhiteCheckBox.TabIndex = 5;
this.blackAndWhiteCheckBox.Text = "Black && White";
this.blackAndWhiteCheckBox.UseVisualStyleBackColor = true;
//
// loResolutionCheckBox
//
this.loResolutionCheckBox.AutoSize = true;
this.loResolutionCheckBox.Enabled = false;
this.loResolutionCheckBox.Location = new System.Drawing.Point(208, 202);
this.loResolutionCheckBox.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.loResolutionCheckBox.Name = "loResolutionCheckBox";
this.loResolutionCheckBox.Size = new System.Drawing.Size(137, 24);
this.loResolutionCheckBox.TabIndex = 6;
this.loResolutionCheckBox.Text = "Low resolution";
this.loResolutionCheckBox.UseVisualStyleBackColor = true;
//
// label2
//
this.label2.Location = new System.Drawing.Point(30, 293);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(152, 28);
this.label2.TabIndex = 9;
this.label2.Text = "Choose resolution:";
//
// resolutionComboBox
//
this.resolutionComboBox.DropDownWidth = 259;
this.resolutionComboBox.Enabled = false;
this.resolutionComboBox.FormattingEnabled = true;
this.resolutionComboBox.Location = new System.Drawing.Point(208, 290);
this.resolutionComboBox.Name = "resolutionComboBox";
this.resolutionComboBox.Size = new System.Drawing.Size(262, 28);
this.resolutionComboBox.TabIndex = 10;
//
// RoiCfgCtrl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.resolutionComboBox);
this.Controls.Add(this.label2);
this.Controls.Add(this.imageRotationComboBox);
this.Controls.Add(this.imageRotationLabel);
this.Controls.Add(this.blackAndWhiteCheckBox);
this.Controls.Add(this.loResolutionCheckBox);
this.Controls.Add(this.parentNameComboBox);
this.Controls.Add(this.textBox1);
this.Controls.Add(this.label1);
this.Controls.Add(this.parentNameLabel);
this.Controls.Add(this.nameTextBox);
this.Controls.Add(this.nameLabel);
this.Controls.Add(this.classNameLabel);
this.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.Name = "RoiCfgCtrl";
this.Size = new System.Drawing.Size(750, 462);
this.Load += new System.EventHandler(this.PumpCfgCtrl_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
private System.Windows.Forms.ComboBox resolutionComboBox;
private System.Windows.Forms.Label label2;
#endregion
private System.Windows.Forms.Label parentNameLabel;
private System.Windows.Forms.TextBox nameTextBox;
private System.Windows.Forms.Label nameLabel;
private System.Windows.Forms.Label classNameLabel;
private System.Windows.Forms.ComboBox parentNameComboBox;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.ComboBox imageRotationComboBox;
private System.Windows.Forms.Label imageRotationLabel;
private System.Windows.Forms.CheckBox blackAndWhiteCheckBox;
private System.Windows.Forms.CheckBox loResolutionCheckBox;
}
}
@@ -1,120 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
@@ -1,70 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
namespace TBF.Rig.Network.Camera.RoiForFixedStartCJMS11.common
{
public class Frame
{
public int Width { get; set; }
public int Height { get; set; }
public Frame() // standard frame
{
this.Width = 640;
this.Height = 480;
}
public Frame(int width, int height)
{
Width = width;
Height = height;
}
public static Frame StandardFrame()
{
return new Frame();
}
public override string ToString() => $"{Width}x{Height}";
// Static method to parse string like "1920x1080"
public static Frame Parse(string resolution)
{
var match = Regex.Match(resolution, @"^\s*(\d+)\s*[xX]\s*(\d+)\s*$");
if (!match.Success)
{
throw new FormatException($"Invalid resolution format: '{resolution}'");
}
int width = int.Parse(match.Groups[1].Value);
int height = int.Parse(match.Groups[2].Value);
return new Frame(width, height);
}
///
/// Finds nearest frame based on selected dimension
/// <b> example: </b>
/// <code>
/// var input = new Frame(1500, 800);
/// //Nearest by Width
/// var nearestByWidth = input.FindNearest(allFrames, f => f.Width);
/// Console.WriteLine($"Nearest by width: {nearestByWidth}"); // → 1280x720
/// //Nearest by Height
/// var nearestByHeight = input.FindNearest(allFrames, f => f.Height);
/// Console.WriteLine($"Nearest by height: {nearestByHeight}"); // → 1280x720
/// </code>
public Frame FindNearest(IEnumerable<Frame> candidates, Func<Frame, int> dimensionSelector)
{
int target = dimensionSelector(this);
return candidates
.OrderBy(f => Math.Abs(dimensionSelector(f) - target))
.ThenBy(dimensionSelector) // tie-breaker: prefer smaller
.FirstOrDefault();
}
}
}
@@ -1,32 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
namespace TBF.Rig.Network.Camera.RoiForFixedStartCJMS11.common
{
public class ResolutionFrames : List<Frame>
{
public ResolutionFrames(IEnumerable<Frame> collection) : base(collection)
{
}
public static readonly IReadOnlyList<Frame> CommonResolutions = new List<Frame>
{
new Frame(320, 240),
new Frame(352, 288),
new Frame(640, 480), // standard frame
new Frame(720, 480),
new Frame(1280, 720),
new Frame(1920, 1080),
new Frame(2560, 1440),
new Frame(3840, 2160),
new Frame(4096, 2160)
}.AsReadOnly();
}
}
@@ -1,71 +0,0 @@
using System;
using System.Drawing;
using Common;
namespace TBF.Rig.Network.Camera.common
{
public class ImageUtils
{
public static void Rotate(Image image, ImageRotation direction)
{
if(!(direction == ImageRotation.Deg90 || direction == ImageRotation.Deg180 || direction == ImageRotation.Deg270))
return;
if (image == null)
throw new ArgumentNullException(nameof(image));
RotateFlipType flipType =
direction == ImageRotation.Deg90 ? RotateFlipType.Rotate90FlipNone :
direction == ImageRotation.Deg180 ? RotateFlipType.Rotate180FlipNone :
direction == ImageRotation.Deg270 ? RotateFlipType.Rotate270FlipNone :
RotateFlipType.RotateNoneFlipNone;
image.RotateFlip(flipType);
}
public static Image RotateCustom(Image image, ImageRotation direction)
{
if (image == null)
throw new ArgumentNullException(nameof(image));
int newWidth = image.Width;
int newHeight = image.Height;
RotateFlipType flipType;
switch (direction)
{
case ImageRotation.Deg90:
flipType = RotateFlipType.Rotate90FlipNone;
newWidth = image.Height;
newHeight = image.Width;
break;
case ImageRotation.Deg180:
flipType = RotateFlipType.Rotate180FlipNone;
break;
case ImageRotation.Deg270:
flipType = RotateFlipType.Rotate270FlipNone;
newWidth = image.Height;
newHeight = image.Width;
break;
default:
throw new ArgumentException("Unsupported rotation direction");
}
Bitmap rotated = new Bitmap(newWidth, newHeight);
using (Graphics g = Graphics.FromImage(rotated))
{
g.TranslateTransform(newWidth / 2f, newHeight / 2f);
g.RotateTransform(
direction == ImageRotation.Deg90 ? 90 :
direction == ImageRotation.Deg180 ? 180 :
direction == ImageRotation.Deg270 ? 270 :
0);
g.TranslateTransform(-image.Width / 2f, -image.Height / 2f);
g.DrawImage(image, new PointF(0, 0));
}
return rotated;
}
}
}
@@ -1,7 +1,5 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using TBF.Rig.Network.Camera.CJMS11;
namespace TBF.Rig.Network.Telnet
{
@@ -63,34 +61,6 @@ namespace TBF.Rig.Network.Telnet
Response = text;
}
}
/// <summary>
/// Type of argument of PromptReceviedEventHandler
/// </summary>
public class PromptReceivedJMSEventArgs : EventArgs
{
public string Response; /// Response to a command from the telnet server ...
/// ... without the terminal prompt string.
public JmsMessage Message; /// Message received from the server.
public PromptReceivedJMSEventArgs(string text, JmsMessage message)
{
Response = text;
Message = message;
}
}
public class PromptReceivedImageEventArgs : EventArgs
{
public Image image; /// server image.
public int idxCamera; /// camera index.
public PromptReceivedImageEventArgs(int idxCamera, Image image)
{
this.image = image;
this.idxCamera = idxCamera;
}
}
+26 -7
View File
@@ -127,11 +127,16 @@ namespace TBF.Rig.Output.FileWriters.Enhanced
/// </summary>
/// <param name="time">Date and time</param>
/// <returns>File name</returns>
string GetFilename(string destinationPath, Results.Entities.Batch batch)
public string GetFilename(string destinationPath, Results.Entities.Batch batch, DateTime now)
{
string directory = destinationPath; /// Ends with "\\";
DateTime time = batch.EndTime;
if (writerCfg.FileNameFormat.Contains("{5:"))
{
time = now; //define path and file name now
}
switch (writerCfg.YearFolders)
{
case YearFolders.FourDigit:
@@ -195,7 +200,7 @@ namespace TBF.Rig.Output.FileWriters.Enhanced
else
{
TBF.Rig.GenericDevices.IBenchInfo bi = TBF.Rig.Sequences.ProcessData.BenchInfo;
return directory + string.Format(writerCfg.FileNameFormat, batch.EndTime, batch.StartTime, batch.BatchNr, bi.TestBenchName, bi.TestBenchId);
return directory + string.Format(writerCfg.FileNameFormat, batch.EndTime, batch.StartTime, batch.BatchNr, bi.TestBenchName, bi.TestBenchId, time);
}
}
catch
@@ -248,6 +253,7 @@ namespace TBF.Rig.Output.FileWriters.Enhanced
}
void WriteRslts(Results.Entities.Batch batch, string destination)
{
if (batch == null || batch.WaterMeters == null || batch.WaterMeters.Count <= 0) return;
@@ -257,8 +263,9 @@ namespace TBF.Rig.Output.FileWriters.Enhanced
StreamWriter writer = StreamWriter.Null;
try
{
writer = File.AppendText(GetFilename(destination, batch));
WriteRsltsEx(batch, writer);
DateTime now = DateTime.Now; // Common time for '{5:' possibility of output
writer = File.AppendText(GetFilename(destination, batch, now));
WriteRsltsEx(batch, writer,now);
log.WarnFormat("Batch {0} written by {1} to file {2}", batch.BatchNr, Name, destination);
}
catch
@@ -273,7 +280,7 @@ namespace TBF.Rig.Output.FileWriters.Enhanced
}
void WriteRsltsEx(Results.Entities.Batch batch, StreamWriter wrtr)
public void WriteRsltsEx(Results.Entities.Batch batch, StreamWriter wrtr, DateTime now)
{
///----------
/// Header
@@ -291,7 +298,15 @@ namespace TBF.Rig.Output.FileWriters.Enhanced
foreach (var v in commonItems)
{
leftColumn[cnt] = v.Caption;
rightColumn[cnt] = (batch.WaterMeters.Count > 0) ? v.Print(batch.WaterMeters[0]) : string.Empty;
if (v.Uid == 72 && writerCfg.FileNameFormat.Contains("{5:"))
{
rightColumn[cnt] = string.Format(v.Format, now);
}
else
{
rightColumn[cnt] = (batch.WaterMeters.Count > 0) ? v.Print(batch.WaterMeters[0]) : string.Empty;
}
cnt++;
}
@@ -308,7 +323,11 @@ namespace TBF.Rig.Output.FileWriters.Enhanced
{
wrtr.Write(new string(' ', maxLen - leftColumn[i].Length + 3));
}
wrtr.Write(separatorStr);
if (!writerCfg.NoSeparatorBetweenItems)
{
wrtr.Write(separatorStr);
}
wrtr.WriteLine(rightColumn[i]);
}
@@ -33,6 +33,13 @@ namespace TBF.Rig.Output.FileWriters.Enhanced
public string[] SelectedItems;
public string Footer;
[XmlIgnore]
private bool? noSeparatorBetweenItems;
public bool NoSeparatorBetweenItems {
get { return noSeparatorBetweenItems.HasValue ? noSeparatorBetweenItems.Value : false; }
set { noSeparatorBetweenItems = value;}
}
[XmlIgnore]
public MetersKind MetersKind;
@@ -61,11 +68,12 @@ namespace TBF.Rig.Output.FileWriters.Enhanced
SaveGoodOnly = false;
Header = string.Empty;
Footer = string.Empty;
NoSeparatorBetweenItems = false;
}
public string ToString(int i)
{
return string.Format("{0}, Path={1}, Y={2}, M={3}, D={4}, FNameFmt={5}, Separator={6}, NoSpaces={7}, GoodOnly={8}",
return string.Format("{0}, Path={1}, Y={2}, M={3}, D={4}, FNameFmt={5}, Separator={6}, NoSpaces={7}, GoodOnly={8}, NoSeparatorBetweenItems={9}",
Name,
DestinationPath,
YearFolders,
@@ -74,7 +82,8 @@ namespace TBF.Rig.Output.FileWriters.Enhanced
FileNameFormat,
Separator,
EliminateSpaces,
SaveGoodOnly);
SaveGoodOnly,
NoSeparatorBetweenItems);
}
}
}
@@ -69,6 +69,7 @@ namespace TBF.Rig.Output.FileWriters.Enhanced
separatorLabel.Text = "Separator";
eliminateSpacesCheckBox.Text = "No spaces";
goodOnlyCheckBox.Text = "Good only";
noSeparatorCICheckBox.Text = "No separ. `Common i`";
headerButton.Text = Strings.Header;
commonItemsButton.Text = "Common items";
testItemsButton.Text = "Test items";
@@ -96,7 +97,8 @@ namespace TBF.Rig.Output.FileWriters.Enhanced
separatorComboBox.Text = config.Separator.ToString();
eliminateSpacesCheckBox.Checked = config.EliminateSpaces;
goodOnlyCheckBox.Checked = config.SaveGoodOnly;
}
noSeparatorCICheckBox.Checked = config.NoSeparatorBetweenItems;
}
public void Unlock()
{
@@ -118,6 +120,7 @@ namespace TBF.Rig.Output.FileWriters.Enhanced
commonItemsButton.Enabled = true;
testItemsButton.Enabled = true;
footerButton.Enabled = true;
noSeparatorCICheckBox.Enabled = true;
}
public CfgUpdateFlags VerifyCfg(ref string message)
@@ -255,6 +258,12 @@ namespace TBF.Rig.Output.FileWriters.Enhanced
config.SaveGoodOnly = goodOnlyCheckBox.Checked;
flags |= (CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
}
if (config.NoSeparatorBetweenItems != noSeparatorCICheckBox.Checked)
{
config.NoSeparatorBetweenItems = noSeparatorCICheckBox.Checked;
flags |= (CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
}
if (config.Header != header)
{
+447 -397
View File
@@ -25,409 +25,459 @@ namespace TBF.Rig.Output.FileWriters.Enhanced
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.nameTextBox = new System.Windows.Forms.TextBox();
this.nameLabel = new System.Windows.Forms.Label();
this.classNameLabel = new System.Windows.Forms.Label();
this.destinationTextBox = new System.Windows.Forms.TextBox();
this.destinationLabel = new System.Windows.Forms.Label();
this.destinationButton = new System.Windows.Forms.Button();
this.separatorLabel = new System.Windows.Forms.Label();
this.separatorComboBox = new System.Windows.Forms.ComboBox();
this.testItemsButton = new System.Windows.Forms.Button();
this.yearFoldersLabel = new System.Windows.Forms.Label();
this.monthFoldersLabel = new System.Windows.Forms.Label();
this.dayFoldersLabel = new System.Windows.Forms.Label();
this.yearFoldersComboBox = new System.Windows.Forms.ComboBox();
this.monthFoldersComboBox = new System.Windows.Forms.ComboBox();
this.dayFoldersComboBox = new System.Windows.Forms.ComboBox();
this.destination2Button = new System.Windows.Forms.Button();
this.destination2TextBox = new System.Windows.Forms.TextBox();
this.destination2Label = new System.Windows.Forms.Label();
this.fileNameFmtTextBox = new System.Windows.Forms.TextBox();
this.fileNameFmtLabel = new System.Windows.Forms.Label();
this.eliminateSpacesCheckBox = new System.Windows.Forms.CheckBox();
this.headerButton = new System.Windows.Forms.Button();
this.footerButton = new System.Windows.Forms.Button();
this.commonItemsButton = new System.Windows.Forms.Button();
this.upgradeWizardButton = new System.Windows.Forms.Button();
this.cultureComboBox = new System.Windows.Forms.ComboBox();
this.cultureLabel = new System.Windows.Forms.Label();
this.goodOnlyCheckBox = new System.Windows.Forms.CheckBox();
this.subtitleFmtTextBox = new System.Windows.Forms.TextBox();
this.subtitleFmtLabel = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// nameTextBox
//
this.nameTextBox.Enabled = false;
this.nameTextBox.Location = new System.Drawing.Point(108, 28);
this.nameTextBox.Name = "nameTextBox";
this.nameTextBox.Size = new System.Drawing.Size(146, 20);
this.nameTextBox.TabIndex = 2;
//
// nameLabel
//
this.nameLabel.AutoSize = true;
this.nameLabel.Location = new System.Drawing.Point(17, 31);
this.nameLabel.Name = "nameLabel";
this.nameLabel.Size = new System.Drawing.Size(35, 13);
this.nameLabel.TabIndex = 1;
this.nameLabel.Text = "Name";
//
// classNameLabel
//
this.classNameLabel.AutoSize = true;
this.classNameLabel.Location = new System.Drawing.Point(105, 6);
this.classNameLabel.Name = "classNameLabel";
this.classNameLabel.Size = new System.Drawing.Size(83, 13);
this.classNameLabel.TabIndex = 0;
this.classNameLabel.Text = "ComonentName";
//
// destinationTextBox
//
this.destinationTextBox.Enabled = false;
this.destinationTextBox.Location = new System.Drawing.Point(108, 49);
this.destinationTextBox.Name = "destinationTextBox";
this.destinationTextBox.Size = new System.Drawing.Size(146, 20);
this.destinationTextBox.TabIndex = 4;
//
// destinationLabel
//
this.destinationLabel.AutoSize = true;
this.destinationLabel.Location = new System.Drawing.Point(17, 52);
this.destinationLabel.Name = "destinationLabel";
this.destinationLabel.Size = new System.Drawing.Size(60, 13);
this.destinationLabel.TabIndex = 3;
this.destinationLabel.Text = "Destination";
//
// destinationButton
//
this.destinationButton.Enabled = false;
this.destinationButton.Location = new System.Drawing.Point(269, 49);
this.destinationButton.Name = "destinationButton";
this.destinationButton.Size = new System.Drawing.Size(30, 20);
this.destinationButton.TabIndex = 5;
this.destinationButton.Text = "...";
this.destinationButton.UseVisualStyleBackColor = true;
this.destinationButton.Click += new System.EventHandler(this.destinationButton_Click);
//
// separatorLabel
//
this.separatorLabel.AutoSize = true;
this.separatorLabel.Location = new System.Drawing.Point(17, 224);
this.separatorLabel.Name = "separatorLabel";
this.separatorLabel.Size = new System.Drawing.Size(53, 13);
this.separatorLabel.TabIndex = 19;
this.separatorLabel.Text = "Separator";
//
// separatorComboBox
//
this.separatorComboBox.Enabled = false;
this.separatorComboBox.FormattingEnabled = true;
this.separatorComboBox.Location = new System.Drawing.Point(108, 221);
this.separatorComboBox.Name = "separatorComboBox";
this.separatorComboBox.Size = new System.Drawing.Size(146, 21);
this.separatorComboBox.TabIndex = 20;
//
// testItemsButton
//
this.testItemsButton.Enabled = false;
this.testItemsButton.Location = new System.Drawing.Point(108, 296);
this.testItemsButton.Name = "testItemsButton";
this.testItemsButton.Size = new System.Drawing.Size(146, 23);
this.testItemsButton.TabIndex = 25;
this.testItemsButton.Text = "Test items";
this.testItemsButton.UseVisualStyleBackColor = true;
this.testItemsButton.Click += new System.EventHandler(this.testItemsButton_Click);
//
// yearFoldersLabel
//
this.yearFoldersLabel.AutoSize = true;
this.yearFoldersLabel.Location = new System.Drawing.Point(17, 94);
this.yearFoldersLabel.Name = "yearFoldersLabel";
this.yearFoldersLabel.Size = new System.Drawing.Size(63, 13);
this.yearFoldersLabel.TabIndex = 9;
this.yearFoldersLabel.Text = "Year folders";
//
// monthFoldersLabel
//
this.monthFoldersLabel.AutoSize = true;
this.monthFoldersLabel.Location = new System.Drawing.Point(17, 116);
this.monthFoldersLabel.Name = "monthFoldersLabel";
this.monthFoldersLabel.Size = new System.Drawing.Size(71, 13);
this.monthFoldersLabel.TabIndex = 11;
this.monthFoldersLabel.Text = "Month folders";
//
// dayFoldersLabel
//
this.dayFoldersLabel.AutoSize = true;
this.dayFoldersLabel.Location = new System.Drawing.Point(17, 138);
this.dayFoldersLabel.Name = "dayFoldersLabel";
this.dayFoldersLabel.Size = new System.Drawing.Size(60, 13);
this.dayFoldersLabel.TabIndex = 13;
this.dayFoldersLabel.Text = "Day folders";
//
// yearFoldersComboBox
//
this.yearFoldersComboBox.Enabled = false;
this.yearFoldersComboBox.FormattingEnabled = true;
this.yearFoldersComboBox.Location = new System.Drawing.Point(108, 91);
this.yearFoldersComboBox.Name = "yearFoldersComboBox";
this.yearFoldersComboBox.Size = new System.Drawing.Size(146, 21);
this.yearFoldersComboBox.TabIndex = 10;
//
// monthFoldersComboBox
//
this.monthFoldersComboBox.Enabled = false;
this.monthFoldersComboBox.FormattingEnabled = true;
this.monthFoldersComboBox.Location = new System.Drawing.Point(108, 113);
this.monthFoldersComboBox.Name = "monthFoldersComboBox";
this.monthFoldersComboBox.Size = new System.Drawing.Size(146, 21);
this.monthFoldersComboBox.TabIndex = 12;
//
// dayFoldersComboBox
//
this.dayFoldersComboBox.Enabled = false;
this.dayFoldersComboBox.FormattingEnabled = true;
this.dayFoldersComboBox.Location = new System.Drawing.Point(108, 135);
this.dayFoldersComboBox.Name = "dayFoldersComboBox";
this.dayFoldersComboBox.Size = new System.Drawing.Size(146, 21);
this.dayFoldersComboBox.TabIndex = 14;
//
// destination2Button
//
this.destination2Button.Enabled = false;
this.destination2Button.Location = new System.Drawing.Point(269, 70);
this.destination2Button.Name = "destination2Button";
this.destination2Button.Size = new System.Drawing.Size(30, 20);
this.destination2Button.TabIndex = 8;
this.destination2Button.Text = "...";
this.destination2Button.UseVisualStyleBackColor = true;
//
// destination2TextBox
//
this.destination2TextBox.Enabled = false;
this.destination2TextBox.Location = new System.Drawing.Point(108, 70);
this.destination2TextBox.Name = "destination2TextBox";
this.destination2TextBox.Size = new System.Drawing.Size(146, 20);
this.destination2TextBox.TabIndex = 7;
//
// destination2Label
//
this.destination2Label.AutoSize = true;
this.destination2Label.Location = new System.Drawing.Point(17, 73);
this.destination2Label.Name = "destination2Label";
this.destination2Label.Size = new System.Drawing.Size(69, 13);
this.destination2Label.TabIndex = 6;
this.destination2Label.Text = "Destination 2";
//
// fileNameFmtTextBox
//
this.fileNameFmtTextBox.Enabled = false;
this.fileNameFmtTextBox.Location = new System.Drawing.Point(108, 157);
this.fileNameFmtTextBox.Name = "fileNameFmtTextBox";
this.fileNameFmtTextBox.Size = new System.Drawing.Size(146, 20);
this.fileNameFmtTextBox.TabIndex = 16;
//
// fileNameFmtLabel
//
this.fileNameFmtLabel.AutoSize = true;
this.fileNameFmtLabel.Location = new System.Drawing.Point(17, 160);
this.fileNameFmtLabel.Name = "fileNameFmtLabel";
this.fileNameFmtLabel.Size = new System.Drawing.Size(84, 13);
this.fileNameFmtLabel.TabIndex = 15;
this.fileNameFmtLabel.Text = "File name format";
//
// eliminateSpacesCheckBox
//
this.eliminateSpacesCheckBox.AutoSize = true;
this.eliminateSpacesCheckBox.Location = new System.Drawing.Point(20, 262);
this.eliminateSpacesCheckBox.Name = "eliminateSpacesCheckBox";
this.eliminateSpacesCheckBox.Size = new System.Drawing.Size(77, 17);
this.eliminateSpacesCheckBox.TabIndex = 21;
this.eliminateSpacesCheckBox.Text = "No spaces";
this.eliminateSpacesCheckBox.UseVisualStyleBackColor = true;
//
// headerButton
//
this.headerButton.Enabled = false;
this.headerButton.Location = new System.Drawing.Point(108, 246);
this.headerButton.Name = "headerButton";
this.headerButton.Size = new System.Drawing.Size(146, 23);
this.headerButton.TabIndex = 23;
this.headerButton.Text = "Header";
this.headerButton.UseVisualStyleBackColor = true;
this.headerButton.Click += new System.EventHandler(this.headerButton_Click);
//
// footerButton
//
this.footerButton.Enabled = false;
this.footerButton.Location = new System.Drawing.Point(108, 321);
this.footerButton.Name = "footerButton";
this.footerButton.Size = new System.Drawing.Size(146, 23);
this.footerButton.TabIndex = 26;
this.footerButton.Text = "Footer";
this.footerButton.UseVisualStyleBackColor = true;
this.footerButton.Click += new System.EventHandler(this.footerButton_Click);
//
// commonItemsButton
//
this.commonItemsButton.Enabled = false;
this.commonItemsButton.Location = new System.Drawing.Point(108, 271);
this.commonItemsButton.Name = "commonItemsButton";
this.commonItemsButton.Size = new System.Drawing.Size(146, 23);
this.commonItemsButton.TabIndex = 24;
this.commonItemsButton.Text = "Common items";
this.commonItemsButton.UseVisualStyleBackColor = true;
this.commonItemsButton.Click += new System.EventHandler(this.commonItemsButton_Click);
//
// upgradeWizardButton
//
this.upgradeWizardButton.Location = new System.Drawing.Point(269, 271);
this.upgradeWizardButton.Name = "upgradeWizardButton";
this.upgradeWizardButton.Size = new System.Drawing.Size(80, 48);
this.upgradeWizardButton.TabIndex = 27;
this.upgradeWizardButton.Text = "Upgrade wizard";
this.upgradeWizardButton.UseVisualStyleBackColor = true;
this.upgradeWizardButton.Click += new System.EventHandler(this.upgradeWizardButton_Click);
//
// cultureComboBox
//
this.cultureComboBox.Enabled = false;
this.cultureComboBox.FormattingEnabled = true;
this.cultureComboBox.Location = new System.Drawing.Point(108, 178);
this.cultureComboBox.Name = "cultureComboBox";
this.cultureComboBox.Size = new System.Drawing.Size(146, 21);
this.cultureComboBox.TabIndex = 18;
//
// cultureLabel
//
this.cultureLabel.AutoSize = true;
this.cultureLabel.Location = new System.Drawing.Point(17, 181);
this.cultureLabel.Name = "cultureLabel";
this.cultureLabel.Size = new System.Drawing.Size(42, 13);
this.cultureLabel.TabIndex = 17;
this.cultureLabel.Text = "Cullture";
//
// goodOnlyCheckBox
//
this.goodOnlyCheckBox.AutoSize = true;
this.goodOnlyCheckBox.Location = new System.Drawing.Point(20, 285);
this.goodOnlyCheckBox.Name = "goodOnlyCheckBox";
this.goodOnlyCheckBox.Size = new System.Drawing.Size(74, 17);
this.goodOnlyCheckBox.TabIndex = 22;
this.goodOnlyCheckBox.Text = "Good only";
this.goodOnlyCheckBox.UseVisualStyleBackColor = true;
//
// subtitleFmtTextBox
//
this.subtitleFmtTextBox.Enabled = false;
this.subtitleFmtTextBox.Location = new System.Drawing.Point(108, 200);
this.subtitleFmtTextBox.Name = "subtitleFmtTextBox";
this.subtitleFmtTextBox.Size = new System.Drawing.Size(146, 20);
this.subtitleFmtTextBox.TabIndex = 29;
//
// subtitleFmtLabel
//
this.subtitleFmtLabel.AutoSize = true;
this.subtitleFmtLabel.Location = new System.Drawing.Point(17, 203);
this.subtitleFmtLabel.Name = "subtitleFmtLabel";
this.subtitleFmtLabel.Size = new System.Drawing.Size(74, 13);
this.subtitleFmtLabel.TabIndex = 28;
this.subtitleFmtLabel.Text = "Subtitle format";
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(257, 211);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(174, 13);
this.label1.TabIndex = 30;
this.label1.Text = "4:wmStr 5:s/n 6:main s/n 7:aux.s/n";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(257, 198);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(168, 13);
this.label2.TabIndex = 31;
this.label2.Text = "0:pos 1:s/n 2:aux.s/n 3:compl.s/n";
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(257, 155);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(138, 13);
this.label3.TabIndex = 32;
this.label3.Text = "0:end t. 1:start t. 2:batch nr.";
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(257, 168);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(128, 13);
this.label4.TabIndex = 33;
this.label4.Text = "3:bench name 4:bench id";
//
// WriterCfgCtrl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.label4);
this.Controls.Add(this.label3);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Controls.Add(this.subtitleFmtTextBox);
this.Controls.Add(this.subtitleFmtLabel);
this.Controls.Add(this.goodOnlyCheckBox);
this.Controls.Add(this.cultureComboBox);
this.Controls.Add(this.cultureLabel);
this.Controls.Add(this.upgradeWizardButton);
this.Controls.Add(this.commonItemsButton);
this.Controls.Add(this.footerButton);
this.Controls.Add(this.headerButton);
this.Controls.Add(this.eliminateSpacesCheckBox);
this.Controls.Add(this.fileNameFmtTextBox);
this.Controls.Add(this.fileNameFmtLabel);
this.Controls.Add(this.destination2Button);
this.Controls.Add(this.destination2TextBox);
this.Controls.Add(this.destination2Label);
this.Controls.Add(this.dayFoldersComboBox);
this.Controls.Add(this.monthFoldersComboBox);
this.Controls.Add(this.yearFoldersComboBox);
this.Controls.Add(this.dayFoldersLabel);
this.Controls.Add(this.monthFoldersLabel);
this.Controls.Add(this.yearFoldersLabel);
this.Controls.Add(this.testItemsButton);
this.Controls.Add(this.separatorComboBox);
this.Controls.Add(this.separatorLabel);
this.Controls.Add(this.destinationButton);
this.Controls.Add(this.destinationTextBox);
this.Controls.Add(this.destinationLabel);
this.Controls.Add(this.nameTextBox);
this.Controls.Add(this.nameLabel);
this.Controls.Add(this.classNameLabel);
this.Name = "WriterCfgCtrl";
this.Size = new System.Drawing.Size(440, 350);
this.Load += new System.EventHandler(this.WriterCfgCtrl_Load);
this.ResumeLayout(false);
this.PerformLayout();
this.nameTextBox = new System.Windows.Forms.TextBox();
this.nameLabel = new System.Windows.Forms.Label();
this.classNameLabel = new System.Windows.Forms.Label();
this.destinationTextBox = new System.Windows.Forms.TextBox();
this.destinationLabel = new System.Windows.Forms.Label();
this.destinationButton = new System.Windows.Forms.Button();
this.separatorLabel = new System.Windows.Forms.Label();
this.separatorComboBox = new System.Windows.Forms.ComboBox();
this.testItemsButton = new System.Windows.Forms.Button();
this.yearFoldersLabel = new System.Windows.Forms.Label();
this.monthFoldersLabel = new System.Windows.Forms.Label();
this.dayFoldersLabel = new System.Windows.Forms.Label();
this.yearFoldersComboBox = new System.Windows.Forms.ComboBox();
this.monthFoldersComboBox = new System.Windows.Forms.ComboBox();
this.dayFoldersComboBox = new System.Windows.Forms.ComboBox();
this.destination2Button = new System.Windows.Forms.Button();
this.destination2TextBox = new System.Windows.Forms.TextBox();
this.destination2Label = new System.Windows.Forms.Label();
this.fileNameFmtTextBox = new System.Windows.Forms.TextBox();
this.fileNameFmtLabel = new System.Windows.Forms.Label();
this.eliminateSpacesCheckBox = new System.Windows.Forms.CheckBox();
this.headerButton = new System.Windows.Forms.Button();
this.footerButton = new System.Windows.Forms.Button();
this.commonItemsButton = new System.Windows.Forms.Button();
this.upgradeWizardButton = new System.Windows.Forms.Button();
this.cultureComboBox = new System.Windows.Forms.ComboBox();
this.cultureLabel = new System.Windows.Forms.Label();
this.goodOnlyCheckBox = new System.Windows.Forms.CheckBox();
this.subtitleFmtTextBox = new System.Windows.Forms.TextBox();
this.subtitleFmtLabel = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.noSeparatorCICheckBox = new System.Windows.Forms.CheckBox();
this.SuspendLayout();
//
// nameTextBox
//
this.nameTextBox.Enabled = false;
this.nameTextBox.Location = new System.Drawing.Point(162, 43);
this.nameTextBox.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.nameTextBox.Name = "nameTextBox";
this.nameTextBox.Size = new System.Drawing.Size(217, 26);
this.nameTextBox.TabIndex = 2;
//
// nameLabel
//
this.nameLabel.AutoSize = true;
this.nameLabel.Location = new System.Drawing.Point(26, 48);
this.nameLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.nameLabel.Name = "nameLabel";
this.nameLabel.Size = new System.Drawing.Size(51, 20);
this.nameLabel.TabIndex = 1;
this.nameLabel.Text = "Name";
//
// classNameLabel
//
this.classNameLabel.AutoSize = true;
this.classNameLabel.Location = new System.Drawing.Point(158, 9);
this.classNameLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.classNameLabel.Name = "classNameLabel";
this.classNameLabel.Size = new System.Drawing.Size(125, 20);
this.classNameLabel.TabIndex = 0;
this.classNameLabel.Text = "ComonentName";
//
// destinationTextBox
//
this.destinationTextBox.Enabled = false;
this.destinationTextBox.Location = new System.Drawing.Point(162, 75);
this.destinationTextBox.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.destinationTextBox.Name = "destinationTextBox";
this.destinationTextBox.Size = new System.Drawing.Size(217, 26);
this.destinationTextBox.TabIndex = 4;
//
// destinationLabel
//
this.destinationLabel.AutoSize = true;
this.destinationLabel.Location = new System.Drawing.Point(26, 80);
this.destinationLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.destinationLabel.Name = "destinationLabel";
this.destinationLabel.Size = new System.Drawing.Size(90, 20);
this.destinationLabel.TabIndex = 3;
this.destinationLabel.Text = "Destination";
//
// destinationButton
//
this.destinationButton.Enabled = false;
this.destinationButton.Location = new System.Drawing.Point(404, 75);
this.destinationButton.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.destinationButton.Name = "destinationButton";
this.destinationButton.Size = new System.Drawing.Size(45, 31);
this.destinationButton.TabIndex = 5;
this.destinationButton.Text = "...";
this.destinationButton.UseVisualStyleBackColor = true;
this.destinationButton.Click += new System.EventHandler(this.destinationButton_Click);
//
// separatorLabel
//
this.separatorLabel.AutoSize = true;
this.separatorLabel.Location = new System.Drawing.Point(26, 345);
this.separatorLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.separatorLabel.Name = "separatorLabel";
this.separatorLabel.Size = new System.Drawing.Size(80, 20);
this.separatorLabel.TabIndex = 19;
this.separatorLabel.Text = "Separator";
//
// separatorComboBox
//
this.separatorComboBox.Enabled = false;
this.separatorComboBox.FormattingEnabled = true;
this.separatorComboBox.Location = new System.Drawing.Point(162, 340);
this.separatorComboBox.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.separatorComboBox.Name = "separatorComboBox";
this.separatorComboBox.Size = new System.Drawing.Size(217, 28);
this.separatorComboBox.TabIndex = 20;
//
// testItemsButton
//
this.testItemsButton.Enabled = false;
this.testItemsButton.Location = new System.Drawing.Point(162, 455);
this.testItemsButton.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.testItemsButton.Name = "testItemsButton";
this.testItemsButton.Size = new System.Drawing.Size(219, 35);
this.testItemsButton.TabIndex = 25;
this.testItemsButton.Text = "Test items";
this.testItemsButton.UseVisualStyleBackColor = true;
this.testItemsButton.Click += new System.EventHandler(this.testItemsButton_Click);
//
// yearFoldersLabel
//
this.yearFoldersLabel.AutoSize = true;
this.yearFoldersLabel.Location = new System.Drawing.Point(26, 145);
this.yearFoldersLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.yearFoldersLabel.Name = "yearFoldersLabel";
this.yearFoldersLabel.Size = new System.Drawing.Size(95, 20);
this.yearFoldersLabel.TabIndex = 9;
this.yearFoldersLabel.Text = "Year folders";
//
// monthFoldersLabel
//
this.monthFoldersLabel.AutoSize = true;
this.monthFoldersLabel.Location = new System.Drawing.Point(26, 178);
this.monthFoldersLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.monthFoldersLabel.Name = "monthFoldersLabel";
this.monthFoldersLabel.Size = new System.Drawing.Size(106, 20);
this.monthFoldersLabel.TabIndex = 11;
this.monthFoldersLabel.Text = "Month folders";
//
// dayFoldersLabel
//
this.dayFoldersLabel.AutoSize = true;
this.dayFoldersLabel.Location = new System.Drawing.Point(26, 212);
this.dayFoldersLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.dayFoldersLabel.Name = "dayFoldersLabel";
this.dayFoldersLabel.Size = new System.Drawing.Size(89, 20);
this.dayFoldersLabel.TabIndex = 13;
this.dayFoldersLabel.Text = "Day folders";
//
// yearFoldersComboBox
//
this.yearFoldersComboBox.Enabled = false;
this.yearFoldersComboBox.FormattingEnabled = true;
this.yearFoldersComboBox.Location = new System.Drawing.Point(162, 140);
this.yearFoldersComboBox.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.yearFoldersComboBox.Name = "yearFoldersComboBox";
this.yearFoldersComboBox.Size = new System.Drawing.Size(217, 28);
this.yearFoldersComboBox.TabIndex = 10;
//
// monthFoldersComboBox
//
this.monthFoldersComboBox.Enabled = false;
this.monthFoldersComboBox.FormattingEnabled = true;
this.monthFoldersComboBox.Location = new System.Drawing.Point(162, 174);
this.monthFoldersComboBox.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.monthFoldersComboBox.Name = "monthFoldersComboBox";
this.monthFoldersComboBox.Size = new System.Drawing.Size(217, 28);
this.monthFoldersComboBox.TabIndex = 12;
//
// dayFoldersComboBox
//
this.dayFoldersComboBox.Enabled = false;
this.dayFoldersComboBox.FormattingEnabled = true;
this.dayFoldersComboBox.Location = new System.Drawing.Point(162, 208);
this.dayFoldersComboBox.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.dayFoldersComboBox.Name = "dayFoldersComboBox";
this.dayFoldersComboBox.Size = new System.Drawing.Size(217, 28);
this.dayFoldersComboBox.TabIndex = 14;
//
// destination2Button
//
this.destination2Button.Enabled = false;
this.destination2Button.Location = new System.Drawing.Point(404, 108);
this.destination2Button.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.destination2Button.Name = "destination2Button";
this.destination2Button.Size = new System.Drawing.Size(45, 31);
this.destination2Button.TabIndex = 8;
this.destination2Button.Text = "...";
this.destination2Button.UseVisualStyleBackColor = true;
//
// destination2TextBox
//
this.destination2TextBox.Enabled = false;
this.destination2TextBox.Location = new System.Drawing.Point(162, 108);
this.destination2TextBox.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.destination2TextBox.Name = "destination2TextBox";
this.destination2TextBox.Size = new System.Drawing.Size(217, 26);
this.destination2TextBox.TabIndex = 7;
//
// destination2Label
//
this.destination2Label.AutoSize = true;
this.destination2Label.Location = new System.Drawing.Point(26, 112);
this.destination2Label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.destination2Label.Name = "destination2Label";
this.destination2Label.Size = new System.Drawing.Size(103, 20);
this.destination2Label.TabIndex = 6;
this.destination2Label.Text = "Destination 2";
//
// fileNameFmtTextBox
//
this.fileNameFmtTextBox.Enabled = false;
this.fileNameFmtTextBox.Location = new System.Drawing.Point(162, 242);
this.fileNameFmtTextBox.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.fileNameFmtTextBox.Name = "fileNameFmtTextBox";
this.fileNameFmtTextBox.Size = new System.Drawing.Size(217, 26);
this.fileNameFmtTextBox.TabIndex = 16;
//
// fileNameFmtLabel
//
this.fileNameFmtLabel.AutoSize = true;
this.fileNameFmtLabel.Location = new System.Drawing.Point(26, 246);
this.fileNameFmtLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.fileNameFmtLabel.Name = "fileNameFmtLabel";
this.fileNameFmtLabel.Size = new System.Drawing.Size(128, 20);
this.fileNameFmtLabel.TabIndex = 15;
this.fileNameFmtLabel.Text = "File name format";
//
// eliminateSpacesCheckBox
//
this.eliminateSpacesCheckBox.AutoSize = true;
this.eliminateSpacesCheckBox.Enabled = false;
this.eliminateSpacesCheckBox.Location = new System.Drawing.Point(30, 403);
this.eliminateSpacesCheckBox.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.eliminateSpacesCheckBox.Name = "eliminateSpacesCheckBox";
this.eliminateSpacesCheckBox.Size = new System.Drawing.Size(110, 24);
this.eliminateSpacesCheckBox.TabIndex = 21;
this.eliminateSpacesCheckBox.Text = "No spaces";
this.eliminateSpacesCheckBox.UseVisualStyleBackColor = true;
//
// headerButton
//
this.headerButton.Enabled = false;
this.headerButton.Location = new System.Drawing.Point(162, 378);
this.headerButton.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.headerButton.Name = "headerButton";
this.headerButton.Size = new System.Drawing.Size(219, 35);
this.headerButton.TabIndex = 23;
this.headerButton.Text = "Header";
this.headerButton.UseVisualStyleBackColor = true;
this.headerButton.Click += new System.EventHandler(this.headerButton_Click);
//
// footerButton
//
this.footerButton.Enabled = false;
this.footerButton.Location = new System.Drawing.Point(162, 494);
this.footerButton.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.footerButton.Name = "footerButton";
this.footerButton.Size = new System.Drawing.Size(219, 35);
this.footerButton.TabIndex = 26;
this.footerButton.Text = "Footer";
this.footerButton.UseVisualStyleBackColor = true;
this.footerButton.Click += new System.EventHandler(this.footerButton_Click);
//
// commonItemsButton
//
this.commonItemsButton.Enabled = false;
this.commonItemsButton.Location = new System.Drawing.Point(162, 417);
this.commonItemsButton.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.commonItemsButton.Name = "commonItemsButton";
this.commonItemsButton.Size = new System.Drawing.Size(219, 35);
this.commonItemsButton.TabIndex = 24;
this.commonItemsButton.Text = "Common items";
this.commonItemsButton.UseVisualStyleBackColor = true;
this.commonItemsButton.Click += new System.EventHandler(this.commonItemsButton_Click);
//
// upgradeWizardButton
//
this.upgradeWizardButton.Location = new System.Drawing.Point(404, 417);
this.upgradeWizardButton.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.upgradeWizardButton.Name = "upgradeWizardButton";
this.upgradeWizardButton.Size = new System.Drawing.Size(120, 74);
this.upgradeWizardButton.TabIndex = 27;
this.upgradeWizardButton.Text = "Upgrade wizard";
this.upgradeWizardButton.UseVisualStyleBackColor = true;
this.upgradeWizardButton.Click += new System.EventHandler(this.upgradeWizardButton_Click);
//
// cultureComboBox
//
this.cultureComboBox.Enabled = false;
this.cultureComboBox.FormattingEnabled = true;
this.cultureComboBox.Location = new System.Drawing.Point(162, 274);
this.cultureComboBox.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.cultureComboBox.Name = "cultureComboBox";
this.cultureComboBox.Size = new System.Drawing.Size(217, 28);
this.cultureComboBox.TabIndex = 18;
//
// cultureLabel
//
this.cultureLabel.AutoSize = true;
this.cultureLabel.Location = new System.Drawing.Point(26, 278);
this.cultureLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.cultureLabel.Name = "cultureLabel";
this.cultureLabel.Size = new System.Drawing.Size(63, 20);
this.cultureLabel.TabIndex = 17;
this.cultureLabel.Text = "Cullture";
//
// goodOnlyCheckBox
//
this.goodOnlyCheckBox.AutoSize = true;
this.goodOnlyCheckBox.Enabled = false;
this.goodOnlyCheckBox.Location = new System.Drawing.Point(30, 438);
this.goodOnlyCheckBox.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.goodOnlyCheckBox.Name = "goodOnlyCheckBox";
this.goodOnlyCheckBox.Size = new System.Drawing.Size(107, 24);
this.goodOnlyCheckBox.TabIndex = 22;
this.goodOnlyCheckBox.Text = "Good only";
this.goodOnlyCheckBox.UseVisualStyleBackColor = false;
//
// subtitleFmtTextBox
//
this.subtitleFmtTextBox.Enabled = false;
this.subtitleFmtTextBox.Location = new System.Drawing.Point(162, 308);
this.subtitleFmtTextBox.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.subtitleFmtTextBox.Name = "subtitleFmtTextBox";
this.subtitleFmtTextBox.Size = new System.Drawing.Size(217, 26);
this.subtitleFmtTextBox.TabIndex = 29;
//
// subtitleFmtLabel
//
this.subtitleFmtLabel.AutoSize = true;
this.subtitleFmtLabel.Location = new System.Drawing.Point(26, 312);
this.subtitleFmtLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.subtitleFmtLabel.Name = "subtitleFmtLabel";
this.subtitleFmtLabel.Size = new System.Drawing.Size(113, 20);
this.subtitleFmtLabel.TabIndex = 28;
this.subtitleFmtLabel.Text = "Subtitle format";
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(386, 325);
this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(248, 20);
this.label1.TabIndex = 30;
this.label1.Text = "4:wmStr 5:s/n 6:main s/n 7:aux.s/n";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(386, 305);
this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(237, 20);
this.label2.TabIndex = 31;
this.label2.Text = "0:pos 1:s/n 2:aux.s/n 3:compl.s/n";
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(386, 238);
this.label3.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(203, 20);
this.label3.TabIndex = 32;
this.label3.Text = "0:end t. 1:start t. 2:batch nr.";
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(386, 258);
this.label4.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(239, 20);
this.label4.TabIndex = 33;
this.label4.Text = "3:bench name 4:bench id, 5:Now";
//
// noSeparatorCICheckBox
//
this.noSeparatorCICheckBox.Enabled = false;
this.noSeparatorCICheckBox.Location = new System.Drawing.Point(30, 470);
this.noSeparatorCICheckBox.Name = "noSeparatorCICheckBox";
this.noSeparatorCICheckBox.Size = new System.Drawing.Size(125, 59);
this.noSeparatorCICheckBox.TabIndex = 34;
this.noSeparatorCICheckBox.Text = "No separ. \"Common i.\"";
this.noSeparatorCICheckBox.UseVisualStyleBackColor = true;
//
// WriterCfgCtrl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.noSeparatorCICheckBox);
this.Controls.Add(this.label4);
this.Controls.Add(this.label3);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Controls.Add(this.subtitleFmtTextBox);
this.Controls.Add(this.subtitleFmtLabel);
this.Controls.Add(this.goodOnlyCheckBox);
this.Controls.Add(this.cultureComboBox);
this.Controls.Add(this.cultureLabel);
this.Controls.Add(this.upgradeWizardButton);
this.Controls.Add(this.commonItemsButton);
this.Controls.Add(this.footerButton);
this.Controls.Add(this.headerButton);
this.Controls.Add(this.eliminateSpacesCheckBox);
this.Controls.Add(this.fileNameFmtTextBox);
this.Controls.Add(this.fileNameFmtLabel);
this.Controls.Add(this.destination2Button);
this.Controls.Add(this.destination2TextBox);
this.Controls.Add(this.destination2Label);
this.Controls.Add(this.dayFoldersComboBox);
this.Controls.Add(this.monthFoldersComboBox);
this.Controls.Add(this.yearFoldersComboBox);
this.Controls.Add(this.dayFoldersLabel);
this.Controls.Add(this.monthFoldersLabel);
this.Controls.Add(this.yearFoldersLabel);
this.Controls.Add(this.testItemsButton);
this.Controls.Add(this.separatorComboBox);
this.Controls.Add(this.separatorLabel);
this.Controls.Add(this.destinationButton);
this.Controls.Add(this.destinationTextBox);
this.Controls.Add(this.destinationLabel);
this.Controls.Add(this.nameTextBox);
this.Controls.Add(this.nameLabel);
this.Controls.Add(this.classNameLabel);
this.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.Name = "WriterCfgCtrl";
this.Size = new System.Drawing.Size(660, 538);
this.Load += new System.EventHandler(this.WriterCfgCtrl_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
private System.Windows.Forms.CheckBox noSeparatorCICheckBox;
#endregion
private System.Windows.Forms.TextBox nameTextBox;
+1 -1
View File
@@ -539,7 +539,7 @@ namespace TBF.Rig.Sequences
AmbTemp, /// ambient temperature in degree C
AmbHumi, /// ambient humidity in R%
AmbPress, /// ambient pressure in mbar (= 1 hPa)
outPath.RegValve?.Position.ToString("F1")); /// regulation valve position in % (0=closed / 100=open)
outPath.RegValve.Position.ToString("F1")); /// regulation valve position in % (0=closed / 100=open)
}
public void LogProcessDataHeaderHeatMeters(ILog logger, string sectionName)
+6 -8
View File
@@ -1505,25 +1505,23 @@ namespace TBF.Rig.Sequences
tstRslt.DensityLine = Formulas.RealDensity();
tstRslt.DensityDiv = Formulas.RealDensity();
double flowMeterLtrPerPulse = outPath.FlowMeter?.LtrPerPulse ?? 1;
tstRslt.MethodClass = TbfComponents.FindComponent(test.Method).ClassName;
tstRslt.StartTime = DateTime.Now;
tstRslt.EndTime = DateTime.Now + new TimeSpan(0, 0, 1);
tstRslt.FlowSetTime = 10;
tstRslt.TestTime = tstRslt.TargetTime();
tstRslt.PulsesMaster = (flowMeterLtrPerPulse > 1E-6) ? (1.0075 * tstRslt.TargetVolume() / flowMeterLtrPerPulse) : 1;
tstRslt.PulsesMaster = (outPath.FlowMeter.LtrPerPulse > 1E-6) ? (1.0075 * tstRslt.TargetVolume() / outPath.FlowMeter.LtrPerPulse) : 1;
tstRslt.MassStartRaw = 0;
tstRslt.MassStart = MeasurementCorrection.CorrectedValue(tstRslt.MassStartRaw, outPath.Scale.Corrections);
tstRslt.MassEndRaw = tstRslt.TargetVolume() * Formulas.RealDensity() / 1000.0f;
tstRslt.MassEnd = MeasurementCorrection.CorrectedValue(tstRslt.MassEndRaw, outPath.Scale.Corrections);
tstRslt.Flow = 3.6 * flowMeterLtrPerPulse * tstRslt.PulsesMaster / tstRslt.TestTime;
tstRslt.Flow = 3.6 * outPath.FlowMeter.LtrPerPulse * tstRslt.PulsesMaster / tstRslt.TestTime;
tstRslt.MassOfEvapWater = 0;
tstRslt.VolumeCTV = 1000 * tstRslt.Batch.Buoyancy * (tstRslt.MassEnd - tstRslt.MassStart) / tstRslt.DensityLine; /// [l] commercially true volume
tstRslt.VolumeMaster = flowMeterLtrPerPulse * tstRslt.PulsesMaster; /// [l] volume from the master flow meter
tstRslt.ConstMasterRaw = flowMeterLtrPerPulse; /// Uncorrected master flowmeter coefficient
tstRslt.ConstMasterCorr = outPath.FlowMeter?.LtrPerPulseCorrected(tstRslt.Flow, tstRslt.TempDownMean) ?? 1; /// Corrected master pulses per liter
tstRslt.ConstMaster = (tstRslt.VolumeMaster == 0) ? tstRslt.ConstMasterCorr : (flowMeterLtrPerPulse * tstRslt.VolumeCTV / tstRslt.VolumeMaster);
tstRslt.VolumeMaster = outPath.FlowMeter.LtrPerPulse * tstRslt.PulsesMaster; /// [l] volume from the master flow meter
tstRslt.ConstMasterRaw = outPath.FlowMeter.LtrPerPulse; /// Uncorrected master flowmeter coefficient
tstRslt.ConstMasterCorr = outPath.FlowMeter.LtrPerPulseCorrected(tstRslt.Flow, tstRslt.TempDownMean); /// Corrected master pulses per liter
tstRslt.ConstMaster = (tstRslt.VolumeMaster == 0) ? tstRslt.ConstMasterCorr : (outPath.FlowMeter.LtrPerPulse * tstRslt.VolumeCTV / tstRslt.VolumeMaster);
tstRslt.ErrorMaster = Formulas.ErrorFromVolumes(tstRslt.VolumeMaster, tstRslt.VolumeCTV);
-3
View File
@@ -76,14 +76,11 @@ namespace TBF.Rig
new Modbus.WaterAnalyzer.Factory(),
new Network.Adapter.Factory(),
new Network.AdapterFTP.Factory(),
new Network.AdapterJMS.Factory(),
new Network.Camera.CJMS11.Factory(),
new Network.Camera.CLP1611.Factory(),
new Network.Camera.KeyenceIV3G120.Factory(),
new Network.Camera.Display.Factory(),
new Network.Camera.Roi.Factory(),
new Network.Camera.RoiForFixedStart.Factory(),
new Network.Camera.RoiForFixedStartCJMS11.Factory(),
new Network.Camera.RoiForFixedStartKeyence.Factory(),
new Network.Comet.Ambient.Factory(),
new Network.RestAPI.Factory(),
@@ -123,11 +123,6 @@ namespace TBF.Rig.TestMethods.LeakTest
Bridge.OnActivity(this, Strings.Setting_the_water_pressure);
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Progress.FlowSetting));
//------------------------------------------------
//TODO BUMI - check this possition for sstart logging - when finish remove this comment
//--- log start process in this section
LogProcessDataTestInfo(processDataLogger, test.Procedure.Name, test.Name);
float pumpPower = test.PumpPower;
int startTime = StateMachine.Time;
@@ -219,14 +214,10 @@ namespace TBF.Rig.TestMethods.LeakTest
Bridge.OnActivity(this, Strings.Test_in_progress);
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Progress.Test));
//------------------------------------------------
LogProcessDataHeader(processDataLogger, "Maximum water pressure set");
State.Create(string.Format("{0}({1}) : Maximum water pressure set", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(new Operations.TimerOp(testParams.DurationPMax))
.AddOperation(processDataLoggingOp)
.EnterState();
do {
e = StateMachine.WaitRunDevsRunOps();
@@ -255,14 +246,10 @@ namespace TBF.Rig.TestMethods.LeakTest
//-----------------------------------------------------
Bridge.OnActivity(this, Strings.Measuring_the_weight);
//-----------------------------------------------------
LogProcessDataHeader(processDataLogger, "Measuring the start mass");
State.Create(string.Format("{0}({1}) : Measuring the start mass", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(scale.ReadStableMassOp(ref StartMass, test.TimeFlow2Mass, test.MassMethod, test.MassRepeats, test.MassSpread))
.AddOperation(processDataLoggingOp)
.EnterState();
do {
e = StateMachine.WaitRunDevsRunOps();
@@ -288,14 +275,10 @@ namespace TBF.Rig.TestMethods.LeakTest
///------------------------------------------------
Bridge.OnActivity(this, Strings.Test_in_progress);
///------------------------------------------------
LogProcessDataHeader(processDataLogger, "Starting the test");
State.Create(string.Format("{0}({1}) : Starting the test", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(new Operations.TimerOp(testParams.DurationLeak))
.AddOperation(processDataLoggingOp)
.EnterState();
do {
e = StateMachine.WaitRunDevsRunOps();
@@ -322,14 +305,10 @@ namespace TBF.Rig.TestMethods.LeakTest
//-----------------------------------------------------
Bridge.OnActivity(this, Strings.Measuring_the_weight);
//-----------------------------------------------------
LogProcessDataHeader(processDataLogger, " Measuring the end mass");
State.Create(string.Format("{0}({1}) : Measuring the end mass", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(scale.ReadStableMassOp(ref EndMass, test.TimeStop2Mass, test.MassMethod, test.MassRepeats, test.MassSpread))
.AddOperation(processDataLoggingOp)
.EnterState();
do {
e = StateMachine.WaitRunDevsRunOps();
+2 -14
View File
@@ -110,7 +110,7 @@ namespace TBF.Rig.TestMethods.PMaxTest
Bridge.OnActivity(this, Strings.Setting_the_water_pressure);
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Progress.FlowSetting));
//------------------------------------------------
float pumpPower = test.PumpPower;
while (true)
{
@@ -174,26 +174,15 @@ namespace TBF.Rig.TestMethods.PMaxTest
int startTime = StateMachine.Time;
int endTime = startTime + testParams.DurationPMax;
//TODO BUMI - check this possition for sstart logging - when finish remove this comment
//--- log start process in this section
LogProcessDataTestInfo(processDataLogger, test.Procedure.Name, test.Name);
//------------------------------------------------
Bridge.OnActivity(this, Strings.Test_in_progress);
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Progress.Test));
//------------------------------------------------
//TODO BUMI - check if is ok possition to start logging - at last remove comment
//--- log start process in this section
LogProcessDataHeader(processDataLogger, "Starting the test");
State.Create(string.Format("{0}({1}) : Starting the test", test.Method, test.Name))
.AddOperation(checkUiOp)
.AddOperations(readTempPressOps)
.AddOperation(new Operations.TimerOp(testParams.DurationPMax))
.AddOperation(processDataLoggingOp)
.EnterState();
do {
e = StateMachine.WaitRunDevsRunOps();
@@ -210,8 +199,7 @@ namespace TBF.Rig.TestMethods.PMaxTest
Bridge.OnActivity(this, string.Format("{0} ... {1} s", Strings.Test_in_progress, remainingTime));
}
while (e.Contains(Event.TimerBusy));
///
/// PMaxTest completed
///
@@ -513,8 +513,6 @@ namespace TBF.Rig.TestMethods.StandingStart
(rr as Rig.Network.Camera.RoiForFixedStart.Roi).BeginWMState = dataEntryCmpnt.WMStartState(i);
if (rr is Rig.Network.Camera.RoiForFixedStartKeyence.Roi)
(rr as Rig.Network.Camera.RoiForFixedStartKeyence.Roi).BeginWMState = dataEntryCmpnt.WMStartState(i);
if (rr is Rig.Network.Camera.RoiForFixedStartCJMS11.Roi)
(rr as Rig.Network.Camera.RoiForFixedStartCJMS11.Roi).BeginWMState = dataEntryCmpnt.WMStartState(i);
}
}
@@ -756,15 +754,6 @@ namespace TBF.Rig.TestMethods.StandingStart
if (rr is Rig.Network.Camera.RoiForFixedStart.Roi)
(rr as Rig.Network.Camera.RoiForFixedStart.Roi).EndWMState = dataEntryCmpnt.WMEndState(i);
if (rr is Rig.Network.Camera.RoiForFixedStartKeyence.Roi)
{
(rr as Rig.Network.Camera.RoiForFixedStartKeyence.Roi).EndWMState =
dataEntryCmpnt.WMEndState(i);
log.DebugFormat(" StandingStartMassCollectionSeq.cs - EndWMState [{0}] -> RoiForFixedStartKeyence.Roi",dataEntryCmpnt.WMEndState(i));
}
if(rr is Rig.Network.Camera.RoiForFixedStartCJMS11.Roi)
(rr as Rig.Network.Camera.RoiForFixedStartCJMS11.Roi).EndWMState = dataEntryCmpnt.WMEndState(i);
}
}
@@ -603,8 +603,6 @@ namespace TBF.Rig.TestMethods.StandingStartMassCollection
dataEntryCmpnt.WMStartState(i);
log.DebugFormat(" StandingStartMassCollectionSeq.cs - BeginWMState [{0}] -> RoiForFixedStartKeyence.Roi",dataEntryCmpnt.WMStartState(i));
}
if (rr is Rig.Network.Camera.RoiForFixedStartCJMS11.Roi)
(rr as Rig.Network.Camera.RoiForFixedStartCJMS11.Roi).BeginWMState = dataEntryCmpnt.WMStartState(i);
}
}
@@ -938,9 +936,6 @@ namespace TBF.Rig.TestMethods.StandingStartMassCollection
dataEntryCmpnt.WMEndState(i);
log.DebugFormat(" StandingStartMassCollectionSeq.cs - EndWMState [{0}] -> RoiForFixedStartKeyence.Roi",dataEntryCmpnt.WMEndState(i));
}
if(rr is Rig.Network.Camera.RoiForFixedStartCJMS11.Roi)
(rr as Rig.Network.Camera.RoiForFixedStartCJMS11.Roi).EndWMState = dataEntryCmpnt.WMEndState(i);
}
}
-68
View File
@@ -113,7 +113,6 @@
<Reference Include="log4net, Version=2.0.15.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<HintPath>..\packages\log4net.2.0.15\lib\net45\log4net.dll</HintPath>
</Reference>
<Reference Include="mscorlib" />
<Reference Include="MySql.Data">
<HintPath>..\packages\MySql.Data.6.6.5\lib\net40\MySql.Data.dll</HintPath>
</Reference>
@@ -140,14 +139,8 @@
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Drawing.Common, Version=9.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Drawing.Common.9.0.5\lib\net462\System.Drawing.Common.dll</HintPath>
</Reference>
<Reference Include="System.Management" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Net.Sockets, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Net.Sockets.4.3.0\lib\net46\System.Net.Sockets.dll</HintPath>
</Reference>
<Reference Include="System.Numerics" />
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.4.5.3\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
@@ -811,15 +804,6 @@
<DependentUpon>NetadapterCfgCtrl.cs</DependentUpon>
</Compile>
<Compile Include="Rig\Network\AdapterInfo.cs" />
<Compile Include="Rig\Network\AdapterJMS\Factory.cs" />
<Compile Include="Rig\Network\AdapterJMS\Netadapter.cs" />
<Compile Include="Rig\Network\AdapterJMS\NetadapterCfg.cs" />
<Compile Include="Rig\Network\AdapterJMS\NetadapterCfgCtrl.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Rig\Network\AdapterJMS\NetadapterCfgCtrl.designer.cs">
<DependentUpon>NetadapterCfgCtrl.cs</DependentUpon>
</Compile>
<Compile Include="Rig\Network\Adapter\Netadapter.cs" />
<Compile Include="Rig\Network\Adapter\Factory.cs" />
<Compile Include="Rig\Network\Adapter\NetadapterCfg.cs" />
@@ -829,33 +813,6 @@
<Compile Include="Rig\Network\Adapter\NetadapterCfgCtrl.designer.cs">
<DependentUpon>NetadapterCfgCtrl.cs</DependentUpon>
</Compile>
<Compile Include="Rig\Network\Camera\CJMS11\Camera.cs" />
<Compile Include="Rig\Network\Camera\CJMS11\CameraCfg.cs" />
<Compile Include="Rig\Network\Camera\CJMS11\CameraCfgCtrl.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Rig\Network\Camera\CJMS11\CameraCfgCtrl.designer.cs">
<DependentUpon>CameraCfgCtrl.cs</DependentUpon>
</Compile>
<Compile Include="Rig\Network\Camera\CJMS11\Factory.cs" />
<Compile Include="Rig\Network\Camera\CJMS11\GrabImagesOp.cs" />
<Compile Include="Rig\Network\Camera\CJMS11\JmsMessage.cs" />
<Compile Include="Rig\Network\Camera\CJMS11\JmsPacket.cs" />
<Compile Include="Rig\Network\Camera\CJMS11\LiveStreamOp.cs" />
<Compile Include="Rig\Network\Camera\CJMS11\POJO\CommandM.cs" />
<Compile Include="Rig\Network\Camera\CJMS11\POJO\CommandMEnum.cs" />
<Compile Include="Rig\Network\Camera\CJMS11\POJO\ImageType.cs" />
<Compile Include="Rig\Network\Camera\CJMS11\POJO\ImageTypeEnum.cs" />
<Compile Include="Rig\Network\Camera\CJMS11\POJO\MessageStatus.cs" />
<Compile Include="Rig\Network\Camera\CJMS11\POJO\MessageStatusEnum.cs" />
<Compile Include="Rig\Network\Camera\CJMS11\POJO\ParsedImage.cs" />
<Compile Include="Rig\Network\Camera\CJMS11\RoisAndResults.cs" />
<Compile Include="Rig\Network\Camera\CJMS11\TerminalDlg.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Rig\Network\Camera\CJMS11\TerminalDlg.Designer.cs">
<DependentUpon>TerminalDlg.cs</DependentUpon>
</Compile>
<Compile Include="Rig\Network\Camera\CLP1611\Camera.cs" />
<Compile Include="Rig\Network\Camera\CLP1611\CameraCfg.cs" />
<Compile Include="Rig\Network\Camera\CLP1611\CameraCfgCtrl.cs">
@@ -877,7 +834,6 @@
<Compile Include="Rig\Network\Camera\CLP1611\TerminalDlg.Designer.cs">
<DependentUpon>TerminalDlg.cs</DependentUpon>
</Compile>
<Compile Include="Rig\Network\Camera\common\ImageUtils.cs" />
<Compile Include="Rig\Network\Camera\Display\DisplayForm.cs">
<SubType>Form</SubType>
</Compile>
@@ -905,18 +861,6 @@
<Compile Include="Rig\Network\Camera\KeyenceIV3G120\Factory.cs" />
<Compile Include="Rig\Network\Camera\KeyenceIV3G120\GrabImagesOp.cs" />
<Compile Include="Rig\Network\Camera\KeyenceIV3G120\RoisAndResults.cs" />
<Compile Include="Rig\Network\Camera\RoiForFixedStartCJMS11\common\Frame.cs" />
<Compile Include="Rig\Network\Camera\RoiForFixedStartCJMS11\common\ResolutionFrames.cs" />
<Compile Include="Rig\Network\Camera\RoiForFixedStartCJMS11\Factory.cs" />
<Compile Include="Rig\Network\Camera\RoiForFixedStartCJMS11\ProcedureParams.cs" />
<Compile Include="Rig\Network\Camera\RoiForFixedStartCJMS11\Roi.cs" />
<Compile Include="Rig\Network\Camera\RoiForFixedStartCJMS11\RoiCfg.cs" />
<Compile Include="Rig\Network\Camera\RoiForFixedStartCJMS11\RoiCfgCtrl.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Rig\Network\Camera\RoiForFixedStartCJMS11\RoiCfgCtrl.designer.cs">
<DependentUpon>RoiCfgCtrl.cs</DependentUpon>
</Compile>
<Compile Include="Rig\Network\Camera\RoiForFixedStartKeyence\Factory.cs" />
<Compile Include="Rig\Network\Camera\RoiForFixedStartKeyence\ProcedureParams.cs" />
<Compile Include="Rig\Network\Camera\RoiForFixedStartKeyence\Roi.cs" />
@@ -2944,18 +2888,9 @@
<EmbeddedResource Include="Rig\Network\AdapterFTP\NetadapterCfgCtrl.resx">
<DependentUpon>NetadapterCfgCtrl.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Rig\Network\AdapterJMS\NetadapterCfgCtrl.resx">
<DependentUpon>NetadapterCfgCtrl.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Rig\Network\Adapter\NetadapterCfgCtrl.resx">
<DependentUpon>NetadapterCfgCtrl.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Rig\Network\Camera\CJMS11\CameraCfgCtrl.resx">
<DependentUpon>CameraCfgCtrl.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Rig\Network\Camera\CJMS11\TerminalDlg.resx">
<DependentUpon>TerminalDlg.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Rig\Network\Camera\CLP1611\CameraCfgCtrl.resx">
<DependentUpon>CameraCfgCtrl.cs</DependentUpon>
</EmbeddedResource>
@@ -2971,9 +2906,6 @@
<EmbeddedResource Include="Rig\Network\Camera\KeyenceIV3G120\CameraCfgCtrl.resx">
<DependentUpon>CameraCfgCtrl.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Rig\Network\Camera\RoiForFixedStartCJMS11\RoiCfgCtrl.resx">
<DependentUpon>RoiCfgCtrl.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Rig\Network\Camera\RoiForFixedStartKeyence\RoiCfgCtrl.resx">
<DependentUpon>RoiCfgCtrl.cs</DependentUpon>
</EmbeddedResource>
+270 -356
View File
@@ -1,11 +1,9 @@
///
/// Copyright (c) 2013-2021 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using System.IO;
using System.Web.UI;
using System.Windows.Forms;
using log4net;
using NHibernate;
@@ -15,31 +13,27 @@ using Config.Entities;
using TBF.Rig;
using TBF.Rig.Generic;
using TBF.Resources;
using TBF.Rig.GenericDevices;
using TBF.Rig.WaterMeters.WaterMeter;
using TBF.UI.Shared;
namespace TBF.UI.Bench.Components
{
public partial class ComponentsManagerDlg : Form, IParentOfListViewEx
{
static readonly ILog log = LogManager.GetLogger(typeof(ComponentsManagerDlg));
public partial class ComponentsManagerDlg : Form, IParentOfListViewEx
{
static readonly ILog log = LogManager.GetLogger(typeof(ComponentsManagerDlg));
/// <summary>
/// List of components (=component configuration instances)
/// </summary>
IList<Component> cmpntEntities;
/// <summary>
/// List of components (=component configuration instances)
/// </summary>
IList<Component> cmpntEntities;
IList<Component> toBeDeletedEntities;
IList<Component> toBeDeletedEntities;
ISession session;
ISession session;
SelectComponentClassDlg selectComponentTypeDlg;
SelectComponentClassDlg selectComponentTypeDlg; /// Constructed once, the selection is kept between dialog usages
/// Constructed once, the selection is kept between dialog usages
CfgUpdateFlags flags;
/// Or-ed from particular Flags from ComponentParametersDlg
CfgUpdateFlags flags; /// Or-ed from particular Flags from ComponentParametersDlg
/// <summary>
/// ListViewEx columns
/// </summary>
@@ -56,29 +50,27 @@ namespace TBF.UI.Bench.Components
}
MySortOrder sortOrder = MySortOrder.Ascending;
int sortColumn = -1;
int sortColumn = -1; /// 0-based index of column to be used for sorting
/// 0-based index of column to be used for sorting
/// Editors used by listViewEx
/// Editors used by listViewEx
ComboBox debugCB;
ComboBox logCB;
bool unlocked;
bool unlocked;
public ComponentsManagerDlg()
{
toBeDeletedEntities = new List<Component>();
public ComponentsManagerDlg()
{
toBeDeletedEntities = new List<Component>();
InitializeComponent();
InitializeComponent();
flags = CfgUpdateFlags.None;
flags = CfgUpdateFlags.None;
selectComponentTypeDlg = new SelectComponentClassDlg();
selectComponentTypeDlg = new SelectComponentClassDlg();
/// SharedDlgButtons configuration
/// SharedDlgButtons configuration
sharedButtons.ParentForm = this;
sharedButtons.RequiredGroupMembership = new GID[] { GID.Metrologists };
sharedButtons.RequiredGroupMembership = new GID[] { GID.Metrologists };
sharedButtons.OptionalButtons = SharedButtons.Buttons.Add |
SharedButtons.Buttons.Remove |
@@ -89,35 +81,34 @@ namespace TBF.UI.Bench.Components
SharedButtons.Buttons.Export |
SharedButtons.Buttons.Import;
sharedButtons.Unlocked += Unlocked;
sharedButtons.OKClicked += okButton_Click;
sharedButtons.CancelClicked += cancelButton_Click;
sharedButtons.AddClicked += addButton_Click;
sharedButtons.RemoveClicked += removeButton_Click;
sharedButtons.UpClicked += upButton_Click;
sharedButtons.DownClicked += downButton_Click;
sharedButtons.EditClicked += editButton_Click;
sharedButtons.OKClicked += okButton_Click;
sharedButtons.CancelClicked += cancelButton_Click;
sharedButtons.AddClicked += addButton_Click;
sharedButtons.RemoveClicked += removeButton_Click;
sharedButtons.UpClicked += upButton_Click;
sharedButtons.DownClicked += downButton_Click;
sharedButtons.EditClicked += editButton_Click;
sharedButtons.CopyClicked += copyButton_Click;
sharedButtons.ExportClicked += exportButton_Click;
sharedButtons.ImportClicked += importButton_Click;
}
private void ComponentsManagerDlg_Load(object sender, EventArgs e)
{
private void ComponentsManagerDlg_Load(object sender, EventArgs e)
{
LoadFormPosition();
Text = Strings.Test_Bench_Components_Configuration;
LocalSettings ls = Program.LocalSettings;
listViewEx.Columns.Add(Strings.Nr, (ls.ComponentsColumnCount > 0) ? ls.ComponentsColumnWidths[0] : 40);
listViewEx.Columns.Add(Strings.Name, (ls.ComponentsColumnCount > 1) ? ls.ComponentsColumnWidths[1] : 80);
listViewEx.Columns.Add(Strings.Type, (ls.ComponentsColumnCount > 2) ? ls.ComponentsColumnWidths[2] : 120);
listViewEx.Columns.Add(Strings.Parent, (ls.ComponentsColumnCount > 3) ? ls.ComponentsColumnWidths[3] : 55);
listViewEx.Columns.Add(Strings.Mode, (ls.ComponentsColumnCount > 4) ? ls.ComponentsColumnWidths[4] : 55);
listViewEx.Columns.Add(Strings.Logging, (ls.ComponentsColumnCount > 5) ? ls.ComponentsColumnWidths[5] : 55);
listViewEx.Columns.Add(Strings.Parameters,
(ls.ComponentsColumnCount > 6) ? ls.ComponentsColumnWidths[6] : 600);
listViewEx.Columns.Add(Strings.Nr, (ls.ComponentsColumnCount > 0) ? ls.ComponentsColumnWidths[0] : 40);
listViewEx.Columns.Add(Strings.Name, (ls.ComponentsColumnCount > 1) ? ls.ComponentsColumnWidths[1] : 80);
listViewEx.Columns.Add(Strings.Type, (ls.ComponentsColumnCount > 2) ? ls.ComponentsColumnWidths[2] : 120);
listViewEx.Columns.Add(Strings.Parent, (ls.ComponentsColumnCount > 3) ? ls.ComponentsColumnWidths[3] : 55);
listViewEx.Columns.Add(Strings.Mode, (ls.ComponentsColumnCount > 4) ? ls.ComponentsColumnWidths[4] : 55);
listViewEx.Columns.Add(Strings.Logging, (ls.ComponentsColumnCount > 5) ? ls.ComponentsColumnWidths[5] : 55);
listViewEx.Columns.Add(Strings.Parameters, (ls.ComponentsColumnCount > 6) ? ls.ComponentsColumnWidths[6] : 600);
listViewEx.HeaderStyle = ColumnHeaderStyle.Clickable;
debugCB = new ComboBox();
debugCB = new ComboBox();
for (DebugMode level = 0; level < DebugMode.Count; level++) debugCB.Items.Add(level.ToDescription());
splitContainer.Panel1.Controls.Add(debugCB);
@@ -128,23 +119,23 @@ namespace TBF.UI.Bench.Components
listViewEx.SubItemClicked += new SubItemEventHandler(listViewEx_SubItemClicked);
listViewEx.SubItemEndEditing += new SubItemEndEditingEventHandler(listViewEx_SubItemEndEditing);
sharedButtons.DisableButtons(SharedButtons.Buttons.Remove | SharedButtons.Buttons.Edit);
sharedButtons.DisableButtons(SharedButtons.Buttons.Remove | SharedButtons.Buttons.Edit);
session = TBF.DB.CreateSession(DBKind.Config);
cmpntEntities = session.QueryOver<Component>()
.OrderBy(x => x.ItemNr).Asc
.List<Component>();
session = TBF.DB.CreateSession(DBKind.Config);
cmpntEntities = session.QueryOver<Component>()
.OrderBy(x => x.ItemNr).Asc
.List<Component>();
RedrawAll();
}
RedrawAll();
}
void listViewEx_SubItemClicked(object sender, SubItemEventArgs e)
{
if (unlocked && e.SubItem == (int)Column.DebugMode)
if (unlocked && e.SubItem == (int)Column.DebugMode)
{
listViewEx.StartEditing(debugCB, e.Item, e.SubItem);
}
else if (unlocked && e.SubItem == (int)Column.Logging)
else if (unlocked && e.SubItem == (int)Column.Logging)
{
listViewEx.StartEditing(logCB, e.Item, e.SubItem);
}
@@ -155,7 +146,7 @@ namespace TBF.UI.Bench.Components
if (!unlocked || ((e.SubItem != (int)Column.DebugMode) && (e.SubItem != (int)Column.Logging))) return;
if (DialogResult.Yes == MessageBox.Show(Strings.Do_you_want_to_copy_this_value_to_all_cells_below_this_cell,
Strings.Confirmation, MessageBoxButtons.YesNo, MessageBoxIcon.Question))
Strings.Confirmation, MessageBoxButtons.YesNo, MessageBoxIcon.Question))
{
int columnNr = e.SubItem;
string value = null;
@@ -213,11 +204,10 @@ namespace TBF.UI.Bench.Components
if (debugCB.Text.Equals(level.ToDescription()))
{
cmpnt.DebugMode = level;
flags |= CfgUpdateFlags.RestartRqrd;
flags |= CfgUpdateFlags.RestartRqrd;
return;
}
}
e.DisplayText = cmpnt.DebugMode.ToString();
}
else if (e.SubItem == (int)Column.Logging)
@@ -227,36 +217,35 @@ namespace TBF.UI.Bench.Components
if (logCB.Text.Equals(level.ToDescription()))
{
cmpnt.LogLevel = level;
flags |= CfgUpdateFlags.RestartRqrd;
return;
flags |= CfgUpdateFlags.RestartRqrd;
return;
}
}
e.DisplayText = cmpnt.LogLevel.ToString();
}
}
private void Unlocked(object sender, EventArgs e)
{
unlocked = true;
private void Unlocked(object sender, EventArgs e)
{
unlocked = true;
if (listViewEx.SelectedItems.Count == 1)
{
int ix = listViewEx.SelectedIndices[0];
Focus();
listViewEx.Items[ix].Selected = true;
listViewEx.Items[ix].EnsureVisible();
}
}
if (listViewEx.SelectedItems.Count == 1)
{
int ix = listViewEx.SelectedIndices[0];
Focus();
listViewEx.Items[ix].Selected = true;
listViewEx.Items[ix].EnsureVisible();
}
}
void RedrawAll()
{
listViewEx.Items.Clear();
foreach (var cmpnt in cmpntEntities) DrawOne(cmpnt);
}
void RedrawAll()
{
listViewEx.Items.Clear();
foreach (var cmpnt in cmpntEntities) DrawOne(cmpnt);
}
void DrawOne(Component cmpnt)
{
void DrawOne(Component cmpnt)
{
ListViewItem lvi = new ListViewItem(cmpnt.ItemNr.ToString());
lvi.Tag = cmpnt;
lvi.SubItems.Add(cmpnt.Name);
@@ -265,17 +254,18 @@ namespace TBF.UI.Bench.Components
IComponentCfg cmpCfg = TbfComponents.CmpntCfgFromCmpntEntity(cmpnt);
if (cmpCfg != null)
{
{
lvi.SubItems.Add(cmpCfg.DebugLevel.ToDescription());
lvi.SubItems.Add(cmpCfg.LogLevel.ToDescription());
lvi.SubItems.Add(cmpCfg.ToString(-1));
}
else
{
lvi.SubItems.Add("---");
lvi.SubItems.Add("---");
lvi.SubItems.Add("Not a component");
}
lvi.SubItems.Add(cmpCfg.LogLevel.ToDescription());
lvi.SubItems.Add(cmpCfg.ToString(-1));
}
else
{
lvi.SubItems.Add("---");
lvi.SubItems.Add("---");
lvi.SubItems.Add("Not a component");
}
listViewEx.Items.Add(lvi);
}
@@ -314,10 +304,10 @@ namespace TBF.UI.Bench.Components
private void LoadFormPosition()
{
LocalSettings ls = Program.LocalSettings;
Width = (ls.ComponentsDlgWidth > 0) ? ls.ComponentsDlgWidth : 850;
Width = (ls.ComponentsDlgWidth > 0) ? ls.ComponentsDlgWidth : 850;
Height = (ls.ComponentsDlgHeight > 0) ? ls.ComponentsDlgHeight : 500;
Left = (ls.ComponentsDlgLeft != 0) ? ls.ComponentsDlgLeft : 200;
Top = (ls.ComponentsDlgTop != 0) ? ls.ComponentsDlgTop : 100;
Left = (ls.ComponentsDlgLeft != 0) ? ls.ComponentsDlgLeft : 200;
Top = (ls.ComponentsDlgTop != 0) ? ls.ComponentsDlgTop : 100;
}
/// <summary>
@@ -344,11 +334,7 @@ namespace TBF.UI.Bench.Components
{
for (int i = 0; i < (int)Column.ColumnsCount; i++)
{
if (listViewEx.Columns[i].Width != ls.ComponentsColumnWidths[i])
{
anyColumnDiffers = true;
break;
}
if (listViewEx.Columns[i].Width != ls.ComponentsColumnWidths[i]) { anyColumnDiffers = true; break; }
}
}
@@ -380,149 +366,84 @@ namespace TBF.UI.Bench.Components
}
///
/// OK
/// OK
///
private void okButton_Click(object sender, EventArgs e)
{
ValidateComponents();
if ((flags & CfgUpdateFlags.AnyChange) != 0 || (flags & CfgUpdateFlags.RestartRqrd) != 0)
{
{
if ((flags & CfgUpdateFlags.AnyChange) != 0 || (flags & CfgUpdateFlags.RestartRqrd) != 0)
{
SaveDBChanges(session);
flags = CfgUpdateFlags.None; /// Changes saved
flags = CfgUpdateFlags.None; /// Changes saved
}
SaveUISettings();
DialogResult = DialogResult.OK;
Close();
return;
}
Close();
return;
}
private void ValidateComponents()
{
Boolean invalid = false;
string validationMessage = "";
//validation cycle
invalid = !ValidateMetersBatchCount(out validationMessage);
if (invalid)
{
MessageBox.Show(validationMessage, Strings.Warning, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
}
private Boolean ValidateMetersBatchCount(out string message)
{
bool invalid = false;
TBF.Rig.DataContainer.BenchInfo.ComponentCfg benchInfo = null;
int waterMetersCount = 0;
int iWaterMeterComponentCount = 0;
foreach (Component component in cmpntEntities)
{
if (component == null)
{
continue;
}
string className = (string.IsNullOrEmpty(component.ClassName) ? string.Empty : component.ClassName);
if (className == "DataContainer.BenchInfo")
{
try
{
var cfg = new TBF.Rig.DataContainer.BenchInfo.Factory().CmpntCfgFromCmpntEntity(component)
as TBF.Rig.DataContainer.BenchInfo.ComponentCfg;
waterMetersCount = cfg.WaterMetersCount;
}
catch (Exception e)
{
log.Error("Finding of DataContainer.BenchInfo data unsuccessfully!");
}
}
if (className == "WaterMeter")
{
iWaterMeterComponentCount++;
}
}
invalid = (waterMetersCount != iWaterMeterComponentCount);
if (invalid)
{
message = "The count of water meters on the bench does not match the count of their components!";
return false;
}
message = "";
return true;
}
/// Cancel
private void cancelButton_Click(object sender, EventArgs e)
{
/// Cancel
private void cancelButton_Click(object sender, EventArgs e)
{
SaveUISettings();
if ((flags & CfgUpdateFlags.AnyChange) != 0 || (flags & CfgUpdateFlags.RestartRqrd) != 0)
{
DialogResult dr = MessageBox.Show(Strings.Changes_will_be_lost_Do_you_want_to_proceed,
Strings.Warning,
MessageBoxButtons.YesNo,
MessageBoxIcon.Question);
if (dr != DialogResult.Yes) return;
}
if ((flags & CfgUpdateFlags.AnyChange) != 0 || (flags & CfgUpdateFlags.RestartRqrd) != 0)
{
DialogResult dr = MessageBox.Show(Strings.Changes_will_be_lost_Do_you_want_to_proceed,
Strings.Warning,
MessageBoxButtons.YesNo,
MessageBoxIcon.Question);
if (dr != DialogResult.Yes) return;
}
flags = CfgUpdateFlags.None; /// Abandoning changes confirmed
flags = CfgUpdateFlags.None; /// Abandoning changes confirmed
DialogResult = DialogResult.Cancel;
Close();
return;
}
Close();
return;
}
/// Add a new component
private void addButton_Click(object sender, EventArgs e)
{
selectComponentTypeDlg.SelectedScriptName = null;
DialogResult dialogRslt = selectComponentTypeDlg.ShowDialog();
if (dialogRslt != DialogResult.OK) return;
/// Add a new component
private void addButton_Click(object sender, EventArgs e)
{
selectComponentTypeDlg.SelectedScriptName = null;
DialogResult dialogRslt = selectComponentTypeDlg.ShowDialog();
if (dialogRslt != DialogResult.OK) return;
IComponentFactory factory = selectComponentTypeDlg.SlctdCmpntFactory;
IComponentFactory factory = selectComponentTypeDlg.SlctdCmpntFactory;
IComponentCfg cfg = factory.DefaultConfig();
if (selectComponentTypeDlg.SelectedScriptName == null)
{
{
///
/// Create a single component of the selected type
///
IComponentCfgCtrl cfgControl = cfg.GetControl(cmpntEntities);
cfgControl.Config = cfg;
cfgControl.Config.ItemNr =
(cmpntEntities.Count > 0) ? (cmpntEntities[cmpntEntities.Count - 1].ItemNr + 1) : 1;
cfgControl.Config = cfg;
cfgControl.Config.ItemNr = (cmpntEntities.Count > 0) ? (cmpntEntities[cmpntEntities.Count - 1].ItemNr + 1) : 1;
ComponentParametersDlg cfgForm = new ComponentParametersDlg(this);
cfgForm.CmpntEntities = cmpntEntities;
cfgForm.ComponentCfgCtrl = cfgControl;
cfgForm.UnlockAfterStart = true;
dialogRslt = cfgForm.ShowDialog();
if (dialogRslt != DialogResult.OK) return;
ComponentParametersDlg cfgForm = new ComponentParametersDlg(this);
cfgForm.CmpntEntities = cmpntEntities;
cfgForm.ComponentCfgCtrl = cfgControl;
cfgForm.UnlockAfterStart = true;
dialogRslt = cfgForm.ShowDialog();
if (dialogRslt != DialogResult.OK) return;
flags |= CfgUpdateFlags.RestartRqrd;
AddOne(cfgForm.Config.CreateDbEntity());
}
else
{
flags |= CfgUpdateFlags.RestartRqrd;
AddOne(cfgForm.Config.CreateDbEntity());
}
else
{
///
/// Create more components, read their names and other properties from a file
///
using (TextReader reader = new StreamReader(selectComponentTypeDlg.SelectedScriptName))
{
int zeroBasedIdx = 0;
string line = reader.ReadLine();
while (line != null)
{
line.Trim();
{
int zeroBasedIdx = 0;
string line = reader.ReadLine();
while (line != null)
{
line.Trim();
if (line.Length > 0)
{
string[] words = line.Split(new char[] { ' ', '\t' });
@@ -530,85 +451,83 @@ namespace TBF.UI.Bench.Components
if (UpdateCfg(ref cfg, words, ref zeroBasedIdx))
{
flags |= CfgUpdateFlags.RestartRqrd;
cfg.ItemNr = (cmpntEntities.Count > 0)
? (cmpntEntities[cmpntEntities.Count - 1].ItemNr + 1)
: 1;
cfg.ItemNr = (cmpntEntities.Count > 0) ? (cmpntEntities[cmpntEntities.Count - 1].ItemNr + 1) : 1;
AddOne(cfg.CreateDbEntity());
}
zeroBasedIdx++;
}
line = reader.ReadLine();
}
}
}
}
line = reader.ReadLine();
}
}
}
}
void AddOne(Component cmpnt)
{
cmpntEntities.Add(cmpnt);
DrawOne(cmpnt);
}
void AddOne(Component cmpnt)
{
cmpntEntities.Add(cmpnt);
DrawOne(cmpnt);
}
/// Delete the component
private void removeButton_Click(object sender, EventArgs e)
{
if (listViewEx.SelectedIndices.Count != 1) return;
int ix = listViewEx.SelectedIndices[0];
if (ix < 0) return;
Component selectedCmpnt = (Component)listViewEx.Items[ix].Tag;
/// Delete the component
private void removeButton_Click(object sender, EventArgs e)
{
if (listViewEx.SelectedIndices.Count != 1) return;
int ix = listViewEx.SelectedIndices[0];
if (ix < 0) return;
Component selectedCmpnt = (Component)listViewEx.Items[ix].Tag;
if (selectedCmpnt.Id != 0) toBeDeletedEntities.Add(selectedCmpnt);
cmpntEntities.Remove(selectedCmpnt);
flags |= CfgUpdateFlags.AnyChange;
RedrawAll();
}
RedrawAll();
}
/// DoubleClick -> Edit the component
private void listViewEx_MouseDoubleClick(object sender, MouseEventArgs e)
{
editButton_Click(sender, e);
}
/// DoubleClick -> Edit the component
private void listViewEx_MouseDoubleClick(object sender, MouseEventArgs e)
{
editButton_Click(sender, e);
}
/// Edit a component
private void editButton_Click(object sender, EventArgs e)
{
/// Edit a component
private void editButton_Click(object sender, EventArgs e)
{
if (listViewEx.SelectedIndices.Count != 1) return;
ListViewItem lvi = listViewEx.SelectedItems[0];
Component component = lvi.Tag as Component;
if (component == null) return;
IComponentCfg cfg = TbfComponents.CmpntCfgFromCmpntEntity(component);
if (cfg != null)
{
IComponentCfg cfg = TbfComponents.CmpntCfgFromCmpntEntity(component);
if (cfg != null)
{
ComponentParametersDlg cfgForm = new ComponentParametersDlg(this, component.Id);
cfgForm.CmpntEntities = cmpntEntities;
cfgForm.CmpntEntities = cmpntEntities;
cfgForm.ComponentCfgCtrl = cfg.GetControl(cmpntEntities);
cfgForm.ComponentCfgCtrl.Config = cfg;
DialogResult dr = cfgForm.ShowDialog();
if (dr != DialogResult.OK) return;
cfgForm.ComponentCfgCtrl.Config = cfg;
DialogResult dr = cfgForm.ShowDialog();
if (dr != DialogResult.OK) return;
flags |= cfgForm.Flags;
flags |= cfgForm.Flags;
sharedButtons.UnlockButtons(); /// Unlock this dialog buttons as changes were enabled
unlocked = true; /// in the ComponentParametersDlg.
sharedButtons.UnlockButtons(); /// Unlock this dialog buttons as changes were enabled
unlocked = true; /// in the ComponentParametersDlg.
Component modified = cfgForm.Config.CreateDbEntity();
Component original = (Component)lvi.Tag;
Component modified = cfgForm.Config.CreateDbEntity();
Component original = (Component)lvi.Tag;
original.Name = modified.Name;
original.ClassName = modified.ClassName;
original.Parent = modified.Parent;
original.DebugMode = modified.DebugMode;
original.LogLevel = modified.LogLevel;
original.Parameters = modified.Parameters;
original.Name = modified.Name;
original.ClassName = modified.ClassName;
original.Parent = modified.Parent;
original.DebugMode = modified.DebugMode;
original.LogLevel = modified.LogLevel;
original.Parameters = modified.Parameters;
RedrawAll();
}
}
RedrawAll();
}
}
/// Copy a component
private void copyButton_Click(object sender, EventArgs e)
@@ -616,7 +535,7 @@ namespace TBF.UI.Bench.Components
if (listViewEx.SelectedIndices.Count != 1) return;
ListViewItem lvi = listViewEx.SelectedItems[0];
IComponentCfg cfg = TbfComponents.CmpntCfgFromCmpntEntity((Component)lvi.Tag);
IComponentCfg cfg = TbfComponents.CmpntCfgFromCmpntEntity((Component)lvi.Tag);
if (cfg != null)
{
cfg.Name += Strings.New_name_copy;
@@ -624,9 +543,7 @@ namespace TBF.UI.Bench.Components
{
IComponentCfgCtrl cfgControl = cfg.GetControl(cmpntEntities);
cfgControl.Config = cfg;
cfgControl.Config.ItemNr = (cmpntEntities.Count > 0)
? (cmpntEntities[cmpntEntities.Count - 1].ItemNr + 1)
: 1;
cfgControl.Config.ItemNr = (cmpntEntities.Count > 0) ? (cmpntEntities[cmpntEntities.Count - 1].ItemNr + 1) : 1;
ComponentParametersDlg cfgForm = new ComponentParametersDlg(this);
cfgForm.CmpntEntities = cmpntEntities;
@@ -671,8 +588,7 @@ namespace TBF.UI.Bench.Components
IComponentCfgCtrl cfgControl = cfg.GetControl(cmpntEntities);
cfgControl.Config = cfg;
cfgControl.Config.Name = cfgControl.Config.Name + " imported";
cfgControl.Config.ItemNr =
(cmpntEntities.Count > 0) ? (cmpntEntities[cmpntEntities.Count - 1].ItemNr + 1) : 1;
cfgControl.Config.ItemNr = (cmpntEntities.Count > 0) ? (cmpntEntities[cmpntEntities.Count - 1].ItemNr + 1) : 1;
ComponentParametersDlg cfgForm = new ComponentParametersDlg(this);
cfgForm.CmpntEntities = cmpntEntities;
@@ -685,90 +601,88 @@ namespace TBF.UI.Bench.Components
}
}
private void upButton_Click(object sender, EventArgs e)
{
if (listViewEx.SelectedIndices.Count != 1) return;
int ix = listViewEx.SelectedIndices[0];
if (ix < 1) return;
private void upButton_Click(object sender, EventArgs e)
{
if (listViewEx.SelectedIndices.Count != 1) return;
int ix = listViewEx.SelectedIndices[0];
if (ix < 1) return;
Component item1 = (Component)(listViewEx.Items[ix - 1].Tag);
Component item2 = (Component)(listViewEx.Items[ix].Tag);
(item1 as IHasItemNr).ItemNr++;
(item2 as IHasItemNr).ItemNr--;
cmpntEntities.RemoveAt(ix);
cmpntEntities.Insert(ix - 1, item2);
Component item1 = (Component)(listViewEx.Items[ix - 1].Tag);
Component item2 = (Component)(listViewEx.Items[ix].Tag);
(item1 as IHasItemNr).ItemNr++;
(item2 as IHasItemNr).ItemNr--;
cmpntEntities.RemoveAt(ix);
cmpntEntities.Insert(ix - 1, item2);
flags |= CfgUpdateFlags.AnyChange;
flags |= CfgUpdateFlags.AnyChange;
RedrawAll();
RedrawAll();
Focus();
listViewEx.Items[ix - 1].Selected = true;
listViewEx.Items[ix - 1].EnsureVisible();
}
Focus();
listViewEx.Items[ix - 1].Selected = true;
listViewEx.Items[ix - 1].EnsureVisible();
}
private void downButton_Click(object sender, EventArgs e)
{
if (listViewEx.SelectedIndices.Count != 1) return;
int ix = listViewEx.SelectedIndices[0];
if (ix >= listViewEx.Items.Count - 1) return;
private void downButton_Click(object sender, EventArgs e)
{
if (listViewEx.SelectedIndices.Count != 1) return;
int ix = listViewEx.SelectedIndices[0];
if (ix >= listViewEx.Items.Count - 1) return;
Component item1 = (Component)(listViewEx.Items[ix].Tag);
Component item2 = (Component)(listViewEx.Items[ix + 1].Tag);
(item1 as IHasItemNr).ItemNr++;
(item2 as IHasItemNr).ItemNr--;
cmpntEntities.RemoveAt(ix + 1);
cmpntEntities.Insert(ix, item2);
Component item1 = (Component)(listViewEx.Items[ix].Tag);
Component item2 = (Component)(listViewEx.Items[ix + 1].Tag);
(item1 as IHasItemNr).ItemNr++;
(item2 as IHasItemNr).ItemNr--;
cmpntEntities.RemoveAt(ix + 1);
cmpntEntities.Insert(ix, item2);
flags |= CfgUpdateFlags.AnyChange;
flags |= CfgUpdateFlags.AnyChange;
RedrawAll();
RedrawAll();
Focus();
listViewEx.Items[ix + 1].Selected = true;
listViewEx.Items[ix + 1].EnsureVisible();
}
Focus();
listViewEx.Items[ix + 1].Selected = true;
listViewEx.Items[ix + 1].EnsureVisible();
}
private void componentsListView_SelectedIndexChanged(object sender, EventArgs e)
{
if (listViewEx.SelectedIndices.Count == 1)
{
sharedButtons.EnableButtons(SharedButtons.Buttons.Remove | SharedButtons.Buttons.Edit);
}
else
{
sharedButtons.DisableButtons(SharedButtons.Buttons.Remove | SharedButtons.Buttons.Edit);
}
}
private void componentsListView_SelectedIndexChanged(object sender, EventArgs e)
{
if (listViewEx.SelectedIndices.Count == 1)
{
sharedButtons.EnableButtons(SharedButtons.Buttons.Remove | SharedButtons.Buttons.Edit);
}
else
{
sharedButtons.DisableButtons(SharedButtons.Buttons.Remove | SharedButtons.Buttons.Edit);
}
}
public void UpdateButtonStates(SharedButtons.SelectedItemPos selectedItemPos)
{
if (selectedItemPos == SharedButtons.SelectedItemPos.None)
{
sharedButtons.DisableButtons(SharedButtons.Buttons.Remove | SharedButtons.Buttons.Up |
SharedButtons.Buttons.Down);
}
else if (selectedItemPos == SharedButtons.SelectedItemPos.First)
{
sharedButtons.EnableButtons(SharedButtons.Buttons.Remove | SharedButtons.Buttons.Down);
sharedButtons.DisableButtons(SharedButtons.Buttons.Up);
}
else if (selectedItemPos == SharedButtons.SelectedItemPos.Last)
{
sharedButtons.EnableButtons(SharedButtons.Buttons.Remove | SharedButtons.Buttons.Up);
sharedButtons.DisableButtons(SharedButtons.Buttons.Down);
}
else if (selectedItemPos == SharedButtons.SelectedItemPos.FirstAndLast)
{
sharedButtons.EnableButtons(SharedButtons.Buttons.Remove);
sharedButtons.DisableButtons(SharedButtons.Buttons.Up | SharedButtons.Buttons.Down);
}
else
{
sharedButtons.EnableButtons(SharedButtons.Buttons.Remove | SharedButtons.Buttons.Up |
SharedButtons.Buttons.Down);
}
}
public void UpdateButtonStates(SharedButtons.SelectedItemPos selectedItemPos)
{
if (selectedItemPos == SharedButtons.SelectedItemPos.None)
{
sharedButtons.DisableButtons(SharedButtons.Buttons.Remove | SharedButtons.Buttons.Up | SharedButtons.Buttons.Down);
}
else if (selectedItemPos == SharedButtons.SelectedItemPos.First)
{
sharedButtons.EnableButtons(SharedButtons.Buttons.Remove | SharedButtons.Buttons.Down);
sharedButtons.DisableButtons(SharedButtons.Buttons.Up);
}
else if (selectedItemPos == SharedButtons.SelectedItemPos.Last)
{
sharedButtons.EnableButtons(SharedButtons.Buttons.Remove | SharedButtons.Buttons.Up);
sharedButtons.DisableButtons(SharedButtons.Buttons.Down);
}
else if (selectedItemPos == SharedButtons.SelectedItemPos.FirstAndLast)
{
sharedButtons.EnableButtons(SharedButtons.Buttons.Remove);
sharedButtons.DisableButtons(SharedButtons.Buttons.Up | SharedButtons.Buttons.Down);
}
else
{
sharedButtons.EnableButtons(SharedButtons.Buttons.Remove | SharedButtons.Buttons.Up | SharedButtons.Buttons.Down);
}
}
private void ComponentsManagerDlg_FormClosing(object sender, FormClosingEventArgs e)
{
@@ -777,9 +691,9 @@ namespace TBF.UI.Bench.Components
if ((flags & CfgUpdateFlags.AnyChange) != 0 || (flags & CfgUpdateFlags.RestartRqrd) != 0)
{
DialogResult dr = MessageBox.Show(Strings.Do_you_want_to_save_changes,
Strings.Warning,
MessageBoxButtons.YesNo,
MessageBoxIcon.Question);
Strings.Warning,
MessageBoxButtons.YesNo,
MessageBoxIcon.Question);
if (dr == DialogResult.Yes)
{
SaveDBChanges(session);
@@ -788,7 +702,7 @@ namespace TBF.UI.Bench.Components
if (CurrentUser.Restore(this)) Program.MainWnd.UpdateUser();
}
/// <summary>
/// Updates component configuration from a script file
@@ -799,7 +713,7 @@ namespace TBF.UI.Bench.Components
/// <returns>true = udated component configuration should be saved, new component should be created</returns>
bool UpdateCfg(ref IComponentCfg cfg, string[] words, ref int zeroBasedIdx)
{
string name = words[words.Length - 1]; /// The last word is the component name
string name = words[words.Length - 1]; /// The last word is the component name
cfg.Name = name.Replace("#", (zeroBasedIdx + 1).ToString());
if (cfg is Rig.BuiltIn.Valve.ValveCfg)
@@ -846,9 +760,9 @@ namespace TBF.UI.Bench.Components
}
else if (cfg is Rig.Modbus.Meret.AdjustableScale.AdjustableMeterCfg)
{
(cfg as IChildComponentCfg).ParentName = "CB";
(cfg as Rig.Modbus.Meret.AdjustableScale.AdjustableMeterCfg).ModbusAddress = (byte)(zeroBasedIdx + 1);
return true;
(cfg as IChildComponentCfg).ParentName = "CB";
(cfg as Rig.Modbus.Meret.AdjustableScale.AdjustableMeterCfg).ModbusAddress = (byte)(zeroBasedIdx + 1);
return true;
}
else if (cfg is Rig.RegisterReaders.PulsesFromUniCB.RRCfg)
{
@@ -904,4 +818,4 @@ namespace TBF.UI.Bench.Components
listViewEx.Sort();
}
}
}
}
-4
View File
@@ -1181,10 +1181,6 @@ namespace TBF.UI.Process
if (args.TestRslt != null)
{
if (ProcessData.BatchRslts.Batch.WaterMeters.Count < wmsCount)
{
throw new Exception("Water Meter components cout is smaller as Bench Info water meter count!");
}
for (int i = 0; i < wmsCount; i++)
{
var wm = ProcessData.BatchRslts.Batch.WaterMeters[i];
-2
View File
@@ -8,8 +8,6 @@
<package id="Newtonsoft.Json" version="12.0.2" targetFramework="net472" />
<package id="Oracle.ManagedDataAccess" version="19.11.0" targetFramework="net472" />
<package id="System.Data.SQLite" version="1.0.90.0" targetFramework="net40" />
<package id="System.Drawing.Common" version="9.0.5" targetFramework="net472" />
<package id="System.Net.Sockets" version="4.3.0" targetFramework="net472" />
<package id="System.Runtime.CompilerServices.Unsafe" version="4.5.3" targetFramework="net472" />
<package id="System.Threading.Tasks.Extensions" version="4.5.4" targetFramework="net472" />
<package id="log4net" version="2.0.15" targetFramework="net472" />
@@ -1,180 +0,0 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Threading.Tasks;
using JetBrains.Annotations;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using TBF.Rig.Generic;
using TBF.Rig.Network.Camera.CJMS11;
using Factory = TBF.Rig.Network.Camera.CJMS11.Factory;
namespace TBFTests.Rig.Network.Camera.CJMS11
{
[TestClass]
//[Ignore("Excluded from automatic test runs - manual execution only")]
[TestSubject(typeof(TBF.Rig.Network.Camera.CJMS11.Camera))]
public class CameraTest
{
private static string ipCamera1 = "192.168.0.170";
private static string ipCamera2 = "192.168.0.169";
public string IPCamera1 { get { return ipCamera1; } }
public string IPCamera2 { get { return ipCamera2; } }
[TestMethod]
public void Initialize()
{
TBF.Rig.Network.Camera.CJMS11.Camera camera = GetCamera( IPCamera1);
camera.Initialize();
TBF.Rig.Network.Camera.CJMS11.Camera camera2 = GetCamera( IPCamera2);
camera2.Initialize();
TBF.Rig.Network.Camera.CJMS11.Camera camera11 = GetCamera( IPCamera1);
camera11.Initialize();
TBF.Rig.Network.Camera.CJMS11.Camera camera12 = GetCamera( IPCamera2);
camera12.Initialize();
}
[TestMethod]
public void Initialize_TwoCamerasInParallel()
{
var task1 = Task.Run(() =>
{
var camera = GetCamera(IPCamera1);
camera.Initialize();
});
var task2 = Task.Run(() =>
{
var camera = GetCamera(IPCamera2);
camera.Initialize();
});
var task3 = Task.Run(() =>
{
var camera = GetCamera(IPCamera2);
camera.Initialize();
});
var task4 = Task.Run(() =>
{
var camera = GetCamera(IPCamera1);
camera.Initialize();
});
Task.WaitAll(task1, task2, task3, task4); // blocks until both finish
// Optionally, add assertions or diagnostics
Assert.IsTrue(task1.IsCompleted);
Assert.IsTrue(task2.IsCompleted);
Assert.IsTrue(task3.IsCompleted);
Assert.IsTrue(task4.IsCompleted);
}
[TestMethod]
public async Task Initialize_TwoCamerasInParallelAsync()
{
var task1 = Task.Run(() =>
{
var camera = GetCamera(IPCamera1);
camera.Initialize();
});
var task2 = Task.Run(() =>
{
var camera = GetCamera(IPCamera2);
camera.Initialize();
});
await Task.WhenAll(task1, task2); // blocks until both finish
// Optionally, add assertions or diagnostics
Assert.IsTrue(task1.IsCompleted);
Assert.IsTrue(task2.IsCompleted);
}
[TestMethod]
public async Task GrabImageTest()
{
var task1 = Task.Run(() =>
{
var camera = GetCamera(IPCamera1);
Task<Image> saveImageTask = Task.Run(() => camera.SaveImageListener());
var timeoutAnswerTask = Task.Delay(TimeSpan.FromSeconds(3));
var completedAnswerTask = Task.WhenAny(saveImageTask, timeoutAnswerTask).Result;
if (completedAnswerTask == timeoutAnswerTask)
{
Assert.Fail();
}
//Assert.IsTrue(saveImageTask.Result != null);
});
var task2 = Task.Run(() =>
{
var camera = GetCamera(IPCamera2);
camera.Initialize();
});
var task3 = Task.Run(() =>
{
var camera = GetCamera(IPCamera2);
Task<Image> saveImageTask = Task.Run(() => camera.SaveImageListener());
var timeoutAnswerTask = Task.Delay(TimeSpan.FromSeconds(3));
var completedAnswerTask = Task.WhenAny(saveImageTask, timeoutAnswerTask).Result;
if (completedAnswerTask == timeoutAnswerTask)
{
Assert.Fail();
}
//TODO BUMI enable check image
//Assert.IsTrue(saveImageTask.Result != null);
});
var task4 = Task.Run(() =>
{
var camera = GetCamera(IPCamera1);
camera.Initialize();
});
await Task.WhenAll(task1, task2,task3, task4); // blocks until both finish
// Optionally, add assertions or diagnostics
Assert.IsTrue(task1.IsCompleted);
Assert.IsTrue(task2.IsCompleted);
Assert.IsTrue(task3.IsCompleted);
Assert.IsTrue(task4.IsCompleted);
}
private TBF.Rig.Network.Camera.CJMS11.Camera GetCamera(string ip)
{
Factory factory = new Factory();
CameraCfg config = new CameraCfg("CameraJMS", factory);
config.IPAddressCJMS = ip;
TBF.Rig.Network.Adapter.Factory factoryNetadapter = new TBF.Rig.Network.Adapter.Factory();
IComponentCfg configNetadapter = new TBF.Rig.Network.Adapter.NetadapterCfg("Network.Adapter", factoryNetadapter);
IList<IComponent> components = new List<IComponent>();
IComponent netAdapter = factoryNetadapter.GetComponent(configNetadapter, null);
components.Add(netAdapter);
return new TBF.Rig.Network.Camera.CJMS11.Camera(config, components);
}
}
}
@@ -0,0 +1,128 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Reflection;
using JetBrains.Annotations;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
using Results;
using TBF.Rig.GenericDevices;
using TBF.Rig.Output.FileWriters.Enhanced;
using TBF.Rig.Sequences;
namespace TBFTests.Rig.Output.FileWriters.Enhanced
{
[TestClass]
[TestSubject(typeof(Writer))]
public class WriterTest
{
[TestInitialize]
public void Setup()
{
// Mock IBenchInfo and assign it to static field
var mockBenchInfo = new Mock<IBenchInfo>();
// Optional: Setup mock behavior if GetName or similar is used
mockBenchInfo.Setup(b => b.TestBenchName).Returns("TestBench");
mockBenchInfo.Setup(b => b.TestBenchId).Returns(1);
ProcessData.BenchInfo = mockBenchInfo.Object;
}
[TestCleanup]
public void Cleanup()
{
// Clean up the static reference
ProcessData.BenchInfo = null;
}
[TestMethod]
public void GetFilenameTest()
{
FactorySingle factory = new FactorySingle();
WriterCfg defaultConfig = factory.DefaultConfig() as WriterCfg;
string dateFormat = "yyMMdd-HHmm";
defaultConfig.FileNameFormat = $"{{5:{dateFormat}}}.txt";
Writer writer = new Writer( defaultConfig);
Results.Entities.Batch batch = new Results.Entities.Batch();
DateTime time = DateTime.Now;
batch.EndTime = time;
string filename = writer.GetFilename("C:\\TBF\\Results\\", batch, time);
// Assert
Assert.IsNotNull(filename, "Filename should not be null.");
Assert.IsTrue(filename.StartsWith("C:\\TBF\\Results\\"), "Filename should start with base path.");
//test extension
Assert.IsTrue(filename.EndsWith(".txt") , "Filename should have correct extension.");
//test path - Format path like \2025\7\28\
string path = $@"\{time.Year}\{time.Month}\{time.Day}\";
Assert.IsTrue( filename.Contains(path));
//test file name
string expected = string.Format($"{{0:{dateFormat}}}.txt", time);
Assert.IsTrue( filename.Contains(expected));
}
[TestMethod]
public void WriteRsltsExTest()
{
FactorySingle factory = new FactorySingle();
WriterCfg defaultConfig = factory.DefaultConfig() as WriterCfg;
string dateFormat = "yyMMdd-HHmm";
defaultConfig.FileNameFormat = $"{{5:{dateFormat}}}.txt";
defaultConfig.Header = "Header :)";
Writer writer = new Writer( defaultConfig);
var field = typeof(Writer).GetField("commonItems", BindingFlags.NonPublic | BindingFlags.Instance);
var fieldHeader = typeof(Writer).GetField("header", BindingFlags.NonPublic | BindingFlags.Instance);
fieldHeader?.SetValue(writer, defaultConfig.Header);
var mockList = new List<Results.WMeterRsltItemSpec>
{
new WMeterRsltItemSpec (ItemID.Batch_end_time, "End", null,Common.Quantity.DateTime, Common.ItemCategory.Other, null)
};
mockList[0].Caption = "Date and time";
string formatCommonTime = "yyyy.MM.dd HH:mm";
mockList[0].Format = $"{{0:{formatCommonTime}}}";
field?.SetValue(writer, mockList);
Results.Entities.Batch batch = new Results.Entities.Batch();
DateTime time = DateTime.Now;
batch.EndTime = time;
using (var memStream = new MemoryStream())
using (var writerStream = new StreamWriter(memStream))
{
writer.WriteRsltsEx(batch, writerStream, time);
writerStream.Flush();
// Get the actual content
memStream.Position = 0;
using (var reader = new StreamReader(memStream))
{
string content = reader.ReadToEnd();
// Assert on the actual content
Assert.IsNotNull(content);
Assert.IsTrue(content.Contains(defaultConfig.Header));
Assert.IsTrue(content.Contains("Date and time"));
string expectedCommonTime = string.Format($"{{0:{formatCommonTime}}}", time);
Assert.IsTrue(content.Contains(expectedCommonTime));
}
}
}
}
}
+9 -2
View File
@@ -67,7 +67,6 @@
<HintPath>..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll</HintPath>
</Reference>
<Reference Include="System.Configuration" />
<Reference Include="System.Drawing" />
<Reference Include="System.Memory, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Memory.4.5.4\lib\net461\System.Memory.dll</HintPath>
</Reference>
@@ -98,19 +97,27 @@
<ItemGroup>
<Compile Include="Entities\MeasurementCorrectionTest.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Rig\Network\Camera\CJMS11\CameraTest.cs" />
<Compile Include="Rig\Network\Camera\KeyenceIV3G120\CameraTest.cs" />
<Compile Include="Rig\Network\Camera\RoiForFixedStartKeyence\RoiTest.cs" />
<Compile Include="Rig\Output\FileWriters\Enhanced\WriterTest.cs" />
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Common\Common.csproj">
<Project>{c8939821-ba5c-4988-a3d0-bf53b74865c7}</Project>
<Name>Common</Name>
</ProjectReference>
<ProjectReference Include="..\Config\Config.csproj">
<Project>{743df7db-c7b6-42eb-986d-0f485e5588e4}</Project>
<Name>Config</Name>
</ProjectReference>
<ProjectReference Include="..\Results\Results.csproj">
<Project>{9d0dcc88-dc81-47eb-9fdd-4c3907871bfb}</Project>
<Name>Results</Name>
</ProjectReference>
<ProjectReference Include="..\TBF\TBF.csproj">
<Project>{8648FD92-CDA1-4C3A-B5F9-FE547CE1FA48}</Project>
<Name>TBF</Name>
@@ -1 +1 @@
69f23eacab403116d7219ae1fde63fb58e91aa28cdb1c4d6eab448a5818f9791
68e639b7d1208407db910dc07789c52f1b741d3e7568e2b914f7e7dfab2a0520
@@ -1 +1 @@
488d44735d3adcc07a0f148fe64d6d1ded107efd14e4fcb2d5d2378975a086a0
b13140660214e1b48c9021e6f280ff951d16dd2027d403736b09a76cec69aa43
+1 -1
View File
@@ -49,7 +49,7 @@ namespace ToFirstMonitor
LeftToFirstMonitor(ref ls.EnduranceDlgLeft);
ls.Save();
Console.WriteLine(@"All windows were shifted to the first monitor");
Console.WriteLine("All windows were shifted to the first monitor");
Console.ReadLine();
return;
}
+1 -1
View File
@@ -49,7 +49,7 @@ namespace ToSecondMonitor
LeftToSecondMonitor(ref ls.EnduranceDlgLeft);
ls.Save();
Console.WriteLine(@"All windows were shifted to the second monitor");
Console.WriteLine("All windows were shifted to the second monitor");
Console.ReadLine();
return;
}