Compare commits

..
94 changed files with 5232 additions and 160568 deletions
+21 -1
View File
@@ -11,7 +11,27 @@
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Xylem.Common.CommonCore" publicKeyToken="null" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.8.18.17954" newVersion="2.8.18.17954" />
<bindingRedirect oldVersion="0.0.0.0-2.8.18.11157" newVersion="2.8.18.11157" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Xylem.Common.CommonCore.Configuration" publicKeyToken="null" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.8.18.11158" newVersion="2.8.18.11158" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Xylem.Common.Hardware.Interfaces.Ports.PortCore" publicKeyToken="null" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.8.18.11158" newVersion="2.8.18.11158" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Xylem.Common.Logic.SoftwareAccessHelper" publicKeyToken="null" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.8.18.11158" newVersion="2.8.18.11158" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Xylem.Common.Utils.Crc16Ccitt" publicKeyToken="null" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.8.18.11158" newVersion="2.8.18.11158" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Xylem.Common.Utils.Logging" publicKeyToken="null" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.8.18.11158" newVersion="2.8.18.11158" />
</dependentAssembly>
</assemblyBinding>
</runtime>
@@ -14,7 +14,7 @@
"Name": "MeterLoginPasswords",
"Type": "LocalDatabase",
"DataSource": "Server=(localdb)\\MojaDB;Database=UnionTownCalibAndSkeleton;Integrated Security=True;",
"DataSource": "Server=LBUMI_23\\MSSQLSERVER01; Database=TestGenesisReader; Integrated Security=True;",
"QueryTemplate": "SELECT [Password] FROM [dbo].[SkeletonKeys] WHERE [PcbId] = QUERYPARAM"
},
@@ -42,7 +42,7 @@
<HintPath>..\packages\Common\Logic.ProductionToProductMapper.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
<HintPath>..\packages\Newtonsoft.Json.13.0.4\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
<HintPath>..\packages\NLog.5.2.2\lib\net46\NLog.dll</HintPath>
+1 -1
View File
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Newtonsoft.Json" version="13.0.3" targetFramework="net48" />
<package id="Newtonsoft.Json" version="13.0.4" targetFramework="net48" />
<package id="NLog" version="5.2.2" targetFramework="net48" />
</packages>
+1 -1
View File
@@ -23,7 +23,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="12.0.2" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
<PackageReference Include="System.IO.Ports" Version="10.0.0-rc.1.25451.107" />
<PackageReference Include="System.Security.Cryptography.Cng" Version="5.0.0" />
<PackageReference Include="System.Threading" Version="4.3.0" />
+2 -2
View File
@@ -32,8 +32,8 @@
<PlatformTarget>x86</PlatformTarget>
</PropertyGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.12.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.13.0.4\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
+1 -1
View File
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Newtonsoft.Json" version="12.0.2" targetFramework="net472" />
<package id="Newtonsoft.Json" version="13.0.4" targetFramework="net48" />
</packages>
+2 -2
View File
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// Build Number
// Revision
//
[assembly: AssemblyVersion("3.9.3130.0")]
[assembly: AssemblyFileVersion("3.9.3130.0")]
[assembly: AssemblyVersion("3.9.3135.0")]
[assembly: AssemblyFileVersion("3.9.3135.0")]
+18
View File
@@ -1427,6 +1427,15 @@ namespace TBF.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Delay between pictures.
/// </summary>
internal static string DelaySendImage {
get {
return ResourceManager.GetString("DelaySendImage", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Density.
/// </summary>
@@ -3839,6 +3848,15 @@ namespace TBF.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Pictures Count.
/// </summary>
internal static string PictureCouts {
get {
return ResourceManager.GetString("PictureCouts", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to PID.
/// </summary>
+6
View File
@@ -543,6 +543,12 @@
<data name="PulsesPerLtr" xml:space="preserve">
<value>Pulses per liter</value>
</data>
<data name="DelaySendImage" xml:space="preserve">
<value>Delay between pictures</value>
</data>
<data name="PictureCouts" xml:space="preserve">
<value>Pictures Count</value>
</data>
<data name="Component" xml:space="preserve">
<value>Component</value>
</data>
@@ -6,6 +6,7 @@ using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
using System.Threading;
using System.Windows.Forms;
using log4net;
@@ -70,6 +71,9 @@ namespace TBF.Rig.DataEntry.StandartCameraPurchaseOrder
int lastWmNr1;
Bitmap lastImage; /// non-zoomed image
Bitmap zoomedImage;
private readonly List<string> currentImageGroup = new List<string>();//multiple pictures
private int currentImageGroupIndex;
private bool mouseOverPictureBox;
Thread imageProcessingThread; /// Thread to process images
public delegate void OcrTextObtainedDelegate(int ix, bool isEnd, string text);
@@ -96,6 +100,12 @@ namespace TBF.Rig.DataEntry.StandartCameraPurchaseOrder
public TestStartEndForm()
{
InitializeComponent();
KeyPreview = true;
pictureBox1.MouseWheel += pictureBox1_MouseWheel;
pictureBox1.MouseEnter += pictureBox1_MouseEnter;
pictureBox1.MouseLeave += pictureBox1_MouseLeave;
this.Icon = Properties.Resources.TBF_icon;
@@ -483,15 +493,46 @@ namespace TBF.Rig.DataEntry.StandartCameraPurchaseOrder
startTextBoxes[i].TextChanged += new System.EventHandler(this.startTextBoxX_TextChanged);
startTextBoxes[i].KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.startTextBoxX_KeyPress);
startTextBoxes[i].MouseDown += new System.Windows.Forms.MouseEventHandler(this.startTextBoxX_MouseDown);
startTextBoxes[i].Enter += startTextBoxX_Enter;
}
private void startTextBoxX_Enter(object sender, EventArgs e)
{
var textBox = sender as TextBox;
if (textBox == null) { return; }
int physPos = PhysPos(textBox, startTextBoxes);
if (physPos >= 0)
{
LoadImage(sender, Tst.Start, physPos);
}
}
private void EndTextBox_EnableHanders(int i)
{
endTextBoxes[i].AcceptsTabChanged += new System.EventHandler(this.endTextBoxX_AcceptsTabChanged);
endTextBoxes[i].TextChanged += new System.EventHandler(this.endTextBoxX_TextChanged);
endTextBoxes[i].KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.endTextBoxX_KeyPress);
endTextBoxes[i].MouseDown += new System.Windows.Forms.MouseEventHandler(this.endTextBoxX_AcceptsTabChanged);
endTextBoxes[i].Enter += endTextBoxX_Enter;
}
private void endTextBoxX_Enter(object sender, EventArgs e)
{
var textBox = sender as TextBox;
if (textBox == null) { return; }
int physPos = PhysPos(textBox, endTextBoxes);
if (physPos >= 0)
{
LoadImage(sender, Tst.End, physPos);
}
}
private void TestStartEndForm_FormClosed(object sender, FormClosedEventArgs e)
{
@@ -763,7 +804,7 @@ namespace TBF.Rig.DataEntry.StandartCameraPurchaseOrder
TextBox clickedTextBox = sender as TextBox;
if (clickedTextBox != null)
{
var physPos = PhysPos(clickedTextBox, startTextBoxes);
var physPos = PhysPos(clickedTextBox, endTextBoxes);//startTextBoxes);
if (physPos < 0)
{
@@ -1069,7 +1110,7 @@ namespace TBF.Rig.DataEntry.StandartCameraPurchaseOrder
TextBox clickedTextBox = sender as TextBox;
if (clickedTextBox != null)
{
var physPos = PhysPos(clickedTextBox, startTextBoxes);
var physPos = PhysPos(clickedTextBox, endTextBoxes);//startTextBoxes);
if (physPos < 0)
{
@@ -1134,65 +1175,479 @@ namespace TBF.Rig.DataEntry.StandartCameraPurchaseOrder
/// </summary>
/// <param name="startOrEnd">Tst.Start or Tst.End</param>
/// <param name="physPos">0..23</param>
void LoadImage(object sender, Tst startOrEnd, int physPos)
{
int wmNr1b = phys2wm[physPos]; /// 0 means no WM
if (wmNr1b <= 0) return;
void LoadImage( object sender, Tst startOrEnd, int physPos)
{
if (physPos < 0 || physPos >= phys2wm.Length)
{
return;
}
wmNr0b = wmNr1b - 1;
int wmNr1b = phys2wm[physPos];
string imageFileName;
if (startOrEnd == Tst.Start && startImages[wmNr0b] != null)
imageFileName = startImages[wmNr0b];
else if (startOrEnd == Tst.End && endImages[wmNr0b] != null)
imageFileName = endImages[wmNr0b];
else
imageFileName = string.Empty;
// Hodnota 0 znamená, že na tejto fyzickej pozícii nie je vodomer.
if (wmNr1b <= 0)
{
return;
}
if (imageFileName == lastImageName)
{
return;
}
wmNr0b = wmNr1b - 1;
lastImageName = imageFileName;
lastWmNr1 = wmNr1b;
string imageFileName = GetBaseImageFileName(
startOrEnd,
wmNr0b);
if (string.IsNullOrEmpty(imageFileName) || !File.Exists(imageFileName))
{
lastImage = null;
}
else
{
using (Bitmap tempBmp = Image.FromFile(imageFileName) as Bitmap)
lastWmNr1 = wmNr1b;
if (string.IsNullOrWhiteSpace(imageFileName))
{
ClearImageGroup();
LoadImageFile(null);
return;
}
/*
* Ak používateľ zvolil iný vodomer alebo Start/End obrázok,
* vytvoríme novú skupinu:
*
* TestAdvance-1-start.bmp
* TestAdvance-1-start_img01_....bmp
* TestAdvance-1-start_img02_....bmp
*/
if (!string.Equals(
imageFileName,
lastImageName,
StringComparison.OrdinalIgnoreCase))
{
lastImageName = imageFileName;
LoadImageGroup(imageFileName);
// Pôvodný kompatibilný obrázok bude zobrazený ako prvý.
currentImageGroupIndex = 0;
}
else
{
/*
* Súbory mohli vzniknúť až po prvom otvorení dialógu,
* preto skupinu pri opätovnom výbere obnovíme.
*/
RefreshCurrentImageGroup();
}
if (currentImageGroup.Count == 0)
{
LoadImageFile(null);
return;
}
currentImageGroupIndex = Math.Max(
0,
Math.Min(
currentImageGroupIndex,
currentImageGroup.Count - 1));
LoadImageFile(
currentImageGroup[currentImageGroupIndex]);
}
/// <summary>
/// base name of image file
/// </summary>
/// <param name="startOrEnd"></param>
/// <param name="waterMeterIndex"></param>
/// <returns></returns>
private string GetBaseImageFileName(
Tst startOrEnd,
int waterMeterIndex)
{
if (waterMeterIndex < 0 ||
waterMeterIndex >= WaterMetersCount)
{
return null;
}
if (startOrEnd == Tst.Start)
{
if (startImages == null ||
waterMeterIndex >= startImages.Length)
{
Rectangle rect;
if (tempBmp.Height < tempBmp.Width)
return null;
}
return startImages[waterMeterIndex];
}
if (startOrEnd == Tst.End)
{
if (endImages == null ||
waterMeterIndex >= endImages.Length)
{
return null;
}
return endImages[waterMeterIndex];
}
return null;
}
/// <summary>
/// load group of images
/// </summary>
/// <param name="baseImageFileName"></param>
private void LoadImageGroup(
string baseImageFileName)
{
currentImageGroup.Clear();
currentImageGroupIndex = 0;
if (string.IsNullOrWhiteSpace(baseImageFileName))
{
return;
}
string fullBaseFileName;
try
{
fullBaseFileName =
Path.GetFullPath(baseImageFileName);
}
catch (Exception exc)
{
log.Warn(
$"Cannot create image group from invalid path: " +
$"file='{baseImageFileName}', " +
$"error={exc.Message}");
return;
}
string directory =
Path.GetDirectoryName(fullBaseFileName);
string baseName =
Path.GetFileNameWithoutExtension(fullBaseFileName);
string extension =
Path.GetExtension(fullBaseFileName);
if (string.IsNullOrWhiteSpace(directory) ||
string.IsNullOrWhiteSpace(baseName))
{
return;
}
/*
* Pôvodný obrázok pridáme ako prvý.
*/
if (File.Exists(fullBaseFileName))
{
currentImageGroup.Add(fullBaseFileName);
}
if (!Directory.Exists(directory))
{
return;
}
string searchPattern =
$"{baseName}_img*{extension}";
try
{
List<string> timedImages =
Directory
.GetFiles(
directory,
searchPattern,
SearchOption.TopDirectoryOnly)
.OrderBy(GetTimedImageIndex)
.ThenBy(
fileName => fileName,
StringComparer.OrdinalIgnoreCase)
.ToList();
foreach (string timedImage in timedImages)
{
if (!currentImageGroup.Contains(
timedImage,
StringComparer.OrdinalIgnoreCase))
{
int hght = tempBmp.Height;
int leftMargin = (tempBmp.Width - hght) / 2;
rect = new Rectangle(leftMargin, 0, hght, hght);
}
else
{
int hght = tempBmp.Height;
int wdth = tempBmp.Width;
int margin = (hght - wdth) / 2;
rect = new Rectangle(0, margin, wdth, wdth);
}
//int hght = tempBmp.Height;
//int leftMargin = (tempBmp.Width - hght) / 2;
//lastImage = new Bitmap(tempBmp.Clone(new Rectangle(leftMargin, 0, hght, hght), tempBmp.PixelFormat));
lastImage = new Bitmap(tempBmp.Clone(rect, tempBmp.PixelFormat));
if (isZoomed[wmNr0b])
{
zoomedImage = MakeZoomedImage(lastImage, zoomCenterLoc[wmNr0b]);
currentImageGroup.Add(timedImage);
}
}
}
ShowImage();
}
log.Debug(
$"Image group loaded: " +
$"baseFile='{fullBaseFileName}', " +
$"searchPattern='{searchPattern}', " +
$"imagesCount={currentImageGroup.Count}");
}
catch (Exception exc)
{
log.Warn(
$"Cannot load image group: " +
$"baseFile='{fullBaseFileName}', " +
$"pattern='{searchPattern}', " +
$"error={exc.Message}");
}
}
/// <summary>
/// grouping by time
/// </summary>
/// <param name="fileName"></param>
/// <returns></returns>
private static int GetTimedImageIndex(
string fileName)
{
if (string.IsNullOrWhiteSpace(fileName))
{
return int.MaxValue;
}
string nameWithoutExtension =
Path.GetFileNameWithoutExtension(fileName);
Match match = Regex.Match(
nameWithoutExtension,
@"_img(?<index>\d+)_",
RegexOptions.IgnoreCase);
if (!match.Success)
{
return int.MaxValue;
}
int imageIndex;
return int.TryParse(
match.Groups["index"].Value,
out imageIndex)
? imageIndex
: int.MaxValue;
}
/// <summary>
/// refreshing current image group
/// </summary>
private void RefreshCurrentImageGroup()
{
if (string.IsNullOrWhiteSpace(lastImageName))
{
return;
}
string currentlySelectedFile =
currentImageGroupIndex >= 0 &&
currentImageGroupIndex < currentImageGroup.Count
? currentImageGroup[currentImageGroupIndex]
: null;
LoadImageGroup(lastImageName);
if (string.IsNullOrWhiteSpace(currentlySelectedFile))
{
return;
}
int restoredIndex =
currentImageGroup.FindIndex(
fileName =>
string.Equals(
fileName,
currentlySelectedFile,
StringComparison.OrdinalIgnoreCase));
if (restoredIndex >= 0)
{
currentImageGroupIndex = restoredIndex;
}
}
/// --- picture load ---
private void LoadImageFile(
string imageFileName)
{
DisposeLoadedImages();
if (string.IsNullOrWhiteSpace(imageFileName) ||
!File.Exists(imageFileName))
{
log.Debug(
$"Image cannot be displayed because the file does not exist: " +
$"file='{imageFileName}'");
ShowImage();
return;
}
try
{
using (var tempBmp =
new Bitmap(imageFileName))
{
Rectangle rect =
CreateSquareCropRectangle(tempBmp);
using (Bitmap croppedImage =
tempBmp.Clone(
rect,
tempBmp.PixelFormat))
{
lastImage =
new Bitmap(croppedImage);
}
}
if (isZoomed[wmNr0b])
{
zoomedImage =
MakeZoomedImage(
lastImage,
zoomCenterLoc[wmNr0b]);
}
log.Debug(
$"Image displayed from group: " +
$"waterMeter={lastWmNr1}, " +
$"groupIndex={currentImageGroupIndex + 1}/" +
$"{currentImageGroup.Count}, " +
$"file='{imageFileName}'");
}
catch (Exception exc)
{
log.Error(
$"Cannot load image: " +
$"file='{imageFileName}', " +
$"error={exc.Message}",
exc);
DisposeLoadedImages();
}
ShowImage();
}
/// --- block picture Crop help method ---
private static Rectangle CreateSquareCropRectangle( Bitmap bitmap)
{
int size = Math.Min( bitmap.Width, bitmap.Height);
int x = (bitmap.Width - size) / 2;
int y = (bitmap.Height - size) / 2;
return new Rectangle( x, y, size, size);
}
// --- block release old pictures ---
private void DisposeLoadedImages()
{
if (lastImage != null)
{
lastImage.Dispose();
lastImage = null;
}
if (zoomedImage != null)
{
zoomedImage.Dispose();
zoomedImage = null;
}
}
private void ClearImageGroup()
{
currentImageGroup.Clear();
currentImageGroupIndex = 0;
lastImageName = null;
}
// --- block picture exchange ---
private void ShowPreviousImageFromGroup()
{
ShowImageFromGroup(-1);
}
private void ShowNextImageFromGroup()
{
ShowImageFromGroup(1);
}
private void ShowImageFromGroup(
int direction)
{
if (direction == 0 ||
currentImageGroup.Count <= 1)
{
return;
}
int newIndex =
currentImageGroupIndex + direction;
/*
* Cyklické prepínanie:
*
* posledný -> prvý
* prvý -> posledný
*/
if (newIndex < 0)
{
newIndex =
currentImageGroup.Count - 1;
}
else if (newIndex >= currentImageGroup.Count)
{
newIndex = 0;
}
currentImageGroupIndex = newIndex;
LoadImageFile(
currentImageGroup[currentImageGroupIndex]);
}
// --- mouse events ---
private void pictureBox1_MouseEnter(
object sender,
EventArgs e)
{
mouseOverPictureBox = true;
/*
* PictureBox štandardne nemusí mať focus.
* Focus pomôže zachytiť klávesy aj koliesko.
*/
pictureBox1.Focus();
}
private void pictureBox1_MouseLeave(
object sender,
EventArgs e)
{
mouseOverPictureBox = false;
}
private void pictureBox1_MouseWheel(
object sender,
MouseEventArgs e)
{
if (!mouseOverPictureBox ||
currentImageGroup.Count <= 1)
{
return;
}
if (e.Delta > 0)
{
ShowPreviousImageFromGroup();
}
else if (e.Delta < 0)
{
ShowNextImageFromGroup();
}
}
/// <summary>
/// Left click = Zoom, Right click = Unzoom
@@ -1276,7 +1731,9 @@ namespace TBF.Rig.DataEntry.StandartCameraPurchaseOrder
{
if (lastImage == null)
{
Image previousImage = pictureBox1.Image;
pictureBox1.Image = new Bitmap(TBF.Properties.Resources.Empty);
previousImage?.Dispose();
return;
}
@@ -1312,10 +1769,108 @@ namespace TBF.Rig.DataEntry.StandartCameraPurchaseOrder
Brush brush = (brightness > 160) ? darkBrush : lightBrush;
grph.DrawString(lastWmNr1.ToString(), font, brush, margin, margin);
DrawImageInfo(grph, tempBmp);
}
Image oldPictureBoxImage = pictureBox1.Image;
pictureBox1.Image = tempBmp;
oldPictureBoxImage?.Dispose();
}
private void DrawImageInfo( Graphics graphics, Bitmap bitmap)
{
if (graphics == null)
{
throw new ArgumentNullException(nameof(graphics));
}
if (bitmap == null)
{
throw new ArgumentNullException(nameof(bitmap));
}
string currentImageFileName = GetCurrentImageFileName();
if (string.IsNullOrWhiteSpace(currentImageFileName))
{
return;
}
string fileName = Path.GetFileName(currentImageFileName);
string displayText = fileName;
Match match = Regex.Match( fileName, @"_img(?<index>\d+)_(?<date>\d{8})_(?<time>\d{6})_(?<ms>\d{3})", RegexOptions.IgnoreCase);
if (match.Success)
{
string imageIndex = match.Groups["index"].Value;
string date = match.Groups["date"].Value;
string time = match.Groups["time"].Value;
string milliseconds = match.Groups["ms"].Value;
string formattedDate =
$"{date.Substring(6, 2)}." +
$"{date.Substring(4, 2)}." +
$"{date.Substring(0, 4)}";
string formattedTime =
$"{time.Substring(0, 2)}:" +
$"{time.Substring(2, 2)}:" +
$"{time.Substring(4, 2)}." +
milliseconds;
string baseFileName =
Regex.Replace(
fileName,
@"_img\d+_\d{8}_\d{6}_\d{3}",
string.Empty,
RegexOptions.IgnoreCase);
displayText =
$"{baseFileName} [img{imageIndex}]" +
Environment.NewLine +
$"{formattedDate} {formattedTime}";
}
using (Font font = new Font( "Arial", isZoomed[wmNr0b] ? 8 : 10, FontStyle.Bold))
{
SizeF textSize =
graphics.MeasureString(
displayText,
font);
float margin = 5;
float x = bitmap.Width - textSize.Width - margin;
float y = bitmap.Height - textSize.Height - margin;
graphics.DrawString( displayText, font, Brushes.Black, x + 1, y + 1);
graphics.DrawString( displayText, font, Brushes.White, x, y);
}
}
private string GetCurrentImageFileName()
{
if (currentImageGroup == null ||
currentImageGroup.Count == 0)
{
return lastImageName;
}
if (currentImageGroupIndex < 0 ||
currentImageGroupIndex >= currentImageGroup.Count)
{
return lastImageName;
}
return currentImageGroup[currentImageGroupIndex];
}
private void checkBoxEnableStartBox_CheckStateChanged(object sender, EventArgs e)
@@ -1345,5 +1900,35 @@ namespace TBF.Rig.DataEntry.StandartCameraPurchaseOrder
}
}
}
//Page Down/Up evenst
protected override bool ProcessCmdKey(
ref Message msg,
Keys keyData)
{
if (mouseOverPictureBox &&
currentImageGroup.Count > 1)
{
if (keyData == Keys.PageUp)
{
ShowPreviousImageFromGroup();
return true;
}
if (keyData == Keys.PageDown)
{
ShowNextImageFromGroup();
return true;
}
}
return base.ProcessCmdKey(
ref msg,
keyData);
}
}
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,154 @@
using System;
using System.IO;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace TBF.Rig.Network.Camera.CJMS11
{
internal sealed class CameraLineReader
{
private readonly Stream stream;
private readonly byte[] receiveBuffer;
private int bufferStart;
private int bufferEnd;
public CameraLineReader(
Stream stream,
int bufferSize = 64 * 1024)
{
if (stream == null)
throw new ArgumentNullException(nameof(stream));
if (!stream.CanRead)
throw new ArgumentException(
"Stream must be readable.",
nameof(stream));
if (bufferSize <= 0)
throw new ArgumentOutOfRangeException(
nameof(bufferSize));
this.stream = stream;
receiveBuffer = new byte[bufferSize];
}
public async Task<string> ReadLineAsync(
int timeoutMs,
CancellationToken cancellationToken)
{
if (timeoutMs <= 0)
throw new ArgumentOutOfRangeException(
nameof(timeoutMs));
using (var lineBuffer = new MemoryStream())
{
while (true)
{
int newLineIndex = FindNewLine();
if (newLineIndex >= 0)
{
int count = newLineIndex - bufferStart;
if (count > 0)
{
lineBuffer.Write(
receiveBuffer,
bufferStart,
count);
}
bufferStart = newLineIndex + 1;
return ConvertLineToString(lineBuffer);
}
if (bufferStart < bufferEnd)
{
lineBuffer.Write(
receiveBuffer,
bufferStart,
bufferEnd - bufferStart);
}
bufferStart = 0;
bufferEnd = 0;
int read = await ReadChunkAsync(
timeoutMs,
cancellationToken)
.ConfigureAwait(false);
if (read == 0)
{
throw new IOException(
"Camera connection was closed.");
}
bufferStart = 0;
bufferEnd = read;
}
}
}
private int FindNewLine()
{
for (int i = bufferStart; i < bufferEnd; i++)
{
if (receiveBuffer[i] == (byte)'\n')
return i;
}
return -1;
}
private async Task<int> ReadChunkAsync(
int timeoutMs,
CancellationToken cancellationToken)
{
using (var timeoutCts =
CancellationTokenSource.CreateLinkedTokenSource(
cancellationToken))
{
timeoutCts.CancelAfter(timeoutMs);
try
{
return await stream.ReadAsync(
receiveBuffer,
0,
receiveBuffer.Length,
timeoutCts.Token)
.ConfigureAwait(false);
}
catch (OperationCanceledException)
when (!cancellationToken.IsCancellationRequested)
{
throw new TimeoutException(
$"Camera read timeout after {timeoutMs} ms.");
}
}
}
private static string ConvertLineToString(
MemoryStream lineBuffer)
{
int length = checked((int)lineBuffer.Length);
if (length == 0)
return string.Empty;
byte[] data = lineBuffer.GetBuffer();
if (data[length - 1] == (byte)'\r')
length--;
return Encoding.ASCII.GetString(
data,
0,
length);
}
}
}
File diff suppressed because it is too large Load Diff
@@ -1,3 +1,4 @@
using System;
using TBF.Rig.Network.Camera.CJMS11.POJO;
namespace TBF.Rig.Network.Camera.CJMS11
@@ -11,6 +12,7 @@ namespace TBF.Rig.Network.Camera.CJMS11
private string orig_status;
private string orig_command;
private string orig_payload;
private DateTime timeStamp;
public POJO.MessageStatus Status
{
@@ -35,6 +37,12 @@ namespace TBF.Rig.Network.Camera.CJMS11
public string OrigCommand => orig_command;
public string OrigPayload => orig_payload;
public DateTime TimeStamp
{
get => timeStamp;
set => timeStamp = value;
}
public JmsMessage(string status, string command, string payload)
{
+41 -14
View File
@@ -1,6 +1,7 @@
using System;
using System.Text.RegularExpressions;
using log4net;
using Newtonsoft.Json;
using TBF.Rig.Network.Camera.CJMS11.POJO;
namespace TBF.Rig.Network.Camera.CJMS11
@@ -44,6 +45,16 @@ namespace TBF.Rig.Network.Camera.CJMS11
if (message.Length < 1) return false;
this.jmsMessage = JmsMessageFromString(message);
try
{
CameraResponse response =
JsonConvert.DeserializeObject<CameraResponse>(jmsMessage.Payload);
jmsMessage.TimeStamp = response.timeStamp;
}catch(Exception e)
{
log.Debug("Error parsing message timestamp: " + e.Message);
}
return true;
}
@@ -70,23 +81,39 @@ namespace TBF.Rig.Network.Camera.CJMS11
return null;
}
public static ParsedImage ImageParser(string payloadImage)
public static ParsedImage ImageParser(
string payloadImage)
{
// Equivalent regex pattern
var imagePattern = new Regex(@"IMAGE:([A-Z0-9_]+):\s*(.*?)\s*~IMAGE_END", RegexOptions.Singleline);
const string prefix = "IMAGE:";
const string endMarker = "~IMAGE_END";
var match = imagePattern.Match(payloadImage);
if (match.Success)
{
string encoding = match.Groups[1].Value;
string imageData = match.Groups[2].Value;
int prefixIndex = payloadImage.IndexOf( prefix, StringComparison.Ordinal);
if (prefixIndex < 0)
throw new ArgumentException( "IMAGE prefix was not found.");
return new ParsedImage(ImageTypeEnum.GetCommandM(encoding), imageData);
}
else
{
throw new ArgumentException($"Payload does not match expected image format: {payloadImage}");
}
int encodingStart =
prefixIndex + prefix.Length;
int encodingEnd =
payloadImage.IndexOf(
':',
encodingStart);
if (encodingEnd < 0)
throw new ArgumentException(
"Image encoding separator was not found.");
int dataStart = encodingEnd + 1;
int dataEnd = payloadImage.IndexOf( endMarker, dataStart, StringComparison.Ordinal);
if (dataEnd < 0)
throw new ArgumentException( "IMAGE_END marker was not found.");
string encoding = payloadImage .Substring( encodingStart, encodingEnd - encodingStart) .Trim();
string imageData = payloadImage.Substring( dataStart,dataEnd - dataStart).Trim();
return new ParsedImage( ImageTypeEnum.GetCommandM(encoding), imageData);
}
public override string ToString()
@@ -0,0 +1,12 @@
using System;
namespace TBF.Rig.Network.Camera.CJMS11.POJO
{
public class CameraResponse
{
public string message { get; set; }
public DateTime timeStamp { get; set; }
}
}
@@ -0,0 +1,37 @@
using Newtonsoft.Json;
namespace TBF.Rig.Network.Camera.CJMS11.POJO
{
public class SendImagePayload
{
[JsonProperty("frameGap")]
public int FrameGap { get; set; }
[JsonProperty("frameTime")]
public string FrameTime { get; set; }
[JsonProperty("frameTimeMillis")]
public long FrameTimeMillis { get; set; }
[JsonProperty("pictureBase64")]
public string PictureBase64 { get; set; }
[JsonProperty("picturesComplete")]
public int PicturesComplete { get; set; }
[JsonProperty("status")]
public string Status { get; set; }
[JsonProperty("taskId")]
public string TaskId { get; set; }
[JsonProperty("taskPath")]
public string TaskPath { get; set; }
[JsonProperty("taskTime")]
public string TaskTime { get; set; }
[JsonProperty("workerId")]
public int WorkerId { get; set; }
}
}
@@ -0,0 +1,16 @@
using Newtonsoft.Json;
namespace TBF.Rig.Network.Camera.CJMS11.POJO
{
public class SendImagesRequest
{
[JsonProperty("count")]
public int Count { get; set; }
[JsonProperty("delay")]
public int Delay { get; set; }
[JsonProperty("taskId")]
public string TaskId { get; set; }
}
}
@@ -0,0 +1,16 @@
using Newtonsoft.Json;
namespace TBF.Rig.Network.Camera.CJMS11.POJO
{
public class SendSummaryPayload
{
[JsonProperty("delay")]
public int Delay { get; set; }
[JsonProperty("pic_count")]
public int PictureCount { get; set; }
[JsonProperty("timeStamp")]
public string TimeStamp { get; set; }
}
}
@@ -0,0 +1,20 @@
using System;
using System.Drawing;
namespace TBF.Rig.Network.Camera.CJMS11.POJO
{
public class TimedCameraImage
{
public int Index { get; set; }
public string TaskId { get; set; }
public DateTimeOffset? FrameTime { get; set; }
public long FrameTimeMillis { get; set; }
public int FrameGap { get; set; }
public Image Image { get; set; }
}
}
@@ -20,17 +20,36 @@ namespace TBF.Rig.Network.Camera.RoiForFixedStartCJMS11
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;
}
///PulsePerMeter [l^-1]
public double PulsesPerLtr;
/// <summary>
/// delta time gap for send parameter
/// </summary>
/// <description>delta time for send parameter 500ms is minimum</description>
public int RoiDeltaTimeMs;
/// <summary>
/// count of picture for send > 1 / grabImage == 0|1 parameter - switch method
/// </summary>
/// <description>count of picture for send > 1 / grabImage == 0|1 parameter - switch method</description>
public int RoiPicCount;
string[] paramNames = new string[]
{
Strings.PulsesPerLtr,
Strings.PictureCouts,
Strings.DelaySendImage,
};
public override void InitializeAll()
{
PulsesPerLtr = 1.0;
RoiPicCount = 1; //default value 1 => grab Image
RoiDeltaTimeMs = 500; //delta time for send parameter 500ms is minimum
}
public override string ParamName(int i) { return paramNames[i]; }
public override int ParamsCount() { return paramNames.Length; }
@@ -39,6 +58,8 @@ namespace TBF.Rig.Network.Camera.RoiForFixedStartCJMS11
switch (i)
{
case 0: return PulsesPerLtr.ToString();
case 1: return RoiPicCount.ToString();
case 2: return RoiDeltaTimeMs.ToString();
default: return string.Empty;
}
}
@@ -49,6 +70,8 @@ namespace TBF.Rig.Network.Camera.RoiForFixedStartCJMS11
switch (i)
{
case 0: PulsesPerLtr = Utils.ParseUDouble(strValue); return CfgUpdateFlags.None;
case 1: RoiPicCount = Int32.Parse(strValue); return CfgUpdateFlags.None;
case 2: RoiDeltaTimeMs = Int32.Parse(strValue); return CfgUpdateFlags.None;
default: return CfgUpdateFlags.None;
}
}
@@ -59,11 +82,26 @@ namespace TBF.Rig.Network.Camera.RoiForFixedStartCJMS11
message = string.Empty;
double dummy;
int dummyInt;
switch (i)
{
case 0:
if (Utils.TryParseUDouble(strValue, out dummy)) return true;
break;
case 1:
if (!Int32.TryParse(strValue, out dummyInt) || (dummyInt < 0 || dummyInt > 50))
{
message = ParamName(i) + " is invalid. Param must be between 0 and 50!";
return false;
}
return true;
case 2:
if (!Int32.TryParse(strValue, out dummyInt) || (dummyInt < 500 || dummyInt < 5500))
{
message = ParamName(i) + " is invalid. Param must be between 500 and 5500!";
return false;
}
return true;
default:
message = "Invalid index";
return false;
@@ -76,6 +114,8 @@ namespace TBF.Rig.Network.Camera.RoiForFixedStartCJMS11
void CopyContentTo(ProcedureParams prms)
{
prms.PulsesPerLtr = this.PulsesPerLtr;
prms.RoiDeltaTimeMs = this.RoiDeltaTimeMs;
prms.RoiPicCount = this.RoiPicCount;
}
public IParamsProvider Clone()
@@ -3,6 +3,7 @@
///
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using log4net;
using Common;
@@ -41,6 +42,8 @@ namespace TBF.Rig.Network.Camera.RoiForFixedStartCJMS11
get { return roiCfg.ProcParams.PulsesPerLtr; }
set { roiCfg.ProcParams.PulsesPerLtr = value; }
}
public int RoiDeltaTimeMs { get { return roiCfg.ProcParams.RoiDeltaTimeMs; } }
public int RoiPicCount { get { return roiCfg.ProcParams.RoiPicCount; } }
public double LtrsPerPulse { get { return (PulsesPerLtr <= float.Epsilon) ? 1.0 : (1 / PulsesPerLtr); } }
public string QuantityUnits { get; set; }
@@ -123,26 +126,65 @@ namespace TBF.Rig.Network.Camera.RoiForFixedStartCJMS11
return GrabImageOp(imageFileName, roiCfg.BlackAndWhite, roiCfg.LowResolution, roiCfg.ImageRotation);
}
public IOperation GrabImageOp(string imageFileName,
bool blackAndWhite, bool lowResolution, ImageRotation imageRotation)
// Roi.cs
public IOperation GrabImageOp(
string imageFileName,
bool blackAndWhite,
bool lowResolution,
ImageRotation imageRotation)
{
if (NetCamera != null)
if (NetCamera == null)
{
///TODO BUMI - implementing grabing multiple images
/// 1. Create a list of image file names
string[] imageNames = new string[roiCfg.ImageOpacity.Count];
for (int i = 0; i < imageNames.Length; i++)
{
imageNames[i] = imageFileName + string.Format("{0}_{1}",imageNames.Length, i);
}
/// 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;
}
int imageCount = Math.Max(1, RoiPicCount);
string[] imageNames = CreateImageFileNames(
imageFileName,
imageCount);
return NetCamera.GrabImagesOp(
imageNames,
blackAndWhite,
lowResolution,
imageRotation);
}
private static string[] CreateImageFileNames(
string originalFileName,
int imageCount)
{
if (imageCount <= 1)
{
return new[] { originalFileName };
}
string directory = Path.GetDirectoryName(originalFileName);
string baseName = Path.GetFileNameWithoutExtension(originalFileName);
string extension = Path.GetExtension(originalFileName);
string timestamp = DateTime.Now.ToString("yyyyMMdd_HHmmss_fff");
var result = new string[imageCount];
// Prvý obrázok zostáva kompatibilný s dialógom.
result[0] = originalFileName;
for (int i = 1; i < imageCount; i++)
{
string fileName = string.Format(
"{0}_{1}_{2:D2}{3}",
baseName,
timestamp,
i + 1,
extension);
result[i] = string.IsNullOrEmpty(directory)
? fileName
: Path.Combine(directory, fileName);
}
return result;
}
public IValve GetValve()
+15 -8
View File
@@ -94,17 +94,24 @@ namespace TBF.Rig.Network.Telnet
public class PromptReceivedImagesEventArgs : EventArgs
{
public Image image; /// server image.
public int idxCamera; /// camera index.
public int idxImage; /// image index.
public int imageCounts; /// number of images.
public PromptReceivedImagesEventArgs(int idxCamera, Image image, int idxImage, int imageCounts)
public int idxCamera;
public int idxImage;
public int imageCount;
public Image image;
public DateTimeOffset? frameTime;
public PromptReceivedImagesEventArgs(
int idxCamera,
int idxImage,
int imageCount,
Image image,
DateTimeOffset? frameTime)
{
this.image = image;
this.idxCamera = idxCamera;
this.idxImage = idxImage;
this.imageCounts = imageCounts;
this.imageCount = imageCount;
this.image = image;
this.frameTime = frameTime;
}
}
@@ -290,6 +290,9 @@ namespace TBF.Rig.RegisterReaders.PoseidonCmdStartStop
public void AddRunAndCaptureJsonAsync<T>(string fileName, string args) where T : new()
{
log.Debug($"CLI: {fileName}");
log.Debug($"ARGS: {args}");
ResetStartTime();
var cts = new CancellationTokenSource();
@@ -323,6 +326,12 @@ namespace TBF.Rig.RegisterReaders.PoseidonCmdStartStop
try
{
log.Debug($"FileName = '{psi.FileName}'");
log.Debug($"Arguments = '{psi.Arguments}'");
log.Debug($"WorkingDirectory = '{psi.WorkingDirectory}'");
log.Debug($"Exists = {System.IO.File.Exists(psi.FileName)}");
process.Start();
var stdoutTask = process.StandardOutput.ReadToEndAsync();
@@ -17,7 +17,7 @@ namespace TBF.Rig.RegisterReaders.PoseidonCmdStartStop
#if DEBUG
get { return Path.Combine("C:\\","TBF","Cli", CmdClientName);}
#else
get { return Path.Combine("..","Cli", CmdClientName);}
get { return Path.Combine("C:\\","TBF","Cli", CmdClientName);}
#endif
}
public string CmdClientName { get; set; } = "HalCli.exe";
@@ -150,9 +150,7 @@ namespace TBF.Rig.TestMethods.StandingStartMassCollectionAdvanceCollect
(rr as Rig.RegisterReaders.StandingStartStop.RegisterReader).EndWMState = dataEntryCmpnt.WMEndState(i);
(rr as Rig.RegisterReaders.StandingStartStop.RegisterReader).BeginWMState = dataEntryCmpnt.WMStartState(i);
}
if (rr is Rig.Network.Camera.RoiForFixedStart.Roi)
{
(rr as Rig.Network.Camera.RoiForFixedStart.Roi).EndWMState = dataEntryCmpnt.WMEndState(i);
@@ -167,6 +165,16 @@ namespace TBF.Rig.TestMethods.StandingStartMassCollectionAdvanceCollect
dataEntryCmpnt.WMStartState(i);
log.DebugFormat(" StandingStartMassCollectionAdvanceSeq.cs - BeginWMState [{0}], EndWMState [{1}] -> RoiForFixedStartKeyence.Roi",dataEntryCmpnt.WMStartState(i),dataEntryCmpnt.WMEndState(i));
}
//New camera CJMS11 - supplier Java Microservices, s.r.o
if (rr is Rig.Network.Camera.RoiForFixedStartCJMS11.Roi)
{
(rr as Rig.Network.Camera.RoiForFixedStartCJMS11.Roi).EndWMState =
dataEntryCmpnt.WMEndState(i);
(rr as Rig.Network.Camera.RoiForFixedStartCJMS11.Roi).BeginWMState =
dataEntryCmpnt.WMStartState(i);
log.DebugFormat(" StandingStartMassCollectionAdvanceSeq.cs - BeginWMState [{0}], EndWMState [{1}] -> RoiForFixedStartCJMS11.Roi",dataEntryCmpnt.WMStartState(i),dataEntryCmpnt.WMEndState(i));
}
}
}
+9
View File
@@ -124,6 +124,9 @@
<Reference Include="MySql.Data">
<HintPath>..\packages\MySql.Data.6.6.5\lib\net40\MySql.Data.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json">
<HintPath>..\..\..\.nuget\packages\newtonsoft.json\13.0.4\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.12.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
@@ -1013,11 +1016,13 @@
<Compile Include="Rig\Network\Camera\CJMS11\CameraCfgCtrl.designer.cs">
<DependentUpon>CameraCfgCtrl.cs</DependentUpon>
</Compile>
<Compile Include="Rig\Network\Camera\CJMS11\CameraLineReader.cs" />
<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\CameraResponse.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"/>
@@ -1025,6 +1030,10 @@
<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\POJO\SendImagePayload.cs" />
<Compile Include="Rig\Network\Camera\CJMS11\POJO\SendImagesRequest.cs" />
<Compile Include="Rig\Network\Camera\CJMS11\POJO\SendSummaryPayload.cs" />
<Compile Include="Rig\Network\Camera\CJMS11\POJO\TimedCameraImage.cs" />
<Compile Include="Rig\Network\Camera\CJMS11\RoisAndResults.cs"/>
<Compile Include="Rig\Network\Camera\CJMS11\TerminalDlg.cs">
<SubType>Form</SubType>
+21 -1
View File
@@ -3,6 +3,7 @@
///
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using log4net;
using NHibernate;
using Common;
@@ -229,7 +230,26 @@ namespace TBF.UiBridge
public static void OnCameraUICmd(object sender, CameraUICmdEventArgs data)
{
if (CameraUICmdHandler == null) return;
try { CameraUICmdHandler(sender, data); }
try
{
log.DebugFormat("CameraUICmdHandler: {0}", data.CameraUICmd);
foreach (EventHandler<CameraUICmdEventArgs> handler in CameraUICmdHandler.GetInvocationList())
{
var localHandler = handler;
Task.Run(() =>
{
try
{
localHandler(sender, data);
}
catch (Exception e)
{
log.Error("CameraUICmdHandler(...) failed", e);
}
});
}
}
catch (Exception e) { log.Error("CameraUICmdHandler(...) failed", e); }
}
public static event EventHandler<CameraUICmdEventArgs> CameraUICmdHandler;
@@ -2,10 +2,13 @@ using System;
using System.Collections.Generic;
using System.Drawing;
using System.Threading.Tasks;
using Common;
using JetBrains.Annotations;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using TBF.Rig.Generic;
using TBF.Rig.Network.Camera.CJMS11;
using TBF.Rig.Network.Camera.RoiForFixedStartCJMS11;
using TBF.Rig.Network.Camera.RoiForFixedStartCJMS11.common;
using Factory = TBF.Rig.Network.Camera.CJMS11.Factory;
@@ -17,25 +20,41 @@ namespace TBFTests.Rig.Network.Camera.CJMS11
public class CameraTest
{
private static string ipCamera1 = "192.168.0.170";
private static string ipCamera2 = "192.168.0.169";
private static string ipCamera2 = "192.168.0.129";
public string IPCamera1 { get { return ipCamera1; } }
public string IPCamera2 { get { return ipCamera2; } }
private RoiCfg CreateTestRoiCfg()
{
var factory = new TBF.Rig.Network.Camera.RoiForFixedStartCJMS11.Factory();
var roi = new RoiCfg("TestRoi", factory);
roi.BlackAndWhite = false;
roi.LowResolution = true;
roi.ImageRotation = ImageRotation.None;
roi.ImageFrame = Frame.StandardFrame();
return roi;
}
[TestMethod]
public void Initialize()
{
TBF.Rig.Network.Camera.CJMS11.Camera camera = GetCamera( IPCamera1);
TBF.Rig.Network.Camera.CJMS11.Camera camera = GetCamera(IPCamera1);
camera.RoiConfiguration = CreateTestRoiCfg();
camera.Initialize();
TBF.Rig.Network.Camera.CJMS11.Camera camera2 = GetCamera( IPCamera2);
camera2.RoiConfiguration = CreateTestRoiCfg();
camera2.Initialize();
TBF.Rig.Network.Camera.CJMS11.Camera camera11 = GetCamera( IPCamera1);
camera11.Initialize();
TBF.Rig.Network.Camera.CJMS11.Camera camera12 = GetCamera( IPCamera2);
camera12.Initialize();
// TBF.Rig.Network.Camera.CJMS11.Camera camera11 = GetCamera( IPCamera1);
// camera11.Initialize();
//
// TBF.Rig.Network.Camera.CJMS11.Camera camera12 = GetCamera( IPCamera2);
// camera12.Initialize();
}
@@ -57,25 +76,25 @@ namespace TBFTests.Rig.Network.Camera.CJMS11
camera.Initialize();
});
var task3 = Task.Run(() =>
{
var camera = GetCamera(IPCamera2);
camera.Initialize();
});
var task4 = Task.Run(() =>
{
var camera = GetCamera(IPCamera1);
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
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);
// Assert.IsTrue(task3.IsCompleted);
// Assert.IsTrue(task4.IsCompleted);
}
@@ -112,7 +131,7 @@ namespace TBFTests.Rig.Network.Camera.CJMS11
var camera = GetCamera(IPCamera1);
Task<Image> saveImageTask = Task.Run(() => camera.SaveImageListener());
Task<Image> saveImageTask = Task.Run(() => camera.SaveImageListenerAsynch());
var timeoutAnswerTask = Task.Delay(TimeSpan.FromSeconds(3));
var completedAnswerTask = Task.WhenAny(saveImageTask, timeoutAnswerTask).Result;
if (completedAnswerTask == timeoutAnswerTask)
@@ -129,35 +148,35 @@ namespace TBFTests.Rig.Network.Camera.CJMS11
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();
}
// var task3 = Task.Run(() =>
// {
// var camera = GetCamera(IPCamera2);
//
// Task<Image> saveImageTask = Task.Run(() => camera.SaveImageListenerAsynch());
// 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();
// });
//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
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);
// Assert.IsTrue(task3.IsCompleted);
// Assert.IsTrue(task4.IsCompleted);
}
Binary file not shown.
+348 -13
View File
@@ -1641,7 +1641,7 @@
</member>
<member name="M:Newtonsoft.Json.JsonConvert.SerializeObject(System.Object,System.Type,Newtonsoft.Json.JsonSerializerSettings)">
<summary>
Serializes the specified object to a JSON string using a type, formatting and <see cref="T:Newtonsoft.Json.JsonSerializerSettings"/>.
Serializes the specified object to a JSON string using a type and <see cref="T:Newtonsoft.Json.JsonSerializerSettings"/>.
</summary>
<param name="value">The object to serialize.</param>
<param name="settings">The <see cref="T:Newtonsoft.Json.JsonSerializerSettings"/> used to serialize the object.
@@ -1660,7 +1660,7 @@
Serializes the specified object to a JSON string using formatting and <see cref="T:Newtonsoft.Json.JsonSerializerSettings"/>.
</summary>
<param name="value">The object to serialize.</param>
<param name="formatting">Indicates how the output should be formatted.</param>
<param name="formatting">Indicates how the output should be formatted. This value overrides the formatting specified on <see cref="T:Newtonsoft.Json.JsonSerializerSettings" />.</param>
<param name="settings">The <see cref="T:Newtonsoft.Json.JsonSerializerSettings"/> used to serialize the object.
If this is <c>null</c>, default serialization settings will be used.</param>
<returns>
@@ -1672,7 +1672,7 @@
Serializes the specified object to a JSON string using a type, formatting and <see cref="T:Newtonsoft.Json.JsonSerializerSettings"/>.
</summary>
<param name="value">The object to serialize.</param>
<param name="formatting">Indicates how the output should be formatted.</param>
<param name="formatting">Indicates how the output should be formatted. This value overrides the formatting specified on <see cref="T:Newtonsoft.Json.JsonSerializerSettings" />.</param>
<param name="settings">The <see cref="T:Newtonsoft.Json.JsonSerializerSettings"/> used to serialize the object.
If this is <c>null</c>, default serialization settings will be used.</param>
<param name="type">
@@ -1689,7 +1689,7 @@
Deserializes the JSON to a .NET object.
</summary>
<param name="value">The JSON to deserialize.</param>
<returns>The deserialized object from the JSON string.</returns>
<returns>The deserialized object from the JSON string. A <see langword="null"/> value is returned if the provided JSON is valid but represents a null value.</returns>
</member>
<member name="M:Newtonsoft.Json.JsonConvert.DeserializeObject(System.String,Newtonsoft.Json.JsonSerializerSettings)">
<summary>
@@ -1700,7 +1700,7 @@
The <see cref="T:Newtonsoft.Json.JsonSerializerSettings"/> used to deserialize the object.
If this is <c>null</c>, default serialization settings will be used.
</param>
<returns>The deserialized object from the JSON string.</returns>
<returns>The deserialized object from the JSON string. A <see langword="null"/> value is returned if the provided JSON is valid but represents a null value.</returns>
</member>
<member name="M:Newtonsoft.Json.JsonConvert.DeserializeObject(System.String,System.Type)">
<summary>
@@ -1708,7 +1708,7 @@
</summary>
<param name="value">The JSON to deserialize.</param>
<param name="type">The <see cref="T:System.Type"/> of object being deserialized.</param>
<returns>The deserialized object from the JSON string.</returns>
<returns>The deserialized object from the JSON string. A <see langword="null"/> value is returned if the provided JSON is valid but represents a null value.</returns>
</member>
<member name="M:Newtonsoft.Json.JsonConvert.DeserializeObject``1(System.String)">
<summary>
@@ -1716,7 +1716,7 @@
</summary>
<typeparam name="T">The type of the object to deserialize to.</typeparam>
<param name="value">The JSON to deserialize.</param>
<returns>The deserialized object from the JSON string.</returns>
<returns>The deserialized object from the JSON string. A <see langword="null"/> value is returned if the provided JSON is valid but represents a null value.</returns>
</member>
<member name="M:Newtonsoft.Json.JsonConvert.DeserializeAnonymousType``1(System.String,``0)">
<summary>
@@ -1729,7 +1729,7 @@
</typeparam>
<param name="value">The JSON to deserialize.</param>
<param name="anonymousTypeObject">The anonymous type object.</param>
<returns>The deserialized anonymous type from the JSON string.</returns>
<returns>The deserialized anonymous type from the JSON string. A <see langword="null"/> value is returned if the provided JSON is valid but represents a null value.</returns>
</member>
<member name="M:Newtonsoft.Json.JsonConvert.DeserializeAnonymousType``1(System.String,``0,Newtonsoft.Json.JsonSerializerSettings)">
<summary>
@@ -1746,7 +1746,7 @@
The <see cref="T:Newtonsoft.Json.JsonSerializerSettings"/> used to deserialize the object.
If this is <c>null</c>, default serialization settings will be used.
</param>
<returns>The deserialized anonymous type from the JSON string.</returns>
<returns>The deserialized anonymous type from the JSON string. A <see langword="null"/> value is returned if the provided JSON is valid but represents a null value.</returns>
</member>
<member name="M:Newtonsoft.Json.JsonConvert.DeserializeObject``1(System.String,Newtonsoft.Json.JsonConverter[])">
<summary>
@@ -1755,7 +1755,7 @@
<typeparam name="T">The type of the object to deserialize to.</typeparam>
<param name="value">The JSON to deserialize.</param>
<param name="converters">Converters to use while deserializing.</param>
<returns>The deserialized object from the JSON string.</returns>
<returns>The deserialized object from the JSON string. A <see langword="null"/> value is returned if the provided JSON is valid but represents a null value.</returns>
</member>
<member name="M:Newtonsoft.Json.JsonConvert.DeserializeObject``1(System.String,Newtonsoft.Json.JsonSerializerSettings)">
<summary>
@@ -1767,7 +1767,7 @@
The <see cref="T:Newtonsoft.Json.JsonSerializerSettings"/> used to deserialize the object.
If this is <c>null</c>, default serialization settings will be used.
</param>
<returns>The deserialized object from the JSON string.</returns>
<returns>The deserialized object from the JSON string. A <see langword="null"/> value is returned if the provided JSON is valid but represents a null value.</returns>
</member>
<member name="M:Newtonsoft.Json.JsonConvert.DeserializeObject(System.String,System.Type,Newtonsoft.Json.JsonConverter[])">
<summary>
@@ -1776,7 +1776,7 @@
<param name="value">The JSON to deserialize.</param>
<param name="type">The type of the object to deserialize.</param>
<param name="converters">Converters to use while deserializing.</param>
<returns>The deserialized object from the JSON string.</returns>
<returns>The deserialized object from the JSON string. A <see langword="null"/> value is returned if the provided JSON is valid but represents a null value.</returns>
</member>
<member name="M:Newtonsoft.Json.JsonConvert.DeserializeObject(System.String,System.Type,Newtonsoft.Json.JsonSerializerSettings)">
<summary>
@@ -1788,7 +1788,7 @@
The <see cref="T:Newtonsoft.Json.JsonSerializerSettings"/> used to deserialize the object.
If this is <c>null</c>, default serialization settings will be used.
</param>
<returns>The deserialized object from the JSON string.</returns>
<returns>The deserialized object from the JSON string. A <see langword="null"/> value is returned if the provided JSON is valid but represents a null value.</returns>
</member>
<member name="M:Newtonsoft.Json.JsonConvert.PopulateObject(System.String,System.Object)">
<summary>
@@ -7186,6 +7186,21 @@
<param name="converters">A collection of <see cref="T:Newtonsoft.Json.JsonConverter"/> which will be used when writing the token.</param>
<returns>A <see cref="T:System.Threading.Tasks.Task"/> that represents the asynchronous write operation.</returns>
</member>
<member name="M:Newtonsoft.Json.Linq.JToken.WriteToAsync(Newtonsoft.Json.JsonWriter,System.Threading.CancellationToken)">
<summary>
Writes this token to a <see cref="T:Newtonsoft.Json.JsonWriter"/> asynchronously.
</summary>
<param name="writer">A <see cref="T:Newtonsoft.Json.JsonWriter"/> into which this method will write.</param>
<param name="cancellationToken">The token to monitor for cancellation requests.</param>
<returns>A <see cref="T:System.Threading.Tasks.Task"/> that represents the asynchronous write operation.</returns>
</member>
<member name="M:Newtonsoft.Json.Linq.JToken.WriteToAsync(Newtonsoft.Json.JsonWriter)">
<summary>
Writes this token to a <see cref="T:Newtonsoft.Json.JsonWriter"/> asynchronously.
</summary>
<param name="writer">A <see cref="T:Newtonsoft.Json.JsonWriter"/> into which this method will write.</param>
<returns>A <see cref="T:System.Threading.Tasks.Task"/> that represents the asynchronous write operation.</returns>
</member>
<member name="M:Newtonsoft.Json.Linq.JToken.ReadFromAsync(Newtonsoft.Json.JsonReader,System.Threading.CancellationToken)">
<summary>
Asynchronously creates a <see cref="T:Newtonsoft.Json.Linq.JToken"/> from a <see cref="T:Newtonsoft.Json.JsonReader"/>.
@@ -7394,6 +7409,12 @@
</summary>
<param name="value">The value.</param>
</member>
<member name="M:Newtonsoft.Json.Linq.JToken.WriteTo(Newtonsoft.Json.JsonWriter)">
<summary>
Writes this token to a <see cref="T:Newtonsoft.Json.JsonWriter"/>.
</summary>
<param name="writer">A <see cref="T:Newtonsoft.Json.JsonWriter"/> into which this method will write.</param>
</member>
<member name="M:Newtonsoft.Json.Linq.JToken.WriteTo(Newtonsoft.Json.JsonWriter,Newtonsoft.Json.JsonConverter[])">
<summary>
Writes this token to a <see cref="T:Newtonsoft.Json.JsonWriter"/>.
@@ -7413,6 +7434,13 @@
The indented JSON for this token.
</returns>
</member>
<member name="M:Newtonsoft.Json.Linq.JToken.ToString(Newtonsoft.Json.Formatting)">
<summary>
Returns the JSON for this token using the given formatting and converters.
</summary>
<param name="formatting">Indicates how the output should be formatted.</param>
<returns>The JSON for this token using the given formatting and converters.</returns>
</member>
<member name="M:Newtonsoft.Json.Linq.JToken.ToString(Newtonsoft.Json.Formatting,Newtonsoft.Json.JsonConverter[])">
<summary>
Returns the JSON for this token using the given formatting and converters.
@@ -11321,6 +11349,180 @@
A <see cref="T:Newtonsoft.Json.JsonWriter"/> write method has not been called.
</summary>
</member>
<member name="T:System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute">
<summary>
Indicates that certain members on a specified <see cref="T:System.Type"/> are accessed dynamically,
for example through <see cref="N:System.Reflection"/>.
</summary>
<remarks>
This allows tools to understand which members are being accessed during the execution
of a program.
This attribute is valid on members whose type is <see cref="T:System.Type"/> or <see cref="T:System.String"/>.
When this attribute is applied to a location of type <see cref="T:System.String"/>, the assumption is
that the string represents a fully qualified type name.
When this attribute is applied to a class, interface, or struct, the members specified
can be accessed dynamically on <see cref="T:System.Type"/> instances returned from calling
<see cref="M:System.Object.GetType"/> on instances of that class, interface, or struct.
If the attribute is applied to a method it's treated as a special case and it implies
the attribute should be applied to the "this" parameter of the method. As such the attribute
should only be used on instance methods of types assignable to System.Type (or string, but no methods
will use it there).
</remarks>
</member>
<member name="M:System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute.#ctor(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes)">
<summary>
Initializes a new instance of the <see cref="T:System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute"/> class
with the specified member types.
</summary>
<param name="memberTypes">The types of members dynamically accessed.</param>
</member>
<member name="P:System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute.MemberTypes">
<summary>
Gets the <see cref="T:System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes"/> which specifies the type
of members dynamically accessed.
</summary>
</member>
<member name="T:System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes">
<summary>
Specifies the types of members that are dynamically accessed.
This enumeration has a <see cref="T:System.FlagsAttribute"/> attribute that allows a
bitwise combination of its member values.
</summary>
</member>
<member name="F:System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.None">
<summary>
Specifies no members.
</summary>
</member>
<member name="F:System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicParameterlessConstructor">
<summary>
Specifies the default, parameterless public constructor.
</summary>
</member>
<member name="F:System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicConstructors">
<summary>
Specifies all public constructors.
</summary>
</member>
<member name="F:System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicConstructors">
<summary>
Specifies all non-public constructors.
</summary>
</member>
<member name="F:System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods">
<summary>
Specifies all public methods.
</summary>
</member>
<member name="F:System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicMethods">
<summary>
Specifies all non-public methods.
</summary>
</member>
<member name="F:System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicFields">
<summary>
Specifies all public fields.
</summary>
</member>
<member name="F:System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicFields">
<summary>
Specifies all non-public fields.
</summary>
</member>
<member name="F:System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicNestedTypes">
<summary>
Specifies all public nested types.
</summary>
</member>
<member name="F:System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicNestedTypes">
<summary>
Specifies all non-public nested types.
</summary>
</member>
<member name="F:System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicProperties">
<summary>
Specifies all public properties.
</summary>
</member>
<member name="F:System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicProperties">
<summary>
Specifies all non-public properties.
</summary>
</member>
<member name="F:System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicEvents">
<summary>
Specifies all public events.
</summary>
</member>
<member name="F:System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicEvents">
<summary>
Specifies all non-public events.
</summary>
</member>
<member name="F:System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.Interfaces">
<summary>
Specifies all interfaces implemented by the type.
</summary>
</member>
<member name="F:System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.All">
<summary>
Specifies all members.
</summary>
</member>
<member name="T:System.Diagnostics.CodeAnalysis.FeatureGuardAttribute">
<summary>
Indicates that the specified public static boolean get-only property
guards access to the specified feature.
</summary>
<remarks>
Analyzers can use this to prevent warnings on calls to code that is
annotated as requiring that feature, when the callsite is guarded by a
call to the property.
</remarks>
</member>
<member name="M:System.Diagnostics.CodeAnalysis.FeatureGuardAttribute.#ctor(System.Type)">
<summary>
Initializes a new instance of the <see cref="T:System.Diagnostics.CodeAnalysis.FeatureGuardAttribute"/> class
with the specified feature type.
</summary>
<param name="featureType">
The type that represents the feature guarded by the property.
</param>
</member>
<member name="P:System.Diagnostics.CodeAnalysis.FeatureGuardAttribute.FeatureType">
<summary>
The type that represents the feature guarded by the property.
</summary>
</member>
<member name="T:System.Diagnostics.CodeAnalysis.FeatureSwitchDefinitionAttribute">
<summary>
Indicates that the specified public static boolean get-only property
corresponds to the feature switch specified by name.
</summary>
<remarks>
IL rewriters and compilers can use this to substitute the return value
of the specified property with the value of the feature switch.
</remarks>
</member>
<member name="M:System.Diagnostics.CodeAnalysis.FeatureSwitchDefinitionAttribute.#ctor(System.String)">
<summary>
Initializes a new instance of the <see cref="T:System.Diagnostics.CodeAnalysis.FeatureSwitchDefinitionAttribute"/> class
with the specified feature switch name.
</summary>
<param name="switchName">
The name of the feature switch that provides the value for the specified property.
</param>
</member>
<member name="P:System.Diagnostics.CodeAnalysis.FeatureSwitchDefinitionAttribute.SwitchName">
<summary>
The name of the feature switch that provides the value for the specified property.
</summary>
</member>
<member name="T:System.Diagnostics.CodeAnalysis.NotNullAttribute">
<summary>Specifies that an output will not be null even if the corresponding type allows it.</summary>
</member>
@@ -11359,5 +11561,138 @@
<member name="P:System.Diagnostics.CodeAnalysis.DoesNotReturnIfAttribute.ParameterValue">
<summary>Gets the condition parameter value.</summary>
</member>
<member name="T:System.Diagnostics.CodeAnalysis.RequiresDynamicCodeAttribute">
<summary>
Indicates that the specified method requires the ability to generate new code at runtime,
for example through <see cref="N:System.Reflection"/>.
</summary>
<remarks>
This allows tools to understand which methods are unsafe to call when compiling ahead of time.
</remarks>
</member>
<member name="M:System.Diagnostics.CodeAnalysis.RequiresDynamicCodeAttribute.#ctor(System.String)">
<summary>
Initializes a new instance of the <see cref="T:System.Diagnostics.CodeAnalysis.RequiresDynamicCodeAttribute"/> class
with the specified message.
</summary>
<param name="message">
A message that contains information about the usage of dynamic code.
</param>
</member>
<member name="P:System.Diagnostics.CodeAnalysis.RequiresDynamicCodeAttribute.Message">
<summary>
Gets a message that contains information about the usage of dynamic code.
</summary>
</member>
<member name="P:System.Diagnostics.CodeAnalysis.RequiresDynamicCodeAttribute.Url">
<summary>
Gets or sets an optional URL that contains more information about the method,
why it requires dynamic code, and what options a consumer has to deal with it.
</summary>
</member>
<member name="T:System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute">
<summary>
Indicates that the specified method requires dynamic access to code that is not referenced
statically, for example through <see cref="N:System.Reflection"/>.
</summary>
<remarks>
This allows tools to understand which methods are unsafe to call when removing unreferenced
code from an application.
</remarks>
</member>
<member name="M:System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute.#ctor(System.String)">
<summary>
Initializes a new instance of the <see cref="T:System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute"/> class
with the specified message.
</summary>
<param name="message">
A message that contains information about the usage of unreferenced code.
</param>
</member>
<member name="P:System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute.Message">
<summary>
Gets a message that contains information about the usage of unreferenced code.
</summary>
</member>
<member name="P:System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute.Url">
<summary>
Gets or sets an optional URL that contains more information about the method,
why it requires unreferenced code, and what options a consumer has to deal with it.
</summary>
</member>
<member name="T:System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute">
<summary>
Suppresses reporting of a specific rule violation, allowing multiple suppressions on a
single code artifact.
</summary>
<remarks>
<see cref="T:System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute"/> is different than
<see cref="T:System.Diagnostics.CodeAnalysis.SuppressMessageAttribute"/> in that it doesn't have a
<see cref="T:System.Diagnostics.ConditionalAttribute"/>. So it is always preserved in the compiled assembly.
</remarks>
</member>
<member name="M:System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute.#ctor(System.String,System.String)">
<summary>
Initializes a new instance of the <see cref="T:System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute"/>
class, specifying the category of the tool and the identifier for an analysis rule.
</summary>
<param name="category">The category for the attribute.</param>
<param name="checkId">The identifier of the analysis rule the attribute applies to.</param>
</member>
<member name="P:System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute.Category">
<summary>
Gets the category identifying the classification of the attribute.
</summary>
<remarks>
The <see cref="P:System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute.Category"/> property describes the tool or tool analysis category
for which a message suppression attribute applies.
</remarks>
</member>
<member name="P:System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute.CheckId">
<summary>
Gets the identifier of the analysis tool rule to be suppressed.
</summary>
<remarks>
Concatenated together, the <see cref="P:System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute.Category"/> and <see cref="P:System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute.CheckId"/>
properties form a unique check identifier.
</remarks>
</member>
<member name="P:System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute.Scope">
<summary>
Gets or sets the scope of the code that is relevant for the attribute.
</summary>
<remarks>
The Scope property is an optional argument that specifies the metadata scope for which
the attribute is relevant.
</remarks>
</member>
<member name="P:System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute.Target">
<summary>
Gets or sets a fully qualified path that represents the target of the attribute.
</summary>
<remarks>
The <see cref="P:System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute.Target"/> property is an optional argument identifying the analysis target
of the attribute. An example value is "System.IO.Stream.ctor():System.Void".
Because it is fully qualified, it can be long, particularly for targets such as parameters.
The analysis tool user interface should be capable of automatically formatting the parameter.
</remarks>
</member>
<member name="P:System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute.MessageId">
<summary>
Gets or sets an optional argument expanding on exclusion criteria.
</summary>
<remarks>
The <see cref="P:System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute.MessageId"/> property is an optional argument that specifies additional
exclusion where the literal metadata target is not sufficiently precise. For example,
the <see cref="T:System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute"/> cannot be applied within a method,
and it may be desirable to suppress a violation against a statement in the method that will
give a rule violation, but not against all statements in the method.
</remarks>
</member>
<member name="P:System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute.Justification">
<summary>
Gets or sets the justification for suppressing the code analysis message.
</summary>
</member>
</members>
</doc>
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -2,44 +2,48 @@
<configuration>
<configSections>
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<section name="Xylem.Common.Ui.GenesisToolBox.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false"/>
<section name="Xylem.Common.Ui.GenesisToolBox.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
</sectionGroup>
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
</startup>
<userSettings>
<Xylem.Common.Ui.GenesisToolBox.Properties.Settings>
<setting name="InitialBinaryPath" serializeAs="String">
<value/>
<value />
</setting>
<setting name="InitialPackageFile" serializeAs="String">
<value/>
<value />
</setting>
</Xylem.Common.Ui.GenesisToolBox.Properties.Settings>
</userSettings>
<appSettings>
<add key="AdminName" value="My Name"/>
<add key="AdminEMail" value="MyEMailAddress"/>
<add key="ClientSettingsProvider.ServiceUri" value=""/>
<add key="AdminName" value="My Name" />
<add key="AdminEMail" value="MyEMailAddress" />
<add key="ClientSettingsProvider.ServiceUri" value="" />
</appSettings>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0"/>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Xylem.Common.CommonCore" publicKeyToken="null" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.8.18.29406" newVersion="2.8.18.29406" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<system.web>
<membership defaultProvider="ClientAuthenticationMembershipProvider">
<providers>
<add name="ClientAuthenticationMembershipProvider" type="System.Web.ClientServices.Providers.ClientFormsAuthenticationMembershipProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri=""/>
<add name="ClientAuthenticationMembershipProvider" type="System.Web.ClientServices.Providers.ClientFormsAuthenticationMembershipProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" />
</providers>
</membership>
<roleManager defaultProvider="ClientRoleProvider" enabled="true">
<providers>
<add name="ClientRoleProvider" type="System.Web.ClientServices.Providers.ClientRoleProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" cacheTimeout="86400"/>
<add name="ClientRoleProvider" type="System.Web.ClientServices.Providers.ClientRoleProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" cacheTimeout="86400" />
</providers>
</roleManager>
</system.web>
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
-20
View File
@@ -1,20 +0,0 @@
The MIT License (MIT)
Copyright (c) 2007 James Newton-King
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large Load Diff
Binary file not shown.
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
Binary file not shown.
-20
View File
@@ -1,20 +0,0 @@
The MIT License (MIT)
Copyright (c) 2007 James Newton-King
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Binary file not shown.
-71
View File
@@ -1,71 +0,0 @@
# ![Logo](https://raw.githubusercontent.com/JamesNK/Newtonsoft.Json/master/Doc/icons/logo.jpg) Json.NET
[![NuGet version (Newtonsoft.Json)](https://img.shields.io/nuget/v/Newtonsoft.Json.svg?style=flat-square)](https://www.nuget.org/packages/Newtonsoft.Json/)
[![Build status](https://dev.azure.com/jamesnk/Public/_apis/build/status/JamesNK.Newtonsoft.Json?branchName=master)](https://dev.azure.com/jamesnk/Public/_build/latest?definitionId=8)
Json.NET is a popular high-performance JSON framework for .NET
## Serialize JSON
```csharp
Product product = new Product();
product.Name = "Apple";
product.Expiry = new DateTime(2008, 12, 28);
product.Sizes = new string[] { "Small" };
string json = JsonConvert.SerializeObject(product);
// {
// "Name": "Apple",
// "Expiry": "2008-12-28T00:00:00",
// "Sizes": [
// "Small"
// ]
// }
```
## Deserialize JSON
```csharp
string json = @"{
'Name': 'Bad Boys',
'ReleaseDate': '1995-4-7T00:00:00',
'Genres': [
'Action',
'Comedy'
]
}";
Movie m = JsonConvert.DeserializeObject<Movie>(json);
string name = m.Name;
// Bad Boys
```
## LINQ to JSON
```csharp
JArray array = new JArray();
array.Add("Manual text");
array.Add(new DateTime(2000, 5, 23));
JObject o = new JObject();
o["MyArray"] = array;
string json = o.ToString();
// {
// "MyArray": [
// "Manual text",
// "2000-05-23T00:00:00"
// ]
// }
```
## Links
- [Homepage](https://www.newtonsoft.com/json)
- [Documentation](https://www.newtonsoft.com/json/help)
- [NuGet Package](https://www.nuget.org/packages/Newtonsoft.Json)
- [Release Notes](https://github.com/JamesNK/Newtonsoft.Json/releases)
- [Contributing Guidelines](https://github.com/JamesNK/Newtonsoft.Json/blob/master/CONTRIBUTING.md)
- [License](https://github.com/JamesNK/Newtonsoft.Json/blob/master/LICENSE.md)
- [Stack Overflow](https://stackoverflow.com/questions/tagged/json.net)
Binary file not shown.
File diff suppressed because it is too large Load Diff
Binary file not shown.
File diff suppressed because it is too large Load Diff
Binary file not shown.
File diff suppressed because it is too large Load Diff
Binary file not shown.
File diff suppressed because it is too large Load Diff
Binary file not shown.
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.7 KiB