From a29ad2113ff8c84d97d27bed1533e2982baea3e4 Mon Sep 17 00:00:00 2001 From: Andre Lafleur Date: Fri, 20 Sep 2024 23:01:11 +0800 Subject: [PATCH 01/22] Refactor code for readability and modern C# features - file-scoped namespaces --- .../Media SDK/OverlaySample/BouncingBall.cs | 117 ++-- .../OverlaySample/BouncingBallOverlay.cs | 103 ++-- .../OverlaySample/OverlayExtensions.cs | 52 +- Samples/Media SDK/OverlaySample/Program.cs | 127 +++-- .../OverlaySample/TimecodeOverlay.cs | 84 ++- .../PlaybackStreamReaderSample/Program.cs | 79 ++- .../VideoExportSample/ExportOption.cs | 20 +- .../G64ConverterBaseExtensions.cs | 53 +- .../Media SDK/VideoExportSample/Program.cs | 113 ++-- .../VideoExportSample/VideoExport.cs | 111 ++-- .../VideoExportSample/VideoExportFormat.cs | 15 +- .../VideoSourceFilterSample/Program.cs | 159 +++--- .../AccessControlUnitManagerSample/Program.cs | 99 ++-- .../AccessControlUnitSample/Program.cs | 515 +++++++++--------- .../AccessEventMonitoringSample/Program.cs | 127 +++-- .../AccessVerifierSample/Program.cs | 149 +++-- .../AlarmMonitoringSample/Program.cs | 147 +++-- .../EntityManagerExtensions.cs | 63 ++- .../Platform SDK/CustomEntitySample/Icon.cs | 27 +- .../Platform SDK/CustomEventSample/Program.cs | 179 +++--- .../Platform SDK/CustomFieldSample/Program.cs | 221 ++++---- .../DiagnosticServerSample/InstanceLogger.cs | 57 +- .../DiagnosticServerSample/Program.cs | 91 ++-- .../DiagnosticServerSample/StaticLogger.cs | 39 +- .../DisplayInTileSample/Program.cs | 127 +++-- .../Program.cs | 129 +++-- .../EntityMappingSample/Program.cs | 137 +++-- .../EventMonitoringSample/Program.cs | 125 +++-- .../EventToActionSample/Program.cs | 89 ++- .../IncidentManagerSample/IncidentData.cs | 45 +- .../IncidentManagerSample/Program.cs | 235 ++++---- .../LicenseManagerSample/Program.cs | 65 ++- .../LoggerSample/InstanceLogger.cs | 35 +- Samples/Platform SDK/LoggerSample/Program.cs | 65 ++- .../Platform SDK/LoggerSample/StaticLogger.cs | 17 +- .../LoginManagerSample/Program.cs | 53 +- .../Platform SDK/RaiseEventSample/Program.cs | 101 ++-- .../SecurityManagerSample/Program.cs | 113 ++-- .../TransactionManagerSample/Program.cs | 161 +++--- .../UnusedCredentialQuerySample/Program.cs | 121 ++-- .../Platform SDK/UserTaskSample/Program.cs | 117 ++-- .../Platform SDK/VideoUnitSample/Program.cs | 177 +++--- .../ArchivedVisitorData.cs | 51 +- .../VisitorManagerSample/Program.cs | 261 +++++---- .../BasicPluginTemplate/BasicPlugin.cs | 39 +- .../BasicPluginDescriptor.cs | 39 +- .../SampleDatabaseManager.cs | 363 ++++++------ .../PluginDatabaseSample/SamplePlugin.cs | 73 ++- .../SamplePluginDescriptor.cs | 41 +- Samples/Shared/CollectionExtensions.cs | 19 +- Samples/Shared/EnumerableExtensions.cs | 35 +- Samples/Shared/SdkResolver.cs | 121 ++-- .../BackgroundProcessPage.cs | 21 +- .../BackgroundProcessPageDescriptor.cs | 25 +- .../BackgroundProcessPageView.xaml.cs | 25 +- .../BackgroundProcessPageViewModel.cs | 73 ++- .../BackgroundProcessSample/SampleModule.cs | 31 +- .../BadgePrinterSample/SampleBadgePrinter.cs | 77 ++- .../BadgePrinterSample/SampleModule.cs | 25 +- .../CredentialFormatComparer.cs | 29 +- .../CredentialReaderView.xaml.cs | 19 +- .../SampleCardholderCredentialReader.cs | 191 ++++--- .../SampleModule.cs | 25 +- .../SampleCardholderFieldsExtractor.cs | 59 +- .../SampleModule.cs | 25 +- .../CardholderFieldsExtractorSample/VCard.cs | 23 +- .../VCardReader.cs | 99 ++-- .../CommandManagerSampleModule.cs | 105 ++-- .../AedUnitCustomEntityType.cs | 15 +- .../AedUnitCustomPrivilege.cs | 23 +- .../ConfigPageSample/AedUnitInformation.cs | 73 ++- .../ConfigPageSample/CustomConfigPage.cs | 197 ++++--- .../CustomConfigPageView.xaml.cs | 17 +- .../ConfigPageSample/SampleModule.cs | 253 +++++---- .../ControlsSample/Chart/ChartSamplePage.cs | 17 +- .../Chart/ChartSamplePageDescriptor.cs | 25 +- .../Chart/ChartSampleView.xaml.cs | 11 +- .../Chart/ChartSampleViewModel.cs | 181 +++--- .../Controls/ControlsSamplePage.cs | 17 +- .../Controls/ControlsSamplePageDescriptor.cs | 25 +- .../Controls/ControlsSampleView.xaml.cs | 13 +- .../ControlsSample/CustomTaskCategories.cs | 13 +- .../ControlsSample/SampleModule.cs | 43 +- .../ControlsSample/Style/StylesSamplePage.cs | 17 +- .../Style/StylesSamplePageDescriptor.cs | 25 +- .../Style/StylesSamplePageView.xaml.cs | 13 +- .../WebBrowser/WebBrowserSamplePage.cs | 17 +- .../WebBrowserSamplePageDescriptor.cs | 25 +- .../WebBrowser/WebBrowserSampleView.xaml.cs | 39 +- .../WebBrowser/WebBrowserSampleViewModel.cs | 49 +- .../CredentialBuilderSample/Program.cs | 219 ++++---- .../CredentialFormatComparer.cs | 29 +- .../CredentialReaderView.xaml.cs | 19 +- .../SampleCredentialReader.cs | 191 ++++--- .../CredentialReaderSample/SampleModule.cs | 25 +- .../DashboardWidgetSample/ClockWidget.cs | 197 ++++--- .../ClockWidgetBuilder.cs | 43 +- .../ClockWidgetConfiguration.cs | 61 +-- .../ClockWidgetView.xaml.cs | 11 +- .../CustomWidgetSettings.xaml.cs | 11 +- .../DashboardWidgetSample/SampleModule.cs | 29 +- .../EventExtenderSample/CustomEventPayload.cs | 45 +- .../EventExtenderSample/FieldName.cs | 17 +- .../SampleEventExtender.cs | 65 ++- .../EventExtenderSample/SampleModule.cs | 29 +- .../SampleImageExtractor.cs | 47 +- .../ImageExtractorSample/SampleModule.cs | 25 +- .../ImageExtractorSample/VCard.cs | 23 +- .../ImageExtractorSample/VCardReader.cs | 99 ++-- .../OptionsExtensionSample/SampleModule.cs | 29 +- .../SampleOptionPage.cs | 161 +++--- .../SampleOptionsData.cs | 81 ++- .../SampleOptionsExtensions.cs | 129 +++-- .../SampleOptionsView.xaml.cs | 19 +- .../PageTaskSample/SampleModule.cs | 29 +- .../PageTaskSample/SamplePage.cs | 17 +- .../PageTaskSample/SamplePageDescriptor.cs | 31 +- .../PageTaskSample/SamplePageView.xaml.cs | 13 +- .../AggregateReportExporter.cs | 46 +- .../ReportExporterSample/CsvReportExporter.cs | 95 ++-- .../HtmlReportExporter.cs | 126 +++-- .../JsonReportExporter.cs | 75 ++- .../MarkdownReportExporter.cs | 77 ++- .../ReportExporterSample/Program.cs | 93 ++-- .../ReportExporterSample/XmlReportExporter.cs | 89 ++- .../Workspace SDK/TaskSample/NotepadTask.cs | 51 +- .../Workspace SDK/TaskSample/SampleModule.cs | 29 +- .../TilePropertiesSample/SampleModule.cs | 27 +- .../SampleTileProperties.cs | 17 +- .../SampleTilePropertiesBuilder.cs | 37 +- .../SampleTilePropertiesView.xaml.cs | 17 +- .../TileViewSample/SampleModule.cs | 29 +- .../TileViewSample/SampleTileView.cs | 25 +- .../TileViewSample/SampleTileViewBuilder.cs | 35 +- .../SampleTileViewControl.xaml.cs | 17 +- .../TileWidgetSample/SampleModule.cs | 27 +- .../TileWidgetSample/SampleTileWidget.cs | 17 +- .../SampleTileWidgetBuilder.cs | 37 +- .../SampleTileWidgetView.xaml.cs | 17 +- .../AlarmTimelineEvent.cs | 71 ++- .../AlarmTimelineProvider.cs | 87 ++- .../AlarmTimelineProviderBuilder.cs | 25 +- .../TimelineProviderSample/SampleModule.cs | 31 +- 143 files changed, 5202 insertions(+), 5350 deletions(-) diff --git a/Samples/Media SDK/OverlaySample/BouncingBall.cs b/Samples/Media SDK/OverlaySample/BouncingBall.cs index 677ddf7..d54c9f5 100644 --- a/Samples/Media SDK/OverlaySample/BouncingBall.cs +++ b/Samples/Media SDK/OverlaySample/BouncingBall.cs @@ -1,82 +1,81 @@ // Copyright (C) 2023 by Genetec, Inc. All rights reserved. // May be used only in accordance with a valid Source Code License Agreement. -namespace Genetec.Dap.CodeSamples +namespace Genetec.Dap.CodeSamples; + +using System.Windows; +using System.Windows.Media; +using Sdk.Media.Overlay; + +public class BouncingBall { - using System.Windows; - using System.Windows.Media; - using Sdk.Media.Overlay; + public double CanvasWidth = 1290; - public class BouncingBall - { - public double CanvasWidth = 1290; + public double CanvasHeight = 100; - public double CanvasHeight = 100; + private double m_x; - private double m_x; + private double m_y; - private double m_y; + private readonly double m_radius; - private readonly double m_radius; + private double m_horizontalVelocity; - private double m_horizontalVelocity; + private double m_verticalVelocity; - private double m_verticalVelocity; + private readonly SolidColorBrush m_brush; - private readonly SolidColorBrush m_brush; + private readonly Pen m_pen; - private readonly Pen m_pen; + public BouncingBall(double x, double y, double horizontalVelocity, double verticalVelocity, double radius) + { + m_x = x; + m_y = y; + m_horizontalVelocity = horizontalVelocity; + m_verticalVelocity = verticalVelocity; + m_radius = radius; - public BouncingBall(double x, double y, double horizontalVelocity, double verticalVelocity, double radius) - { - m_x = x; - m_y = y; - m_horizontalVelocity = horizontalVelocity; - m_verticalVelocity = verticalVelocity; - m_radius = radius; + m_brush = new SolidColorBrush((Color)ColorConverter.ConvertFromString("Red")); + m_brush.Freeze(); - m_brush = new SolidColorBrush((Color)ColorConverter.ConvertFromString("Red")); - m_brush.Freeze(); + m_pen = new Pen(m_brush, 1.0); + m_pen.Freeze(); + } - m_pen = new Pen(m_brush, 1.0); - m_pen.Freeze(); - } + public void Draw(Layer layer) + { + Update(); + layer.DrawEllipse(m_brush, m_pen, new Point(m_x, m_y), m_radius, m_radius); + } + + private void Update() + { + // Update position using basic physics equations + m_x += m_horizontalVelocity * 0.5f; + m_y += m_verticalVelocity * 0.5f; - public void Draw(Layer layer) + // Check if ball has collided with the left or right boundary + if (m_x - m_radius < 0) { - Update(); - layer.DrawEllipse(m_brush, m_pen, new Point(m_x, m_y), m_radius, m_radius); + m_x = m_radius; + m_horizontalVelocity = -m_horizontalVelocity; + } + else if (m_x + m_radius > CanvasWidth) + { + m_x = CanvasWidth - m_radius; + m_horizontalVelocity = -m_horizontalVelocity; } - private void Update() + // Check if ball has collided with the top or bottom boundary + if (m_y - m_radius < 0) + { + m_y = m_radius; + m_verticalVelocity = -m_verticalVelocity; + } + else if (m_y + m_radius > CanvasHeight) { - // Update position using basic physics equations - m_x += m_horizontalVelocity * 0.5f; - m_y += m_verticalVelocity * 0.5f; - - // Check if ball has collided with the left or right boundary - if (m_x - m_radius < 0) - { - m_x = m_radius; - m_horizontalVelocity = -m_horizontalVelocity; - } - else if (m_x + m_radius > CanvasWidth) - { - m_x = CanvasWidth - m_radius; - m_horizontalVelocity = -m_horizontalVelocity; - } - - // Check if ball has collided with the top or bottom boundary - if (m_y - m_radius < 0) - { - m_y = m_radius; - m_verticalVelocity = -m_verticalVelocity; - } - else if (m_y + m_radius > CanvasHeight) - { - m_y = CanvasHeight - m_radius; - m_verticalVelocity = -m_verticalVelocity; - } + m_y = CanvasHeight - m_radius; + m_verticalVelocity = -m_verticalVelocity; } } -} +} \ No newline at end of file diff --git a/Samples/Media SDK/OverlaySample/BouncingBallOverlay.cs b/Samples/Media SDK/OverlaySample/BouncingBallOverlay.cs index bbb9b96..f12d8cf 100644 --- a/Samples/Media SDK/OverlaySample/BouncingBallOverlay.cs +++ b/Samples/Media SDK/OverlaySample/BouncingBallOverlay.cs @@ -1,72 +1,71 @@ // Copyright (C) 2023 by Genetec, Inc. All rights reserved. // May be used only in accordance with a valid Source Code License Agreement. -namespace Genetec.Dap.CodeSamples +namespace Genetec.Dap.CodeSamples; + +using System; +using System.Threading; +using System.Threading.Tasks; +using Sdk.Media.Overlay; + +public class BouncingBallOverlay { - using System; - using System.Threading; - using System.Threading.Tasks; - using Sdk.Media.Overlay; + private readonly Guid m_cameraId; + private readonly Guid m_layerId = new Guid("69A64ACE-6DDC-4142-AD04-06690D8591B3"); + private Task m_task; + private CancellationTokenSource m_cancellationTokenSource; - public class BouncingBallOverlay + public BouncingBallOverlay(Guid cameraId) { - private readonly Guid m_cameraId; - private readonly Guid m_layerId = new Guid("69A64ACE-6DDC-4142-AD04-06690D8591B3"); - private Task m_task; - private CancellationTokenSource m_cancellationTokenSource; - - public BouncingBallOverlay(Guid cameraId) - { - m_cameraId = cameraId; - } + m_cameraId = cameraId; + } - public void Stop() - { - m_cancellationTokenSource?.Cancel(); - m_cancellationTokenSource?.Dispose(); - } + public void Stop() + { + m_cancellationTokenSource?.Cancel(); + m_cancellationTokenSource?.Dispose(); + } - public void Start() - { - if (m_task is { IsCompleted: false }) - return; + public void Start() + { + if (m_task is { IsCompleted: false }) + return; - m_cancellationTokenSource?.Dispose(); - m_cancellationTokenSource = new CancellationTokenSource(); + m_cancellationTokenSource?.Dispose(); + m_cancellationTokenSource = new CancellationTokenSource(); - CancellationToken token = m_cancellationTokenSource.Token; + CancellationToken token = m_cancellationTokenSource.Token; - m_task = Task.Run(async () => + m_task = Task.Run(async () => + { + var ball = new BouncingBall(50, 50, 50, 50, 25) { - var ball = new BouncingBall(50, 50, 50, 50, 25) - { - CanvasHeight = 960, - CanvasWidth = 1280 - }; - - Overlay overlay = OverlayFactory.Get(m_cameraId, "Bouncing ball"); + CanvasHeight = 960, + CanvasWidth = 1280 + }; - if (overlay.DrawingSurfaceWidth == 0 || overlay.DrawingSurfaceHeight == 0) - { - overlay.Initialize(1280, 960); - } + Overlay overlay = OverlayFactory.Get(m_cameraId, "Bouncing ball"); - await overlay.WaitUntilReadyForUpdate(); + if (overlay.DrawingSurfaceWidth == 0 || overlay.DrawingSurfaceHeight == 0) + { + overlay.Initialize(1280, 960); + } - Layer layer = overlay.CreateLayer(m_layerId, "Bouncing ball"); + await overlay.WaitUntilReadyForUpdate(); - while (!token.IsCancellationRequested) - { - ball.Draw(layer); + Layer layer = overlay.CreateLayer(m_layerId, "Bouncing ball"); - if (!layer.Update()) - { - Console.WriteLine("Update failed"); - } + while (!token.IsCancellationRequested) + { + ball.Draw(layer); - await Task.Delay(10, token); + if (!layer.Update()) + { + Console.WriteLine("Update failed"); } - }, token); - } + + await Task.Delay(10, token); + } + }, token); } -} +} \ No newline at end of file diff --git a/Samples/Media SDK/OverlaySample/OverlayExtensions.cs b/Samples/Media SDK/OverlaySample/OverlayExtensions.cs index 311af6c..f9b9b3c 100644 --- a/Samples/Media SDK/OverlaySample/OverlayExtensions.cs +++ b/Samples/Media SDK/OverlaySample/OverlayExtensions.cs @@ -1,40 +1,38 @@ // Copyright (C) 2023 by Genetec, Inc. All rights reserved. // May be used only in accordance with a valid Source Code License Agreement. -namespace Genetec.Dap.CodeSamples -{ - using System.Threading.Tasks; - using Sdk.Media.Overlay; +namespace Genetec.Dap.CodeSamples; - public static class OverlayExtensions - { - public static async Task WaitUntilReadyForUpdate(this Overlay overlay) - { - var completion = new TaskCompletionSource(); +using System.Threading.Tasks; +using Sdk.Media.Overlay; - overlay.StateChange += OnStateChange; - try - { - if (overlay.IsReadyForUpdate) - { - return; - } +public static class OverlayExtensions +{ + public static async Task WaitUntilReadyForUpdate(this Overlay overlay) + { + var completion = new TaskCompletionSource(); - await completion.Task; - } - finally + overlay.StateChange += OnStateChange; + try + { + if (overlay.IsReadyForUpdate) { - overlay.StateChange -= OnStateChange; + return; } - void OnStateChange(object sender, OverlayStatusEventArgs e) + await completion.Task; + } + finally + { + overlay.StateChange -= OnStateChange; + } + + void OnStateChange(object sender, OverlayStatusEventArgs e) + { + if (e.CanPropagateUpdate) { - if (e.CanPropagateUpdate) - { - completion.SetResult(null); - } + completion.SetResult(null); } } } - -} +} \ No newline at end of file diff --git a/Samples/Media SDK/OverlaySample/Program.cs b/Samples/Media SDK/OverlaySample/Program.cs index f38c942..b36b3ad 100644 --- a/Samples/Media SDK/OverlaySample/Program.cs +++ b/Samples/Media SDK/OverlaySample/Program.cs @@ -1,88 +1,87 @@ // Copyright (C) 2023 by Genetec, Inc. All rights reserved. // May be used only in accordance with a valid Source Code License Agreement. -namespace Genetec.Dap.CodeSamples +namespace Genetec.Dap.CodeSamples; + +using System; +using System.Data; +using System.Linq; +using System.Threading.Tasks; +using Sdk.Entities; +using Sdk.Media.Overlay; +using Sdk; +using Sdk.Queries; + +class Program { - using System; - using System.Data; - using System.Linq; - using System.Threading.Tasks; - using Sdk.Entities; - using Sdk.Media.Overlay; - using Sdk; - using Sdk.Queries; - - class Program - { - static Program() => SdkResolver.Initialize(); - - static async Task Main() - { - const string server = "localhost"; - const string username = "admin"; - const string password = ""; + static Program() => SdkResolver.Initialize(); - using var engine = new Engine(); - - ConnectionStateCode state = await engine.LogOnAsync(server, username, password); + static async Task Main() + { + const string server = "localhost"; + const string username = "admin"; + const string password = ""; - if (state == ConnectionStateCode.Success) - { - OverlayFactory.Initialize(engine); + using var engine = new Engine(); - Camera camera = await FindSupportedCamera(); + ConnectionStateCode state = await engine.LogOnAsync(server, username, password); - if (camera is null) - { - Console.WriteLine("No camera found"); - } - else - { - Console.WriteLine($"Drawing overlays on camera: {camera.Name}"); + if (state == ConnectionStateCode.Success) + { + OverlayFactory.Initialize(engine); - var timecodeOverlay = new TimecodeOverlay(camera.Guid); - timecodeOverlay.Start(); + Camera camera = await FindSupportedCamera(); - var bouncingBall = new BouncingBallOverlay(camera.Guid); - bouncingBall.Start(); - } + if (camera is null) + { + Console.WriteLine("No camera found"); } else { - Console.WriteLine($"Logon failed: {state}"); + Console.WriteLine($"Drawing overlays on camera: {camera.Name}"); + + var timecodeOverlay = new TimecodeOverlay(camera.Guid); + timecodeOverlay.Start(); + + var bouncingBall = new BouncingBallOverlay(camera.Guid); + bouncingBall.Start(); } + } + else + { + Console.WriteLine($"Logon failed: {state}"); + } - Console.WriteLine("Press any key to exit..."); - Console.ReadKey(); + Console.WriteLine("Press any key to exit..."); + Console.ReadKey(); - async Task FindSupportedCamera() - { - var query = (EntityConfigurationQuery)engine.ReportManager.CreateReportQuery(ReportType.EntityConfiguration); - query.EntityTypeFilter.Add(EntityType.Camera); - query.Page = 1; - query.PageSize = 50; + async Task FindSupportedCamera() + { + var query = (EntityConfigurationQuery)engine.ReportManager.CreateReportQuery(ReportType.EntityConfiguration); + query.EntityTypeFilter.Add(EntityType.Camera); + query.Page = 1; + query.PageSize = 50; - QueryCompletedEventArgs args; - do - { - var result = args = await Task.Factory.FromAsync(query.BeginQuery, query.EndQuery, null); + QueryCompletedEventArgs args; + do + { + var result = args = await Task.Factory.FromAsync(query.BeginQuery, query.EndQuery, null); - var camera = result.Data.AsEnumerable().Take(query.PageSize) - .Select(row => engine.GetEntity(row.Field(nameof(Guid)))) - .OfType() - .FirstOrDefault(camera => camera.IsOverlaySupported && camera.RunningState == State.Running); + var camera = result.Data.AsEnumerable().Take(query.PageSize) + .Select(row => engine.GetEntity(row.Field(nameof(Guid)))) + .OfType() + .FirstOrDefault(camera => camera.IsOverlaySupported && camera.RunningState == State.Running); - if (camera != null) - { - return camera; - } + if (camera != null) + { + return camera; + } - query.Page++; + query.Page++; - } while (args.Error == ReportError.TooManyResults || args.Data.Rows.Count > query.PageSize); + } while (args.Error == ReportError.TooManyResults || args.Data.Rows.Count > query.PageSize); - return null; - } + return null; } } -} +} \ No newline at end of file diff --git a/Samples/Media SDK/OverlaySample/TimecodeOverlay.cs b/Samples/Media SDK/OverlaySample/TimecodeOverlay.cs index bda19ce..981925f 100644 --- a/Samples/Media SDK/OverlaySample/TimecodeOverlay.cs +++ b/Samples/Media SDK/OverlaySample/TimecodeOverlay.cs @@ -1,61 +1,59 @@ // Copyright (C) 2023 by Genetec, Inc. All rights reserved. // May be used only in accordance with a valid Source Code License Agreement. -namespace Genetec.Dap.CodeSamples +namespace Genetec.Dap.CodeSamples; + +using System; +using System.Threading; +using System.Threading.Tasks; +using Sdk.Media.Overlay; + +public class TimecodeOverlay { - using System; - using System.Threading; - using System.Threading.Tasks; - using Sdk.Media.Overlay; + private readonly Guid m_cameraId; + private readonly Guid m_layerId = new Guid("69A64ACE-6DDC-4142-AD04-06690D8591B3"); + private CancellationTokenSource m_cancellationTokenSource; + private Task m_task; - public class TimecodeOverlay + public TimecodeOverlay(Guid cameraId) { - private readonly Guid m_cameraId; - private readonly Guid m_layerId = new Guid("69A64ACE-6DDC-4142-AD04-06690D8591B3"); - private CancellationTokenSource m_cancellationTokenSource; - private Task m_task; - - public TimecodeOverlay(Guid cameraId) - { - m_cameraId = cameraId; - } + m_cameraId = cameraId; + } - public void Stop() - { - m_cancellationTokenSource?.Cancel(); - m_cancellationTokenSource?.Dispose(); - } + public void Stop() + { + m_cancellationTokenSource?.Cancel(); + m_cancellationTokenSource?.Dispose(); + } - public void Start() - { - if (m_task is { IsCompleted: false }) - return; + public void Start() + { + if (m_task is { IsCompleted: false }) + return; - m_cancellationTokenSource = new CancellationTokenSource(); - var token = m_cancellationTokenSource.Token; + m_cancellationTokenSource = new CancellationTokenSource(); + var token = m_cancellationTokenSource.Token; - m_task = Task.Run(async () => - { - Overlay overlay = OverlayFactory.Get(m_cameraId, "Timecode"); + m_task = Task.Run(async () => + { + Overlay overlay = OverlayFactory.Get(m_cameraId, "Timecode"); - if (overlay.DrawingSurfaceWidth == 0 || overlay.DrawingSurfaceHeight == 0) - overlay.Initialize(1280, 960); + if (overlay.DrawingSurfaceWidth == 0 || overlay.DrawingSurfaceHeight == 0) + overlay.Initialize(1280, 960); - await overlay.WaitUntilReadyForUpdate(); + await overlay.WaitUntilReadyForUpdate(); - Layer layer = overlay.CreateLayer(m_layerId, "Timecode"); + Layer layer = overlay.CreateLayer(m_layerId, "Timecode"); - while (!token.IsCancellationRequested) - { - layer.DrawText(DateTime.Now.ToString("F"), "Arial", 18, "Red", 0, 0); + while (!token.IsCancellationRequested) + { + layer.DrawText(DateTime.Now.ToString("F"), "Arial", 18, "Red", 0, 0); - if (!layer.Update()) - Console.WriteLine("Update failed"); + if (!layer.Update()) + Console.WriteLine("Update failed"); - await Task.Delay(1000, token); - } - }, token); - } + await Task.Delay(1000, token); + } + }, token); } - } \ No newline at end of file diff --git a/Samples/Media SDK/PlaybackStreamReaderSample/Program.cs b/Samples/Media SDK/PlaybackStreamReaderSample/Program.cs index ea3bb60..40ca00c 100644 --- a/Samples/Media SDK/PlaybackStreamReaderSample/Program.cs +++ b/Samples/Media SDK/PlaybackStreamReaderSample/Program.cs @@ -1,58 +1,57 @@ // Copyright (C) 2023 by Genetec, Inc. All rights reserved. // May be used only in accordance with a valid Source Code License Agreement. -namespace Genetec.Dap.CodeSamples +namespace Genetec.Dap.CodeSamples; + +using System; +using System.Threading.Tasks; +using Sdk; +using Sdk.Entities; +using Sdk.Media.Reader; + +class Program { - using System; - using System.Threading.Tasks; - using Sdk; - using Sdk.Entities; - using Sdk.Media.Reader; + static Program() => SdkResolver.Initialize(); - class Program + static async Task Main() { - static Program() => SdkResolver.Initialize(); + const string server = "localhost"; + const string username = "admin"; + const string password = ""; - static async Task Main() - { - const string server = "localhost"; - const string username = "admin"; - const string password = ""; + using var engine = new Engine(); - using var engine = new Engine(); + ConnectionStateCode state = await engine.LogOnAsync(server, username, password); - ConnectionStateCode state = await engine.LogOnAsync(server, username, password); + if (state == ConnectionStateCode.Success) + { + var camera = (Camera)engine.GetEntity(EntityType.Camera, 1); - if (state == ConnectionStateCode.Success) + await using var reader = PlaybackStreamReader.CreateVideoReader(engine, camera.Guid); + await reader.ConnectAsync(); + await reader.SeekAsync(DateTime.UtcNow.AddMinutes(-1)); + + while (true) { - var camera = (Camera)engine.GetEntity(EntityType.Camera, 1); + RawDataContent content = await reader.ReadAsync(); + if (content is null) + { + Console.WriteLine("End reached"); + break; + } - await using var reader = PlaybackStreamReader.CreateVideoReader(engine, camera.Guid); - await reader.ConnectAsync(); - await reader.SeekAsync(DateTime.UtcNow.AddMinutes(-1)); - - while (true) + using (content) { - RawDataContent content = await reader.ReadAsync(); - if (content is null) - { - Console.WriteLine("End reached"); - break; - } - - using (content) - { - Console.WriteLine($"Frame time {content.FrameTime}, Format: {content.Format}, Data size: {content.Data.Count}"); - } + Console.WriteLine($"Frame time {content.FrameTime}, Format: {content.Format}, Data size: {content.Data.Count}"); } } - else - { - Console.WriteLine($"logon failed: {state}"); - } - - Console.WriteLine("Press any key to exit..."); - Console.ReadKey(); } + else + { + Console.WriteLine($"logon failed: {state}"); + } + + Console.WriteLine("Press any key to exit..."); + Console.ReadKey(); } } \ No newline at end of file diff --git a/Samples/Media SDK/VideoExportSample/ExportOption.cs b/Samples/Media SDK/VideoExportSample/ExportOption.cs index 7eabb29..29054af 100644 --- a/Samples/Media SDK/VideoExportSample/ExportOption.cs +++ b/Samples/Media SDK/VideoExportSample/ExportOption.cs @@ -1,19 +1,17 @@ // Copyright (C) 2023 by Genetec, Inc. All rights reserved. // May be used only in accordance with a valid Source Code License Agreement. -namespace Genetec.Dap.CodeSamples -{ - using Sdk.Media.Export; +namespace Genetec.Dap.CodeSamples; - public struct ExportOption - { - public VideoExportFormat Format { get; set; } +using Sdk.Media.Export; - public PlaybackMode PlaybackMode { get; set; } +public struct ExportOption +{ + public VideoExportFormat Format { get; set; } - public bool IncludeWatermark { get; set; } + public PlaybackMode PlaybackMode { get; set; } - public bool ExportAudio { get; set; } - } -} + public bool IncludeWatermark { get; set; } + public bool ExportAudio { get; set; } +} \ No newline at end of file diff --git a/Samples/Media SDK/VideoExportSample/G64ConverterBaseExtensions.cs b/Samples/Media SDK/VideoExportSample/G64ConverterBaseExtensions.cs index cf658a6..3a17ce2 100644 --- a/Samples/Media SDK/VideoExportSample/G64ConverterBaseExtensions.cs +++ b/Samples/Media SDK/VideoExportSample/G64ConverterBaseExtensions.cs @@ -8,42 +8,41 @@ using System.Threading.Tasks; using Genetec.Sdk.Media.Export; -namespace Genetec.Dap.CodeSamples +namespace Genetec.Dap.CodeSamples; + +public static class G64ConverterBaseExtensions { - public static class G64ConverterBaseExtensions + public static async Task> ConvertAsync(this G64ConverterBase converter, IProgress progress, CancellationToken token) { - public static async Task> ConvertAsync(this G64ConverterBase converter, IProgress progress, CancellationToken token) - { - token.Register(() => converter.CancelConversion(true)); + token.Register(() => converter.CancelConversion(true)); - ConversionFinishedEventArgs args = null; + ConversionFinishedEventArgs args = null; - converter.ProgressChanged += OnProgressChanged; - converter.ConversionFinished += OnConversionFinished; - try - { - await converter.ConvertAsync().ConfigureAwait(false); + converter.ProgressChanged += OnProgressChanged; + converter.ConversionFinished += OnConversionFinished; + try + { + await converter.ConvertAsync().ConfigureAwait(false); - if (args.Result == ConversionResult.Cancelled) - throw new OperationCanceledException(token); + if (args.Result == ConversionResult.Cancelled) + throw new OperationCanceledException(token); - if (args.ExceptionDetails != null) - throw args.ExceptionDetails; + if (args.ExceptionDetails != null) + throw args.ExceptionDetails; - if (!string.IsNullOrEmpty(args.ErrorMessage)) - throw new Exception(args.ErrorMessage); + if (!string.IsNullOrEmpty(args.ErrorMessage)) + throw new Exception(args.ErrorMessage); - return args.Filenames; - } - finally - { - converter.ProgressChanged -= OnProgressChanged; - converter.ConversionFinished -= OnConversionFinished; - } + return args.Filenames; + } + finally + { + converter.ProgressChanged -= OnProgressChanged; + converter.ConversionFinished -= OnConversionFinished; + } - void OnProgressChanged(object sender, ProgressChangedEventArgs e) => progress?.Report(e.ProgressPercentage); + void OnProgressChanged(object sender, ProgressChangedEventArgs e) => progress?.Report(e.ProgressPercentage); - void OnConversionFinished(object sender, ConversionFinishedEventArgs e) => args = e; - } + void OnConversionFinished(object sender, ConversionFinishedEventArgs e) => args = e; } } \ No newline at end of file diff --git a/Samples/Media SDK/VideoExportSample/Program.cs b/Samples/Media SDK/VideoExportSample/Program.cs index 26b3e00..8ef89fe 100644 --- a/Samples/Media SDK/VideoExportSample/Program.cs +++ b/Samples/Media SDK/VideoExportSample/Program.cs @@ -1,81 +1,80 @@ // Copyright (C) 2023 by Genetec, Inc. All rights reserved. // May be used only in accordance with a valid Source Code License Agreement. -namespace Genetec.Dap.CodeSamples +namespace Genetec.Dap.CodeSamples; + +using System; +using System.IO; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Sdk.Entities; +using Sdk.Media.Export; +using Sdk; + +class Program { - using System; - using System.IO; - using System.Linq; - using System.Threading; - using System.Threading.Tasks; - using Sdk.Entities; - using Sdk.Media.Export; - using Sdk; + static Program() => SdkResolver.Initialize(); - class Program + static async Task Main() { - static Program() => SdkResolver.Initialize(); + const string server = "localhost"; + const string username = "admin"; + const string password = ""; - static async Task Main() - { - const string server = "localhost"; - const string username = "admin"; - const string password = ""; + using var engine = new Engine(); - using var engine = new Engine(); + ConnectionStateCode state = await engine.LogOnAsync(server, username, password); - ConnectionStateCode state = await engine.LogOnAsync(server, username, password); + if (state == ConnectionStateCode.Success) + { + var entity = (Camera)engine.GetEntity(EntityType.Camera, 1); - if (state == ConnectionStateCode.Success) + try { - var entity = (Camera)engine.GetEntity(EntityType.Camera, 1); - - try - { - var progress = new Progress(percent => Console.WriteLine($"Export progress: {percent}")); - var exportedFile = await Export(engine, entity, DateTime.UtcNow.AddMinutes(-5), DateTime.UtcNow, "Export", progress); - Console.WriteLine($"Video file exported: {exportedFile}"); - } - catch (Exception ex) - { - Console.WriteLine($"An error occured while exporting video: {ex.Message}"); - } + var progress = new Progress(percent => Console.WriteLine($"Export progress: {percent}")); + var exportedFile = await Export(engine, entity, DateTime.UtcNow.AddMinutes(-5), DateTime.UtcNow, "Export", progress); + Console.WriteLine($"Video file exported: {exportedFile}"); } - else + catch (Exception ex) { - Console.WriteLine($"Logon failed: {state}"); + Console.WriteLine($"An error occured while exporting video: {ex.Message}"); } - - Console.WriteLine("Press any key to exit..."); - Console.ReadKey(); } - - static async Task Export(Engine engine, Camera camera, DateTime startTime, DateTime endTime, string fileName, IProgress progress = null, CancellationToken cancellationToken = default) + else { - var exporter = new MediaExporter(); - exporter.StatisticsReceived += OnStatisticsReceived; + Console.WriteLine($"Logon failed: {state}"); + } - try - { - exporter.Initialize(engine, Environment.CurrentDirectory); - exporter.SetExportFileFormat(MediaExportFileFormat.G64X); + Console.WriteLine("Press any key to exit..."); + Console.ReadKey(); + } - var config = new CameraExportConfig(camera.Guid, Enumerable.Repeat(new Genetec.Sdk.Media.DateTimeRange(startTime, endTime), 1)); + static async Task Export(Engine engine, Camera camera, DateTime startTime, DateTime endTime, string fileName, IProgress progress = null, CancellationToken cancellationToken = default) + { + var exporter = new MediaExporter(); + exporter.StatisticsReceived += OnStatisticsReceived; - using (cancellationToken.Register(() => exporter.CancelExport(true))) - { - ExportEndedResult result = await exporter.ExportAsync(config, PlaybackMode.AllAtOnce, Path.GetFileNameWithoutExtension(fileName), false); + try + { + exporter.Initialize(engine, Environment.CurrentDirectory); + exporter.SetExportFileFormat(MediaExportFileFormat.G64X); - return result.ExceptionDetails != null ? throw result.ExceptionDetails : result.ExportFileList.FirstOrDefault(); - } - } - finally + var config = new CameraExportConfig(camera.Guid, Enumerable.Repeat(new Genetec.Sdk.Media.DateTimeRange(startTime, endTime), 1)); + + using (cancellationToken.Register(() => exporter.CancelExport(true))) { - exporter.StatisticsReceived -= OnStatisticsReceived; - exporter.Dispose(); - } + ExportEndedResult result = await exporter.ExportAsync(config, PlaybackMode.AllAtOnce, Path.GetFileNameWithoutExtension(fileName), false); - void OnStatisticsReceived(object sender, ExportStatisticsEventArgs args) => progress?.Report(args.ExportPercentComplete); + return result.ExceptionDetails != null ? throw result.ExceptionDetails : result.ExportFileList.FirstOrDefault(); + } } + finally + { + exporter.StatisticsReceived -= OnStatisticsReceived; + exporter.Dispose(); + } + + void OnStatisticsReceived(object sender, ExportStatisticsEventArgs args) => progress?.Report(args.ExportPercentComplete); } -} +} \ No newline at end of file diff --git a/Samples/Media SDK/VideoExportSample/VideoExport.cs b/Samples/Media SDK/VideoExportSample/VideoExport.cs index fc5c96f..2490233 100644 --- a/Samples/Media SDK/VideoExportSample/VideoExport.cs +++ b/Samples/Media SDK/VideoExportSample/VideoExport.cs @@ -1,63 +1,63 @@ // Copyright (C) 2023 by Genetec, Inc. All rights reserved. // May be used only in accordance with a valid Source Code License Agreement. -namespace Genetec.Dap.CodeSamples +namespace Genetec.Dap.CodeSamples; + +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Sdk; +using Sdk.Entities; +using Sdk.Media.Export; +using File = System.IO.File; + +public class VideoExport { - using System; - using System.Collections.Generic; - using System.IO; - using System.Linq; - using System.Threading; - using System.Threading.Tasks; - using Sdk; - using Sdk.Entities; - using Sdk.Media.Export; - using File = System.IO.File; - - public class VideoExport - { - private readonly IEngine m_engine; + private readonly IEngine m_engine; - public VideoExport(IEngine engine) => m_engine = engine; + public VideoExport(IEngine engine) => m_engine = engine; - public Task Export(IEnumerable cameras, Sdk.Media.DateTimeRange range, string fileName, ExportOption option, IProgress progress = null, CancellationToken cancellationToken = default) - { - IEnumerable configs = cameras.Select(camera => new CameraExportConfig(camera.Guid, Enumerable.Repeat(range, 1))); + public Task Export(IEnumerable cameras, Sdk.Media.DateTimeRange range, string fileName, ExportOption option, IProgress progress = null, CancellationToken cancellationToken = default) + { + IEnumerable configs = cameras.Select(camera => new CameraExportConfig(camera.Guid, Enumerable.Repeat(range, 1))); - return option.Format != VideoExportFormat.G64x - ? Task.WhenAll(configs.Select(config => Export(Enumerable.Repeat(config, 1), fileName, option, progress, cancellationToken))) - : Export(configs, fileName, option, progress, cancellationToken); - } + return option.Format != VideoExportFormat.G64x + ? Task.WhenAll(configs.Select(config => Export(Enumerable.Repeat(config, 1), fileName, option, progress, cancellationToken))) + : Export(configs, fileName, option, progress, cancellationToken); + } - public async Task Export(IEnumerable configs, string fileName, ExportOption option, IProgress progress = null, CancellationToken cancellationToken = default) + public async Task Export(IEnumerable configs, string fileName, ExportOption option, IProgress progress = null, CancellationToken cancellationToken = default) + { + var exporter = new MediaExporter(); + exporter.StatisticsReceived += OnStatisticsReceived; + try { - var exporter = new MediaExporter(); - exporter.StatisticsReceived += OnStatisticsReceived; - try - { - exporter.Initialize(m_engine, Path.GetDirectoryName(fileName)); - exporter.SetExportFileFormat(option.Format == VideoExportFormat.G64 ? MediaExportFileFormat.G64 : MediaExportFileFormat.G64X); + exporter.Initialize(m_engine, Path.GetDirectoryName(fileName)); + exporter.SetExportFileFormat(option.Format == VideoExportFormat.G64 ? MediaExportFileFormat.G64 : MediaExportFileFormat.G64X); - ExportEndedResult result = await exporter.ExportAsync(configs, option.PlaybackMode, Path.GetFileNameWithoutExtension(fileName), option.IncludeWatermark); + ExportEndedResult result = await exporter.ExportAsync(configs, option.PlaybackMode, Path.GetFileNameWithoutExtension(fileName), option.IncludeWatermark); - if (result.ExceptionDetails != null) - throw result.ExceptionDetails; + if (result.ExceptionDetails != null) + throw result.ExceptionDetails; - await Task.WhenAll(result.ExportFileList.Select(filePath => Convert(filePath, option.Format, new Progress(value => progress?.Report(value))))); - } - finally - { - exporter.StatisticsReceived -= OnStatisticsReceived; - exporter.Dispose(); - } + await Task.WhenAll(result.ExportFileList.Select(filePath => Convert(filePath, option.Format, new Progress(value => progress?.Report(value))))); + } + finally + { + exporter.StatisticsReceived -= OnStatisticsReceived; + exporter.Dispose(); + } - void OnStatisticsReceived(object sender, ExportStatisticsEventArgs args) => progress?.Report(args.ExportPercentComplete); + void OnStatisticsReceived(object sender, ExportStatisticsEventArgs args) => progress?.Report(args.ExportPercentComplete); - async Task Convert(string filePath, VideoExportFormat format, IProgress convertProgress) + async Task Convert(string filePath, VideoExportFormat format, IProgress convertProgress) + { + switch (format) { - switch (format) - { - case VideoExportFormat.Asf: + case VideoExportFormat.Asf: using (var converter = new G64ToAsfConverter()) { converter.Initialize( @@ -73,7 +73,7 @@ async Task Convert(string filePath, VideoExportFormat format, IProgress con break; - case VideoExportFormat.MP4: + case VideoExportFormat.MP4: using (var converter = new G64ToMp4Converter()) { converter.Initialize( @@ -86,21 +86,20 @@ async Task Convert(string filePath, VideoExportFormat format, IProgress con } break; - } + } - string GetOutputFilePath() + string GetOutputFilePath() + { + string path = Path.Combine(Path.GetDirectoryName(filePath), $"{Path.GetFileNameWithoutExtension(filePath)}.{format.ToString().ToLower()}"); + if (File.Exists(path)) { - string path = Path.Combine(Path.GetDirectoryName(filePath), $"{Path.GetFileNameWithoutExtension(filePath)}.{format.ToString().ToLower()}"); - if (File.Exists(path)) - { - File.Delete(path); - } - - return path; + File.Delete(path); } - Task ConvertAsync(G64ConverterBase converter) => converter.ConvertAsync(convertProgress, cancellationToken).ContinueWith(task => File.Delete(filePath), cancellationToken); + return path; } + + Task ConvertAsync(G64ConverterBase converter) => converter.ConvertAsync(convertProgress, cancellationToken).ContinueWith(task => File.Delete(filePath), cancellationToken); } } } \ No newline at end of file diff --git a/Samples/Media SDK/VideoExportSample/VideoExportFormat.cs b/Samples/Media SDK/VideoExportSample/VideoExportFormat.cs index 3618a74..5d747cd 100644 --- a/Samples/Media SDK/VideoExportSample/VideoExportFormat.cs +++ b/Samples/Media SDK/VideoExportSample/VideoExportFormat.cs @@ -1,13 +1,12 @@ // Copyright (C) 2023 by Genetec, Inc. All rights reserved. // May be used only in accordance with a valid Source Code License Agreement. -namespace Genetec.Dap.CodeSamples +namespace Genetec.Dap.CodeSamples; + +public enum VideoExportFormat { - public enum VideoExportFormat - { - G64x, - G64, - Asf, - MP4 - } + G64x, + G64, + Asf, + MP4 } \ No newline at end of file diff --git a/Samples/Media SDK/VideoSourceFilterSample/Program.cs b/Samples/Media SDK/VideoSourceFilterSample/Program.cs index e816d94..6c2864f 100644 --- a/Samples/Media SDK/VideoSourceFilterSample/Program.cs +++ b/Samples/Media SDK/VideoSourceFilterSample/Program.cs @@ -1,114 +1,113 @@ // Copyright (C) 2023 by Genetec, Inc. All rights reserved. // May be used only in accordance with a valid Source Code License Agreement. -namespace Genetec.Dap.CodeSamples +namespace Genetec.Dap.CodeSamples; + +using System; +using System.Drawing.Imaging; +using System.IO; +using System.Threading.Tasks; +using Sdk.Entities; +using Sdk; +using Sdk.Media; + +class Program { - using System; - using System.Drawing.Imaging; - using System.IO; - using System.Threading.Tasks; - using Sdk.Entities; - using Sdk; - using Sdk.Media; - - class Program + static Program() => SdkResolver.Initialize(); + + static async Task Main() { - static Program() => SdkResolver.Initialize(); + const string server = "localhost"; + const string username = "admin"; + const string password = ""; - static async Task Main() - { - const string server = "localhost"; - const string username = "admin"; - const string password = ""; + using var engine = new Engine(); - using var engine = new Engine(); + ConnectionStateCode state = await engine.LogOnAsync(server, username, password); - ConnectionStateCode state = await engine.LogOnAsync(server, username, password); + if (state == ConnectionStateCode.Success) + { + var camera = (Camera)engine.GetEntity(EntityType.Camera, 1); + + using var videoSourceFilter = new VideoSourceFilter(); - if (state == ConnectionStateCode.Success) + videoSourceFilter.FrameDecoded += (sender, args) => { - var camera = (Camera)engine.GetEntity(EntityType.Camera, 1); + using (args) + { + Console.WriteLine($"Frame Time: {args.FrameTime}, IsKeyFrame: {args.IsKeyFrame}"); + } + }; - using var videoSourceFilter = new VideoSourceFilter(); + videoSourceFilter.Initialize(engine, camera.Guid); + videoSourceFilter.PlayLive(); + } + else + { + Console.WriteLine($"Logon failed: {state}"); + } - videoSourceFilter.FrameDecoded += (sender, args) => - { - using (args) - { - Console.WriteLine($"Frame Time: {args.FrameTime}, IsKeyFrame: {args.IsKeyFrame}"); - } - }; + Console.WriteLine("Press any key to exit..."); + Console.ReadKey(); + } - videoSourceFilter.Initialize(engine, camera.Guid); + static async Task GetCameraSnapshot(Engine engine, Guid camera) + { + var completion = new TaskCompletionSource(); + + using (var videoSourceFilter = new VideoSourceFilter()) + { + videoSourceFilter.FrameDecoded += OnFrameDecoded; + videoSourceFilter.PlayerStateChanged += OnPlayerStateChanged; + try + { + videoSourceFilter.Initialize(engine, camera); videoSourceFilter.PlayLive(); + return await completion.Task; } - else + finally { - Console.WriteLine($"Logon failed: {state}"); + videoSourceFilter.FrameDecoded -= OnFrameDecoded; + videoSourceFilter.Stop(); } - - Console.WriteLine("Press any key to exit..."); - Console.ReadKey(); } - static async Task GetCameraSnapshot(Engine engine, Guid camera) + void OnFrameDecoded(object sender, FrameDecodedEventArgs args) { - var completion = new TaskCompletionSource(); - - using (var videoSourceFilter = new VideoSourceFilter()) + using (args) { - videoSourceFilter.FrameDecoded += OnFrameDecoded; - videoSourceFilter.PlayerStateChanged += OnPlayerStateChanged; + using var decodedFrame = args.DecodedFrameContent?.GetBitmap(); + if (decodedFrame is null) + return; + + using var bitmap = decodedFrame.Bitmap; + using var memoryStream = new MemoryStream(); + try { - videoSourceFilter.Initialize(engine, camera); - videoSourceFilter.PlayLive(); - return await completion.Task; + bitmap.Save(memoryStream, ImageFormat.Bmp); } - finally + catch (Exception ex) { - videoSourceFilter.FrameDecoded -= OnFrameDecoded; - videoSourceFilter.Stop(); + completion.SetException(ex); } - } - void OnFrameDecoded(object sender, FrameDecodedEventArgs args) - { - using (args) - { - using var decodedFrame = args.DecodedFrameContent?.GetBitmap(); - if (decodedFrame is null) - return; - - using var bitmap = decodedFrame.Bitmap; - using var memoryStream = new MemoryStream(); - - try - { - bitmap.Save(memoryStream, ImageFormat.Bmp); - } - catch (Exception ex) - { - completion.SetException(ex); - } - - memoryStream.Position = 0; - completion.TrySetResult(memoryStream.ToArray()); - } + memoryStream.Position = 0; + completion.TrySetResult(memoryStream.ToArray()); } + } - void OnPlayerStateChanged(object sender, PlayerStateChangedEventArgs e) + void OnPlayerStateChanged(object sender, PlayerStateChangedEventArgs e) + { + switch (e.State) { - switch (e.State) + case PlayerState.NoVideoSequenceAvailable: + case PlayerState.InsufficientSecurityInformation: + case PlayerState.Error: { - case PlayerState.NoVideoSequenceAvailable: - case PlayerState.InsufficientSecurityInformation: - case PlayerState.Error: - { - var videoSourceFilter = (VideoSourceFilter)sender; - completion.TrySetException(new Exception(videoSourceFilter.ErrorDetails?.Details)); - break; - } + var videoSourceFilter = (VideoSourceFilter)sender; + completion.TrySetException(new Exception(videoSourceFilter.ErrorDetails?.Details)); + break; } } } diff --git a/Samples/Platform SDK/AccessControlUnitManagerSample/Program.cs b/Samples/Platform SDK/AccessControlUnitManagerSample/Program.cs index 18a4ec3..4b360c0 100644 --- a/Samples/Platform SDK/AccessControlUnitManagerSample/Program.cs +++ b/Samples/Platform SDK/AccessControlUnitManagerSample/Program.cs @@ -1,68 +1,67 @@ // Copyright (C) 2023 by Genetec, Inc. All rights reserved. // May be used only in accordance with a valid Source Code License Agreement. -namespace Genetec.Dap.CodeSamples +namespace Genetec.Dap.CodeSamples; + +using System; +using System.Linq; +using System.Net; +using System.Security; +using System.Threading.Tasks; +using Sdk; +using Sdk.Entities; +using Sdk.Entities.AccessControl; +using Sdk.Queries; + +class Program { - using System; - using System.Linq; - using System.Net; - using System.Security; - using System.Threading.Tasks; - using Sdk; - using Sdk.Entities; - using Sdk.Entities.AccessControl; - using Sdk.Queries; + static Program() => SdkResolver.Initialize(); - class Program + static async Task Main() { - static Program() => SdkResolver.Initialize(); + const string server = "localhost"; + const string username = "admin"; + const string password = ""; - static async Task Main() - { - const string server = "localhost"; - const string username = "admin"; - const string password = ""; + using var engine = new Engine(); - using var engine = new Engine(); + ConnectionStateCode state = await engine.LogOnAsync(server, username, password); - ConnectionStateCode state = await engine.LogOnAsync(server, username, password); - - if (state == ConnectionStateCode.Success) - { - AccessManagerRole accessManagerRole = await GetAccessManagerRole(); + if (state == ConnectionStateCode.Success) + { + AccessManagerRole accessManagerRole = await GetAccessManagerRole(); - var info = new AddAccessControlUnitInfo( - address: IPAddress.Parse("127.0.0.1"), - extensionType: AccessControlExtensionType.CloudLink, - port: 80, - username: "admin", - password: new SecureString()); + var info = new AddAccessControlUnitInfo( + address: IPAddress.Parse("127.0.0.1"), + extensionType: AccessControlExtensionType.CloudLink, + port: 80, + username: "admin", + password: new SecureString()); - engine.AccessControlUnitManager.UnitEnrollmentSucceeded += (sender, e) => Console.WriteLine("Unit enrollment succeeded"); - engine.AccessControlUnitManager.UnitEnrollmentFailed += (sender, e) => Console.WriteLine($"Unit enrollment failed: {e.ActionDetails}"); - engine.AccessControlUnitManager.UnitEnrollmentUpdated += (sender, e) => Console.WriteLine($"Unit enrollment progress: {e.State}"); + engine.AccessControlUnitManager.UnitEnrollmentSucceeded += (sender, e) => Console.WriteLine("Unit enrollment succeeded"); + engine.AccessControlUnitManager.UnitEnrollmentFailed += (sender, e) => Console.WriteLine($"Unit enrollment failed: {e.ActionDetails}"); + engine.AccessControlUnitManager.UnitEnrollmentUpdated += (sender, e) => Console.WriteLine($"Unit enrollment progress: {e.State}"); - Console.WriteLine("Enrolling access control unit..."); - engine.AccessControlUnitManager.EnrollAccessControlUnit(info, accessManagerRole.Guid); - } - else - { - Console.WriteLine($"Logon failed: {state}"); - } + Console.WriteLine("Enrolling access control unit..."); + engine.AccessControlUnitManager.EnrollAccessControlUnit(info, accessManagerRole.Guid); + } + else + { + Console.WriteLine($"Logon failed: {state}"); + } - Console.WriteLine("Press any key to exit..."); - Console.ReadKey(); + Console.WriteLine("Press any key to exit..."); + Console.ReadKey(); - async Task GetAccessManagerRole() - { - var query = (EntityConfigurationQuery)engine.ReportManager.CreateReportQuery(ReportType.EntityConfiguration); - query.EntityTypeFilter.Add(EntityType.Role); - query.DownloadAllRelatedData = true; + async Task GetAccessManagerRole() + { + var query = (EntityConfigurationQuery)engine.ReportManager.CreateReportQuery(ReportType.EntityConfiguration); + query.EntityTypeFilter.Add(EntityType.Role); + query.DownloadAllRelatedData = true; - await Task.Factory.FromAsync(query.BeginQuery, query.EndQuery, null); + await Task.Factory.FromAsync(query.BeginQuery, query.EndQuery, null); - return engine.GetEntities(EntityType.Role).OfType().FirstOrDefault(); - } + return engine.GetEntities(EntityType.Role).OfType().FirstOrDefault(); } } -} +} \ No newline at end of file diff --git a/Samples/Platform SDK/AccessControlUnitSample/Program.cs b/Samples/Platform SDK/AccessControlUnitSample/Program.cs index 60028ae..f76494c 100644 --- a/Samples/Platform SDK/AccessControlUnitSample/Program.cs +++ b/Samples/Platform SDK/AccessControlUnitSample/Program.cs @@ -5,321 +5,320 @@ // Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -namespace Genetec.Dap.CodeSamples +namespace Genetec.Dap.CodeSamples; + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Sdk; +using Sdk.Entities; +using Sdk.Entities.AccessControl.AccessControlInterfaces.AccessControlInterfaceBaseClasses; +using Sdk.Entities.Devices; +using Sdk.Queries; + +class Program { - using System; - using System.Collections.Generic; - using System.Linq; - using System.Threading.Tasks; - using Sdk; - using Sdk.Entities; - using Sdk.Entities.AccessControl.AccessControlInterfaces.AccessControlInterfaceBaseClasses; - using Sdk.Entities.Devices; - using Sdk.Queries; - - class Program + static Program() => SdkResolver.Initialize(); + + static async Task Main() { - static Program() => SdkResolver.Initialize(); + const string server = "localhost"; + const string username = "admin"; + const string password = ""; - static async Task Main() - { - const string server = "localhost"; - const string username = "admin"; - const string password = ""; + using var engine = new Engine(); - using var engine = new Engine(); + ConnectionStateCode state = await engine.LogOnAsync(server, username, password); - ConnectionStateCode state = await engine.LogOnAsync(server, username, password); + if (state == ConnectionStateCode.Success) + { + await LoadUnitsAndDevices(); - if (state == ConnectionStateCode.Success) - { - await LoadUnitsAndDevices(); + IEnumerable accessControlUnits = engine.GetEntities(EntityType.Unit).OfType(); - IEnumerable accessControlUnits = engine.GetEntities(EntityType.Unit).OfType(); + foreach (Unit accessControlUnit in accessControlUnits) + { + PrintUnitDetails(accessControlUnit); - foreach (Unit accessControlUnit in accessControlUnits) + IEnumerable interfaceModules = accessControlUnit.InterfaceModules.Select(engine.GetEntity).OfType(); + foreach (InterfaceModule interfaceModule in interfaceModules) { - PrintUnitDetails(accessControlUnit); - - IEnumerable interfaceModules = accessControlUnit.InterfaceModules.Select(engine.GetEntity).OfType(); - foreach (InterfaceModule interfaceModule in interfaceModules) - { - PrintInterfaceModule(interfaceModule, " "); - } + PrintInterfaceModule(interfaceModule, " "); } } - else + } + else + { + Console.WriteLine($"Logon failed: {state}"); + } + + Console.WriteLine("Press any key to exit..."); + Console.ReadKey(); + + async Task LoadUnitsAndDevices() + { + var query = (EntityConfigurationQuery)engine.ReportManager.CreateReportQuery(ReportType.EntityConfiguration); + query.EntityTypeFilter.Add(EntityType.Role); + query.EntityTypeFilter.Add(EntityType.Unit); + query.EntityTypeFilter.Add(EntityType.Device); + query.DownloadAllRelatedData = true; + query.Page = 1; + query.PageSize = 1000; + + QueryCompletedEventArgs args; + do { - Console.WriteLine($"Logon failed: {state}"); - } + args = await Task.Factory.FromAsync(query.BeginQuery, query.EndQuery, null); + query.Page++; + } while (args.Error == ReportError.TooManyResults || args.Data.Rows.Count > query.PageSize); + } - Console.WriteLine("Press any key to exit..."); - Console.ReadKey(); + void PrintInterfaceModule(InterfaceModule interfaceModule, string indent) + { + Console.WriteLine($"{indent}Interface Module:"); + Console.WriteLine($"{indent} Name: {interfaceModule.Name}"); + Console.WriteLine($"{indent} State: {interfaceModule.RunningState}"); + Console.WriteLine($"{indent} Description: {interfaceModule.Description}"); - async Task LoadUnitsAndDevices() + try { - var query = (EntityConfigurationQuery)engine.ReportManager.CreateReportQuery(ReportType.EntityConfiguration); - query.EntityTypeFilter.Add(EntityType.Role); - query.EntityTypeFilter.Add(EntityType.Unit); - query.EntityTypeFilter.Add(EntityType.Device); - query.DownloadAllRelatedData = true; - query.Page = 1; - query.PageSize = 1000; - - QueryCompletedEventArgs args; - do - { - args = await Task.Factory.FromAsync(query.BeginQuery, query.EndQuery, null); - query.Page++; - } while (args.Error == ReportError.TooManyResults || args.Data.Rows.Count > query.PageSize); + AccessControlInterfaceBase interfaceBase = interfaceModule.GetAccessControlInterface(); + Console.WriteLine($"{indent} Type: {interfaceBase.GetType().Name}"); } - - void PrintInterfaceModule(InterfaceModule interfaceModule, string indent) + catch (SdkException ex) when (ex.ErrorCode == SdkError.InvalidOperation) { - Console.WriteLine($"{indent}Interface Module:"); - Console.WriteLine($"{indent} Name: {interfaceModule.Name}"); - Console.WriteLine($"{indent} State: {interfaceModule.RunningState}"); - Console.WriteLine($"{indent} Description: {interfaceModule.Description}"); - - try - { - AccessControlInterfaceBase interfaceBase = interfaceModule.GetAccessControlInterface(); - Console.WriteLine($"{indent} Type: {interfaceBase.GetType().Name}"); - } - catch (SdkException ex) when (ex.ErrorCode == SdkError.InvalidOperation) - { - Console.WriteLine($"{indent} Type: Unavailable"); - } + Console.WriteLine($"{indent} Type: Unavailable"); + } - List devices = interfaceModule.Devices.Select(engine.GetEntity).OfType().ToList(); + List devices = interfaceModule.Devices.Select(engine.GetEntity).OfType().ToList(); - PrintDevices(indent, "Readers", devices.Where(device => device.DeviceType == DeviceType.Reader)); - PrintDevices(indent, "Input devices", devices.Where(device => device.DeviceType == DeviceType.Input)); - PrintDevices(indent, "Output devices", devices.Where(device => device.DeviceType == DeviceType.Output)); + PrintDevices(indent, "Readers", devices.Where(device => device.DeviceType == DeviceType.Reader)); + PrintDevices(indent, "Input devices", devices.Where(device => device.DeviceType == DeviceType.Input)); + PrintDevices(indent, "Output devices", devices.Where(device => device.DeviceType == DeviceType.Output)); - foreach (InterfaceModule childInterface in interfaceModule.ChildrenInterfaceModule.Select(engine.GetEntity).OfType()) - { - PrintInterfaceModule(childInterface, $"{indent} "); - } - } - - void PrintDevices(string indent, string deviceType, IEnumerable devices) + foreach (InterfaceModule childInterface in interfaceModule.ChildrenInterfaceModule.Select(engine.GetEntity).OfType()) { - Console.WriteLine($"{indent}{deviceType}:"); - foreach (Device device in devices) - { - Console.WriteLine($"{indent} Name: {device.Name}"); - Console.WriteLine($"{indent} Physical name: {device.PhysicalName}"); - Console.WriteLine($"{indent} Unique ID: {device.UniqueId}"); - Console.WriteLine($"{indent} Online: {device.IsOnline}"); - - switch (device) - { - case InputDevice inputDevice: - Console.WriteLine($"{indent} State: {inputDevice.State}"); - try - { - DisplayDeviceSettings(inputDevice.InputDeviceSettings); - } - catch (SdkException ex) when (ex.ErrorCode == SdkError.CannotGetProperty) - { - } - break; - - case OutputDevice outputDevice: - Console.WriteLine($"{indent} State: {outputDevice.State}"); - try - { - DisplayDeviceSettings(outputDevice.OutputDeviceSettings); - } - catch (SdkException ex) when (ex.ErrorCode == SdkError.CannotGetProperty) - { - } - break; - - case Reader reader: - try - { - DisplayDeviceSettings(reader.ReaderSettings); - } - catch (SdkException ex) when (ex.ErrorCode == SdkError.CannotGetProperty) - { - } - break; - } - - Console.WriteLine(); - } + PrintInterfaceModule(childInterface, $"{indent} "); } + } - void DisplayDeviceSettings(object settings) + void PrintDevices(string indent, string deviceType, IEnumerable devices) + { + Console.WriteLine($"{indent}{deviceType}:"); + foreach (Device device in devices) { - switch (settings) + Console.WriteLine($"{indent} Name: {device.Name}"); + Console.WriteLine($"{indent} Physical name: {device.PhysicalName}"); + Console.WriteLine($"{indent} Unique ID: {device.UniqueId}"); + Console.WriteLine($"{indent} Online: {device.IsOnline}"); + + switch (device) { - case SMCInputDeviceSettings smcInputSettings: - DisplaySmcInputDeviceSettings(smcInputSettings); + case InputDevice inputDevice: + Console.WriteLine($"{indent} State: {inputDevice.State}"); + try + { + DisplayDeviceSettings(inputDevice.InputDeviceSettings); + } + catch (SdkException ex) when (ex.ErrorCode == SdkError.CannotGetProperty) + { + } break; - case HIDInputDeviceSettings hidInputSettings: - DisplayHIDInputDeviceSettings(hidInputSettings); + case OutputDevice outputDevice: + Console.WriteLine($"{indent} State: {outputDevice.State}"); + try + { + DisplayDeviceSettings(outputDevice.OutputDeviceSettings); + } + catch (SdkException ex) when (ex.ErrorCode == SdkError.CannotGetProperty) + { + } break; - case SMCOutputDeviceSettings smcOutputSettings: - DisplaySmcOutputDeviceSettings(smcOutputSettings); + case Reader reader: + try + { + DisplayDeviceSettings(reader.ReaderSettings); + } + catch (SdkException ex) when (ex.ErrorCode == SdkError.CannotGetProperty) + { + } break; + } - case HIDOutputDeviceSettings hidOutputSettings: - DisplayHIDOutputDeviceSettings(hidOutputSettings); - break; + Console.WriteLine(); + } + } - case SMCReaderSettings smcReaderSettings: - DisplaySmcReaderSettings(smcReaderSettings); - break; + void DisplayDeviceSettings(object settings) + { + switch (settings) + { + case SMCInputDeviceSettings smcInputSettings: + DisplaySmcInputDeviceSettings(smcInputSettings); + break; - case HIDReaderSettings hidReaderSettings: - DisplayHIDReaderSettings(hidReaderSettings); - break; - } + case HIDInputDeviceSettings hidInputSettings: + DisplayHIDInputDeviceSettings(hidInputSettings); + break; + + case SMCOutputDeviceSettings smcOutputSettings: + DisplaySmcOutputDeviceSettings(smcOutputSettings); + break; + + case HIDOutputDeviceSettings hidOutputSettings: + DisplayHIDOutputDeviceSettings(hidOutputSettings); + break; + + case SMCReaderSettings smcReaderSettings: + DisplaySmcReaderSettings(smcReaderSettings); + break; + + case HIDReaderSettings hidReaderSettings: + DisplayHIDReaderSettings(hidReaderSettings); + break; } + } - void PrintUnitDetails(Unit accessControlUnit) + void PrintUnitDetails(Unit accessControlUnit) + { + Console.WriteLine("Unit:"); + Console.WriteLine($" Name: {accessControlUnit.Name}"); + Console.WriteLine($" Access Manager: {accessControlUnit.AccessManagerRole.Name}"); + Console.WriteLine($" State: {accessControlUnit.RunningState}"); + Console.WriteLine($" MAC address: {accessControlUnit.MacAddress}"); + Console.WriteLine($" IP address: {accessControlUnit.IPAddress}"); + Console.WriteLine($" Time zone: {accessControlUnit.TimeZone}"); + Console.WriteLine($" Latitude: {accessControlUnit.GeographicalLocation.Latitude}"); + Console.WriteLine($" Longitude: {accessControlUnit.GeographicalLocation.Longitude}"); + Console.WriteLine($" Serial number: {accessControlUnit.SerialNumber}"); + Console.WriteLine($" Firmware version: {accessControlUnit.FirmwareVersion}"); + + try { - Console.WriteLine("Unit:"); - Console.WriteLine($" Name: {accessControlUnit.Name}"); - Console.WriteLine($" Access Manager: {accessControlUnit.AccessManagerRole.Name}"); - Console.WriteLine($" State: {accessControlUnit.RunningState}"); - Console.WriteLine($" MAC address: {accessControlUnit.MacAddress}"); - Console.WriteLine($" IP address: {accessControlUnit.IPAddress}"); - Console.WriteLine($" Time zone: {accessControlUnit.TimeZone}"); - Console.WriteLine($" Latitude: {accessControlUnit.GeographicalLocation.Latitude}"); - Console.WriteLine($" Longitude: {accessControlUnit.GeographicalLocation.Longitude}"); - Console.WriteLine($" Serial number: {accessControlUnit.SerialNumber}"); - Console.WriteLine($" Firmware version: {accessControlUnit.FirmwareVersion}"); - - try - { - Console.WriteLine($" Type: {accessControlUnit.UnitExtensionType}"); - } - catch (SdkException ex) when (ex.ErrorCode == SdkError.InvalidValue) - { - Console.WriteLine(" Type: N/A"); - } + Console.WriteLine($" Type: {accessControlUnit.UnitExtensionType}"); } - - void DisplaySmcReaderSettings(SMCReaderSettings settings) + catch (SdkException ex) when (ex.ErrorCode == SdkError.InvalidValue) { - Console.WriteLine(" Reader Settings (SMC):"); - Console.WriteLine($" Keypad mode: {settings.KeypadMode}"); - Console.WriteLine($" Led drive mode: {settings.LedDriveMode}"); + Console.WriteLine(" Type: N/A"); + } + } - if (settings.LedDriveMode == LedDriveMode.CustomOSDP) - { - Console.WriteLine($" OSDP baud rate: {settings.OSDPBaudRate}"); - Console.WriteLine($" OSDP Tracing: {settings.Tracing}"); - Console.WriteLine($" OSDP Smart Card: {settings.SmartCard}"); - Console.WriteLine($" OSDP Address: {settings.Address}"); - Console.WriteLine($" OSDP Secured: {settings.Secured}"); - } + void DisplaySmcReaderSettings(SMCReaderSettings settings) + { + Console.WriteLine(" Reader Settings (SMC):"); + Console.WriteLine($" Keypad mode: {settings.KeypadMode}"); + Console.WriteLine($" Led drive mode: {settings.LedDriveMode}"); - Console.WriteLine($" Shunted: {settings.Shunted}"); - Console.WriteLine($" Wiegand pulses: {settings.WiegandPulses}"); - Console.WriteLine($" Trim zero bits: {settings.TrimZeroBits}"); - Console.WriteLine($" Format to nibble array: {settings.FormatToNibbleArray}"); - Console.WriteLine($" Allow bi-directional mag decode: {settings.AllowBidirectionalMagDecode}"); - Console.WriteLine($" Allow northern mag decode: {settings.AllowNorthernMagDecode}"); - Console.WriteLine($" Casi 1-Wire F2F: {settings.Casi1WireF2F}"); - Console.WriteLine($" Supervised: {settings.Supervised}"); - Console.WriteLine($" Inputs come from reader: {settings.InputsComeFromReader}"); + if (settings.LedDriveMode == LedDriveMode.CustomOSDP) + { + Console.WriteLine($" OSDP baud rate: {settings.OSDPBaudRate}"); + Console.WriteLine($" OSDP Tracing: {settings.Tracing}"); + Console.WriteLine($" OSDP Smart Card: {settings.SmartCard}"); + Console.WriteLine($" OSDP Address: {settings.Address}"); + Console.WriteLine($" OSDP Secured: {settings.Secured}"); } - void DisplaySmcOutputDeviceSettings(SMCOutputDeviceSettings settings) + Console.WriteLine($" Shunted: {settings.Shunted}"); + Console.WriteLine($" Wiegand pulses: {settings.WiegandPulses}"); + Console.WriteLine($" Trim zero bits: {settings.TrimZeroBits}"); + Console.WriteLine($" Format to nibble array: {settings.FormatToNibbleArray}"); + Console.WriteLine($" Allow bi-directional mag decode: {settings.AllowBidirectionalMagDecode}"); + Console.WriteLine($" Allow northern mag decode: {settings.AllowNorthernMagDecode}"); + Console.WriteLine($" Casi 1-Wire F2F: {settings.Casi1WireF2F}"); + Console.WriteLine($" Supervised: {settings.Supervised}"); + Console.WriteLine($" Inputs come from reader: {settings.InputsComeFromReader}"); + } + + void DisplaySmcOutputDeviceSettings(SMCOutputDeviceSettings settings) + { + Console.WriteLine(" Output Device Settings (SMC):"); + Console.WriteLine($" Output contact type: {settings.OutputContactType}"); + } + + void DisplaySmcInputDeviceSettings(SMCInputDeviceSettings settings) + { + Console.WriteLine(" Input Device Settings (SMC):"); + try { - Console.WriteLine(" Output Device Settings (SMC):"); - Console.WriteLine($" Output contact type: {settings.OutputContactType}"); + Console.WriteLine($" Debounce: {settings.Debounce}"); } - - void DisplaySmcInputDeviceSettings(SMCInputDeviceSettings settings) + catch (SdkException ex) when (ex.ErrorCode == SdkError.CannotGetProperty) { - Console.WriteLine(" Input Device Settings (SMC):"); - try - { - Console.WriteLine($" Debounce: {settings.Debounce}"); - } - catch (SdkException ex) when (ex.ErrorCode == SdkError.CannotGetProperty) - { - Console.WriteLine(" Debounce: N/A"); - } - - Console.WriteLine($" Input contact type: {settings.InputContactType}"); - Console.WriteLine($" Shunted: {settings.Shunted}"); + Console.WriteLine(" Debounce: N/A"); } - void DisplayHIDReaderSettings(HIDReaderSettings settings) + Console.WriteLine($" Input contact type: {settings.InputContactType}"); + Console.WriteLine($" Shunted: {settings.Shunted}"); + } + + void DisplayHIDReaderSettings(HIDReaderSettings settings) + { + Console.WriteLine(" Reader Settings (HID):"); + Console.WriteLine($" Reader type: {settings.ReaderType}"); + } + + void DisplayHIDOutputDeviceSettings(HIDOutputDeviceSettings settings) + { + Console.WriteLine(" Output Device Settings (HID):"); + try { - Console.WriteLine(" Reader Settings (HID):"); - Console.WriteLine($" Reader type: {settings.ReaderType}"); + Console.WriteLine($" Minimum time: {settings.MinimumTime}"); } - - void DisplayHIDOutputDeviceSettings(HIDOutputDeviceSettings settings) + catch (SdkException ex) when (ex.ErrorCode == SdkError.CannotGetProperty) { - Console.WriteLine(" Output Device Settings (HID):"); - try - { - Console.WriteLine($" Minimum time: {settings.MinimumTime}"); - } - catch (SdkException ex) when (ex.ErrorCode == SdkError.CannotGetProperty) - { - Console.WriteLine($" Minimum time: {ex.Message}"); - } + Console.WriteLine($" Minimum time: {ex.Message}"); } + } - void DisplayHIDInputDeviceSettings(HIDInputDeviceSettings settings) + void DisplayHIDInputDeviceSettings(HIDInputDeviceSettings settings) + { + Console.WriteLine(" Input Device Settings (HID):"); + try { - Console.WriteLine(" Input Device Settings (HID):"); - try - { - Console.WriteLine($" Debounce: {settings.Debounce}"); - } - catch (SdkException ex) when (ex.ErrorCode == SdkError.CannotGetProperty) - { - Console.WriteLine(" Debounce: N/A"); - } + Console.WriteLine($" Debounce: {settings.Debounce}"); + } + catch (SdkException ex) when (ex.ErrorCode == SdkError.CannotGetProperty) + { + Console.WriteLine(" Debounce: N/A"); + } - try - { - Console.WriteLine($" Normal high: {settings.NormalHigh}"); - } - catch (SdkException ex) when (ex.ErrorCode == SdkError.CannotGetProperty) - { - Console.WriteLine(" Normal high: N/A"); - } + try + { + Console.WriteLine($" Normal high: {settings.NormalHigh}"); + } + catch (SdkException ex) when (ex.ErrorCode == SdkError.CannotGetProperty) + { + Console.WriteLine(" Normal high: N/A"); + } - try - { - Console.WriteLine($" Normal low: {settings.NormalLow}"); - } - catch (SdkException ex) when (ex.ErrorCode == SdkError.CannotGetProperty) - { - Console.WriteLine(" Normal low: N/A"); - } + try + { + Console.WriteLine($" Normal low: {settings.NormalLow}"); + } + catch (SdkException ex) when (ex.ErrorCode == SdkError.CannotGetProperty) + { + Console.WriteLine(" Normal low: N/A"); + } - try - { - Console.WriteLine($" Active high: {settings.ActiveHigh}"); - } - catch (SdkException ex) when (ex.ErrorCode == SdkError.CannotGetProperty) - { - Console.WriteLine(" Active high: N/A"); - } + try + { + Console.WriteLine($" Active high: {settings.ActiveHigh}"); + } + catch (SdkException ex) when (ex.ErrorCode == SdkError.CannotGetProperty) + { + Console.WriteLine(" Active high: N/A"); + } - try - { - Console.WriteLine($" Active low: {settings.ActiveLow}"); - } - catch (SdkException ex) when (ex.ErrorCode == SdkError.CannotGetProperty) - { - Console.WriteLine(" Active low: N/A"); - } + try + { + Console.WriteLine($" Active low: {settings.ActiveLow}"); + } + catch (SdkException ex) when (ex.ErrorCode == SdkError.CannotGetProperty) + { + Console.WriteLine(" Active low: N/A"); } } } diff --git a/Samples/Platform SDK/AccessEventMonitoringSample/Program.cs b/Samples/Platform SDK/AccessEventMonitoringSample/Program.cs index 588a520..7bd3027 100644 --- a/Samples/Platform SDK/AccessEventMonitoringSample/Program.cs +++ b/Samples/Platform SDK/AccessEventMonitoringSample/Program.cs @@ -5,91 +5,90 @@ // Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -namespace Genetec.Dap.CodeSamples +namespace Genetec.Dap.CodeSamples; + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Genetec.Sdk.Events.AccessPoint; +using Genetec.Sdk; +using Genetec.Sdk.Credentials; +using Genetec.Sdk.Entities; +using Genetec.Sdk.Queries; + +class Program { - using System; - using System.Collections.Generic; - using System.Linq; - using System.Threading.Tasks; - using Genetec.Sdk.Events.AccessPoint; - using Genetec.Sdk; - using Genetec.Sdk.Credentials; - using Genetec.Sdk.Entities; - using Genetec.Sdk.Queries; + static Program() => SdkResolver.Initialize(); - class Program + static async Task Main() { - static Program() => SdkResolver.Initialize(); + const string server = "localhost"; + const string username = "admin"; + const string password = ""; + + using var engine = new Engine(); + engine.EventReceived += OnEventReceived; - static async Task Main() + ConnectionStateCode state = await engine.LogOnAsync(server, username, password); + + if (state == ConnectionStateCode.Success) + { + await LoadAccessPoints(); + } + else { - const string server = "localhost"; - const string username = "admin"; - const string password = ""; + Console.WriteLine($"Logon failed: {state}"); + } - using var engine = new Engine(); - engine.EventReceived += OnEventReceived; + Console.WriteLine("Press any key to exit..."); + Console.ReadKey(); - ConnectionStateCode state = await engine.LogOnAsync(server, username, password); + Task LoadAccessPoints() + { + var query = (EntityConfigurationQuery)engine.ReportManager.CreateReportQuery(ReportType.EntityConfiguration); + query.EntityTypeFilter.Add(EntityType.AccessPoint); + query.DownloadAllRelatedData = true; + return Task.Factory.FromAsync(query.BeginQuery, query.EndQuery, null); + } - if (state == ConnectionStateCode.Success) - { - await LoadAccessPoints(); - } - else + IEnumerable GetCredentialFormats(AccessEvent accessEvent) + { + if (accessEvent is AccessPointCredentialUnknownEvent unknownEvent) { - Console.WriteLine($"Logon failed: {state}"); + yield return CredentialFormat.Deserialize(unknownEvent.XmlCredential); } - Console.WriteLine("Press any key to exit..."); - Console.ReadKey(); + IEnumerable formats = accessEvent.Credentials.Select(engine.GetEntity).OfType().Select(credential => credential.Format); - Task LoadAccessPoints() + foreach (var format in formats) { - var query = (EntityConfigurationQuery)engine.ReportManager.CreateReportQuery(ReportType.EntityConfiguration); - query.EntityTypeFilter.Add(EntityType.AccessPoint); - query.DownloadAllRelatedData = true; - return Task.Factory.FromAsync(query.BeginQuery, query.EndQuery, null); + yield return format; } + } - IEnumerable GetCredentialFormats(AccessEvent accessEvent) + void OnEventReceived(object sender, EventReceivedEventArgs e) + { + if (e.Event is AccessEvent accessEvent) { - if (accessEvent is AccessPointCredentialUnknownEvent unknownEvent) + if (engine.GetEntity(accessEvent.AccessPoint) is AccessPoint accessPoint && engine.GetEntity(accessPoint.Device) is Device device) { - yield return CredentialFormat.Deserialize(unknownEvent.XmlCredential); - } + var accessPointGroup = (AccessPointGroup)engine.GetEntity(accessPoint.AccessPointGroup); + var cardholder = engine.GetEntity(accessEvent.Cardholder); - IEnumerable formats = accessEvent.Credentials.Select(engine.GetEntity).OfType().Select(credential => credential.Format); - - foreach (var format in formats) - { - yield return format; - } - } - - void OnEventReceived(object sender, EventReceivedEventArgs e) - { - if (e.Event is AccessEvent accessEvent) - { - if (engine.GetEntity(accessEvent.AccessPoint) is AccessPoint accessPoint && engine.GetEntity(accessPoint.Device) is Device device) + foreach (CredentialFormat format in GetCredentialFormats(accessEvent)) { - var accessPointGroup = (AccessPointGroup)engine.GetEntity(accessPoint.AccessPointGroup); - var cardholder = engine.GetEntity(accessEvent.Cardholder); - - foreach (CredentialFormat format in GetCredentialFormats(accessEvent)) - { - Console.WriteLine( - $"[{e.Timestamp:yyyy-MM-dd HH:mm:ss}] Access Event: {e.EventType}\n" + - $" Cardholder: {cardholder?.Name ?? "Unknown"}\n" + - $" Credential Format: {format}\n" + - $" Access Point Group: {accessPointGroup.Name}\n" + - $" Access Point: {accessPoint.Name}\n" + - $" Device: {device.Name}\n" - ); - } + Console.WriteLine( + $"[{e.Timestamp:yyyy-MM-dd HH:mm:ss}] Access Event: {e.EventType}\n" + + $" Cardholder: {cardholder?.Name ?? "Unknown"}\n" + + $" Credential Format: {format}\n" + + $" Access Point Group: {accessPointGroup.Name}\n" + + $" Access Point: {accessPoint.Name}\n" + + $" Device: {device.Name}\n" + ); } } } } } -} +} \ No newline at end of file diff --git a/Samples/Platform SDK/AccessVerifierSample/Program.cs b/Samples/Platform SDK/AccessVerifierSample/Program.cs index f3da8c7..f18db44 100644 --- a/Samples/Platform SDK/AccessVerifierSample/Program.cs +++ b/Samples/Platform SDK/AccessVerifierSample/Program.cs @@ -1,104 +1,103 @@ // Copyright (C) 2023 by Genetec, Inc. All rights reserved. // May be used only in accordance with a valid Source Code License Agreement. -namespace Genetec.Dap.CodeSamples +namespace Genetec.Dap.CodeSamples; + +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Genetec.Sdk.Entities; +using Sdk; +using Sdk.Queries; + +class Program { - using System; - using System.Collections.Generic; - using System.IO; - using System.Linq; - using System.Text; - using System.Threading.Tasks; - using Genetec.Sdk.Entities; - using Sdk; - using Sdk.Queries; - - class Program + static Program() => SdkResolver.Initialize(); + + static async Task Main() { - static Program() => SdkResolver.Initialize(); + const string server = "localhost"; + const string username = "admin"; + const string password = ""; + + using var engine = new Engine(); - static async Task Main() + ConnectionStateCode state = await engine.LogOnAsync(server, username, password); + + if (state == ConnectionStateCode.Success) { - const string server = "localhost"; - const string username = "admin"; - const string password = ""; + await PrefetchEntities(engine); - using var engine = new Engine(); + List doorGuids = engine.GetEntities(EntityType.Door).Select(door => door.Guid).ToList(); - ConnectionStateCode state = await engine.LogOnAsync(server, username, password); + DateTime currentTime = DateTime.UtcNow; - if (state == ConnectionStateCode.Success) - { - await PrefetchEntities(engine); + List<(AccessPoint, Credential, AccessResult Result)> accessResults = engine.GetEntities(EntityType.Credential) + .SelectMany(credential => engine.AccessVerifier.GetAccessResults(doorGuids, currentTime, credential.Guid, Guid.Empty, Guid.Empty) + .Select(result => (engine.GetEntity(result.AccessPoint), engine.GetEntity(credential.Guid), result.Result))) + .ToList(); - List doorGuids = engine.GetEntities(EntityType.Door).Select(door => door.Guid).ToList(); + using var fileStream = new FileStream($"AccessMatrix_{currentTime.ToLocalTime():yyyyMMdd_HHmmss}.csv", FileMode.Create, FileAccess.Write); + using var streamWriter = new StreamWriter(fileStream, Encoding.UTF8); - DateTime currentTime = DateTime.UtcNow; + GenerateAccessMatrixCsv(engine, accessResults, streamWriter); - List<(AccessPoint, Credential, AccessResult Result)> accessResults = engine.GetEntities(EntityType.Credential) - .SelectMany(credential => engine.AccessVerifier.GetAccessResults(doorGuids, currentTime, credential.Guid, Guid.Empty, Guid.Empty) - .Select(result => (engine.GetEntity(result.AccessPoint), engine.GetEntity(credential.Guid), result.Result))) - .ToList(); + Console.WriteLine($"File created: {fileStream.Name}"); + } + else + { + Console.WriteLine($"Logon failed: {state}"); + } - using var fileStream = new FileStream($"AccessMatrix_{currentTime.ToLocalTime():yyyyMMdd_HHmmss}.csv", FileMode.Create, FileAccess.Write); - using var streamWriter = new StreamWriter(fileStream, Encoding.UTF8); + Console.WriteLine("Press any key to exit..."); + Console.ReadKey(); + } - GenerateAccessMatrixCsv(engine, accessResults, streamWriter); + static async Task PrefetchEntities(IEngine engine) + { + var query = (EntityConfigurationQuery)engine.ReportManager.CreateReportQuery(ReportType.EntityConfiguration); + query.EntityTypeFilter.Add(EntityType.Credential); + query.EntityTypeFilter.Add(EntityType.AccessPoint); + query.EntityTypeFilter.Add(EntityType.Schedule); + query.EntityTypeFilter.Add(EntityType.AccessRule); + query.DownloadAllRelatedData = true; + query.Page = 1; + query.PageSize = 1000; + + QueryCompletedEventArgs args; + do + { + args = await Task.Factory.FromAsync(query.BeginQuery, query.EndQuery, null); + query.Page++; + } while (args.Error == ReportError.TooManyResults || args.Data.Rows.Count > query.PageSize); + } - Console.WriteLine($"File created: {fileStream.Name}"); - } - else - { - Console.WriteLine($"Logon failed: {state}"); - } + static void GenerateAccessMatrixCsv(IEngine engine, ICollection<(AccessPoint AccessPoint, Credential Credential, AccessResult Result)> accessResults, TextWriter textWriter) + { + var accessPoints = accessResults.Select(tuple => tuple.AccessPoint).Distinct().ToList(); - Console.WriteLine("Press any key to exit..."); - Console.ReadKey(); - } + var resultLookup = accessResults.ToDictionary(tuple => (tuple.AccessPoint, tuple.Credential), tuple => tuple.Result); - static async Task PrefetchEntities(IEngine engine) + textWriter.Write("Credential"); + foreach (var accessPoint in accessPoints) { - var query = (EntityConfigurationQuery)engine.ReportManager.CreateReportQuery(ReportType.EntityConfiguration); - query.EntityTypeFilter.Add(EntityType.Credential); - query.EntityTypeFilter.Add(EntityType.AccessPoint); - query.EntityTypeFilter.Add(EntityType.Schedule); - query.EntityTypeFilter.Add(EntityType.AccessRule); - query.DownloadAllRelatedData = true; - query.Page = 1; - query.PageSize = 1000; - - QueryCompletedEventArgs args; - do - { - args = await Task.Factory.FromAsync(query.BeginQuery, query.EndQuery, null); - query.Page++; - } while (args.Error == ReportError.TooManyResults || args.Data.Rows.Count > query.PageSize); + textWriter.Write($",{engine.GetEntity(accessPoint.AccessPointGroup).Name} ({accessPoint.Name})"); } + textWriter.WriteLine(); - static void GenerateAccessMatrixCsv(IEngine engine, ICollection<(AccessPoint AccessPoint, Credential Credential, AccessResult Result)> accessResults, TextWriter textWriter) + foreach (var credential in accessResults.Select(tuple => tuple.Credential).Distinct()) { - var accessPoints = accessResults.Select(tuple => tuple.AccessPoint).Distinct().ToList(); - - var resultLookup = accessResults.ToDictionary(tuple => (tuple.AccessPoint, tuple.Credential), tuple => tuple.Result); + textWriter.Write(credential.Name); - textWriter.Write("Credential"); foreach (var accessPoint in accessPoints) { - textWriter.Write($",{engine.GetEntity(accessPoint.AccessPointGroup).Name} ({accessPoint.Name})"); + textWriter.Write(resultLookup.TryGetValue((accessPoint, credential), out var result) ? $",{result}" : ","); } - textWriter.WriteLine(); - - foreach (var credential in accessResults.Select(tuple => tuple.Credential).Distinct()) - { - textWriter.Write(credential.Name); - foreach (var accessPoint in accessPoints) - { - textWriter.Write(resultLookup.TryGetValue((accessPoint, credential), out var result) ? $",{result}" : ","); - } - - textWriter.WriteLine(); - } + textWriter.WriteLine(); } } -} +} \ No newline at end of file diff --git a/Samples/Platform SDK/AlarmMonitoringSample/Program.cs b/Samples/Platform SDK/AlarmMonitoringSample/Program.cs index 1f10e47..101aa3b 100644 --- a/Samples/Platform SDK/AlarmMonitoringSample/Program.cs +++ b/Samples/Platform SDK/AlarmMonitoringSample/Program.cs @@ -1,103 +1,102 @@ // Copyright (C) 2023 by Genetec, Inc. All rights reserved. // May be used only in accordance with a valid Source Code License Agreement. -namespace Genetec.Dap.CodeSamples +namespace Genetec.Dap.CodeSamples; + +using System; +using System.Threading.Tasks; +using Genetec.Sdk; +using Genetec.Sdk.Entities; + +class Program { - using System; - using System.Threading.Tasks; - using Genetec.Sdk; - using Genetec.Sdk.Entities; + static Program() => SdkResolver.Initialize(); - class Program + static async Task Main() { - static Program() => SdkResolver.Initialize(); + const string server = "localhost"; + const string username = "admin"; + const string password = ""; - static async Task Main() - { - const string server = "localhost"; - const string username = "admin"; - const string password = ""; + using var engine = new Engine(); - using var engine = new Engine(); + engine.AlarmTriggered += OnAlarmTriggered; + engine.AlarmAcknowledged += OnAlarmAcknowledged; + engine.AlarmInvestigating += OnAlarmInvestigating; + engine.AlarmSourceConditionCleared += OnAlarmSourceConditionCleared; - engine.AlarmTriggered += OnAlarmTriggered; - engine.AlarmAcknowledged += OnAlarmAcknowledged; - engine.AlarmInvestigating += OnAlarmInvestigating; - engine.AlarmSourceConditionCleared += OnAlarmSourceConditionCleared; + ConnectionStateCode state = await engine.LogOnAsync(server, username, password); - ConnectionStateCode state = await engine.LogOnAsync(server, username, password); + if (state != ConnectionStateCode.Success) + Console.WriteLine($"Logon failed: {state}"); - if (state != ConnectionStateCode.Success) - Console.WriteLine($"Logon failed: {state}"); + Console.WriteLine("Press any key to exit..."); + Console.ReadKey(); + + void OnAlarmTriggered(object sender, AlarmTriggeredEventArgs e) + { + var alarm = (Alarm)engine.GetEntity(e.AlarmGuid); - Console.WriteLine("Press any key to exit..."); - Console.ReadKey(); + Console.WriteLine("[Alarm Triggered]"); + Console.WriteLine($"\tName: {alarm.Name}"); + Console.WriteLine($"\tInstance ID: {e.InstanceId}"); + Console.WriteLine($"\tTrigger time: {e.TriggerTimestamp}"); + Console.WriteLine($"\tContext: {e.DynamicAlarmContent?.Context}"); + Console.WriteLine($"\tTrigger Event: {e.TriggerEvent}"); + Console.WriteLine($"\tOccurence Period: {e.OfflinePeriod}"); - void OnAlarmTriggered(object sender, AlarmTriggeredEventArgs e) + if (engine.GetEntity(e.SourceGuid) is { } entity) { - var alarm = (Alarm)engine.GetEntity(e.AlarmGuid); - - Console.WriteLine("[Alarm Triggered]"); - Console.WriteLine($"\tName: {alarm.Name}"); - Console.WriteLine($"\tInstance ID: {e.InstanceId}"); - Console.WriteLine($"\tTrigger time: {e.TriggerTimestamp}"); - Console.WriteLine($"\tContext: {e.DynamicAlarmContent?.Context}"); - Console.WriteLine($"\tTrigger Event: {e.TriggerEvent}"); - Console.WriteLine($"\tOccurence Period: {e.OfflinePeriod}"); - - if (engine.GetEntity(e.SourceGuid) is { } entity) - { - Console.WriteLine($"\tSource: {entity.Name}"); - Console.WriteLine($"\tSource entity type: {entity.EntityType}"); - } - - Console.WriteLine(new string('-', 50)); + Console.WriteLine($"\tSource: {entity.Name}"); + Console.WriteLine($"\tSource entity type: {entity.EntityType}"); } - void OnAlarmAcknowledged(object sender, AlarmAcknowledgedEventArgs e) - { - var alarm = (Alarm)engine.GetEntity(e.AlarmGuid); + Console.WriteLine(new string('-', 50)); + } - Console.WriteLine("[Alarm Acknowledged]"); - Console.WriteLine($"\tName: {alarm.Name}"); - Console.WriteLine($"\tInstance ID: {e.InstanceId}"); - Console.WriteLine($"\tAcknowledged on: {e.AckTime}"); + void OnAlarmAcknowledged(object sender, AlarmAcknowledgedEventArgs e) + { + var alarm = (Alarm)engine.GetEntity(e.AlarmGuid); - if (engine.GetEntity(e.AckBy) is { } entity) - { - Console.WriteLine($"\tAcknowledged by: {entity.Name}"); - } + Console.WriteLine("[Alarm Acknowledged]"); + Console.WriteLine($"\tName: {alarm.Name}"); + Console.WriteLine($"\tInstance ID: {e.InstanceId}"); + Console.WriteLine($"\tAcknowledged on: {e.AckTime}"); - Console.WriteLine(new string('-', 50)); + if (engine.GetEntity(e.AckBy) is { } entity) + { + Console.WriteLine($"\tAcknowledged by: {entity.Name}"); } - void OnAlarmInvestigating(object sender, AlarmInvestigatingEventArgs e) - { - var alarm = (Alarm)engine.GetEntity(e.AlarmGuid); + Console.WriteLine(new string('-', 50)); + } - Console.WriteLine("[Alarm Investigating]"); - Console.WriteLine($"\tName: {alarm.Name}"); - Console.WriteLine($"\tInstance ID: {e.InstanceId}"); - Console.WriteLine($"\tInvestigated on: {e.InvestigatedTime}"); + void OnAlarmInvestigating(object sender, AlarmInvestigatingEventArgs e) + { + var alarm = (Alarm)engine.GetEntity(e.AlarmGuid); - if (engine.GetEntity(e.InvestigatedBy) is { } entity) - { - Console.WriteLine($"\tInvestigated by: {entity.Name}"); - } + Console.WriteLine("[Alarm Investigating]"); + Console.WriteLine($"\tName: {alarm.Name}"); + Console.WriteLine($"\tInstance ID: {e.InstanceId}"); + Console.WriteLine($"\tInvestigated on: {e.InvestigatedTime}"); - Console.WriteLine(new string('-', 50)); + if (engine.GetEntity(e.InvestigatedBy) is { } entity) + { + Console.WriteLine($"\tInvestigated by: {entity.Name}"); } - void OnAlarmSourceConditionCleared(object sender, AlarmSourceConditionClearedEventArgs e) - { - var alarm = (Alarm)engine.GetEntity(e.AlarmGuid); + Console.WriteLine(new string('-', 50)); + } - Console.WriteLine("[Alarm Source Condition Cleared]"); - Console.WriteLine($"\tName: {alarm.Name}"); - Console.WriteLine($"\tInstance ID: {e.InstanceId}"); - Console.WriteLine($"\tAcknowledgement Required: {e.AcknowledgeActionRequired}"); - Console.WriteLine(new string('-', 50)); - } + void OnAlarmSourceConditionCleared(object sender, AlarmSourceConditionClearedEventArgs e) + { + var alarm = (Alarm)engine.GetEntity(e.AlarmGuid); + + Console.WriteLine("[Alarm Source Condition Cleared]"); + Console.WriteLine($"\tName: {alarm.Name}"); + Console.WriteLine($"\tInstance ID: {e.InstanceId}"); + Console.WriteLine($"\tAcknowledgement Required: {e.AcknowledgeActionRequired}"); + Console.WriteLine(new string('-', 50)); } } -} +} \ No newline at end of file diff --git a/Samples/Platform SDK/CopyConfiguratonSample/EntityManagerExtensions.cs b/Samples/Platform SDK/CopyConfiguratonSample/EntityManagerExtensions.cs index 1a8e918..395a37c 100644 --- a/Samples/Platform SDK/CopyConfiguratonSample/EntityManagerExtensions.cs +++ b/Samples/Platform SDK/CopyConfiguratonSample/EntityManagerExtensions.cs @@ -5,44 +5,43 @@ // Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -namespace Genetec.Dap.CodeSamples -{ - using System; - using System.Collections.Generic; - using System.Linq; - using System.Threading.Tasks; - using Sdk; - using Sdk.EventsArgs; - using Sdk.Workflows.EntityManager; +namespace Genetec.Dap.CodeSamples; + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Sdk; +using Sdk.EventsArgs; +using Sdk.Workflows.EntityManager; - static class EntityManagerExtensions +static class EntityManagerExtensions +{ + public static async Task CopyConfigurationAsync(this IEntityManager manager, Guid source, IEnumerable destinations, IProgress progress = null, params CopyConfigOption[] options) { - public static async Task CopyConfigurationAsync(this IEntityManager manager, Guid source, IEnumerable destinations, IProgress progress = null, params CopyConfigOption[] options) - { - var taskCompletionSource = new TaskCompletionSource(); + var taskCompletionSource = new TaskCompletionSource(); - EventHandler copyConfigFinished = (s, e) => taskCompletionSource.TrySetResult(e); - manager.CopyConfigFinished += copyConfigFinished; + EventHandler copyConfigFinished = (s, e) => taskCompletionSource.TrySetResult(e); + manager.CopyConfigFinished += copyConfigFinished; - EventHandler copyConfigProgress = null; - if (progress != null) - { - copyConfigProgress = (s, e) => progress.Report(e.ProgressPercentage); - manager.CopyConfigProgress += copyConfigProgress; - } + EventHandler copyConfigProgress = null; + if (progress != null) + { + copyConfigProgress = (s, e) => progress.Report(e.ProgressPercentage); + manager.CopyConfigProgress += copyConfigProgress; + } - try - { - manager.CopyConfiguration(source, destinations.ToList(), options.ToList()); - return await taskCompletionSource.Task; - } - finally + try + { + manager.CopyConfiguration(source, destinations.ToList(), options.ToList()); + return await taskCompletionSource.Task; + } + finally + { + manager.CopyConfigFinished -= copyConfigFinished; + if (copyConfigProgress != null) { - manager.CopyConfigFinished -= copyConfigFinished; - if (copyConfigProgress != null) - { - manager.CopyConfigProgress -= copyConfigProgress; - } + manager.CopyConfigProgress -= copyConfigProgress; } } } diff --git a/Samples/Platform SDK/CustomEntitySample/Icon.cs b/Samples/Platform SDK/CustomEntitySample/Icon.cs index b827c38..5174a33 100644 --- a/Samples/Platform SDK/CustomEntitySample/Icon.cs +++ b/Samples/Platform SDK/CustomEntitySample/Icon.cs @@ -1,21 +1,20 @@ // Copyright (C) 2023 by Genetec, Inc. All rights reserved. // May be used only in accordance with a valid Source Code License Agreement. -namespace Genetec.Dap.CodeSamples -{ - using System; - using System.Windows.Media.Imaging; +namespace Genetec.Dap.CodeSamples; - public static class Icon - { - private static BitmapImage LoadIcon(string resourceName) - { - var bitmap = new BitmapImage(new Uri(resourceName, UriKind.RelativeOrAbsolute)); - bitmap.Freeze(); - return bitmap; - } +using System; +using System.Windows.Media.Imaging; - public static BitmapImage SmallIcon => LoadIcon("pack://application:,,,/CustomEntitySample;component/Resources/SmallIcon.png"); - public static BitmapImage LargeIcon => LoadIcon("pack://application:,,,/CustomEntitySample;component/Resources/LargeIcon.png"); +public static class Icon +{ + private static BitmapImage LoadIcon(string resourceName) + { + var bitmap = new BitmapImage(new Uri(resourceName, UriKind.RelativeOrAbsolute)); + bitmap.Freeze(); + return bitmap; } + + public static BitmapImage SmallIcon => LoadIcon("pack://application:,,,/CustomEntitySample;component/Resources/SmallIcon.png"); + public static BitmapImage LargeIcon => LoadIcon("pack://application:,,,/CustomEntitySample;component/Resources/LargeIcon.png"); } \ No newline at end of file diff --git a/Samples/Platform SDK/CustomEventSample/Program.cs b/Samples/Platform SDK/CustomEventSample/Program.cs index 871fc27..a13c135 100644 --- a/Samples/Platform SDK/CustomEventSample/Program.cs +++ b/Samples/Platform SDK/CustomEventSample/Program.cs @@ -5,122 +5,121 @@ // Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -namespace Genetec.Dap.CodeSamples +namespace Genetec.Dap.CodeSamples; + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Sdk; +using Sdk.Entities; +using Sdk.Entities.CustomEvents; +using Sdk.Events; + +class Program { - using System; - using System.Collections.Generic; - using System.Linq; - using System.Threading.Tasks; - using Sdk; - using Sdk.Entities; - using Sdk.Entities.CustomEvents; - using Sdk.Events; - - class Program - { - static Program() => SdkResolver.Initialize(); + static Program() => SdkResolver.Initialize(); - static async Task Main() - { - const string server = "localhost"; - const string username = "admin"; - const string password = ""; + static async Task Main() + { + const string server = "localhost"; + const string username = "admin"; + const string password = ""; - // TODO: Replace with your own custom event ID - const int customEventId = 1000; + // TODO: Replace with your own custom event ID + const int customEventId = 1000; - // TODO: Replace with your own camera GUID - Guid cameraGuid = new Guid("YOUR_CAMERA_GUID_HERE"); + // TODO: Replace with your own camera GUID + Guid cameraGuid = new Guid("YOUR_CAMERA_GUID_HERE"); - using var engine = new Engine(); + using var engine = new Engine(); - ConnectionStateCode state = await engine.LogOnAsync(server, username, password); + ConnectionStateCode state = await engine.LogOnAsync(server, username, password); - if (state == ConnectionStateCode.Success) - { - var config = (SystemConfiguration)engine.GetEntity(SystemConfiguration.SystemConfigurationGuid); - ICustomEventService customEventService = config.CustomEventService; + if (state == ConnectionStateCode.Success) + { + var config = (SystemConfiguration)engine.GetEntity(SystemConfiguration.SystemConfigurationGuid); + ICustomEventService customEventService = config.CustomEventService; - IReadOnlyList events = customEventService.CustomEvents; - DisplayCustomEvents(events); + IReadOnlyList events = customEventService.CustomEvents; + DisplayCustomEvents(events); - CustomEvent customEvent = await CreateOrGetCustomEvent(customEventService, customEventId); - RaiseCustomEvent(customEvent); - } - else - { - Console.WriteLine($"Logon failed: {state}"); - } + CustomEvent customEvent = await CreateOrGetCustomEvent(customEventService, customEventId); + RaiseCustomEvent(customEvent); + } + else + { + Console.WriteLine($"Logon failed: {state}"); + } + + Console.WriteLine("Press any key to exit..."); + Console.ReadKey(); - Console.WriteLine("Press any key to exit..."); - Console.ReadKey(); + void DisplayCustomEvents(IReadOnlyList events) + { + Console.WriteLine($"Total Number of Custom Events: {events.Count}"); - void DisplayCustomEvents(IReadOnlyList events) + foreach (var group in events.GroupBy(e => e.SourceEntityType).OrderBy(g => g.Key)) { - Console.WriteLine($"Total Number of Custom Events: {events.Count}"); + Console.WriteLine($"\nSource Entity Type: {group.Key}"); + Console.WriteLine(new string('-', 30)); - foreach (var group in events.GroupBy(e => e.SourceEntityType).OrderBy(g => g.Key)) + foreach (var customEvent in group.OrderBy(e => e.Id)) { - Console.WriteLine($"\nSource Entity Type: {group.Key}"); - Console.WriteLine(new string('-', 30)); - - foreach (var customEvent in group.OrderBy(e => e.Id)) - { - Console.WriteLine($"Name: {customEvent.Name}"); - Console.WriteLine($" ID: {customEvent.Id}"); - Console.WriteLine($" Local: {customEvent.LocalCustomEvent}"); - - if (engine.GetEntity(customEvent.Owner) is Role owner) - Console.WriteLine($" Owner: {owner.Name}"); - else - Console.WriteLine(" Owner: LocalSystem"); - - Console.WriteLine(); - } + Console.WriteLine($"Name: {customEvent.Name}"); + Console.WriteLine($" ID: {customEvent.Id}"); + Console.WriteLine($" Local: {customEvent.LocalCustomEvent}"); + + if (engine.GetEntity(customEvent.Owner) is Role owner) + Console.WriteLine($" Owner: {owner.Name}"); + else + Console.WriteLine(" Owner: LocalSystem"); + + Console.WriteLine(); } } + } - async Task CreateOrGetCustomEvent(ICustomEventService customEventService, int eventId) + async Task CreateOrGetCustomEvent(ICustomEventService customEventService, int eventId) + { + CustomEvent customEvent = customEventService.CustomEvents.FirstOrDefault(@event => @event.Id == eventId); + if (customEvent is null) { - CustomEvent customEvent = customEventService.CustomEvents.FirstOrDefault(@event => @event.Id == eventId); - if (customEvent is null) - { - Console.WriteLine($"Creating new custom event with ID: {eventId}"); + Console.WriteLine($"Creating new custom event with ID: {eventId}"); - ICustomEventBuilder builder = customEventService.CreateCustomEventBuilder(); + ICustomEventBuilder builder = customEventService.CreateCustomEventBuilder(); - customEvent = builder.SetEntityType(EntityType.Camera) - .SetId(eventId) - .SetName("Camera custom event") - .Build(); + customEvent = builder.SetEntityType(EntityType.Camera) + .SetId(eventId) + .SetName("Camera custom event") + .Build(); - await customEventService.AddAsync(customEvent); - } - else - { - Console.WriteLine($"Using existing custom event with ID: {eventId}"); - } - return customEvent; + await customEventService.AddAsync(customEvent); } - - void RaiseCustomEvent(CustomEvent customEvent) + else { - Console.WriteLine("Raising custom event"); - - Entity source = engine.GetEntity(cameraGuid); - if (source is null) - { - Console.WriteLine($"Error: No entity found with GUID {cameraGuid}"); - return; - } + Console.WriteLine($"Using existing custom event with ID: {eventId}"); + } + return customEvent; + } - var eventInstance = (CustomEventInstance)engine.ActionManager.BuildEvent(EventType.CustomEvent, cameraGuid); - eventInstance.Id = new CustomEventId(customEvent.Id); - eventInstance.Message = "Custom event message"; - eventInstance.ExtraHiddenPayload = "Custom event extra payload"; + void RaiseCustomEvent(CustomEvent customEvent) + { + Console.WriteLine("Raising custom event"); - engine.ActionManager.RaiseEvent(eventInstance); + Entity source = engine.GetEntity(cameraGuid); + if (source is null) + { + Console.WriteLine($"Error: No entity found with GUID {cameraGuid}"); + return; } + + var eventInstance = (CustomEventInstance)engine.ActionManager.BuildEvent(EventType.CustomEvent, cameraGuid); + eventInstance.Id = new CustomEventId(customEvent.Id); + eventInstance.Message = "Custom event message"; + eventInstance.ExtraHiddenPayload = "Custom event extra payload"; + + engine.ActionManager.RaiseEvent(eventInstance); } } } \ No newline at end of file diff --git a/Samples/Platform SDK/CustomFieldSample/Program.cs b/Samples/Platform SDK/CustomFieldSample/Program.cs index 85d5a10..76ff467 100644 --- a/Samples/Platform SDK/CustomFieldSample/Program.cs +++ b/Samples/Platform SDK/CustomFieldSample/Program.cs @@ -5,150 +5,149 @@ // Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -namespace Genetec.Dap.CodeSamples +namespace Genetec.Dap.CodeSamples; + +using System; +using System.Collections.Generic; +using System.Data; +using System.Linq; +using System.Threading.Tasks; +using Genetec.Sdk.Queries; +using Sdk; +using Sdk.Entities; +using Sdk.Entities.CustomFields; + +class Program { - using System; - using System.Collections.Generic; - using System.Data; - using System.Linq; - using System.Threading.Tasks; - using Genetec.Sdk.Queries; - using Sdk; - using Sdk.Entities; - using Sdk.Entities.CustomFields; - - class Program - { - static Program() => SdkResolver.Initialize(); - - static async Task Main() - { - const string server = "localhost"; - const string username = "admin"; - const string password = ""; - const string customFieldName = "Employee ID"; - const string customFieldValue = "12345"; + static Program() => SdkResolver.Initialize(); - using var engine = new Engine(); + static async Task Main() + { + const string server = "localhost"; + const string username = "admin"; + const string password = ""; + const string customFieldName = "Employee ID"; + const string customFieldValue = "12345"; - ConnectionStateCode state = await engine.LogOnAsync(server, username, password); + using var engine = new Engine(); - if (state == ConnectionStateCode.Success) - { - var configuration = (SystemConfiguration)engine.GetEntity(SystemConfiguration.SystemConfigurationGuid); - ICustomFieldService customFieldService = configuration.CustomFieldService; + ConnectionStateCode state = await engine.LogOnAsync(server, username, password); - await PrintExistingCustomFields(customFieldService); + if (state == ConnectionStateCode.Success) + { + var configuration = (SystemConfiguration)engine.GetEntity(SystemConfiguration.SystemConfigurationGuid); + ICustomFieldService customFieldService = configuration.CustomFieldService; - CustomField customField = await CreateOrUpdateCustomField(customFieldService); + await PrintExistingCustomFields(customFieldService); - await CreateCardholderWithCustomField(customFieldService, customField, customFieldValue); + CustomField customField = await CreateOrUpdateCustomField(customFieldService); - await QueryAndPrintCardholder(customFieldService, customField, customFieldValue); - } - else - { - Console.WriteLine($"Logon failed: {state}"); - } + await CreateCardholderWithCustomField(customFieldService, customField, customFieldValue); - Console.WriteLine("Press any key to exit..."); - Console.ReadKey(); + await QueryAndPrintCardholder(customFieldService, customField, customFieldValue); + } + else + { + Console.WriteLine($"Logon failed: {state}"); + } - async Task PrintExistingCustomFields(ICustomFieldService service) - { - Console.WriteLine("Existing Custom Fields:"); + Console.WriteLine("Press any key to exit..."); + Console.ReadKey(); - IReadOnlyList customFields = await service.GetCustomFieldsAsync(); + async Task PrintExistingCustomFields(ICustomFieldService service) + { + Console.WriteLine("Existing Custom Fields:"); - foreach (IGrouping group in customFields.GroupBy(cf => cf.EntityType).OrderBy(g => g.Key)) - { - Console.WriteLine($"\nEntity Type: {group.Key}"); - Console.WriteLine(new string('-', 20)); + IReadOnlyList customFields = await service.GetCustomFieldsAsync(); - foreach (CustomField customField in group.OrderBy(cf => cf.Name)) - { - PrintCustomFieldDetails(customField); - } - } + foreach (IGrouping group in customFields.GroupBy(cf => cf.EntityType).OrderBy(g => g.Key)) + { + Console.WriteLine($"\nEntity Type: {group.Key}"); + Console.WriteLine(new string('-', 20)); - void PrintCustomFieldDetails(CustomField customField) + foreach (CustomField customField in group.OrderBy(cf => cf.Name)) { - Console.WriteLine($" Name: {customField.Name}"); - Console.WriteLine($" Guid: {customField.Guid}"); - Console.WriteLine($" ValueType: {customField.ValueType}"); - Console.WriteLine($" CustomEntityTypeId: {customField.CustomEntityTypeId}"); - Console.WriteLine($" DefaultValue: {customField.DefaultValue}"); - Console.WriteLine($" GroupName: {customField.GroupName}"); - Console.WriteLine($" GroupPriority: {customField.GroupPriority}"); - Console.WriteLine($" Mandatory: {customField.Mandatory}"); - Console.WriteLine($" Owner: {customField.Owner}"); - Console.WriteLine($" ShowInReports: {customField.ShowInReports}"); - Console.WriteLine($" Unique: {customField.Unique}"); - Console.WriteLine($" CustomDataType: {customField.CustomDataType}"); - Console.WriteLine(); + PrintCustomFieldDetails(customField); } } - async Task CreateOrUpdateCustomField(ICustomFieldService service) + void PrintCustomFieldDetails(CustomField customField) { - Console.WriteLine($"Searching for existing custom field: {customFieldName}"); - CustomField customField = service.CustomFields.FirstOrDefault(cf => cf.EntityType == EntityType.Cardholder && cf.Name.Equals(customFieldName, StringComparison.OrdinalIgnoreCase)); + Console.WriteLine($" Name: {customField.Name}"); + Console.WriteLine($" Guid: {customField.Guid}"); + Console.WriteLine($" ValueType: {customField.ValueType}"); + Console.WriteLine($" CustomEntityTypeId: {customField.CustomEntityTypeId}"); + Console.WriteLine($" DefaultValue: {customField.DefaultValue}"); + Console.WriteLine($" GroupName: {customField.GroupName}"); + Console.WriteLine($" GroupPriority: {customField.GroupPriority}"); + Console.WriteLine($" Mandatory: {customField.Mandatory}"); + Console.WriteLine($" Owner: {customField.Owner}"); + Console.WriteLine($" ShowInReports: {customField.ShowInReports}"); + Console.WriteLine($" Unique: {customField.Unique}"); + Console.WriteLine($" CustomDataType: {customField.CustomDataType}"); + Console.WriteLine(); + } + } - if (customField is null) - { - Console.WriteLine($"Custom field '{customFieldName}' not found. Creating new custom field..."); + async Task CreateOrUpdateCustomField(ICustomFieldService service) + { + Console.WriteLine($"Searching for existing custom field: {customFieldName}"); + CustomField customField = service.CustomFields.FirstOrDefault(cf => cf.EntityType == EntityType.Cardholder && cf.Name.Equals(customFieldName, StringComparison.OrdinalIgnoreCase)); - customField = service.CreateCustomFieldBuilder() - .SetEntityType(EntityType.Cardholder) - .SetName(customFieldName) - .SetValueType(CustomFieldValueType.Text) - .SetDefaultValue(string.Empty) - .Build(); + if (customField is null) + { + Console.WriteLine($"Custom field '{customFieldName}' not found. Creating new custom field..."); - await service.AddCustomFieldAsync(customField); - Console.WriteLine($"Created new custom field: {customField.Name}"); - } - else - { - Console.WriteLine($"Custom field '{customFieldName}' already exists:"); - } + customField = service.CreateCustomFieldBuilder() + .SetEntityType(EntityType.Cardholder) + .SetName(customFieldName) + .SetValueType(CustomFieldValueType.Text) + .SetDefaultValue(string.Empty) + .Build(); - return customField; + await service.AddCustomFieldAsync(customField); + Console.WriteLine($"Created new custom field: {customField.Name}"); } - - Task CreateCardholderWithCustomField(ICustomFieldService service, CustomField customField, object value) => engine.TransactionManager.ExecuteTransactionAsync(() => + else { - Console.WriteLine("Creating new cardholder"); + Console.WriteLine($"Custom field '{customFieldName}' already exists:"); + } - var cardholder = (Cardholder)engine.CreateEntity("John Doe", EntityType.Cardholder); - cardholder.FirstName = "John"; - cardholder.LastName = "Doe"; - cardholder.EmailAddress = "johndoe@example.com"; + return customField; + } - Console.WriteLine($"Setting custom field '{customFieldName}'"); + Task CreateCardholderWithCustomField(ICustomFieldService service, CustomField customField, object value) => engine.TransactionManager.ExecuteTransactionAsync(() => + { + Console.WriteLine("Creating new cardholder"); - service.SetValue(customField, cardholder.Guid, value); - }); + var cardholder = (Cardholder)engine.CreateEntity("John Doe", EntityType.Cardholder); + cardholder.FirstName = "John"; + cardholder.LastName = "Doe"; + cardholder.EmailAddress = "johndoe@example.com"; - async Task QueryAndPrintCardholder(ICustomFieldService service, CustomField customField, string customFieldValue) - { - Console.WriteLine($"Searching for cardholder with custom field '{customField.Name}' value: {customFieldValue}"); + Console.WriteLine($"Setting custom field '{customFieldName}'"); - var query = (CardholderConfigurationQuery)engine.ReportManager.CreateReportQuery(ReportType.CardholderConfiguration); - query.CustomFields.Add(new CustomFieldFilter(customField, customFieldValue, FieldRangeType.Equal)); + service.SetValue(customField, cardholder.Guid, value); + }); - QueryCompletedEventArgs queryResults = await Task.Factory.FromAsync(query.BeginQuery, query.EndQuery, null); + async Task QueryAndPrintCardholder(ICustomFieldService service, CustomField customField, string customFieldValue) + { + Console.WriteLine($"Searching for cardholder with custom field '{customField.Name}' value: {customFieldValue}"); - Console.WriteLine($"Found {queryResults.Data.Rows.Count} cardholder(s) matching the query:"); + var query = (CardholderConfigurationQuery)engine.ReportManager.CreateReportQuery(ReportType.CardholderConfiguration); + query.CustomFields.Add(new CustomFieldFilter(customField, customFieldValue, FieldRangeType.Equal)); - foreach (Cardholder cardholder in queryResults.Data.AsEnumerable().Select(row => engine.GetEntity(row.Field(nameof(Guid)))).OfType()) - { - Console.WriteLine($"- Name: {cardholder.Name}"); - Console.WriteLine($" First Name: {cardholder.FirstName}"); - Console.WriteLine($" Last Name: {cardholder.LastName}"); - Console.WriteLine($" Email: {cardholder.EmailAddress}"); - Console.WriteLine($" Custom Field '{customField.Name}' Value: {service.GetValue(customField, cardholder.Guid)}"); - } + QueryCompletedEventArgs queryResults = await Task.Factory.FromAsync(query.BeginQuery, query.EndQuery, null); + + Console.WriteLine($"Found {queryResults.Data.Rows.Count} cardholder(s) matching the query:"); + + foreach (Cardholder cardholder in queryResults.Data.AsEnumerable().Select(row => engine.GetEntity(row.Field(nameof(Guid)))).OfType()) + { + Console.WriteLine($"- Name: {cardholder.Name}"); + Console.WriteLine($" First Name: {cardholder.FirstName}"); + Console.WriteLine($" Last Name: {cardholder.LastName}"); + Console.WriteLine($" Email: {cardholder.EmailAddress}"); + Console.WriteLine($" Custom Field '{customField.Name}' Value: {service.GetValue(customField, cardholder.Guid)}"); } } } diff --git a/Samples/Platform SDK/DiagnosticServerSample/InstanceLogger.cs b/Samples/Platform SDK/DiagnosticServerSample/InstanceLogger.cs index 36e6fa7..c91d861 100644 --- a/Samples/Platform SDK/DiagnosticServerSample/InstanceLogger.cs +++ b/Samples/Platform SDK/DiagnosticServerSample/InstanceLogger.cs @@ -5,40 +5,39 @@ // Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -namespace Genetec.Dap.CodeSamples +namespace Genetec.Dap.CodeSamples; + +using System; +using Genetec.Sdk.Diagnostics.Logging; +using Genetec.Sdk.Diagnostics.Logging.Core; + +class InstanceLogger : IDisposable { - using System; - using Genetec.Sdk.Diagnostics.Logging; - using Genetec.Sdk.Diagnostics.Logging.Core; + private readonly Logger m_logger; - class InstanceLogger : IDisposable + public InstanceLogger() { - private readonly Logger m_logger; - - public InstanceLogger() - { - m_logger = Logger.CreateInstanceLogger(this); - } + m_logger = Logger.CreateInstanceLogger(this); + } - public void Dispose() - { - m_logger.Dispose(); - } + public void Dispose() + { + m_logger.Dispose(); + } - public void LogDebugMessage() - { - m_logger.TraceDebug("This is a debug message"); - } + public void LogDebugMessage() + { + m_logger.TraceDebug("This is a debug message"); + } - /// - /// Executes a debug method and returns a result message. - /// - /// A string containing the output message of this sample debug method. - [DebugMethod(Description = "Executes a sample debug method", DisplayName = "Sample Debug Method", IsHidden = false, IsSecured = false)] - [UserCommand("Genetec.Dap.Samples")] - public string ExecuteSampleDebugMethod() - { - return "This is the result of executing the sample debug method."; - } + /// + /// Executes a debug method and returns a result message. + /// + /// A string containing the output message of this sample debug method. + [DebugMethod(Description = "Executes a sample debug method", DisplayName = "Sample Debug Method", IsHidden = false, IsSecured = false)] + [UserCommand("Genetec.Dap.Samples")] + public string ExecuteSampleDebugMethod() + { + return "This is the result of executing the sample debug method."; } } \ No newline at end of file diff --git a/Samples/Platform SDK/DiagnosticServerSample/Program.cs b/Samples/Platform SDK/DiagnosticServerSample/Program.cs index 56d30a1..5f33e38 100644 --- a/Samples/Platform SDK/DiagnosticServerSample/Program.cs +++ b/Samples/Platform SDK/DiagnosticServerSample/Program.cs @@ -5,68 +5,67 @@ // Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -namespace Genetec.Dap.CodeSamples +namespace Genetec.Dap.CodeSamples; + +using System; +using System.Diagnostics; +using System.Threading.Tasks; +using Sdk.Diagnostics; + +class Program { - using System; - using System.Diagnostics; - using System.Threading.Tasks; - using Sdk.Diagnostics; + static Program() => SdkResolver.Initialize(); - class Program + static async Task Main() { - static Program() => SdkResolver.Initialize(); + await InitializeAndStartServer(); - static async Task Main() - { - await InitializeAndStartServer(); + LogDebugMessage(); - LogDebugMessage(); + Console.WriteLine("Press any key to exit..."); + Console.ReadKey(); - Console.WriteLine("Press any key to exit..."); - Console.ReadKey(); + Cleanup(); + } - Cleanup(); - } + static void LogDebugMessage() + { + using var logger = new InstanceLogger(); + logger.LogDebugMessage(); - static void LogDebugMessage() - { - using var logger = new InstanceLogger(); - logger.LogDebugMessage(); + StaticLogger.LogDebugMessage(); + } - StaticLogger.LogDebugMessage(); - } + static async Task InitializeAndStartServer() + { + const int diagnosticServerPort = 4523; + const int webServerPort = 6023; + const string password = ""; // The password is optional, by default, it's an empty string - static async Task InitializeAndStartServer() + try { - const int diagnosticServerPort = 4523; - const int webServerPort = 6023; - const string password = ""; // The password is optional, by default, it's an empty string + DiagnosticServer.Instance.InitializeServer(diagnosticServerPort, webServerPort, password); - try - { - DiagnosticServer.Instance.InitializeServer(diagnosticServerPort, webServerPort, password); + var url = $"http://localhost:{webServerPort}/Console"; + Console.WriteLine($"Console started: {url}"); + Process.Start(new ProcessStartInfo(url) { UseShellExecute = true }); - var url = $"http://localhost:{webServerPort}/Console"; - Console.WriteLine($"Console started: {url}"); - Process.Start(new ProcessStartInfo(url) { UseShellExecute = true }); - - // Wait for a few seconds to ensure the web browser has enough time to load the page - await Task.Delay(5000); // Adjust the delay as necessary - } - catch (Exception ex) - { - Console.WriteLine($"Error initializing server: {ex.Message}"); - Console.WriteLine(ex.StackTrace); - } + // Wait for a few seconds to ensure the web browser has enough time to load the page + await Task.Delay(5000); // Adjust the delay as necessary } + catch (Exception ex) + { + Console.WriteLine($"Error initializing server: {ex.Message}"); + Console.WriteLine(ex.StackTrace); + } + } - static void Cleanup() + static void Cleanup() + { + if (DiagnosticServer.IsInstanceCreated && DiagnosticServer.Instance.IsInitialized) { - if (DiagnosticServer.IsInstanceCreated && DiagnosticServer.Instance.IsInitialized) - { - DiagnosticServer.Instance.Dispose(); - Console.WriteLine("Diagnostic server disposed."); - } + DiagnosticServer.Instance.Dispose(); + Console.WriteLine("Diagnostic server disposed."); } } } \ No newline at end of file diff --git a/Samples/Platform SDK/DiagnosticServerSample/StaticLogger.cs b/Samples/Platform SDK/DiagnosticServerSample/StaticLogger.cs index e320040..c53fac7 100644 --- a/Samples/Platform SDK/DiagnosticServerSample/StaticLogger.cs +++ b/Samples/Platform SDK/DiagnosticServerSample/StaticLogger.cs @@ -5,29 +5,28 @@ // Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -namespace Genetec.Dap.CodeSamples +namespace Genetec.Dap.CodeSamples; + +using Genetec.Sdk.Diagnostics.Logging; +using Genetec.Sdk.Diagnostics.Logging.Core; + +static class StaticLogger { - using Genetec.Sdk.Diagnostics.Logging; - using Genetec.Sdk.Diagnostics.Logging.Core; + private static readonly Logger s_logger = Logger.CreateClassLogger(typeof(StaticLogger)); - static class StaticLogger + public static void LogDebugMessage() { - private static readonly Logger s_logger = Logger.CreateClassLogger(typeof(StaticLogger)); - - public static void LogDebugMessage() - { - s_logger.TraceDebug("This is a debug message"); - } + s_logger.TraceDebug("This is a debug message"); + } - /// - /// Executes a static debug method and returns a result message. - /// - /// A string containing the output message of this sample static debug method. - [DebugMethod(Description = "Executes a sample static debug method", DisplayName = "Sample Static Debug Method", IsHidden = false, IsSecured = false)] - [UserCommand("Genetec.Dap.Samples")] - public static string ExecuteSampleDebugMethod() - { - return "This is the result of executing the sample static debug method."; - } + /// + /// Executes a static debug method and returns a result message. + /// + /// A string containing the output message of this sample static debug method. + [DebugMethod(Description = "Executes a sample static debug method", DisplayName = "Sample Static Debug Method", IsHidden = false, IsSecured = false)] + [UserCommand("Genetec.Dap.Samples")] + public static string ExecuteSampleDebugMethod() + { + return "This is the result of executing the sample static debug method."; } } \ No newline at end of file diff --git a/Samples/Platform SDK/DisplayInTileSample/Program.cs b/Samples/Platform SDK/DisplayInTileSample/Program.cs index 22392c5..0dc800e 100644 --- a/Samples/Platform SDK/DisplayInTileSample/Program.cs +++ b/Samples/Platform SDK/DisplayInTileSample/Program.cs @@ -5,92 +5,91 @@ // Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -namespace Genetec.Dap.CodeSamples +namespace Genetec.Dap.CodeSamples; + +using System; +using System.Linq; +using System.Threading.Tasks; +using Genetec.Sdk; +using Sdk.Entities; +using Sdk.Queries; + +class Program { - using System; - using System.Linq; - using System.Threading.Tasks; - using Genetec.Sdk; - using Sdk.Entities; - using Sdk.Queries; - - class Program - { - static Program() => SdkResolver.Initialize(); + static Program() => SdkResolver.Initialize(); - static async Task Main() - { - const string server = "localhost"; - const string username = "admin"; - const string password = ""; + static async Task Main() + { + const string server = "localhost"; + const string username = "admin"; + const string password = ""; - // Replace with your actual camera GUID - Guid cameraGuid = Guid.Parse("00000000-0000-0000-0000-000000000000"); + // Replace with your actual camera GUID + Guid cameraGuid = Guid.Parse("00000000-0000-0000-0000-000000000000"); - using var engine = new Engine(); + using var engine = new Engine(); - ConnectionStateCode state = await engine.LogOnAsync(server, username, password); + ConnectionStateCode state = await engine.LogOnAsync(server, username, password); - if (state == ConnectionStateCode.Success) - { - await LoadApplications(); - DisplayCameraInTiles(); - } - else - { - Console.WriteLine($"Logon failed: {state}"); - } + if (state == ConnectionStateCode.Success) + { + await LoadApplications(); + DisplayCameraInTiles(); + } + else + { + Console.WriteLine($"Logon failed: {state}"); + } - Console.WriteLine("Press any key to exit..."); - Console.ReadKey(); + Console.WriteLine("Press any key to exit..."); + Console.ReadKey(); - // Load all applications into the engine - async Task LoadApplications() - { - Console.WriteLine("Loading applications..."); - var query = (EntityConfigurationQuery)engine.ReportManager.CreateReportQuery(ReportType.EntityConfiguration); - query.EntityTypeFilter.Add(EntityType.Application); - await Task.Factory.FromAsync(query.BeginQuery, query.EndQuery, null); - } + // Load all applications into the engine + async Task LoadApplications() + { + Console.WriteLine("Loading applications..."); + var query = (EntityConfigurationQuery)engine.ReportManager.CreateReportQuery(ReportType.EntityConfiguration); + query.EntityTypeFilter.Add(EntityType.Application); + await Task.Factory.FromAsync(query.BeginQuery, query.EndQuery, null); + } - // Display the camera feed in tiles on all available Security Desk monitors - void DisplayCameraInTiles() - { - Console.WriteLine("Searching for online Security Desk applications..."); + // Display the camera feed in tiles on all available Security Desk monitors + void DisplayCameraInTiles() + { + Console.WriteLine("Searching for online Security Desk applications..."); - // Get all online Security Desk applications - var securityDeskApps = engine.GetEntities(EntityType.Application) - .OfType() - .Where(app => app.ApplicationType == ApplicationType.SecurityDesk && app.IsOnline) - .ToList(); + // Get all online Security Desk applications + var securityDeskApps = engine.GetEntities(EntityType.Application) + .OfType() + .Where(app => app.ApplicationType == ApplicationType.SecurityDesk && app.IsOnline) + .ToList(); - Console.WriteLine($"Found {securityDeskApps.Count} online Security Desk application(s)."); + Console.WriteLine($"Found {securityDeskApps.Count} online Security Desk application(s)."); - Console.WriteLine("Retrieving monitors from Security Desk applications..."); + Console.WriteLine("Retrieving monitors from Security Desk applications..."); - // Get all monitors from these applications - var monitors = securityDeskApps.SelectMany(app => app.Monitors) - .Select(engine.GetEntity) - .OfType() - .Select(monitor => monitor.MonitorId) - .ToList(); + // Get all monitors from these applications + var monitors = securityDeskApps.SelectMany(app => app.Monitors) + .Select(engine.GetEntity) + .OfType() + .Select(monitor => monitor.MonitorId) + .ToList(); - Console.WriteLine($"Found {monitors.Count} monitor(s)."); + Console.WriteLine($"Found {monitors.Count} monitor(s)."); - // Display camera on each monitor - foreach (var monitor in monitors) - { + // Display camera on each monitor + foreach (var monitor in monitors) + { - string xmlContent = $@" + string xmlContent = $@" "; - Console.WriteLine($"Displaying camera on monitor ID: {monitor}"); - engine.ActionManager.DisplayInTile(monitor, xmlContent); - } + Console.WriteLine($"Displaying camera on monitor ID: {monitor}"); + engine.ActionManager.DisplayInTile(monitor, xmlContent); } } } diff --git a/Samples/Platform SDK/EntityCertificatesManagerSample/Program.cs b/Samples/Platform SDK/EntityCertificatesManagerSample/Program.cs index bd0298c..1c7291e 100644 --- a/Samples/Platform SDK/EntityCertificatesManagerSample/Program.cs +++ b/Samples/Platform SDK/EntityCertificatesManagerSample/Program.cs @@ -1,90 +1,89 @@ // Copyright (C) 2023 by Genetec, Inc. All rights reserved. // May be used only in accordance with a valid Source Code License Agreement. -namespace Genetec.Dap.CodeSamples +namespace Genetec.Dap.CodeSamples; + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Security.Cryptography.X509Certificates; +using System.Security.Cryptography; +using System.Threading.Tasks; +using Sdk; +using Sdk.Entities; +using Sdk.Workflows.EntityCertificatesManagers; + +class Program { - using System; - using System.Collections.Generic; - using System.Linq; - using System.Security.Cryptography.X509Certificates; - using System.Security.Cryptography; - using System.Threading.Tasks; - using Sdk; - using Sdk.Entities; - using Sdk.Workflows.EntityCertificatesManagers; - - class Program - { - static Program() => SdkResolver.Initialize(); - - static async Task Main() - { - const string server = "localhost"; - const string username = "admin"; - const string password = ""; + static Program() => SdkResolver.Initialize(); - using var engine = new Engine(); + static async Task Main() + { + const string server = "localhost"; + const string username = "admin"; + const string password = ""; - ConnectionStateCode state = await engine.LogOnAsync(server, username, password); + using var engine = new Engine(); - if (state == ConnectionStateCode.Success) - { - CertificateSummary summary = await GetOrCreateCertificate(engine, "Sample"); + ConnectionStateCode state = await engine.LogOnAsync(server, username, password); - Console.WriteLine($"Certificate ID: {summary.Id}, Thumbprint: {summary.Thumbprint}"); + if (state == ConnectionStateCode.Success) + { + CertificateSummary summary = await GetOrCreateCertificate(engine, "Sample"); - X509Certificate2 certificate = await engine.EntityCertificatesManager.GetCertificateAsync(summary.Id); + Console.WriteLine($"Certificate ID: {summary.Id}, Thumbprint: {summary.Thumbprint}"); - Console.WriteLine($"Certificate fetched: {certificate.Subject}"); + X509Certificate2 certificate = await engine.EntityCertificatesManager.GetCertificateAsync(summary.Id); - await engine.EntityCertificatesManager.DeleteCertificateAsync(summary.Id); - Console.WriteLine($"Certificate deleted: {summary.Id}"); - } - else - { - Console.WriteLine($"Logon failed: {state}"); - } + Console.WriteLine($"Certificate fetched: {certificate.Subject}"); - Console.WriteLine("Press any key to exit..."); - Console.ReadKey(); + await engine.EntityCertificatesManager.DeleteCertificateAsync(summary.Id); + Console.WriteLine($"Certificate deleted: {summary.Id}"); + } + else + { + Console.WriteLine($"Logon failed: {state}"); } - static async Task GetOrCreateCertificate(Engine engine, string tag) + Console.WriteLine("Press any key to exit..."); + Console.ReadKey(); + } + + static async Task GetOrCreateCertificate(Engine engine, string tag) + { + List summaries = await engine.EntityCertificatesManager.GetAllCertificatesOfEntityAsync(SystemConfiguration.SystemConfigurationGuid, tag); + if (!summaries.Any()) { - List summaries = await engine.EntityCertificatesManager.GetAllCertificatesOfEntityAsync(SystemConfiguration.SystemConfigurationGuid, tag); - if (!summaries.Any()) - { - Console.WriteLine($"Creating certificate with tag: {tag}"); + Console.WriteLine($"Creating certificate with tag: {tag}"); - X509Certificate2 certificate = CreateSelfSignedCertificate(); + X509Certificate2 certificate = CreateSelfSignedCertificate(); - Guid certificateId = await engine.EntityCertificatesManager.CreateCertificateAsync( - relatedEntity: SystemConfiguration.SystemConfigurationGuid, - certificate: certificate, - tag: tag, - eraseExistingEntries: false); + Guid certificateId = await engine.EntityCertificatesManager.CreateCertificateAsync( + relatedEntity: SystemConfiguration.SystemConfigurationGuid, + certificate: certificate, + tag: tag, + eraseExistingEntries: false); - return await engine.EntityCertificatesManager.GetCertificateSummaryAsync(certificateId); - } + return await engine.EntityCertificatesManager.GetCertificateSummaryAsync(certificateId); + } - Console.WriteLine("A certificate already exists."); + Console.WriteLine("A certificate already exists."); - return summaries.First(); - } + return summaries.First(); + } - public static X509Certificate2 CreateSelfSignedCertificate() - { - var distinguishedName = new X500DistinguishedName("CN=SelfSignedEncryptionCert"); - using var rsa = new RSACryptoServiceProvider(2048); - var request = new CertificateRequest(distinguishedName, rsa, HashAlgorithmName.SHA256, RSASignaturePadding.Pkcs1); + public static X509Certificate2 CreateSelfSignedCertificate() + { + var distinguishedName = new X500DistinguishedName("CN=SelfSignedEncryptionCert"); + using var rsa = new RSACryptoServiceProvider(2048); + var request = new CertificateRequest(distinguishedName, rsa, HashAlgorithmName.SHA256, RSASignaturePadding.Pkcs1); - request.CertificateExtensions.Add(new X509KeyUsageExtension(X509KeyUsageFlags.DataEncipherment, false)); - request.CertificateExtensions.Add(new X509BasicConstraintsExtension(false, false, 0, false)); + request.CertificateExtensions.Add(new X509KeyUsageExtension(X509KeyUsageFlags.DataEncipherment, false)); + request.CertificateExtensions.Add(new X509BasicConstraintsExtension(false, false, 0, false)); - var certificate = request.CreateSelfSigned(DateTimeOffset.Now, DateTimeOffset.Now.AddYears(1)); - byte[] certData = certificate.Export(X509ContentType.Pfx); + var certificate = request.CreateSelfSigned(DateTimeOffset.Now, DateTimeOffset.Now.AddYears(1)); + byte[] certData = certificate.Export(X509ContentType.Pfx); - return new X509Certificate2(certData, "", X509KeyStorageFlags.Exportable | X509KeyStorageFlags.PersistKeySet); - } + return new X509Certificate2(certData, "", X509KeyStorageFlags.Exportable | X509KeyStorageFlags.PersistKeySet); } -} +} \ No newline at end of file diff --git a/Samples/Platform SDK/EntityMappingSample/Program.cs b/Samples/Platform SDK/EntityMappingSample/Program.cs index e3a2d8a..fd234a7 100644 --- a/Samples/Platform SDK/EntityMappingSample/Program.cs +++ b/Samples/Platform SDK/EntityMappingSample/Program.cs @@ -1,98 +1,97 @@ // Copyright (C) 2023 by Genetec, Inc. All rights reserved. // May be used only in accordance with a valid Source Code License Agreement. -namespace Genetec.Dap.CodeSamples +namespace Genetec.Dap.CodeSamples; + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Sdk; +using Sdk.Entities; +using Sdk.Queries; + +class Program { - using System; - using System.Collections.Generic; - using System.Linq; - using System.Threading.Tasks; - using Sdk; - using Sdk.Entities; - using Sdk.Queries; - - class Program + static Program() => SdkResolver.Initialize(); + + static async Task Main() { - static Program() => SdkResolver.Initialize(); + const string server = "localhost"; + const string username = "admin"; + const string password = ""; - static async Task Main() - { - const string server = "localhost"; - const string username = "admin"; - const string password = ""; + using var engine = new Engine(); - using var engine = new Engine(); + ConnectionStateCode state = await engine.LogOnAsync(server, username, password); - ConnectionStateCode state = await engine.LogOnAsync(server, username, password); + if (state == ConnectionStateCode.Success) + { + await LoadCameras(); - if (state == ConnectionStateCode.Success) + foreach (Camera camera in engine.GetEntities(EntityType.Camera).OfType()) { - await LoadCameras(); - - foreach (Camera camera in engine.GetEntities(EntityType.Camera).OfType()) + if (!TryGetMapping(camera, out string data)) { - if (!TryGetMapping(camera, out string data)) - { - SaveMapping(camera, "DATA"); - } - - Console.WriteLine($"{camera.Name,-20}: {data}"); + SaveMapping(camera, "DATA"); } + + Console.WriteLine($"{camera.Name,-20}: {data}"); } - else - { - Console.WriteLine($"Logon failed: {state}"); - } + } + else + { + Console.WriteLine($"Logon failed: {state}"); + } - Console.WriteLine("Press any key to exit..."); - Console.ReadKey(); + Console.WriteLine("Press any key to exit..."); + Console.ReadKey(); - async Task LoadCameras() - { - var query = (EntityConfigurationQuery)engine.ReportManager.CreateReportQuery(ReportType.EntityConfiguration); - query.DownloadAllRelatedData = true; - query.EntityTypeFilter.Add(EntityType.Camera); - query.EntityTypeFilter.Add(EntityType.VideoUnit); - await Task.Factory.FromAsync(query.BeginQuery, query.EndQuery, null); - } + async Task LoadCameras() + { + var query = (EntityConfigurationQuery)engine.ReportManager.CreateReportQuery(ReportType.EntityConfiguration); + query.DownloadAllRelatedData = true; + query.EntityTypeFilter.Add(EntityType.Camera); + query.EntityTypeFilter.Add(EntityType.VideoUnit); + await Task.Factory.FromAsync(query.BeginQuery, query.EndQuery, null); + } - void SaveMapping(Camera camera, string data) + void SaveMapping(Camera camera, string data) + { + if (engine.GetEntity(camera.Unit) is VideoUnit unit) { - if (engine.GetEntity(camera.Unit) is VideoUnit unit) - { - List mappings = unit.ArchiverRole.EntityMappings; + List mappings = unit.ArchiverRole.EntityMappings; - EntityMapping mapping = mappings.FirstOrDefault(mapping => mapping.LocalEntityId == camera.Guid); + EntityMapping mapping = mappings.FirstOrDefault(mapping => mapping.LocalEntityId == camera.Guid); - if (mapping is null) - { - mappings.Add(new EntityMapping { LocalEntityId = camera.Guid, RoleId = unit.ArchiverRoleGuid, XmlInfo = data }); - } - else - { - mapping.XmlInfo = data; - } - - unit.ArchiverRole.EntityMappings = mappings; + if (mapping is null) + { + mappings.Add(new EntityMapping { LocalEntityId = camera.Guid, RoleId = unit.ArchiverRoleGuid, XmlInfo = data }); + } + else + { + mapping.XmlInfo = data; } + + unit.ArchiverRole.EntityMappings = mappings; } + } - bool TryGetMapping(Camera camera, out string data) + bool TryGetMapping(Camera camera, out string data) + { + if (engine.GetEntity(camera.Unit) is VideoUnit unit) { - if (engine.GetEntity(camera.Unit) is VideoUnit unit) - { - EntityMapping mapping = unit.ArchiverRole.EntityMappings.FirstOrDefault(mapping => mapping.LocalEntityId == camera.Guid); + EntityMapping mapping = unit.ArchiverRole.EntityMappings.FirstOrDefault(mapping => mapping.LocalEntityId == camera.Guid); - if (mapping != null) - { - data = mapping.XmlInfo; - return true; - } + if (mapping != null) + { + data = mapping.XmlInfo; + return true; } - - data = default; - return false; } + + data = default; + return false; } } } \ No newline at end of file diff --git a/Samples/Platform SDK/EventMonitoringSample/Program.cs b/Samples/Platform SDK/EventMonitoringSample/Program.cs index 9f8b0e3..fe5bd72 100644 --- a/Samples/Platform SDK/EventMonitoringSample/Program.cs +++ b/Samples/Platform SDK/EventMonitoringSample/Program.cs @@ -5,81 +5,80 @@ // Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -namespace Genetec.Dap.CodeSamples +namespace Genetec.Dap.CodeSamples; + +using System; +using System.Threading.Tasks; +using Sdk; +using Sdk.Entities; +using Sdk.Queries; + +class Program { - using System; - using System.Threading.Tasks; - using Sdk; - using Sdk.Entities; - using Sdk.Queries; + static Program() => SdkResolver.Initialize(); - class Program + static async Task Main() { - static Program() => SdkResolver.Initialize(); + const string server = "localhost"; + const string username = "admin"; + const string password = ""; - static async Task Main() - { - const string server = "localhost"; - const string username = "admin"; - const string password = ""; + using var engine = new Engine(); - using var engine = new Engine(); + engine.SetEventFilter(new[] + { + EventType.UnitConnected, + EventType.UnitDisconnected, + EventType.InterfaceOnline, + EventType.InterfaceOffline, + EventType.EntityWarning + }); - engine.SetEventFilter(new[] - { - EventType.UnitConnected, - EventType.UnitDisconnected, - EventType.InterfaceOnline, - EventType.InterfaceOffline, - EventType.EntityWarning - }); + engine.EventReceived += (sender, e) => + { + Entity entity = engine.GetEntity(e.SourceGuid); - engine.EventReceived += (sender, e) => + switch (e.EventType) { - Entity entity = engine.GetEntity(e.SourceGuid); + case EventType.UnitConnected: + Console.WriteLine($"{entity.Name} connected."); + break; + case EventType.UnitDisconnected: + Console.WriteLine($"{entity.Name} disconnected."); + break; + case EventType.InterfaceOnline: + Console.WriteLine($"{entity.Name} interface online."); + break; + case EventType.InterfaceOffline: + Console.WriteLine($"{entity.Name} interface offline."); + break; + case EventType.EntityWarning: + Console.WriteLine($"{entity.Name} warning."); + break; + } + }; - switch (e.EventType) - { - case EventType.UnitConnected: - Console.WriteLine($"{entity.Name} connected."); - break; - case EventType.UnitDisconnected: - Console.WriteLine($"{entity.Name} disconnected."); - break; - case EventType.InterfaceOnline: - Console.WriteLine($"{entity.Name} interface online."); - break; - case EventType.InterfaceOffline: - Console.WriteLine($"{entity.Name} interface offline."); - break; - case EventType.EntityWarning: - Console.WriteLine($"{entity.Name} warning."); - break; - } - }; + ConnectionStateCode state = await engine.LogOnAsync(server, username, password); - ConnectionStateCode state = await engine.LogOnAsync(server, username, password); - - if (state == ConnectionStateCode.Success) - { - await LoadEntities(); + if (state == ConnectionStateCode.Success) + { + await LoadEntities(); - Console.WriteLine($"Listening to events: {string.Join(",", engine.GetEventFilter())}"); - } - else - { - Console.WriteLine($"Logon failed: {state}"); - } + Console.WriteLine($"Listening to events: {string.Join(",", engine.GetEventFilter())}"); + } + else + { + Console.WriteLine($"Logon failed: {state}"); + } - Console.WriteLine("Press any key to exit..."); - Console.ReadKey(); + Console.WriteLine("Press any key to exit..."); + Console.ReadKey(); - async Task LoadEntities() - { - var query = (EntityConfigurationQuery)engine.ReportManager.CreateReportQuery(ReportType.EntityConfiguration); - query.EntityTypeFilter.Add(EntityType.Unit); - await Task.Factory.FromAsync(query.BeginQuery, query.EndQuery, null); - } + async Task LoadEntities() + { + var query = (EntityConfigurationQuery)engine.ReportManager.CreateReportQuery(ReportType.EntityConfiguration); + query.EntityTypeFilter.Add(EntityType.Unit); + await Task.Factory.FromAsync(query.BeginQuery, query.EndQuery, null); } } -} +} \ No newline at end of file diff --git a/Samples/Platform SDK/EventToActionSample/Program.cs b/Samples/Platform SDK/EventToActionSample/Program.cs index 849c618..d699925 100644 --- a/Samples/Platform SDK/EventToActionSample/Program.cs +++ b/Samples/Platform SDK/EventToActionSample/Program.cs @@ -1,67 +1,66 @@ // Copyright (C) 2023 by Genetec, Inc. All rights reserved. // May be used only in accordance with a valid Source Code License Agreement. -namespace Genetec.Dap.CodeSamples +namespace Genetec.Dap.CodeSamples; + +using System; +using System.Threading.Tasks; +using Sdk; +using Sdk.Entities; +using Sdk.Entities.Collections; +using Sdk.Entities.CustomEvents; + +class Program { - using System; - using System.Threading.Tasks; - using Sdk; - using Sdk.Entities; - using Sdk.Entities.Collections; - using Sdk.Entities.CustomEvents; + static Program() => SdkResolver.Initialize(); - class Program + static async Task Main() { - static Program() => SdkResolver.Initialize(); + const string server = "localhost"; + const string username = "admin"; + const string password = ""; + + var engine = new Engine(); - static async Task Main() + ConnectionStateCode state = await engine.LogOnAsync(server, username, password); + + if (state == ConnectionStateCode.Success) + { + PrintEventToActions(engine); + } + else { - const string server = "localhost"; - const string username = "admin"; - const string password = ""; + Console.WriteLine($"Logon failed: {state}"); + } - var engine = new Engine(); + Console.WriteLine("Press any key to exit..."); + Console.ReadKey(); + } - ConnectionStateCode state = await engine.LogOnAsync(server, username, password); + private static void PrintEventToActions(Engine engine) + { + var configuration = (SystemConfiguration)engine.GetEntity(SystemConfiguration.SystemConfigurationGuid); - if (state == ConnectionStateCode.Success) + foreach (EventToAction eventToAction in configuration.EventToActions) + { + Console.WriteLine($"Id: {eventToAction.Id}"); + + if (eventToAction.EventType == EventType.CustomEvent && eventToAction.CustomEventId.HasValue) { - PrintEventToActions(engine); + CustomEvent customEvent = configuration.CustomEventService.GetCustomEvent(eventToAction.CustomEventId.Value); + Console.WriteLine($"Event: {customEvent.Name} ({customEvent.SourceEntityType})"); } else { - Console.WriteLine($"Logon failed: {state}"); + Console.WriteLine($"Event: {eventToAction.EventType}"); } - Console.WriteLine("Press any key to exit..."); - Console.ReadKey(); - } - - private static void PrintEventToActions(Engine engine) - { - var configuration = (SystemConfiguration)engine.GetEntity(SystemConfiguration.SystemConfigurationGuid); - - foreach (EventToAction eventToAction in configuration.EventToActions) + if (!string.IsNullOrEmpty(eventToAction.CustomCondition)) { - Console.WriteLine($"Id: {eventToAction.Id}"); - - if (eventToAction.EventType == EventType.CustomEvent && eventToAction.CustomEventId.HasValue) - { - CustomEvent customEvent = configuration.CustomEventService.GetCustomEvent(eventToAction.CustomEventId.Value); - Console.WriteLine($"Event: {customEvent.Name} ({customEvent.SourceEntityType})"); - } - else - { - Console.WriteLine($"Event: {eventToAction.EventType}"); - } - - if (!string.IsNullOrEmpty(eventToAction.CustomCondition)) - { - Console.WriteLine($"Custom Condition: {eventToAction.CustomCondition}"); - } - - Console.WriteLine($"Action: {eventToAction.Action.Type}"); + Console.WriteLine($"Custom Condition: {eventToAction.CustomCondition}"); } + + Console.WriteLine($"Action: {eventToAction.Action.Type}"); } } } \ No newline at end of file diff --git a/Samples/Platform SDK/IncidentManagerSample/IncidentData.cs b/Samples/Platform SDK/IncidentManagerSample/IncidentData.cs index ced8a8b..3edd620 100644 --- a/Samples/Platform SDK/IncidentManagerSample/IncidentData.cs +++ b/Samples/Platform SDK/IncidentManagerSample/IncidentData.cs @@ -3,28 +3,27 @@ // You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 // Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -namespace Genetec.Dap.CodeSamples -{ - using System; - using System.Collections.ObjectModel; - using Sdk; +namespace Genetec.Dap.CodeSamples; + +using System; +using System.Collections.ObjectModel; +using Sdk; - public class IncidentData - { - public Guid InstanceGuid { get; set; } - public double Latitude { get; set; } - public double Longitude { get; set; } - public string Title { get; set; } - public string Notes { get; set; } - public int AlarmInstance { get; set; } - public string Category { get; set; } - public Guid CreatedBy { get; set; } - public DateTime CreationTime { get; set; } - public string Data { get; set; } - public string AttachedData { get; set; } - public DateTime Timestamp { get; set; } - public EventType Event { get; set; } - public Guid LastModifiedBy { get; set; } - public Collection References { get; set; } - } +public class IncidentData +{ + public Guid InstanceGuid { get; set; } + public double Latitude { get; set; } + public double Longitude { get; set; } + public string Title { get; set; } + public string Notes { get; set; } + public int AlarmInstance { get; set; } + public string Category { get; set; } + public Guid CreatedBy { get; set; } + public DateTime CreationTime { get; set; } + public string Data { get; set; } + public string AttachedData { get; set; } + public DateTime Timestamp { get; set; } + public EventType Event { get; set; } + public Guid LastModifiedBy { get; set; } + public Collection References { get; set; } } \ No newline at end of file diff --git a/Samples/Platform SDK/IncidentManagerSample/Program.cs b/Samples/Platform SDK/IncidentManagerSample/Program.cs index cebe614..65dad6a 100644 --- a/Samples/Platform SDK/IncidentManagerSample/Program.cs +++ b/Samples/Platform SDK/IncidentManagerSample/Program.cs @@ -1,140 +1,139 @@ // Copyright (C) 2023 by Genetec, Inc. All rights reserved. // May be used only in accordance with a valid Source Code License Agreement. -namespace Genetec.Dap.CodeSamples +namespace Genetec.Dap.CodeSamples; + +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Data; +using System.Linq; +using System.Threading.Tasks; +using Genetec.Sdk.Queries; +using Genetec.Sdk.Workflows; +using Genetec.Sdk; + +class Program { - using System; - using System.Collections.Generic; - using System.Collections.ObjectModel; - using System.Data; - using System.Linq; - using System.Threading.Tasks; - using Genetec.Sdk.Queries; - using Genetec.Sdk.Workflows; - using Genetec.Sdk; - - class Program + static Program() => SdkResolver.Initialize(); + + static async Task Main() { - static Program() => SdkResolver.Initialize(); + const string server = "localhost"; + const string username = "admin"; + const string password = ""; + + using var engine = new Engine(); + + ConnectionStateCode state = await engine.LogOnAsync(server, username, password); - static async Task Main() + if (state == ConnectionStateCode.Success) { - const string server = "localhost"; - const string username = "admin"; - const string password = ""; + Console.WriteLine("\nExisting Incidents:"); - using var engine = new Engine(); + var query = (IncidentSdkQuery)engine.ReportManager.CreateReportQuery(ReportType.Incident); + QueryCompletedEventArgs args = await Task.Factory.FromAsync(query.BeginQuery, query.EndQuery, null); - ConnectionStateCode state = await engine.LogOnAsync(server, username, password); + IEnumerable incidentData = args.Data.AsEnumerable().Select(CreateIncidentData); - if (state == ConnectionStateCode.Success) + foreach (var data in incidentData) { - Console.WriteLine("\nExisting Incidents:"); - - var query = (IncidentSdkQuery)engine.ReportManager.CreateReportQuery(ReportType.Incident); - QueryCompletedEventArgs args = await Task.Factory.FromAsync(query.BeginQuery, query.EndQuery, null); - - IEnumerable incidentData = args.Data.AsEnumerable().Select(CreateIncidentData); - - foreach (var data in incidentData) - { - PrintIncidentDetails(data); - } - - IncidentManager incidentManager = engine.IncidentManager; - - const string newCategory = "NewIncidentCategory"; - Console.WriteLine($"Creating new incident category: {newCategory}"); - bool categoryCreated = incidentManager.AddIncidentCategory(newCategory); - Console.WriteLine($"{(categoryCreated ? "✓" : "✗")} Incident category '{newCategory}' created"); - - Console.WriteLine("\nListing all incident categories:"); - foreach (string category in incidentManager.GetIncidentCategories()) - { - Console.WriteLine($"- {category}"); - } - - Console.WriteLine("\nCreating a new incident..."); - Incident newIncident = incidentManager.CreateIncident(); - - newIncident.Title = "Sample Incident"; - newIncident.Category = newCategory; - newIncident.AlarmInstance = 1234; - newIncident.Timestamp = DateTime.Now; - newIncident.Location = new GeoCoordinate(45.4215, -75.6972); // Example coordinates - newIncident.Notes = "This is a sample incident note."; - - Console.WriteLine("Saving the new incident..."); - incidentManager.SaveIncident(newIncident); - Console.WriteLine("Incident saved successfully"); - - Incident retrievedIncident = incidentManager.GetIncident(newIncident.Guid); - - Console.WriteLine("\nIncident Details:"); - Console.WriteLine($"Title: {retrievedIncident.Title}"); - Console.WriteLine($"Category: {retrievedIncident.Category}"); - Console.WriteLine($"Created By: {retrievedIncident.CreatedBy}"); - Console.WriteLine($"Creation Time: {retrievedIncident.CreationTime}"); - Console.WriteLine($"Location: {retrievedIncident.Location?.Latitude}, {retrievedIncident.Location?.Longitude}"); - Console.WriteLine($"Notes: {retrievedIncident.Notes}"); - - Console.WriteLine("\nDeleting the incident..."); - bool deleteSuccess = incidentManager.DeleteIncident(newIncident.Guid); - Console.WriteLine($"{(deleteSuccess ? "✓" : "✗")} Incident deleted"); - - Console.WriteLine($"\nDeleting incident category '{newCategory}'..."); - bool categoryDeleted = incidentManager.RemoveIncidentCategory(newCategory); - Console.WriteLine($"{(categoryDeleted ? "✓" : "✗")} Incident category '{newCategory}' deleted"); + PrintIncidentDetails(data); } - else + + IncidentManager incidentManager = engine.IncidentManager; + + const string newCategory = "NewIncidentCategory"; + Console.WriteLine($"Creating new incident category: {newCategory}"); + bool categoryCreated = incidentManager.AddIncidentCategory(newCategory); + Console.WriteLine($"{(categoryCreated ? "✓" : "✗")} Incident category '{newCategory}' created"); + + Console.WriteLine("\nListing all incident categories:"); + foreach (string category in incidentManager.GetIncidentCategories()) { - Console.WriteLine($"Logon failed: {state}"); + Console.WriteLine($"- {category}"); } - Console.WriteLine("\nPress any key to exit..."); - Console.ReadKey(); + Console.WriteLine("\nCreating a new incident..."); + Incident newIncident = incidentManager.CreateIncident(); - IncidentData CreateIncidentData(DataRow row) => new IncidentData - { - InstanceGuid = row.Field(IncidentSdkQuery.InstanceGuidColumnName), - Latitude = row.Field(IncidentSdkQuery.LatitudeColumnName), - Longitude = row.Field(IncidentSdkQuery.LongitudeColumnName), - Title = row.Field(IncidentSdkQuery.TitleColumnName), - Notes = row.Field(IncidentSdkQuery.NoteColumnName), - AlarmInstance = row.Field(IncidentSdkQuery.AlarmInstanceColumnName), - Category = row.Field(IncidentSdkQuery.CategoryColumnName), - CreatedBy = row.Field(IncidentSdkQuery.CreatedByColumnName), - CreationTime = row.Field(IncidentSdkQuery.CreationTimestampColumnName), - Data = row.Field(IncidentSdkQuery.DataColumnName), - AttachedData = row.Field(IncidentSdkQuery.AttachedDataColumnName), - Timestamp = row.Field(IncidentSdkQuery.IncidentTimestamp), - Event = row.Field(IncidentSdkQuery.EventTypeColumnName), - LastModifiedBy = row.Field(IncidentSdkQuery.ModifiedByColumnName), - References = string.IsNullOrEmpty(row.Field(IncidentSdkQuery.GuidReferenceColumnName)) ? new Collection() : new Collection(row.Field(IncidentSdkQuery.GuidReferenceColumnName).Split(',').Select(Guid.Parse).ToList()) - }; + newIncident.Title = "Sample Incident"; + newIncident.Category = newCategory; + newIncident.AlarmInstance = 1234; + newIncident.Timestamp = DateTime.Now; + newIncident.Location = new GeoCoordinate(45.4215, -75.6972); // Example coordinates + newIncident.Notes = "This is a sample incident note."; + + Console.WriteLine("Saving the new incident..."); + incidentManager.SaveIncident(newIncident); + Console.WriteLine("Incident saved successfully"); + + Incident retrievedIncident = incidentManager.GetIncident(newIncident.Guid); + + Console.WriteLine("\nIncident Details:"); + Console.WriteLine($"Title: {retrievedIncident.Title}"); + Console.WriteLine($"Category: {retrievedIncident.Category}"); + Console.WriteLine($"Created By: {retrievedIncident.CreatedBy}"); + Console.WriteLine($"Creation Time: {retrievedIncident.CreationTime}"); + Console.WriteLine($"Location: {retrievedIncident.Location?.Latitude}, {retrievedIncident.Location?.Longitude}"); + Console.WriteLine($"Notes: {retrievedIncident.Notes}"); + + Console.WriteLine("\nDeleting the incident..."); + bool deleteSuccess = incidentManager.DeleteIncident(newIncident.Guid); + Console.WriteLine($"{(deleteSuccess ? "✓" : "✗")} Incident deleted"); + + Console.WriteLine($"\nDeleting incident category '{newCategory}'..."); + bool categoryDeleted = incidentManager.RemoveIncidentCategory(newCategory); + Console.WriteLine($"{(categoryDeleted ? "✓" : "✗")} Incident category '{newCategory}' deleted"); } + else + { + Console.WriteLine($"Logon failed: {state}"); + } + + Console.WriteLine("\nPress any key to exit..."); + Console.ReadKey(); - static void PrintIncidentDetails(IncidentData data) + IncidentData CreateIncidentData(DataRow row) => new IncidentData { - Console.WriteLine("\nIncident Details:"); - Console.WriteLine($"Title: {data.Title}"); - Console.WriteLine($"Category: {data.Category}"); - Console.WriteLine($"Created By: {data.CreatedBy}"); - Console.WriteLine($"Creation Time: {data.CreationTime}"); - Console.WriteLine($"Location: {data.Latitude}, {data.Longitude}"); - Console.WriteLine($"Notes: {data.Notes}"); - Console.WriteLine($"Alarm Instance: {data.AlarmInstance}"); - Console.WriteLine($"Event: {data.Event}"); - Console.WriteLine($"Last Modified By: {data.LastModifiedBy}"); - Console.WriteLine($"Timestamp: {data.Timestamp}"); - Console.WriteLine($"Data: {data.Data}"); - Console.WriteLine($"Attached Data: {data.AttachedData}"); - Console.WriteLine("References:"); - - foreach (var reference in data.References) - { - Console.WriteLine($"- {reference}"); - } + InstanceGuid = row.Field(IncidentSdkQuery.InstanceGuidColumnName), + Latitude = row.Field(IncidentSdkQuery.LatitudeColumnName), + Longitude = row.Field(IncidentSdkQuery.LongitudeColumnName), + Title = row.Field(IncidentSdkQuery.TitleColumnName), + Notes = row.Field(IncidentSdkQuery.NoteColumnName), + AlarmInstance = row.Field(IncidentSdkQuery.AlarmInstanceColumnName), + Category = row.Field(IncidentSdkQuery.CategoryColumnName), + CreatedBy = row.Field(IncidentSdkQuery.CreatedByColumnName), + CreationTime = row.Field(IncidentSdkQuery.CreationTimestampColumnName), + Data = row.Field(IncidentSdkQuery.DataColumnName), + AttachedData = row.Field(IncidentSdkQuery.AttachedDataColumnName), + Timestamp = row.Field(IncidentSdkQuery.IncidentTimestamp), + Event = row.Field(IncidentSdkQuery.EventTypeColumnName), + LastModifiedBy = row.Field(IncidentSdkQuery.ModifiedByColumnName), + References = string.IsNullOrEmpty(row.Field(IncidentSdkQuery.GuidReferenceColumnName)) ? new Collection() : new Collection(row.Field(IncidentSdkQuery.GuidReferenceColumnName).Split(',').Select(Guid.Parse).ToList()) + }; + } + + static void PrintIncidentDetails(IncidentData data) + { + Console.WriteLine("\nIncident Details:"); + Console.WriteLine($"Title: {data.Title}"); + Console.WriteLine($"Category: {data.Category}"); + Console.WriteLine($"Created By: {data.CreatedBy}"); + Console.WriteLine($"Creation Time: {data.CreationTime}"); + Console.WriteLine($"Location: {data.Latitude}, {data.Longitude}"); + Console.WriteLine($"Notes: {data.Notes}"); + Console.WriteLine($"Alarm Instance: {data.AlarmInstance}"); + Console.WriteLine($"Event: {data.Event}"); + Console.WriteLine($"Last Modified By: {data.LastModifiedBy}"); + Console.WriteLine($"Timestamp: {data.Timestamp}"); + Console.WriteLine($"Data: {data.Data}"); + Console.WriteLine($"Attached Data: {data.AttachedData}"); + Console.WriteLine("References:"); + + foreach (var reference in data.References) + { + Console.WriteLine($"- {reference}"); } } } \ No newline at end of file diff --git a/Samples/Platform SDK/LicenseManagerSample/Program.cs b/Samples/Platform SDK/LicenseManagerSample/Program.cs index 293db6a..a8e45b6 100644 --- a/Samples/Platform SDK/LicenseManagerSample/Program.cs +++ b/Samples/Platform SDK/LicenseManagerSample/Program.cs @@ -3,49 +3,48 @@ // You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 // Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -namespace Genetec.Dap.CodeSamples +namespace Genetec.Dap.CodeSamples; + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Sdk; +using Sdk.Workflows; + +class Program { - using System; - using System.Collections.Generic; - using System.Threading.Tasks; - using Sdk; - using Sdk.Workflows; + static Program() => SdkResolver.Initialize(); - class Program + static async Task Main() { - static Program() => SdkResolver.Initialize(); + const string server = "localhost"; + const string username = "admin"; + const string password = ""; - static async Task Main() - { - const string server = "localhost"; - const string username = "admin"; - const string password = ""; + using var engine = new Engine(); - using var engine = new Engine(); + ConnectionStateCode state = await engine.LoginManager.LogOnAsync(server, username, password); - ConnectionStateCode state = await engine.LoginManager.LogOnAsync(server, username, password); + if (state == ConnectionStateCode.Success) + { + await DisplayLicenseUsageAsync(); + } + else + { + Console.WriteLine($"logon failed: {state}"); + } - if (state == ConnectionStateCode.Success) - { - await DisplayLicenseUsageAsync(); - } - else - { - Console.WriteLine($"logon failed: {state}"); - } + Console.WriteLine("Press any key to exit..."); + Console.ReadKey(); - Console.WriteLine("Press any key to exit..."); - Console.ReadKey(); + async Task DisplayLicenseUsageAsync() + { + Console.WriteLine("License Usage Information:"); - async Task DisplayLicenseUsageAsync() + Dictionary usages = await engine.LicenseManager.GetEveryLicenseItemUsageAsync(); + foreach (var usage in usages) { - Console.WriteLine("License Usage Information:"); - - Dictionary usages = await engine.LicenseManager.GetEveryLicenseItemUsageAsync(); - foreach (var usage in usages) - { - Console.WriteLine($"{usage.Key,-40} {usage.Value.CurrentCount} / {usage.Value.MaximumCount}"); - } + Console.WriteLine($"{usage.Key,-40} {usage.Value.CurrentCount} / {usage.Value.MaximumCount}"); } } } diff --git a/Samples/Platform SDK/LoggerSample/InstanceLogger.cs b/Samples/Platform SDK/LoggerSample/InstanceLogger.cs index 56c7413..4a0c5cf 100644 --- a/Samples/Platform SDK/LoggerSample/InstanceLogger.cs +++ b/Samples/Platform SDK/LoggerSample/InstanceLogger.cs @@ -5,28 +5,27 @@ // Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -namespace Genetec.Dap.CodeSamples +namespace Genetec.Dap.CodeSamples; + +using System; +using Sdk.Diagnostics.Logging.Core; + +class InstanceLogger : IDisposable { - using System; - using Sdk.Diagnostics.Logging.Core; + private readonly Logger m_logger; - class InstanceLogger : IDisposable + public InstanceLogger() { - private readonly Logger m_logger; - - public InstanceLogger() - { - m_logger = Logger.CreateInstanceLogger(this); - } + m_logger = Logger.CreateInstanceLogger(this); + } - public void Dispose() - { - m_logger.Dispose(); - } + public void Dispose() + { + m_logger.Dispose(); + } - public void LogDebugMessage() - { - m_logger.TraceDebug("This is a debug message"); - } + public void LogDebugMessage() + { + m_logger.TraceDebug("This is a debug message"); } } \ No newline at end of file diff --git a/Samples/Platform SDK/LoggerSample/Program.cs b/Samples/Platform SDK/LoggerSample/Program.cs index d4db874..6731afe 100644 --- a/Samples/Platform SDK/LoggerSample/Program.cs +++ b/Samples/Platform SDK/LoggerSample/Program.cs @@ -5,48 +5,47 @@ // Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -namespace Genetec.Dap.CodeSamples +namespace Genetec.Dap.CodeSamples; + +using System; +using System.Threading; +using System.Threading.Tasks; + +class Program { - using System; - using System.Threading; - using System.Threading.Tasks; + static Program() => SdkResolver.Initialize(); - class Program + static async Task Main() { - static Program() => SdkResolver.Initialize(); + using var cancellationTokenSource = new CancellationTokenSource(); + + // Handle Ctrl+C to cancel the loop + Console.CancelKeyPress += (sender, eventArgs) => + { + eventArgs.Cancel = true; + cancellationTokenSource.Cancel(); + }; - static async Task Main() + try { - using var cancellationTokenSource = new CancellationTokenSource(); - - // Handle Ctrl+C to cancel the loop - Console.CancelKeyPress += (sender, eventArgs) => - { - eventArgs.Cancel = true; - cancellationTokenSource.Cancel(); - }; - - try - { - await LogDebugMessage(cancellationTokenSource.Token); - } - catch (OperationCanceledException) - { - // Ignore task canceled - } + await LogDebugMessage(cancellationTokenSource.Token); } - - static async Task LogDebugMessage(CancellationToken token) + catch (OperationCanceledException) { - using var logger = new InstanceLogger(); + // Ignore task canceled + } + } - while (!token.IsCancellationRequested) - { - logger.LogDebugMessage(); - StaticLogger.LogDebugMessage(); + static async Task LogDebugMessage(CancellationToken token) + { + using var logger = new InstanceLogger(); + + while (!token.IsCancellationRequested) + { + logger.LogDebugMessage(); + StaticLogger.LogDebugMessage(); - await Task.Delay(1000, token); - } + await Task.Delay(1000, token); } } } \ No newline at end of file diff --git a/Samples/Platform SDK/LoggerSample/StaticLogger.cs b/Samples/Platform SDK/LoggerSample/StaticLogger.cs index 0b80ec7..9be1a69 100644 --- a/Samples/Platform SDK/LoggerSample/StaticLogger.cs +++ b/Samples/Platform SDK/LoggerSample/StaticLogger.cs @@ -5,17 +5,16 @@ // Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -namespace Genetec.Dap.CodeSamples +namespace Genetec.Dap.CodeSamples; + +using Sdk.Diagnostics.Logging.Core; + +static class StaticLogger { - using Sdk.Diagnostics.Logging.Core; + private static readonly Logger s_logger = Logger.CreateClassLogger(typeof(StaticLogger)); - static class StaticLogger + public static void LogDebugMessage() { - private static readonly Logger s_logger = Logger.CreateClassLogger(typeof(StaticLogger)); - - public static void LogDebugMessage() - { - s_logger.TraceDebug("This is a debug message"); - } + s_logger.TraceDebug("This is a debug message"); } } \ No newline at end of file diff --git a/Samples/Platform SDK/LoginManagerSample/Program.cs b/Samples/Platform SDK/LoginManagerSample/Program.cs index f840d8c..d68c0db 100644 --- a/Samples/Platform SDK/LoginManagerSample/Program.cs +++ b/Samples/Platform SDK/LoginManagerSample/Program.cs @@ -1,40 +1,39 @@ // Copyright (C) 2023 by Genetec, Inc. All rights reserved. // May be used only in accordance with a valid Source Code License Agreement. -namespace Genetec.Dap.CodeSamples -{ - using System; - using System.Threading.Tasks; - using Sdk; +namespace Genetec.Dap.CodeSamples; - class Program - { - static Program() => SdkResolver.Initialize(); +using System; +using System.Threading.Tasks; +using Sdk; - static async Task Main() - { - const string server = "localhost"; - const string username = "admin"; - const string password = ""; +class Program +{ + static Program() => SdkResolver.Initialize(); - using var engine = new Engine(); + static async Task Main() + { + const string server = "localhost"; + const string username = "admin"; + const string password = ""; - engine.LoginManager.ConnectionRetry = -1; + using var engine = new Engine(); - engine.LoginManager.LogonStatusChanged += (sender, args) => Console.WriteLine($"Status changed: {args.Status}"); - engine.LoginManager.LoggedOn += (sender, e) => Console.WriteLine($"Logged on to {e.ServerName} using {e.UserName}"); - engine.LoginManager.LoggingOff += (sender, e) => Console.WriteLine("Logging off"); - engine.LoginManager.LoggedOff += (sender, e) => Console.WriteLine($"Logged off. AutoReconnect={e.AutoReconnect}"); - engine.LoginManager.LogonFailed += (sender, e) => Console.WriteLine($"Logon failed: {e.FormattedErrorMessage}"); + engine.LoginManager.ConnectionRetry = -1; - ConnectionStateCode state = await engine.LoginManager.LogOnAsync(server, username, password); - if (state != ConnectionStateCode.Success) - { - Console.WriteLine($"logon failed: {state}"); - } + engine.LoginManager.LogonStatusChanged += (sender, args) => Console.WriteLine($"Status changed: {args.Status}"); + engine.LoginManager.LoggedOn += (sender, e) => Console.WriteLine($"Logged on to {e.ServerName} using {e.UserName}"); + engine.LoginManager.LoggingOff += (sender, e) => Console.WriteLine("Logging off"); + engine.LoginManager.LoggedOff += (sender, e) => Console.WriteLine($"Logged off. AutoReconnect={e.AutoReconnect}"); + engine.LoginManager.LogonFailed += (sender, e) => Console.WriteLine($"Logon failed: {e.FormattedErrorMessage}"); - Console.WriteLine("Press any key to exit..."); - Console.ReadKey(); + ConnectionStateCode state = await engine.LoginManager.LogOnAsync(server, username, password); + if (state != ConnectionStateCode.Success) + { + Console.WriteLine($"logon failed: {state}"); } + + Console.WriteLine("Press any key to exit..."); + Console.ReadKey(); } } \ No newline at end of file diff --git a/Samples/Platform SDK/RaiseEventSample/Program.cs b/Samples/Platform SDK/RaiseEventSample/Program.cs index 9a5f42d..60935d4 100644 --- a/Samples/Platform SDK/RaiseEventSample/Program.cs +++ b/Samples/Platform SDK/RaiseEventSample/Program.cs @@ -5,70 +5,69 @@ // Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -namespace Genetec.Dap.CodeSamples -{ - using System; - using System.Linq; - using System.Threading.Tasks; - using Sdk; - using Sdk.Entities; - using Sdk.Events.AccessPoint; - using Sdk.Workflows; +namespace Genetec.Dap.CodeSamples; - class Program - { - static Program() => SdkResolver.Initialize(); +using System; +using System.Linq; +using System.Threading.Tasks; +using Sdk; +using Sdk.Entities; +using Sdk.Events.AccessPoint; +using Sdk.Workflows; - static async Task Main() - { - const string server = "localhost"; - const string username = "admin"; - const string password = ""; +class Program +{ + static Program() => SdkResolver.Initialize(); - using var engine = new Engine(); + static async Task Main() + { + const string server = "localhost"; + const string username = "admin"; + const string password = ""; - ConnectionStateCode state = await engine.LogOnAsync(server, username, password); + using var engine = new Engine(); - if (state == ConnectionStateCode.Success) - { - // Retrieve the credential and reader entities using their GUIDs - var credential = (Credential)engine.GetEntity(new Guid("YOUR_CREDENTIAL_GUID")); - var reader = (Reader)engine.GetEntity(new Guid("YOUR_READER_GUID")); + ConnectionStateCode state = await engine.LogOnAsync(server, username, password); - RaiseAccessGranted(engine, credential, reader); - } - else - { - Console.WriteLine($"Logon failed: {state}"); - } + if (state == ConnectionStateCode.Success) + { + // Retrieve the credential and reader entities using their GUIDs + var credential = (Credential)engine.GetEntity(new Guid("YOUR_CREDENTIAL_GUID")); + var reader = (Reader)engine.GetEntity(new Guid("YOUR_READER_GUID")); - Console.WriteLine("Press any key to exit..."); - Console.ReadKey(); + RaiseAccessGranted(engine, credential, reader); } - - static void RaiseAccessGranted(Engine engine, Credential credential, Reader reader) + else { - using EventTransaction transaction = engine.TransactionManager.CreateEventTransaction(); + Console.WriteLine($"Logon failed: {state}"); + } - // Find the access point - AccessPoint accessPoint = reader.AccessPoint.Select(engine.GetEntity).OfType().FirstOrDefault(point => point.AccessPointType == AccessPointType.CardReader); + Console.WriteLine("Press any key to exit..."); + Console.ReadKey(); + } + + static void RaiseAccessGranted(Engine engine, Credential credential, Reader reader) + { + using EventTransaction transaction = engine.TransactionManager.CreateEventTransaction(); - if (accessPoint != null) - { - var accessEvent = (AccessEvent)engine.ActionManager.BuildEvent(EventType.AccessGranted, accessPoint.Guid); - accessEvent.Cardholder = credential.CardholderGuid; - accessEvent.Credentials.Add(credential.Guid); - accessEvent.DoorSideGuid = accessPoint.Guid; + // Find the access point + AccessPoint accessPoint = reader.AccessPoint.Select(engine.GetEntity).OfType().FirstOrDefault(point => point.AccessPointType == AccessPointType.CardReader); - // Add the event to the transaction - transaction.AddEvent(accessEvent); + if (accessPoint != null) + { + var accessEvent = (AccessEvent)engine.ActionManager.BuildEvent(EventType.AccessGranted, accessPoint.Guid); + accessEvent.Cardholder = credential.CardholderGuid; + accessEvent.Credentials.Add(credential.Guid); + accessEvent.DoorSideGuid = accessPoint.Guid; - Console.WriteLine("Access granted event raised successfully."); - } - else - { - Console.WriteLine("No card reader access point found."); - } + // Add the event to the transaction + transaction.AddEvent(accessEvent); + + Console.WriteLine("Access granted event raised successfully."); + } + else + { + Console.WriteLine("No card reader access point found."); } } } \ No newline at end of file diff --git a/Samples/Platform SDK/SecurityManagerSample/Program.cs b/Samples/Platform SDK/SecurityManagerSample/Program.cs index 6789ecd..c6679e5 100644 --- a/Samples/Platform SDK/SecurityManagerSample/Program.cs +++ b/Samples/Platform SDK/SecurityManagerSample/Program.cs @@ -1,84 +1,83 @@ // Copyright (C) 2023 by Genetec, Inc. All rights reserved. // May be used only in accordance with a valid Source Code License Agreement. -namespace Genetec.Dap.CodeSamples +namespace Genetec.Dap.CodeSamples; + +using System; +using System.Linq; +using System.Threading.Tasks; +using Genetec.Sdk; +using Sdk.Entities; +using Sdk.Queries; + +internal class Program { - using System; - using System.Linq; - using System.Threading.Tasks; - using Genetec.Sdk; - using Sdk.Entities; - using Sdk.Queries; - - internal class Program + static Program() => SdkResolver.Initialize(); + + static async Task Main() { - static Program() => SdkResolver.Initialize(); + const string server = "localhost"; + const string username = "admin"; + const string password = ""; - static async Task Main() - { - const string server = "localhost"; - const string username = "admin"; - const string password = ""; + using var engine = new Engine(); - using var engine = new Engine(); + ConnectionStateCode state = await engine.LogOnAsync(server, username, password); - ConnectionStateCode state = await engine.LogOnAsync(server, username, password); + if (state == ConnectionStateCode.Success) + { + PrintPrivileges(engine); + await PrintUsersPrivileges(engine); + } + else + { + Console.WriteLine($"Logon failed: {state}"); + } - if (state == ConnectionStateCode.Success) - { - PrintPrivileges(engine); - await PrintUsersPrivileges(engine); - } - else - { - Console.WriteLine($"Logon failed: {state}"); - } + Console.WriteLine("Press any key to exit..."); + Console.ReadKey(); + } - Console.WriteLine("Press any key to exit..."); - Console.ReadKey(); - } + static async Task PrintUsersPrivileges(Engine engine) + { + var query = (EntityConfigurationQuery)engine.ReportManager.CreateReportQuery(ReportType.EntityConfiguration); + query.EntityTypeFilter.Add(EntityType.User); + await Task.Factory.FromAsync(query.BeginQuery, query.EndQuery, null); - static async Task PrintUsersPrivileges(Engine engine) - { - var query = (EntityConfigurationQuery)engine.ReportManager.CreateReportQuery(ReportType.EntityConfiguration); - query.EntityTypeFilter.Add(EntityType.User); - await Task.Factory.FromAsync(query.BeginQuery, query.EndQuery, null); + var definitions = engine.SecurityManager.GetPrivilegeDefinitions().ToDictionary(information => information.Id); - var definitions = engine.SecurityManager.GetPrivilegeDefinitions().ToDictionary(information => information.Id); + foreach (User user in engine.GetEntities(EntityType.User).OfType()) + { + Console.WriteLine($"User: {user.Name}"); - foreach (User user in engine.GetEntities(EntityType.User).OfType()) + foreach (var privilegeInformation in user.Privileges.Where(e => e.State == PrivilegeAccess.Granted)) { - Console.WriteLine($"User: {user.Name}"); - - foreach (var privilegeInformation in user.Privileges.Where(e => e.State == PrivilegeAccess.Granted)) + if (definitions.TryGetValue(privilegeInformation.PrivilegeGuid, out var definition) && definition.Type != PrivilegeType.Group) { - if (definitions.TryGetValue(privilegeInformation.PrivilegeGuid, out var definition) && definition.Type != PrivilegeType.Group) - { - Console.WriteLine($"{definition.Description}"); - } + Console.WriteLine($"{definition.Description}"); } } } + } - static void PrintPrivileges(Engine engine) + static void PrintPrivileges(Engine engine) + { + var definitions = engine.SecurityManager.GetPrivilegeDefinitions().ToDictionary(information => information.Id); + + foreach (var privilege in definitions.Values.Where(p => p.ParentId == Guid.Empty)) { - var definitions = engine.SecurityManager.GetPrivilegeDefinitions().ToDictionary(information => information.Id); + PrintPrivilege(privilege, 0); + } - foreach (var privilege in definitions.Values.Where(p => p.ParentId == Guid.Empty)) - { - PrintPrivilege(privilege, 0); - } + void PrintPrivilege(PrivilegeDefinitionInformation privilege, int depth) + { + Console.WriteLine($"{new string(' ', depth * 2)}({privilege.Type}) {privilege.Description}"); - void PrintPrivilege(PrivilegeDefinitionInformation privilege, int depth) + foreach (var child in privilege.Children) { - Console.WriteLine($"{new string(' ', depth * 2)}({privilege.Type}) {privilege.Description}"); - - foreach (var child in privilege.Children) + if (definitions.TryGetValue(child, out var value)) { - if (definitions.TryGetValue(child, out var value)) - { - PrintPrivilege(value, depth + 1); - } + PrintPrivilege(value, depth + 1); } } } diff --git a/Samples/Platform SDK/TransactionManagerSample/Program.cs b/Samples/Platform SDK/TransactionManagerSample/Program.cs index b788a92..966ad6c 100644 --- a/Samples/Platform SDK/TransactionManagerSample/Program.cs +++ b/Samples/Platform SDK/TransactionManagerSample/Program.cs @@ -1,103 +1,102 @@ // Copyright (C) 2023 by Genetec, Inc. All rights reserved. // May be used only in accordance with a valid Source Code License Agreement. -namespace Genetec.Dap.CodeSamples +namespace Genetec.Dap.CodeSamples; + +using System; +using System.Threading.Tasks; +using Sdk; +using Sdk.Entities; + +class Program { - using System; - using System.Threading.Tasks; - using Sdk; - using Sdk.Entities; + static Program() => SdkResolver.Initialize(); - class Program + static async Task Main() { - static Program() => SdkResolver.Initialize(); - - static async Task Main() - { - const string server = "localhost"; - const string username = "admin"; - const string password = ""; + const string server = "localhost"; + const string username = "admin"; + const string password = ""; - using var engine = new Engine(); + using var engine = new Engine(); - ConnectionStateCode state = await engine.LogOnAsync(server, username, password); + ConnectionStateCode state = await engine.LogOnAsync(server, username, password); - if (state == ConnectionStateCode.Success) - { - // Define an action to create a cardholder - Action action = () => - { - Console.WriteLine("Creating a cardholder inside of a transaction..."); - - // Create a new cardholder entity - var cardholder = (Cardholder)engine.CreateEntity("John Doe", EntityType.Cardholder); - cardholder.FirstName = "John"; - cardholder.LastName = "Doe"; - cardholder.EmailAddress = "johndoe@example.com"; - - Console.WriteLine("Cardholder created successfully."); - }; - - // Execute the action within a transaction using two different methods - Console.WriteLine("Executing transaction using CreateTransaction:"); - CreateTransaction(engine, action); - - Console.WriteLine("Executing transaction using ExecuteTransactionAsync:"); - await ExecuteTransactionAsync(engine, action); - } - else + if (state == ConnectionStateCode.Success) + { + // Define an action to create a cardholder + Action action = () => { - Console.WriteLine($"Logon failed: {state}"); - } + Console.WriteLine("Creating a cardholder inside of a transaction..."); - Console.WriteLine("Press any key to exit..."); - Console.ReadKey(); - } + // Create a new cardholder entity + var cardholder = (Cardholder)engine.CreateEntity("John Doe", EntityType.Cardholder); + cardholder.FirstName = "John"; + cardholder.LastName = "Doe"; + cardholder.EmailAddress = "johndoe@example.com"; - static void CreateTransaction(Engine engine, Action action) - { - Console.WriteLine("Starting transaction..."); - Console.WriteLine($"IsTransactionActive (before): {engine.TransactionManager.IsTransactionActive}"); + Console.WriteLine("Cardholder created successfully."); + }; - // Begin a new transaction - engine.TransactionManager.CreateTransaction(); - try - { - // Perform the action within the transaction - action(); - - // Commit the transaction if successful - engine.TransactionManager.CommitTransaction(rollBackOnFailure: true); - Console.WriteLine("Transaction committed successfully."); - } - catch (Exception ex) - { - // Rollback the transaction in case of failure - Console.WriteLine($"Transaction failed: {ex.Message}"); - engine.TransactionManager.RollbackTransaction(); - Console.WriteLine("Transaction rolled back."); - } + // Execute the action within a transaction using two different methods + Console.WriteLine("Executing transaction using CreateTransaction:"); + CreateTransaction(engine, action); - Console.WriteLine($"IsTransactionActive (after): {engine.TransactionManager.IsTransactionActive}"); + Console.WriteLine("Executing transaction using ExecuteTransactionAsync:"); + await ExecuteTransactionAsync(engine, action); + } + else + { + Console.WriteLine($"Logon failed: {state}"); } - static async Task ExecuteTransactionAsync(Engine engine, Action action) + Console.WriteLine("Press any key to exit..."); + Console.ReadKey(); + } + + static void CreateTransaction(Engine engine, Action action) + { + Console.WriteLine("Starting transaction..."); + Console.WriteLine($"IsTransactionActive (before): {engine.TransactionManager.IsTransactionActive}"); + + // Begin a new transaction + engine.TransactionManager.CreateTransaction(); + try { - Console.WriteLine("Starting transaction..."); - Console.WriteLine($"IsTransactionActive (before): {engine.TransactionManager.IsTransactionActive}"); + // Perform the action within the transaction + action(); - try - { - // Perform the action within the transaction asynchronously - await engine.TransactionManager.ExecuteTransactionAsync(action); - Console.WriteLine("Transaction executed successfully."); - } - catch (SdkException ex) - { - Console.WriteLine($"Transaction failed: {ex.Message}"); - } + // Commit the transaction if successful + engine.TransactionManager.CommitTransaction(rollBackOnFailure: true); + Console.WriteLine("Transaction committed successfully."); + } + catch (Exception ex) + { + // Rollback the transaction in case of failure + Console.WriteLine($"Transaction failed: {ex.Message}"); + engine.TransactionManager.RollbackTransaction(); + Console.WriteLine("Transaction rolled back."); + } + + Console.WriteLine($"IsTransactionActive (after): {engine.TransactionManager.IsTransactionActive}"); + } + + static async Task ExecuteTransactionAsync(Engine engine, Action action) + { + Console.WriteLine("Starting transaction..."); + Console.WriteLine($"IsTransactionActive (before): {engine.TransactionManager.IsTransactionActive}"); - Console.WriteLine($"IsTransactionActive (after): {engine.TransactionManager.IsTransactionActive}"); + try + { + // Perform the action within the transaction asynchronously + await engine.TransactionManager.ExecuteTransactionAsync(action); + Console.WriteLine("Transaction executed successfully."); } + catch (SdkException ex) + { + Console.WriteLine($"Transaction failed: {ex.Message}"); + } + + Console.WriteLine($"IsTransactionActive (after): {engine.TransactionManager.IsTransactionActive}"); } } \ No newline at end of file diff --git a/Samples/Platform SDK/UnusedCredentialQuerySample/Program.cs b/Samples/Platform SDK/UnusedCredentialQuerySample/Program.cs index f7ec483..64fd253 100644 --- a/Samples/Platform SDK/UnusedCredentialQuerySample/Program.cs +++ b/Samples/Platform SDK/UnusedCredentialQuerySample/Program.cs @@ -1,86 +1,85 @@ // Copyright (C) 2023 by Genetec, Inc. All rights reserved. // May be used only in accordance with a valid Source Code License Agreement. -namespace Genetec.Dap.CodeSamples +namespace Genetec.Dap.CodeSamples; + +using System; +using System.Collections.Generic; +using System.Data; +using System.Linq; +using System.Threading.Tasks; +using Genetec.Sdk; +using Genetec.Sdk.Entities; +using Genetec.Sdk.Queries.AccessControl; +using Sdk.Queries; + +class Program { - using System; - using System.Collections.Generic; - using System.Data; - using System.Linq; - using System.Threading.Tasks; - using Genetec.Sdk; - using Genetec.Sdk.Entities; - using Genetec.Sdk.Queries.AccessControl; - using Sdk.Queries; - - class Program - { - static Program() => SdkResolver.Initialize(); + static Program() => SdkResolver.Initialize(); - static async Task Main() - { - const string serverAddress = "localhost"; - const string adminUsername = "admin"; - const string adminPassword = ""; + static async Task Main() + { + const string serverAddress = "localhost"; + const string adminUsername = "admin"; + const string adminPassword = ""; - using var engine = new Engine(); + using var engine = new Engine(); - ConnectionStateCode status = await engine.LogOnAsync(serverAddress, adminUsername, adminPassword); + ConnectionStateCode status = await engine.LogOnAsync(serverAddress, adminUsername, adminPassword); - if (status == ConnectionStateCode.Success) - { - var credentialsToDeactivate = await FetchUnusedCredentials(TimeSpan.FromDays(30)); + if (status == ConnectionStateCode.Success) + { + var credentialsToDeactivate = await FetchUnusedCredentials(TimeSpan.FromDays(30)); - Console.WriteLine($"{credentialsToDeactivate.Count} credentials have not been used in the last 30 days."); + Console.WriteLine($"{credentialsToDeactivate.Count} credentials have not been used in the last 30 days."); - await DeactivateCredentials(credentialsToDeactivate); - } - else - { - Console.WriteLine($"Logon failed: {status}"); - } + await DeactivateCredentials(credentialsToDeactivate); + } + else + { + Console.WriteLine($"Logon failed: {status}"); + } - Console.WriteLine("Press any key to exit..."); - Console.ReadKey(); + Console.WriteLine("Press any key to exit..."); + Console.ReadKey(); - async Task> FetchUnusedCredentials(TimeSpan unusedDuration) - { - var query = (UnusedCredentialQuery)engine.ReportManager.CreateReportQuery(ReportType.UnusedCredentials); - query.TimeRange.SetTimeRange(-unusedDuration); + async Task> FetchUnusedCredentials(TimeSpan unusedDuration) + { + var query = (UnusedCredentialQuery)engine.ReportManager.CreateReportQuery(ReportType.UnusedCredentials); + query.TimeRange.SetTimeRange(-unusedDuration); - QueryCompletedEventArgs queryResults = await Task.Factory.FromAsync(query.BeginQuery, query.EndQuery, null); + QueryCompletedEventArgs queryResults = await Task.Factory.FromAsync(query.BeginQuery, query.EndQuery, null); - List credentialGuids = queryResults.Data.AsEnumerable() - .Select(row => row.Field(UnusedEntityQuery.UnusedEntityGuidColumnName)) - .ToList(); + List credentialGuids = queryResults.Data.AsEnumerable() + .Select(row => row.Field(UnusedEntityQuery.UnusedEntityGuidColumnName)) + .ToList(); - await PrefetchEntities(credentialGuids); + await PrefetchEntities(credentialGuids); - return credentialGuids.Select(engine.GetEntity).OfType().ToList(); - } + return credentialGuids.Select(engine.GetEntity).OfType().ToList(); + } - async Task DeactivateCredentials(IEnumerable credentials) + async Task DeactivateCredentials(IEnumerable credentials) + { + await engine.TransactionManager.ExecuteTransactionAsync(() => { - await engine.TransactionManager.ExecuteTransactionAsync(() => + foreach (var credential in credentials.Where(credential => credential.Status.State == CredentialState.Active)) { - foreach (var credential in credentials.Where(credential => credential.Status.State == CredentialState.Active)) - { - Console.WriteLine($"Deactivating {credential.Name}"); - credential.Status.Deactivate(); - } - }); - } + Console.WriteLine($"Deactivating {credential.Name}"); + credential.Status.Deactivate(); + } + }); + } - async Task PrefetchEntities(IEnumerable entityGuids) + async Task PrefetchEntities(IEnumerable entityGuids) + { + foreach (var batch in entityGuids.Split(2000)) { - foreach (var batch in entityGuids.Split(2000)) - { - var query = (EntityConfigurationQuery)engine.ReportManager.CreateReportQuery(ReportType.EntityConfiguration); - query.EntityGuids.AddRange(batch); - query.DownloadAllRelatedData = true; + var query = (EntityConfigurationQuery)engine.ReportManager.CreateReportQuery(ReportType.EntityConfiguration); + query.EntityGuids.AddRange(batch); + query.DownloadAllRelatedData = true; - await Task.Factory.FromAsync(query.BeginQuery, query.EndQuery, null); - } + await Task.Factory.FromAsync(query.BeginQuery, query.EndQuery, null); } } } diff --git a/Samples/Platform SDK/UserTaskSample/Program.cs b/Samples/Platform SDK/UserTaskSample/Program.cs index f8689ad..6e938c8 100644 --- a/Samples/Platform SDK/UserTaskSample/Program.cs +++ b/Samples/Platform SDK/UserTaskSample/Program.cs @@ -1,81 +1,80 @@ // Copyright (C) 2023 by Genetec, Inc. All rights reserved. // May be used only in accordance with a valid Source Code License Agreement. -namespace Genetec.Dap.CodeSamples +namespace Genetec.Dap.CodeSamples; + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Genetec.Sdk.Entities; +using Sdk; +using Sdk.UserTaskManagement; + +class Program { - using System; - using System.Collections.Generic; - using System.Linq; - using System.Threading.Tasks; - using Genetec.Sdk.Entities; - using Sdk; - using Sdk.UserTaskManagement; + static Program() => SdkResolver.Initialize(); - class Program + static async Task Main() { - static Program() => SdkResolver.Initialize(); - - static async Task Main() - { - const string server = "localhost"; - const string username = "admin"; - const string password = ""; + const string server = "localhost"; + const string username = "admin"; + const string password = ""; - using var engine = new Engine(); + using var engine = new Engine(); - ConnectionStateCode state = await engine.LogOnAsync(server: server, username: username, password: password); + ConnectionStateCode state = await engine.LogOnAsync(server: server, username: username, password: password); - if (state == ConnectionStateCode.Success) + if (state == ConnectionStateCode.Success) + { + IEnumerable privateTasks = engine.UserTaskManager.GetPrivateTasks().OfType().ToList(); + Console.WriteLine($"Number of private tasks: {privateTasks.Count()}"); + foreach (var task in privateTasks) { - IEnumerable privateTasks = engine.UserTaskManager.GetPrivateTasks().OfType().ToList(); - Console.WriteLine($"Number of private tasks: {privateTasks.Count()}"); - foreach (var task in privateTasks) + Console.WriteLine($"Task Name: {task.Name}, Task Type: {GetTaskTypeName(task.TaskType)}"); + foreach (var item in task.Content.Where(item => item.Type != EntityType.None)) { - Console.WriteLine($"Task Name: {task.Name}, Task Type: {GetTaskTypeName(task.TaskType)}"); - foreach (var item in task.Content.Where(item => item.Type != EntityType.None)) - { - Console.WriteLine($" Content Item ID: {item.Id}, Type: {item.Type}"); - } + Console.WriteLine($" Content Item ID: {item.Id}, Type: {item.Type}"); } + } - Console.WriteLine(); + Console.WriteLine(); - IEnumerable publicTasks = engine.UserTaskManager.GetPublicTasks().OfType().ToList(); - Console.WriteLine($"Number of public tasks: {publicTasks.Count()}"); - foreach (var task in publicTasks) + IEnumerable publicTasks = engine.UserTaskManager.GetPublicTasks().OfType().ToList(); + Console.WriteLine($"Number of public tasks: {publicTasks.Count()}"); + foreach (var task in publicTasks) + { + Console.WriteLine($"Task Name: {task.Name}, Task Type: {GetTaskTypeName(task.TaskType)}"); + foreach (var item in task.Content.Where(item => item.Type != EntityType.None)) { - Console.WriteLine($"Task Name: {task.Name}, Task Type: {GetTaskTypeName(task.TaskType)}"); - foreach (var item in task.Content.Where(item => item.Type != EntityType.None)) - { - Console.WriteLine($" Content Item ID: {item.Id}, Type: {item.Type}"); - } + Console.WriteLine($" Content Item ID: {item.Id}, Type: {item.Type}"); } } - else - { - Console.WriteLine($"Logon failed: {state}"); - } + } + else + { + Console.WriteLine($"Logon failed: {state}"); + } - Console.WriteLine("Press any key to exit..."); - Console.ReadKey(); + Console.WriteLine("Press any key to exit..."); + Console.ReadKey(); - string GetTaskTypeName(Guid taskTypeId) - { - if (taskTypeId == TaskGuid.AlarmsTask.Id) - return TaskGuid.AlarmsTask.Name; - if (taskTypeId == TaskGuid.CardholderManagerTask.Id) - return TaskGuid.CardholderManagerTask.Name; - if (taskTypeId == TaskGuid.MapDesignerTask.Id) - return TaskGuid.MapDesignerTask.Name; - if (taskTypeId == TaskGuid.MapsTask.Id) - return TaskGuid.MapsTask.Name; - if (taskTypeId == TaskGuid.MonitoringTask.Id) - return TaskGuid.MonitoringTask.Name; - if (taskTypeId == TaskGuid.RemotingTask.Id) - return TaskGuid.RemotingTask.Name; + string GetTaskTypeName(Guid taskTypeId) + { + if (taskTypeId == TaskGuid.AlarmsTask.Id) + return TaskGuid.AlarmsTask.Name; + if (taskTypeId == TaskGuid.CardholderManagerTask.Id) + return TaskGuid.CardholderManagerTask.Name; + if (taskTypeId == TaskGuid.MapDesignerTask.Id) + return TaskGuid.MapDesignerTask.Name; + if (taskTypeId == TaskGuid.MapsTask.Id) + return TaskGuid.MapsTask.Name; + if (taskTypeId == TaskGuid.MonitoringTask.Id) + return TaskGuid.MonitoringTask.Name; + if (taskTypeId == TaskGuid.RemotingTask.Id) + return TaskGuid.RemotingTask.Name; - return $"Unknown Task Type ({taskTypeId})"; - } + return $"Unknown Task Type ({taskTypeId})"; } } -} +} \ No newline at end of file diff --git a/Samples/Platform SDK/VideoUnitSample/Program.cs b/Samples/Platform SDK/VideoUnitSample/Program.cs index cedf9c0..cee2826 100644 --- a/Samples/Platform SDK/VideoUnitSample/Program.cs +++ b/Samples/Platform SDK/VideoUnitSample/Program.cs @@ -1,127 +1,126 @@ // Copyright (C) 2023 by Genetec, Inc. All rights reserved. // May be used only in accordance with a valid Source Code License Agreement. -namespace Genetec.Dap.CodeSamples +namespace Genetec.Dap.CodeSamples; + +using System; +using System.Collections.Generic; +using System.Data; +using System.Linq; +using System.Net; +using System.Threading.Tasks; +using Sdk; +using Sdk.Entities; +using Sdk.Entities.Video; +using Sdk.Queries; +using Sdk.Workflows; +using Sdk.Workflows.UnitManager; + +internal class Program { - using System; - using System.Collections.Generic; - using System.Data; - using System.Linq; - using System.Net; - using System.Threading.Tasks; - using Sdk; - using Sdk.Entities; - using Sdk.Entities.Video; - using Sdk.Queries; - using Sdk.Workflows; - using Sdk.Workflows.UnitManager; - - internal class Program - { - static Program() => SdkResolver.Initialize(); + static Program() => SdkResolver.Initialize(); - static async Task Main() - { - const string server = "localhost"; - const string username = "admin"; - const string password = ""; + static async Task Main() + { + const string server = "localhost"; + const string username = "admin"; + const string password = ""; - using var engine = new Engine(); + using var engine = new Engine(); - ConnectionStateCode state = await engine.LogOnAsync(server: server, username: username, password: password); + ConnectionStateCode state = await engine.LogOnAsync(server: server, username: username, password: password); - if (state == ConnectionStateCode.Success) - { - PrintSupportedCameras(engine.VideoUnitManager); + if (state == ConnectionStateCode.Success) + { + PrintSupportedCameras(engine.VideoUnitManager); - VideoUnitProductInfo productInfo = engine.VideoUnitManager.FindProductsByManufacturer("Genetec").First(p => p.ProductType == "All"); + VideoUnitProductInfo productInfo = engine.VideoUnitManager.FindProductsByManufacturer("Genetec").First(p => p.ProductType == "All"); - var endpoint = new IPEndPoint(address: IPAddress.Parse("127.0.0.1"), port: 16000); + var endpoint = new IPEndPoint(address: IPAddress.Parse("127.0.0.1"), port: 16000); - var info = new AddVideoUnitInfo(videoUnitProductInfo: productInfo, endpoint, useDefaultCredentials: true); + var info = new AddVideoUnitInfo(videoUnitProductInfo: productInfo, endpoint, useDefaultCredentials: true); - ArchiverRole role = await GetArchiverRole(engine); - if (role != null) + ArchiverRole role = await GetArchiverRole(engine); + if (role != null) + { + try { - try - { - Guid videoUnitId = await AddVideoUnit(engine.VideoUnitManager, info, role.Guid); - var videoUnit = (VideoUnit)engine.GetEntity(videoUnitId); - Console.WriteLine($"Video unit: {videoUnit} has been created."); - } - catch (Exception ex) - { - Console.WriteLine(ex.Message); - } + Guid videoUnitId = await AddVideoUnit(engine.VideoUnitManager, info, role.Guid); + var videoUnit = (VideoUnit)engine.GetEntity(videoUnitId); + Console.WriteLine($"Video unit: {videoUnit} has been created."); } - else + catch (Exception ex) { - Console.WriteLine("No Archiver role was found. An Archiver role must be created to enroll a camera."); + Console.WriteLine(ex.Message); } } else { - Console.WriteLine($"Logon failed: {state}"); + Console.WriteLine("No Archiver role was found. An Archiver role must be created to enroll a camera."); } - - Console.WriteLine("Press any key to exit..."); - Console.ReadKey(); } - - static async Task GetArchiverRole(Engine engine) + else { - var query = (EntityConfigurationQuery)engine.ReportManager.CreateReportQuery(ReportType.EntityConfiguration); - query.EntityTypeFilter.Add(EntityType.Role); - var result = await Task.Factory.FromAsync(query.BeginQuery, query.EndQuery, null); - return result.Data.AsEnumerable().Select(row => engine.GetEntity(row.Field(nameof(Guid)))).OfType().FirstOrDefault(); + Console.WriteLine($"Logon failed: {state}"); } - static void PrintSupportedCameras(IVideoUnitManager manager) - { - foreach (var grouping in ListSupportedCameras(manager).GroupBy(productInfo => productInfo.Manufacturer)) - { - Console.WriteLine($"Manufacturer: {grouping.Key}"); - Console.WriteLine(new string('-', 20)); + Console.WriteLine("Press any key to exit..."); + Console.ReadKey(); + } - foreach (var productInfo in grouping) - { - Console.WriteLine($" - Product Type: {productInfo.ProductType}"); - Console.WriteLine($" Description: {productInfo.Description}"); - Console.WriteLine(); - } + static async Task GetArchiverRole(Engine engine) + { + var query = (EntityConfigurationQuery)engine.ReportManager.CreateReportQuery(ReportType.EntityConfiguration); + query.EntityTypeFilter.Add(EntityType.Role); + var result = await Task.Factory.FromAsync(query.BeginQuery, query.EndQuery, null); + return result.Data.AsEnumerable().Select(row => engine.GetEntity(row.Field(nameof(Guid)))).OfType().FirstOrDefault(); + } + static void PrintSupportedCameras(IVideoUnitManager manager) + { + foreach (var grouping in ListSupportedCameras(manager).GroupBy(productInfo => productInfo.Manufacturer)) + { + Console.WriteLine($"Manufacturer: {grouping.Key}"); + Console.WriteLine(new string('-', 20)); + + foreach (var productInfo in grouping) + { + Console.WriteLine($" - Product Type: {productInfo.ProductType}"); + Console.WriteLine($" Description: {productInfo.Description}"); Console.WriteLine(); } - } - static IEnumerable ListSupportedCameras(IVideoUnitManager videoUnitManager) - { - return videoUnitManager.Manufacturers.SelectMany(videoUnitManager.FindProductsByManufacturer); + Console.WriteLine(); } + } - static async Task AddVideoUnit(IVideoUnitManager videoUnitManager, AddVideoUnitInfo videoUnitInfo, Guid archiver) - { - var completion = new TaskCompletionSource(); + static IEnumerable ListSupportedCameras(IVideoUnitManager videoUnitManager) + { + return videoUnitManager.Manufacturers.SelectMany(videoUnitManager.FindProductsByManufacturer); + } - videoUnitManager.EnrollmentStatusChanged += OnEnrollmentStatusChanged; - try - { - AddUnitResponse response = await videoUnitManager.AddVideoUnit(videoUnitInfo, archiver); + static async Task AddVideoUnit(IVideoUnitManager videoUnitManager, AddVideoUnitInfo videoUnitInfo, Guid archiver) + { + var completion = new TaskCompletionSource(); - return response.Error != Error.None ? throw new Exception($"Fail to add video unit {response.Error}") : await completion.Task; - } - finally - { - videoUnitManager.EnrollmentStatusChanged -= OnEnrollmentStatusChanged; - } + videoUnitManager.EnrollmentStatusChanged += OnEnrollmentStatusChanged; + try + { + AddUnitResponse response = await videoUnitManager.AddVideoUnit(videoUnitInfo, archiver); - void OnEnrollmentStatusChanged(object sender, Sdk.EventsArgs.UnitEnrolledEventArgs e) + return response.Error != Error.None ? throw new Exception($"Fail to add video unit {response.Error}") : await completion.Task; + } + finally + { + videoUnitManager.EnrollmentStatusChanged -= OnEnrollmentStatusChanged; + } + + void OnEnrollmentStatusChanged(object sender, Sdk.EventsArgs.UnitEnrolledEventArgs e) + { + if (e.EnrollmentResult == EnrollmentResult.Added) { - if (e.EnrollmentResult == EnrollmentResult.Added) - { - completion.SetResult(e.Unit); - } + completion.SetResult(e.Unit); } } } -} +} \ No newline at end of file diff --git a/Samples/Platform SDK/VisitorManagerSample/ArchivedVisitorData.cs b/Samples/Platform SDK/VisitorManagerSample/ArchivedVisitorData.cs index 27d7d5d..fc09815 100644 --- a/Samples/Platform SDK/VisitorManagerSample/ArchivedVisitorData.cs +++ b/Samples/Platform SDK/VisitorManagerSample/ArchivedVisitorData.cs @@ -3,31 +3,30 @@ // You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 // Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -namespace Genetec.Dap.CodeSamples -{ - using System; - using Sdk.Entities.CustomFields; - using Sdk.Queries; +namespace Genetec.Dap.CodeSamples; + +using System; +using Sdk.Entities.CustomFields; +using Sdk.Queries; - class ArchivedVisitorData - { - public Guid Guid { get; set; } - public string FirstName { get; set; } - public string LastName { get; set; } - public string EmailAddress { get; set; } - public DateTime ActivationDate { get; set; } - public DateTime ExpirationDate { get; set; } - public Guid Thumbnail { get; set; } - public DateTime CheckinDate { get; set; } - public Guid Picture { get; set; } - public DateTime CheckoutDate { get; set; } - public string Description { get; set; } - public Guid Escort { get; set; } - public Guid Escort2 { get; set; } - public bool MandatoryEscort { get; set; } - public DateTime VisitDate { get; set; } - public string MobilePhoneNumber { get; set; } - public VisitorState VisitorState { get; set; } - public CustomFieldsCollection CustomFields { get; set; } - } +class ArchivedVisitorData +{ + public Guid Guid { get; set; } + public string FirstName { get; set; } + public string LastName { get; set; } + public string EmailAddress { get; set; } + public DateTime ActivationDate { get; set; } + public DateTime ExpirationDate { get; set; } + public Guid Thumbnail { get; set; } + public DateTime CheckinDate { get; set; } + public Guid Picture { get; set; } + public DateTime CheckoutDate { get; set; } + public string Description { get; set; } + public Guid Escort { get; set; } + public Guid Escort2 { get; set; } + public bool MandatoryEscort { get; set; } + public DateTime VisitDate { get; set; } + public string MobilePhoneNumber { get; set; } + public VisitorState VisitorState { get; set; } + public CustomFieldsCollection CustomFields { get; set; } } \ No newline at end of file diff --git a/Samples/Platform SDK/VisitorManagerSample/Program.cs b/Samples/Platform SDK/VisitorManagerSample/Program.cs index 3ce7983..b1fb205 100644 --- a/Samples/Platform SDK/VisitorManagerSample/Program.cs +++ b/Samples/Platform SDK/VisitorManagerSample/Program.cs @@ -3,165 +3,164 @@ // You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 // Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -namespace Genetec.Dap.CodeSamples +namespace Genetec.Dap.CodeSamples; + +using System; +using System.Data; +using System.Linq; +using System.Threading.Tasks; +using Genetec.Sdk.Entities; +using Genetec.Sdk.Entities.CustomFields; +using Genetec.Sdk.Queries; +using Sdk; +using Sdk.Entities.AccessControl.Visitors; + +class Program { - using System; - using System.Data; - using System.Linq; - using System.Threading.Tasks; - using Genetec.Sdk.Entities; - using Genetec.Sdk.Entities.CustomFields; - using Genetec.Sdk.Queries; - using Sdk; - using Sdk.Entities.AccessControl.Visitors; - - class Program + static Program() => SdkResolver.Initialize(); + + static async Task Main() { - static Program() => SdkResolver.Initialize(); + const string server = "localhost"; + const string username = "admin"; + const string password = ""; - static async Task Main() - { - const string server = "localhost"; - const string username = "admin"; - const string password = ""; + using var engine = new Engine(); - using var engine = new Engine(); + ConnectionStateCode state = await engine.LogOnAsync(server, username, password); - ConnectionStateCode state = await engine.LogOnAsync(server, username, password); + if (state == ConnectionStateCode.Success) + { + const string visitorFirstName = "John"; + const string visitorLastName = "Doe"; + const string visitorMobileNumber = "123-456-7890"; - if (state == ConnectionStateCode.Success) - { - const string visitorFirstName = "John"; - const string visitorLastName = "Doe"; - const string visitorMobileNumber = "123-456-7890"; + Visitor visitor; - Visitor visitor; + ArchivedVisitorData archivedVisitorData = await FindArchivedVisitor(engine, visitorFirstName, visitorLastName, visitorMobileNumber); + if (archivedVisitorData is null) + { + visitor = await CreateVisitor(); + } + else + { + ArchivedVisitor archivedVisitor = engine.VisitorManager.GetArchivedVisitor(archivedVisitorData.Guid); - ArchivedVisitorData archivedVisitorData = await FindArchivedVisitor(engine, visitorFirstName, visitorLastName, visitorMobileNumber); - if (archivedVisitorData is null) - { - visitor = await CreateVisitor(); - } - else - { - ArchivedVisitor archivedVisitor = engine.VisitorManager.GetArchivedVisitor(archivedVisitorData.Guid); + DisplayArchivedVisitorInfo(archivedVisitor); - DisplayArchivedVisitorInfo(archivedVisitor); + Console.WriteLine("Creating visitor from archived visitor"); + visitor = engine.VisitorManager.CreateVisitor(archivedVisitor); + } - Console.WriteLine("Creating visitor from archived visitor"); - visitor = engine.VisitorManager.CreateVisitor(archivedVisitor); - } + DisplayVisitorInfo(visitor); - DisplayVisitorInfo(visitor); + PerformCheckin(visitor); - PerformCheckin(visitor); + await Task.Delay(TimeSpan.FromSeconds(5)); - await Task.Delay(TimeSpan.FromSeconds(5)); + PerformCheckout(visitor); - PerformCheckout(visitor); + Task CreateVisitor() + { + Console.WriteLine("Creating visitor"); - Task CreateVisitor() + return engine.TransactionManager.ExecuteTransactionAsync(() => { - Console.WriteLine("Creating visitor"); - - return engine.TransactionManager.ExecuteTransactionAsync(() => - { - var visitor = (Visitor)engine.CreateEntity($"{visitorFirstName} {visitorLastName}", EntityType.Visitor); - visitor.FirstName = visitorFirstName; - visitor.LastName = visitorLastName; - visitor.MobilePhoneNumber = visitorMobileNumber; - return visitor; - }); - } - } - else - { - Console.WriteLine($"Logon failed: {state}"); + var visitor = (Visitor)engine.CreateEntity($"{visitorFirstName} {visitorLastName}", EntityType.Visitor); + visitor.FirstName = visitorFirstName; + visitor.LastName = visitorLastName; + visitor.MobilePhoneNumber = visitorMobileNumber; + return visitor; + }); } - - Console.WriteLine("Press any key to exit..."); - Console.ReadKey(); } - - static void DisplayVisitorInfo(Visitor visitor) + else { - Console.WriteLine("Visitor information:"); - Console.WriteLine($"First name: {visitor.FirstName}"); - Console.WriteLine($"Last name: {visitor.LastName}"); - Console.WriteLine($"Mobile number: {visitor.MobilePhoneNumber}"); - Console.WriteLine(); + Console.WriteLine($"Logon failed: {state}"); } - static void PerformCheckin(Visitor visitor) - { - Console.WriteLine("Check-in"); - visitor.Status.Activate(); + Console.WriteLine("Press any key to exit..."); + Console.ReadKey(); + } - Console.WriteLine($"Check-in date: {visitor.CheckinDate.ToLocalTime()}"); - Console.WriteLine($"Arrival date: {visitor.Arrival.ToLocalTime()}"); - Console.WriteLine($"Visitor status: {visitor.Status.State}"); - Console.WriteLine(); - } + static void DisplayVisitorInfo(Visitor visitor) + { + Console.WriteLine("Visitor information:"); + Console.WriteLine($"First name: {visitor.FirstName}"); + Console.WriteLine($"Last name: {visitor.LastName}"); + Console.WriteLine($"Mobile number: {visitor.MobilePhoneNumber}"); + Console.WriteLine(); + } - static void PerformCheckout(Visitor visitor) - { - Console.WriteLine("Checkout"); - visitor.Checkout(); + static void PerformCheckin(Visitor visitor) + { + Console.WriteLine("Check-in"); + visitor.Status.Activate(); - Console.WriteLine(); - } + Console.WriteLine($"Check-in date: {visitor.CheckinDate.ToLocalTime()}"); + Console.WriteLine($"Arrival date: {visitor.Arrival.ToLocalTime()}"); + Console.WriteLine($"Visitor status: {visitor.Status.State}"); + Console.WriteLine(); + } - static async Task FindArchivedVisitor(Engine engine, string firstName, string lastName, string mobileNumber) - { - Console.WriteLine("Searching archived visitor"); + static void PerformCheckout(Visitor visitor) + { + Console.WriteLine("Checkout"); + visitor.Checkout(); - var query = (VisitorQuery)engine.ReportManager.CreateReportQuery(ReportType.Visitor); - query.FirstName = firstName; - query.FirstNameSearchMode = StringSearchMode.Is; - query.LastName = lastName; - query.LastNameSearchMode = StringSearchMode.Is; - query.MobilePhoneNumber = mobileNumber; - query.MobilePhoneNumberSearchMode = StringSearchMode.Is; - query.LastConfiguration = true; + Console.WriteLine(); + } - QueryCompletedEventArgs args = await Task.Factory.FromAsync(query.BeginQuery, query.EndQuery, null); + static async Task FindArchivedVisitor(Engine engine, string firstName, string lastName, string mobileNumber) + { + Console.WriteLine("Searching archived visitor"); - return args.Data.AsEnumerable().Select(row => new ArchivedVisitorData - { - Guid = row.Field("Guid"), - FirstName = row.Field("FirstName"), - LastName = row.Field("LastName"), - EmailAddress = row.Field("Email"), - CustomFields = row.Field("CustomField"), - ActivationDate = row.Field("ActivationDate"), - ExpirationDate = row.Field("ExpirationDate"), - Picture = row.Field("Picture"), - Thumbnail = row.Field("Thumbnail"), - CheckinDate = row.Field("CheckinDate"), - CheckoutDate = row.Field("CheckoutDate"), - Description = row.Field("Description"), - Escort = row.Field("Escort"), - Escort2 = row.Field("Escort2"), - MandatoryEscort = row.Field("MandatoryEscort"), - VisitDate = row.Field("VisitDate"), - MobilePhoneNumber = row.Field("MobilePhoneNumber"), - VisitorState = row.Field("VisitorState"), - }).LastOrDefault(); - } + var query = (VisitorQuery)engine.ReportManager.CreateReportQuery(ReportType.Visitor); + query.FirstName = firstName; + query.FirstNameSearchMode = StringSearchMode.Is; + query.LastName = lastName; + query.LastNameSearchMode = StringSearchMode.Is; + query.MobilePhoneNumber = mobileNumber; + query.MobilePhoneNumberSearchMode = StringSearchMode.Is; + query.LastConfiguration = true; + + QueryCompletedEventArgs args = await Task.Factory.FromAsync(query.BeginQuery, query.EndQuery, null); - static void DisplayArchivedVisitorInfo(ArchivedVisitor archivedVisitor) + return args.Data.AsEnumerable().Select(row => new ArchivedVisitorData { - Console.WriteLine("Archived visitor information:"); - Console.WriteLine($"Name: {archivedVisitor.Name}"); - Console.WriteLine($"First name: {archivedVisitor.FirstName}"); - Console.WriteLine($"Last name: {archivedVisitor.LastName}"); - Console.WriteLine($"Email: {archivedVisitor.EmailAddress}"); - Console.WriteLine($"Mobile number: {archivedVisitor.MobilePhoneNumber}"); - Console.WriteLine($"Activation date: {archivedVisitor.ActivationDate}"); - Console.WriteLine($"Expiration date: {archivedVisitor.ExpirationDate}"); - Console.WriteLine($"Check-in date: {archivedVisitor.CheckinDate.ToLocalTime()}"); - Console.WriteLine($"Checkout date: {archivedVisitor.CheckoutDate.ToLocalTime()}"); - Console.WriteLine(); - } + Guid = row.Field("Guid"), + FirstName = row.Field("FirstName"), + LastName = row.Field("LastName"), + EmailAddress = row.Field("Email"), + CustomFields = row.Field("CustomField"), + ActivationDate = row.Field("ActivationDate"), + ExpirationDate = row.Field("ExpirationDate"), + Picture = row.Field("Picture"), + Thumbnail = row.Field("Thumbnail"), + CheckinDate = row.Field("CheckinDate"), + CheckoutDate = row.Field("CheckoutDate"), + Description = row.Field("Description"), + Escort = row.Field("Escort"), + Escort2 = row.Field("Escort2"), + MandatoryEscort = row.Field("MandatoryEscort"), + VisitDate = row.Field("VisitDate"), + MobilePhoneNumber = row.Field("MobilePhoneNumber"), + VisitorState = row.Field("VisitorState"), + }).LastOrDefault(); + } + + static void DisplayArchivedVisitorInfo(ArchivedVisitor archivedVisitor) + { + Console.WriteLine("Archived visitor information:"); + Console.WriteLine($"Name: {archivedVisitor.Name}"); + Console.WriteLine($"First name: {archivedVisitor.FirstName}"); + Console.WriteLine($"Last name: {archivedVisitor.LastName}"); + Console.WriteLine($"Email: {archivedVisitor.EmailAddress}"); + Console.WriteLine($"Mobile number: {archivedVisitor.MobilePhoneNumber}"); + Console.WriteLine($"Activation date: {archivedVisitor.ActivationDate}"); + Console.WriteLine($"Expiration date: {archivedVisitor.ExpirationDate}"); + Console.WriteLine($"Check-in date: {archivedVisitor.CheckinDate.ToLocalTime()}"); + Console.WriteLine($"Checkout date: {archivedVisitor.CheckoutDate.ToLocalTime()}"); + Console.WriteLine(); } -} +} \ No newline at end of file diff --git a/Samples/Plugin SDK/BasicPluginTemplate/BasicPlugin.cs b/Samples/Plugin SDK/BasicPluginTemplate/BasicPlugin.cs index 09f10d0..89cf910 100644 --- a/Samples/Plugin SDK/BasicPluginTemplate/BasicPlugin.cs +++ b/Samples/Plugin SDK/BasicPluginTemplate/BasicPlugin.cs @@ -1,32 +1,31 @@ // Copyright (C) 2023 by Genetec, Inc. All rights reserved. // May be used only in accordance with a valid Source Code License Agreement. -namespace Genetec.Dap.CodeSamples -{ - using Sdk.EventsArgs; - using Sdk.Plugin; +namespace Genetec.Dap.CodeSamples; + +using Sdk.EventsArgs; +using Sdk.Plugin; - [PluginProperty(typeof(BasicPluginDescriptor))] - public class BasicPlugin : Plugin +[PluginProperty(typeof(BasicPluginDescriptor))] +public class BasicPlugin : Plugin +{ + protected override void OnPluginLoaded() { - protected override void OnPluginLoaded() - { - } + } - protected override void OnPluginStart() - { - ModifyPluginState(new PluginStateEntry("PluginState", "Plugin started")); - } + protected override void OnPluginStart() + { + ModifyPluginState(new PluginStateEntry("PluginState", "Plugin started")); + } - protected override void Dispose(bool disposing) + protected override void Dispose(bool disposing) + { + if (disposing) { - if (disposing) - { - } } + } - protected override void OnQueryReceived(ReportQueryReceivedEventArgs args) - { - } + protected override void OnQueryReceived(ReportQueryReceivedEventArgs args) + { } } \ No newline at end of file diff --git a/Samples/Plugin SDK/BasicPluginTemplate/BasicPluginDescriptor.cs b/Samples/Plugin SDK/BasicPluginTemplate/BasicPluginDescriptor.cs index 5f7fe49..3455337 100644 --- a/Samples/Plugin SDK/BasicPluginTemplate/BasicPluginDescriptor.cs +++ b/Samples/Plugin SDK/BasicPluginTemplate/BasicPluginDescriptor.cs @@ -1,29 +1,28 @@ // Copyright (C) 2023 by Genetec, Inc. All rights reserved. // May be used only in accordance with a valid Source Code License Agreement. -namespace Genetec.Dap.CodeSamples -{ - using System; - using System.Collections.Generic; - using Sdk.Plugin; +namespace Genetec.Dap.CodeSamples; - public class BasicPluginDescriptor : PluginDescriptor - { - public override string Description => "Basic plugin's description"; +using System; +using System.Collections.Generic; +using Sdk.Plugin; - public override string Name => "Basic Plugin"; +public class BasicPluginDescriptor : PluginDescriptor +{ + public override string Description => "Basic plugin's description"; - // TODO: Replace with your own unique plugin GUID - public override Guid PluginGuid => new Guid("84E87A98-8AD3-4853-85E3-05C86B9BF90C"); + public override string Name => "Basic Plugin"; - public override string SpecificDefaultConfig => null; + // TODO: Replace with your own unique plugin GUID + public override Guid PluginGuid => new Guid("84E87A98-8AD3-4853-85E3-05C86B9BF90C"); - public override bool IsSingleInstance => true; + public override string SpecificDefaultConfig => null; - public override List ApplicationId => new List - { - "KxsD11z743Hf5Gq9mv3+5ekxzemlCiUXkTFY5ba1NOGcLCmGstt2n0zYE9NsNimv", // Allow the plugin to run on a demo system - //TODO: Add your SDK certificate application ID - }; - } -} + public override bool IsSingleInstance => true; + + public override List ApplicationId => new List + { + "KxsD11z743Hf5Gq9mv3+5ekxzemlCiUXkTFY5ba1NOGcLCmGstt2n0zYE9NsNimv", // Allow the plugin to run on a demo system + //TODO: Add your SDK certificate application ID + }; +} \ No newline at end of file diff --git a/Samples/Plugin SDK/PluginDatabaseSample/SampleDatabaseManager.cs b/Samples/Plugin SDK/PluginDatabaseSample/SampleDatabaseManager.cs index 7c1f2ef..382e397 100644 --- a/Samples/Plugin SDK/PluginDatabaseSample/SampleDatabaseManager.cs +++ b/Samples/Plugin SDK/PluginDatabaseSample/SampleDatabaseManager.cs @@ -5,213 +5,212 @@ // Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -namespace Genetec.Dap.CodeSamples +namespace Genetec.Dap.CodeSamples; + +using System; +using System.Collections.Generic; +using System.Data; +using Properties; +using Sdk.Diagnostics.Logging.Core; +using Sdk.Plugin; +using Sdk.Plugin.Objects; + +/// +/// Manages database operations for the plugin, including schema creation, cleanup, and upgrades. +/// Implements DatabaseManager for core functionality and IDisposable for resource management. +/// +public class SampleDatabaseManager : DatabaseManager, IDisposable { - using System; - using System.Collections.Generic; - using System.Data; - using Properties; - using Sdk.Diagnostics.Logging.Core; - using Sdk.Plugin; - using Sdk.Plugin.Objects; + private const string LogsCleanupThreshold = "LogThreshold"; - /// - /// Manages database operations for the plugin, including schema creation, cleanup, and upgrades. - /// Implements DatabaseManager for core functionality and IDisposable for resource management. - /// - public class SampleDatabaseManager : DatabaseManager, IDisposable + private readonly Logger m_logger; + + public SampleDatabaseManager() { - private const string LogsCleanupThreshold = "LogThreshold"; + m_logger = Logger.CreateInstanceLogger(this); + } - private readonly Logger m_logger; + /// + /// Gets the current database configuration. + /// + public DatabaseConfiguration Configuration { get; private set; } - public SampleDatabaseManager() - { - m_logger = Logger.CreateInstanceLogger(this); - } + /// + /// Gets the current state of the database. + /// + public DatabaseState State { get; private set; } - /// - /// Gets the current database configuration. - /// - public DatabaseConfiguration Configuration { get; private set; } + /// + /// Releases resources used by the SampleDatabaseManager. + /// + public void Dispose() + { + m_logger.Dispose(); + } - /// - /// Gets the current state of the database. - /// - public DatabaseState State { get; private set; } + /// + /// Returns the SQL script for creating tables, stored procedures, and functions. + /// + /// The name of the database. + /// A string containing the SQL creation script. + public override string GetSpecificCreationScript(string databaseName) + { + return Resources.CreationScript; + } - /// - /// Releases resources used by the SampleDatabaseManager. - /// - public void Dispose() + /// + /// Executes the database cleanup based on the specified threshold. + /// + /// The name of the cleanup threshold. + /// The retention period in days. + public override void DatabaseCleanup(string name, int retentionPeriod) + { + if (name == LogsCleanupThreshold) { - m_logger.Dispose(); + DeleteOldLogs(retentionPeriod); } + } - /// - /// Returns the SQL script for creating tables, stored procedures, and functions. - /// - /// The name of the database. - /// A string containing the SQL creation script. - public override string GetSpecificCreationScript(string databaseName) + /// + /// Deletes logs older than the specified number of days. + /// + /// The number of days old logs to delete. + /// + /// This method uses different database providers depending on the SDK version: + /// For version 5.11 or earlier: System.Data.SqlClient + /// For version 5.12 or later: Microsoft.Data.SqlClient + /// + public void DeleteOldLogs(int daysOld) + { + m_logger.TraceDebug($"Deleting logs older than {daysOld} days"); + + // When using version 5.11 or earlier, use System.Data.SqlClient.SqlConnection + //using System.Data.SqlClient.SqlConnection connection = Configuration.CreateSqlConnection(); + //using var command = new System.Data.SqlClient.SqlCommand("DeleteOldLogs", connection); + //command.CommandType = CommandType.StoredProcedure; + //command.Parameters.Add(new System.Data.SqlClient.SqlParameter("@DaysOld", daysOld)); + //try + //{ + // connection.Open(); + + // int rowsAffected = command.ExecuteNonQuery(); + // m_logger.TraceDebug($"{rowsAffected} rows were deleted."); + //} + //catch (Exception ex) + //{ + // m_logger.TraceError(ex, $"An error occurred: {ex.Message}"); + //} + + // When using version 5.12 or later, use Microsoft.Data.SqlClient.SqlConnection + using Microsoft.Data.SqlClient.SqlConnection connection = Configuration.CreateSqlDatabaseConnection(); + using var command = new Microsoft.Data.SqlClient.SqlCommand("DeleteOldLogs", connection); + command.CommandType = CommandType.StoredProcedure; + command.Parameters.Add(new Microsoft.Data.SqlClient.SqlParameter("@DaysOld", daysOld)); + try { - return Resources.CreationScript; - } + connection.Open(); + int rowsAffected = command.ExecuteNonQuery(); - /// - /// Executes the database cleanup based on the specified threshold. - /// - /// The name of the cleanup threshold. - /// The retention period in days. - public override void DatabaseCleanup(string name, int retentionPeriod) - { - if (name == LogsCleanupThreshold) - { - DeleteOldLogs(retentionPeriod); - } + m_logger.TraceDebug($"{rowsAffected} rows were deleted."); } - - /// - /// Deletes logs older than the specified number of days. - /// - /// The number of days old logs to delete. - /// - /// This method uses different database providers depending on the SDK version: - /// For version 5.11 or earlier: System.Data.SqlClient - /// For version 5.12 or later: Microsoft.Data.SqlClient - /// - public void DeleteOldLogs(int daysOld) + catch (Exception ex) { - m_logger.TraceDebug($"Deleting logs older than {daysOld} days"); - - // When using version 5.11 or earlier, use System.Data.SqlClient.SqlConnection - //using System.Data.SqlClient.SqlConnection connection = Configuration.CreateSqlConnection(); - //using var command = new System.Data.SqlClient.SqlCommand("DeleteOldLogs", connection); - //command.CommandType = CommandType.StoredProcedure; - //command.Parameters.Add(new System.Data.SqlClient.SqlParameter("@DaysOld", daysOld)); - //try - //{ - // connection.Open(); - - // int rowsAffected = command.ExecuteNonQuery(); - // m_logger.TraceDebug($"{rowsAffected} rows were deleted."); - //} - //catch (Exception ex) - //{ - // m_logger.TraceError(ex, $"An error occurred: {ex.Message}"); - //} - - // When using version 5.12 or later, use Microsoft.Data.SqlClient.SqlConnection - using Microsoft.Data.SqlClient.SqlConnection connection = Configuration.CreateSqlDatabaseConnection(); - using var command = new Microsoft.Data.SqlClient.SqlCommand("DeleteOldLogs", connection); - command.CommandType = CommandType.StoredProcedure; - command.Parameters.Add(new Microsoft.Data.SqlClient.SqlParameter("@DaysOld", daysOld)); - try - { - connection.Open(); - int rowsAffected = command.ExecuteNonQuery(); - - m_logger.TraceDebug($"{rowsAffected} rows were deleted."); - } - catch (Exception ex) - { - m_logger.TraceError(ex, $"An error occurred while deleting logs: {ex.Message}"); - } + m_logger.TraceError(ex, $"An error occurred while deleting logs: {ex.Message}"); } + } - /// - /// Inserts a new log entry into the database. - /// - /// The timestamp of the log entry. - /// The log level. - /// The log message. - /// - /// This method uses Microsoft.Data.SqlClient, which is appropriate for SDK version 5.12 or later. - /// For earlier versions, you would use System.Data.SqlClient instead. - /// - public void InsertLog(DateTime timestamp, int logLevel, string message) + /// + /// Inserts a new log entry into the database. + /// + /// The timestamp of the log entry. + /// The log level. + /// The log message. + /// + /// This method uses Microsoft.Data.SqlClient, which is appropriate for SDK version 5.12 or later. + /// For earlier versions, you would use System.Data.SqlClient instead. + /// + public void InsertLog(DateTime timestamp, int logLevel, string message) + { + // When using version 5.11 or earlier, use System.Data.SqlClient.SqlConnection + //using System.Data.SqlClient.SqlConnection connection = Configuration.CreateSqlConnection(); + //using var command = new System.Data.SqlClient.SqlCommand("InsertLog", connection); + //command.CommandType = CommandType.StoredProcedure; + + //command.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Timestamp", timestamp)); + //command.Parameters.Add(new System.Data.SqlClient.SqlParameter("@LogLevel", logLevel)); + //command.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Message", message)); + //try + //{ + // connection.Open(); + // command.ExecuteNonQuery(); + //} + //catch (Exception ex) + //{ + // m_logger.TraceError(ex, $"An error occurred while inserting log: {ex.Message}"); + //} + + // When using version 5.12 or later, use Microsoft.Data.SqlClient.SqlConnection + using Microsoft.Data.SqlClient.SqlConnection connection = Configuration.CreateSqlDatabaseConnection(); + using var command = new Microsoft.Data.SqlClient.SqlCommand("InsertLog", connection); + command.CommandType = CommandType.StoredProcedure; + + command.Parameters.Add(new Microsoft.Data.SqlClient.SqlParameter("@Timestamp", timestamp)); + command.Parameters.Add(new Microsoft.Data.SqlClient.SqlParameter("@LogLevel", logLevel)); + command.Parameters.Add(new Microsoft.Data.SqlClient.SqlParameter("@Message", message)); + try { - // When using version 5.11 or earlier, use System.Data.SqlClient.SqlConnection - //using System.Data.SqlClient.SqlConnection connection = Configuration.CreateSqlConnection(); - //using var command = new System.Data.SqlClient.SqlCommand("InsertLog", connection); - //command.CommandType = CommandType.StoredProcedure; - - //command.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Timestamp", timestamp)); - //command.Parameters.Add(new System.Data.SqlClient.SqlParameter("@LogLevel", logLevel)); - //command.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Message", message)); - //try - //{ - // connection.Open(); - // command.ExecuteNonQuery(); - //} - //catch (Exception ex) - //{ - // m_logger.TraceError(ex, $"An error occurred while inserting log: {ex.Message}"); - //} - - // When using version 5.12 or later, use Microsoft.Data.SqlClient.SqlConnection - using Microsoft.Data.SqlClient.SqlConnection connection = Configuration.CreateSqlDatabaseConnection(); - using var command = new Microsoft.Data.SqlClient.SqlCommand("InsertLog", connection); - command.CommandType = CommandType.StoredProcedure; - - command.Parameters.Add(new Microsoft.Data.SqlClient.SqlParameter("@Timestamp", timestamp)); - command.Parameters.Add(new Microsoft.Data.SqlClient.SqlParameter("@LogLevel", logLevel)); - command.Parameters.Add(new Microsoft.Data.SqlClient.SqlParameter("@Message", message)); - try - { - connection.Open(); - command.ExecuteNonQuery(); - } - catch (Exception ex) - { - m_logger.TraceError(ex, $"An error occurred while inserting log: {ex.Message}"); - } + connection.Open(); + command.ExecuteNonQuery(); } - - /// - /// Returns the database cleanup thresholds. - /// - /// An IEnumerable of DatabaseCleanupThreshold objects. - public override IEnumerable GetDatabaseCleanupThresholds() + catch (Exception ex) { - yield return new DatabaseCleanupThreshold(LogsCleanupThreshold, "Keep logs"); + m_logger.TraceError(ex, $"An error occurred while inserting log: {ex.Message}"); } + } - /// - /// Returns the database upgrade items. - /// - /// An IEnumerable of DatabaseUpgradeItem objects. - public override IEnumerable GetDatabaseUpgradeItems() - { - // Return the upgrade items for upgrading from version 50001 to 500002 - yield return new DatabaseUpgradeItem(50001, 500002, Resources.UpgradeScript_50002); + /// + /// Returns the database cleanup thresholds. + /// + /// An IEnumerable of DatabaseCleanupThreshold objects. + public override IEnumerable GetDatabaseCleanupThresholds() + { + yield return new DatabaseCleanupThreshold(LogsCleanupThreshold, "Keep logs"); + } - // Return the upgrade items for upgrading from version 50002 to 500003 - yield return new DatabaseUpgradeItem(50002, 500003, Resources.UpgradeScript_50003); - } + /// + /// Returns the database upgrade items. + /// + /// An IEnumerable of DatabaseUpgradeItem objects. + public override IEnumerable GetDatabaseUpgradeItems() + { + // Return the upgrade items for upgrading from version 50001 to 500002 + yield return new DatabaseUpgradeItem(50001, 500002, Resources.UpgradeScript_50002); - /// - /// Event raised when the database state changes. - /// - public event EventHandler DatabaseStateChanged; + // Return the upgrade items for upgrading from version 50002 to 500003 + yield return new DatabaseUpgradeItem(50002, 500003, Resources.UpgradeScript_50003); + } - /// - /// Handles database state changes. - /// - /// The DatabaseNotification object containing the new state. - public override void OnDatabaseStateChanged(DatabaseNotification notification) - { - State = notification.State; // Update the current state of the database - DatabaseStateChanged?.Invoke(this, EventArgs.Empty); // Raise the DatabaseStateChanged event - } + /// + /// Event raised when the database state changes. + /// + public event EventHandler DatabaseStateChanged; - /// - /// Sets the database configuration. - /// - /// The new DatabaseConfiguration object. - public override void SetDatabaseInformation(DatabaseConfiguration databaseConfiguration) - { - Configuration = databaseConfiguration; // Update the current DatabaseConfiguration - } + /// + /// Handles database state changes. + /// + /// The DatabaseNotification object containing the new state. + public override void OnDatabaseStateChanged(DatabaseNotification notification) + { + State = notification.State; // Update the current state of the database + DatabaseStateChanged?.Invoke(this, EventArgs.Empty); // Raise the DatabaseStateChanged event + } + + /// + /// Sets the database configuration. + /// + /// The new DatabaseConfiguration object. + public override void SetDatabaseInformation(DatabaseConfiguration databaseConfiguration) + { + Configuration = databaseConfiguration; // Update the current DatabaseConfiguration } } \ No newline at end of file diff --git a/Samples/Plugin SDK/PluginDatabaseSample/SamplePlugin.cs b/Samples/Plugin SDK/PluginDatabaseSample/SamplePlugin.cs index 5aece8e..68ca92f 100644 --- a/Samples/Plugin SDK/PluginDatabaseSample/SamplePlugin.cs +++ b/Samples/Plugin SDK/PluginDatabaseSample/SamplePlugin.cs @@ -5,51 +5,50 @@ // Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -namespace Genetec.Dap.CodeSamples +namespace Genetec.Dap.CodeSamples; + +using System; +using Genetec.Sdk.Diagnostics.Logging.Core; +using Genetec.Sdk.EventsArgs; +using Genetec.Sdk.Plugin; +using Genetec.Sdk.Plugin.Interfaces; +using Genetec.Sdk.Plugin.Objects; + +[PluginProperty(typeof(SamplePluginDescriptor))] +public class SamplePlugin : Plugin, IPluginDatabaseSupport // Implement the IPluginDatabaseSupport interface to support database operations { - using System; - using Genetec.Sdk.Diagnostics.Logging.Core; - using Genetec.Sdk.EventsArgs; - using Genetec.Sdk.Plugin; - using Genetec.Sdk.Plugin.Interfaces; - using Genetec.Sdk.Plugin.Objects; - - [PluginProperty(typeof(SamplePluginDescriptor))] - public class SamplePlugin : Plugin, IPluginDatabaseSupport // Implement the IPluginDatabaseSupport interface to support database operations - { - private readonly SampleDatabaseManager m_databaseManager = new(); + private readonly SampleDatabaseManager m_databaseManager = new(); - public DatabaseManager DatabaseManager => m_databaseManager; + public DatabaseManager DatabaseManager => m_databaseManager; - protected override void Dispose(bool disposing) + protected override void Dispose(bool disposing) + { + if (disposing) { - if (disposing) - { - m_databaseManager.Dispose(); - } + m_databaseManager.Dispose(); } + } - protected override void OnPluginLoaded() + protected override void OnPluginLoaded() + { + // Subscribe to the DatabaseStateChanged event to know when the database is connected + m_databaseManager.DatabaseStateChanged += (sender, e) => { - // Subscribe to the DatabaseStateChanged event to know when the database is connected - m_databaseManager.DatabaseStateChanged += (sender, e) => - { - Logger.TraceDebug($"Database state Changed to {m_databaseManager.State}"); - - if (m_databaseManager.State == DatabaseState.Connected) // Insert a log message when the database is connected - { - m_databaseManager.InsertLog(DateTime.UtcNow, 1, "This is a test log message."); - } - }; - } + Logger.TraceDebug($"Database state Changed to {m_databaseManager.State}"); - protected override void OnPluginStart() - { - ModifyPluginState(new PluginStateEntry("PluginState", "Plugin started")); - } + if (m_databaseManager.State == DatabaseState.Connected) // Insert a log message when the database is connected + { + m_databaseManager.InsertLog(DateTime.UtcNow, 1, "This is a test log message."); + } + }; + } - protected override void OnQueryReceived(ReportQueryReceivedEventArgs args) - { - } + protected override void OnPluginStart() + { + ModifyPluginState(new PluginStateEntry("PluginState", "Plugin started")); + } + + protected override void OnQueryReceived(ReportQueryReceivedEventArgs args) + { } } \ No newline at end of file diff --git a/Samples/Plugin SDK/PluginDatabaseSample/SamplePluginDescriptor.cs b/Samples/Plugin SDK/PluginDatabaseSample/SamplePluginDescriptor.cs index ee9313c..d03f5e9 100644 --- a/Samples/Plugin SDK/PluginDatabaseSample/SamplePluginDescriptor.cs +++ b/Samples/Plugin SDK/PluginDatabaseSample/SamplePluginDescriptor.cs @@ -5,30 +5,29 @@ // Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -namespace Genetec.Dap.CodeSamples -{ - using System; - using System.Collections.Generic; - using Genetec.Sdk.Plugin; +namespace Genetec.Dap.CodeSamples; + +using System; +using System.Collections.Generic; +using Genetec.Sdk.Plugin; - public class SamplePluginDescriptor : PluginDescriptor - { - // TODO: Replace with your own plugin description - public override string Description => "A plugin with database support"; +public class SamplePluginDescriptor : PluginDescriptor +{ + // TODO: Replace with your own plugin description + public override string Description => "A plugin with database support"; - // TODO: Replace with your own plugin name - public override string Name => "Sample Plugin Database"; + // TODO: Replace with your own plugin name + public override string Name => "Sample Plugin Database"; - // TODO: Replace with your own unique plugin GUID - public override Guid PluginGuid => new Guid("266B2366-26AA-4538-9953-FC435D3063EE"); + // TODO: Replace with your own unique plugin GUID + public override Guid PluginGuid => new Guid("266B2366-26AA-4538-9953-FC435D3063EE"); - // This plugin does not use a configuration - public override string SpecificDefaultConfig => null; + // This plugin does not use a configuration + public override string SpecificDefaultConfig => null; - public override List ApplicationId => - [ - "KxsD11z743Hf5Gq9mv3+5ekxzemlCiUXkTFY5ba1NOGcLCmGstt2n0zYE9NsNimv", // Allow the plugin to run on a demo system - //TODO: Add your SDK certificate application ID - ]; - } + public override List ApplicationId => + [ + "KxsD11z743Hf5Gq9mv3+5ekxzemlCiUXkTFY5ba1NOGcLCmGstt2n0zYE9NsNimv", // Allow the plugin to run on a demo system + //TODO: Add your SDK certificate application ID + ]; } \ No newline at end of file diff --git a/Samples/Shared/CollectionExtensions.cs b/Samples/Shared/CollectionExtensions.cs index c6f6775..72df0e6 100644 --- a/Samples/Shared/CollectionExtensions.cs +++ b/Samples/Shared/CollectionExtensions.cs @@ -1,18 +1,17 @@ // Copyright (C) 2023 by Genetec, Inc. All rights reserved. // May be used only in accordance with a valid Source Code License Agreement. -namespace Genetec.Dap.CodeSamples -{ - using System.Collections.Generic; +namespace Genetec.Dap.CodeSamples; + +using System.Collections.Generic; - public static class CollectionExtensions +public static class CollectionExtensions +{ + public static void AddRange(this ICollection collection, IEnumerable items) { - public static void AddRange(this ICollection collection, IEnumerable items) + foreach (var item in items) { - foreach (var item in items) - { - collection.Add(item); - } + collection.Add(item); } } -} +} \ No newline at end of file diff --git a/Samples/Shared/EnumerableExtensions.cs b/Samples/Shared/EnumerableExtensions.cs index 9e92d6a..1ba470b 100644 --- a/Samples/Shared/EnumerableExtensions.cs +++ b/Samples/Shared/EnumerableExtensions.cs @@ -1,31 +1,30 @@ // Copyright (C) 2023 by Genetec, Inc. All rights reserved. // May be used only in accordance with a valid Source Code License Agreement. -namespace Genetec.Dap.CodeSamples -{ - using System.Collections.Generic; +namespace Genetec.Dap.CodeSamples; - public static class EnumerableExtensions - { - public static IEnumerable> Split(this IEnumerable source, int chunkSize) - { - var chunk = new List(chunkSize); +using System.Collections.Generic; - foreach (T item in source) - { - chunk.Add(item); +public static class EnumerableExtensions +{ + public static IEnumerable> Split(this IEnumerable source, int chunkSize) + { + var chunk = new List(chunkSize); - if (chunk.Count == chunkSize) - { - yield return chunk; - chunk = new List(chunkSize); - } - } + foreach (T item in source) + { + chunk.Add(item); - if (chunk.Count > 0) + if (chunk.Count == chunkSize) { yield return chunk; + chunk = new List(chunkSize); } } + + if (chunk.Count > 0) + { + yield return chunk; + } } } \ No newline at end of file diff --git a/Samples/Shared/SdkResolver.cs b/Samples/Shared/SdkResolver.cs index 0213698..5cf6316 100644 --- a/Samples/Shared/SdkResolver.cs +++ b/Samples/Shared/SdkResolver.cs @@ -1,89 +1,88 @@ // Copyright (C) 2023 by Genetec, Inc. All rights reserved. // May be used only in accordance with a valid Source Code License Agreement. -namespace Genetec.Dap.CodeSamples +namespace Genetec.Dap.CodeSamples; + +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Reflection; +using System.Runtime.InteropServices; +using Microsoft.Win32; + +public static class SdkResolver { - using System; - using System.Collections.Generic; - using System.IO; - using System.Linq; - using System.Reflection; - using System.Runtime.InteropServices; - using Microsoft.Win32; + private static string s_probingPath; - public static class SdkResolver + public static void Initialize() { - private static string s_probingPath; - - public static void Initialize() - { - AppDomain.CurrentDomain.AssemblyResolve += OnAssemblyResolve; - s_probingPath = GetProbingPath(); - } + AppDomain.CurrentDomain.AssemblyResolve += OnAssemblyResolve; + s_probingPath = GetProbingPath(); + } - private static string GetProbingPath() - { - string sdkFolder = Environment.GetEnvironmentVariable(RuntimeInformation.FrameworkDescription.StartsWith(".NET Framework") ? "GSC_SDK" : "GSC_SDK_CORE"); + private static string GetProbingPath() + { + string sdkFolder = Environment.GetEnvironmentVariable(RuntimeInformation.FrameworkDescription.StartsWith(".NET Framework") ? "GSC_SDK" : "GSC_SDK_CORE"); - return Directory.Exists(sdkFolder) - ? sdkFolder - : GetInstallationFolders().OrderBy(tuple => tuple.Version).Select(tuple => tuple.Folder).Where(Directory.Exists).LastOrDefault(); + return Directory.Exists(sdkFolder) + ? sdkFolder + : GetInstallationFolders().OrderBy(tuple => tuple.Version).Select(tuple => tuple.Folder).Where(Directory.Exists).LastOrDefault(); - IEnumerable<(Version Version, string Folder)> GetInstallationFolders() + IEnumerable<(Version Version, string Folder)> GetInstallationFolders() + { + foreach (var root in new[] { @"SOFTWARE\Genetec\Security Center\", @"SOFTWARE\Wow6432Node\Genetec\Security Center\" }) { - foreach (var root in new[] { @"SOFTWARE\Genetec\Security Center\", @"SOFTWARE\Wow6432Node\Genetec\Security Center\" }) + using RegistryKey key = Registry.LocalMachine.OpenSubKey(root); + if (key is null) { - using RegistryKey key = Registry.LocalMachine.OpenSubKey(root); - if (key is null) - { - continue; - } + continue; + } - foreach (var name in key.GetSubKeyNames()) + foreach (var name in key.GetSubKeyNames()) + { + if (Version.TryParse(name, out Version version)) { - if (Version.TryParse(name, out Version version)) + using RegistryKey subKey = key.OpenSubKey(name); + if (subKey is null) { - using RegistryKey subKey = key.OpenSubKey(name); - if (subKey is null) - { - continue; - } + continue; + } - if (subKey.GetValue("Installation Path") is string path) //SDK installation PATH - { - yield return (version, path); - } - else if (subKey.GetValue("InstallDir") is string dir) //Security Center installation PATH - { - yield return (version, dir); - } + if (subKey.GetValue("Installation Path") is string path) //SDK installation PATH + { + yield return (version, path); + } + else if (subKey.GetValue("InstallDir") is string dir) //Security Center installation PATH + { + yield return (version, dir); } } } } } + } - private static Assembly OnAssemblyResolve(object sender, ResolveEventArgs args) + private static Assembly OnAssemblyResolve(object sender, ResolveEventArgs args) + { + foreach (var assemblyFile in GetAssemblyPaths(s_probingPath).Where(File.Exists)) { - foreach (var assemblyFile in GetAssemblyPaths(s_probingPath).Where(File.Exists)) + try { - try - { - return Assembly.LoadFile(assemblyFile); - } - catch - { - } + return Assembly.LoadFile(assemblyFile); } - - return null; - - IEnumerable GetAssemblyPaths(string probingPath) + catch { - var assemblyName = new AssemblyName(args.Name); - yield return Path.Combine(probingPath, $"{assemblyName.Name}.dll"); - yield return Path.Combine(probingPath, $"{assemblyName.Name}.exe"); } } + + return null; + + IEnumerable GetAssemblyPaths(string probingPath) + { + var assemblyName = new AssemblyName(args.Name); + yield return Path.Combine(probingPath, $"{assemblyName.Name}.dll"); + yield return Path.Combine(probingPath, $"{assemblyName.Name}.exe"); + } } -} +} \ No newline at end of file diff --git a/Samples/Workspace SDK/BackgroundProcessSample/BackgroundProcessPage.cs b/Samples/Workspace SDK/BackgroundProcessSample/BackgroundProcessPage.cs index b6e1ffe..2823231 100644 --- a/Samples/Workspace SDK/BackgroundProcessSample/BackgroundProcessPage.cs +++ b/Samples/Workspace SDK/BackgroundProcessSample/BackgroundProcessPage.cs @@ -5,19 +5,18 @@ // Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -namespace Genetec.Dap.CodeSamples -{ - using Genetec.Sdk.Workspace.Pages; - using Genetec.Sdk.Workspace.Services; +namespace Genetec.Dap.CodeSamples; + +using Genetec.Sdk.Workspace.Pages; +using Genetec.Sdk.Workspace.Services; - [Page(typeof(BackgroundProcessPageDescriptor))] - public class BackgroundProcessPage : Page +[Page(typeof(BackgroundProcessPageDescriptor))] +public class BackgroundProcessPage : Page +{ + protected override void Initialize() { - protected override void Initialize() - { - var service = Workspace.Services.Get(); + var service = Workspace.Services.Get(); - View = new BackgroundProcessPageView(new BackgroundProcessPageViewModel(service)); - } + View = new BackgroundProcessPageView(new BackgroundProcessPageViewModel(service)); } } \ No newline at end of file diff --git a/Samples/Workspace SDK/BackgroundProcessSample/BackgroundProcessPageDescriptor.cs b/Samples/Workspace SDK/BackgroundProcessSample/BackgroundProcessPageDescriptor.cs index e3a46bf..cde1ae5 100644 --- a/Samples/Workspace SDK/BackgroundProcessSample/BackgroundProcessPageDescriptor.cs +++ b/Samples/Workspace SDK/BackgroundProcessSample/BackgroundProcessPageDescriptor.cs @@ -5,22 +5,21 @@ // Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -namespace Genetec.Dap.CodeSamples -{ - using System; - using Genetec.Sdk.Workspace.Pages; - using Genetec.Sdk.Workspace.Tasks; +namespace Genetec.Dap.CodeSamples; + +using System; +using Genetec.Sdk.Workspace.Pages; +using Genetec.Sdk.Workspace.Tasks; - public class BackgroundProcessPageDescriptor : PageDescriptor - { - public override Guid CategoryId { get; } = new Guid(TaskCategories.Operation); +public class BackgroundProcessPageDescriptor : PageDescriptor +{ + public override Guid CategoryId { get; } = new Guid(TaskCategories.Operation); - public override string Description => "Demonstrate the IBackgroundProcessNotificationService"; + public override string Description => "Demonstrate the IBackgroundProcessNotificationService"; - public override string Name => "Background Process Service"; + public override string Name => "Background Process Service"; - public override Guid Type { get; } = new Guid("B94C35AA-D324-4381-A05E-B3A5F24FF487"); // TODO: Replace with a new GUID + public override Guid Type { get; } = new Guid("B94C35AA-D324-4381-A05E-B3A5F24FF487"); // TODO: Replace with a new GUID - public override bool AllowOfflineExecution => false; - } + public override bool AllowOfflineExecution => false; } \ No newline at end of file diff --git a/Samples/Workspace SDK/BackgroundProcessSample/BackgroundProcessPageView.xaml.cs b/Samples/Workspace SDK/BackgroundProcessSample/BackgroundProcessPageView.xaml.cs index cc9873c..60d93b7 100644 --- a/Samples/Workspace SDK/BackgroundProcessSample/BackgroundProcessPageView.xaml.cs +++ b/Samples/Workspace SDK/BackgroundProcessSample/BackgroundProcessPageView.xaml.cs @@ -5,20 +5,19 @@ // Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -namespace Genetec.Dap.CodeSamples -{ - using System.Windows.Controls; +namespace Genetec.Dap.CodeSamples; + +using System.Windows.Controls; - public partial class BackgroundProcessPageView : UserControl +public partial class BackgroundProcessPageView : UserControl +{ + public BackgroundProcessPageView() { - public BackgroundProcessPageView() - { - InitializeComponent(); - } + InitializeComponent(); + } - public BackgroundProcessPageView(object dataContext) : this() - { - DataContext = dataContext; - } + public BackgroundProcessPageView(object dataContext) : this() + { + DataContext = dataContext; } -} +} \ No newline at end of file diff --git a/Samples/Workspace SDK/BackgroundProcessSample/BackgroundProcessPageViewModel.cs b/Samples/Workspace SDK/BackgroundProcessSample/BackgroundProcessPageViewModel.cs index 818df3b..6289262 100644 --- a/Samples/Workspace SDK/BackgroundProcessSample/BackgroundProcessPageViewModel.cs +++ b/Samples/Workspace SDK/BackgroundProcessSample/BackgroundProcessPageViewModel.cs @@ -5,50 +5,49 @@ // Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -namespace Genetec.Dap.CodeSamples +namespace Genetec.Dap.CodeSamples; + +using System; +using System.Threading.Tasks; +using Genetec.Sdk; +using Genetec.Sdk.Workspace.Services; +using Prism.Commands; +using Prism.Mvvm; +using static System.String; + +public class BackgroundProcessPageViewModel : BindableBase { - using System; - using System.Threading.Tasks; - using Genetec.Sdk; - using Genetec.Sdk.Workspace.Services; - using Prism.Commands; - using Prism.Mvvm; - using static System.String; - - public class BackgroundProcessPageViewModel : BindableBase - { - private readonly IBackgroundProcessNotificationService m_service; + private readonly IBackgroundProcessNotificationService m_service; - private string m_notificationMessage; - - public BackgroundProcessPageViewModel(IBackgroundProcessNotificationService service) - { - m_service = service; - StartProcessCommand = new DelegateCommand(StartProcess); - SendNotificationCommand = new DelegateCommand(() => m_service.Notify(NotificationMessage), () => !IsNullOrEmpty(NotificationMessage)).ObservesProperty(() => NotificationMessage); - } + private string m_notificationMessage; - public DelegateCommand StartProcessCommand { get; } + public BackgroundProcessPageViewModel(IBackgroundProcessNotificationService service) + { + m_service = service; + StartProcessCommand = new DelegateCommand(StartProcess); + SendNotificationCommand = new DelegateCommand(() => m_service.Notify(NotificationMessage), () => !IsNullOrEmpty(NotificationMessage)).ObservesProperty(() => NotificationMessage); + } - public DelegateCommand SendNotificationCommand { get; } + public DelegateCommand StartProcessCommand { get; } - public string NotificationMessage - { - get => m_notificationMessage; - set => SetProperty(ref m_notificationMessage, value); - } + public DelegateCommand SendNotificationCommand { get; } - private async void StartProcess() - { - Guid processId = m_service.AddProcess("Background process"); + public string NotificationMessage + { + get => m_notificationMessage; + set => SetProperty(ref m_notificationMessage, value); + } - for (int i = 0; i <= 100; i += 10) - { - await Task.Delay(500); - m_service.UpdateProgress(processId, i); - } + private async void StartProcess() + { + Guid processId = m_service.AddProcess("Background process"); - m_service.EndProcess(processId, BackgroundProcessResult.Success, "Background process completed."); + for (int i = 0; i <= 100; i += 10) + { + await Task.Delay(500); + m_service.UpdateProgress(processId, i); } + + m_service.EndProcess(processId, BackgroundProcessResult.Success, "Background process completed."); } -} +} \ No newline at end of file diff --git a/Samples/Workspace SDK/BackgroundProcessSample/SampleModule.cs b/Samples/Workspace SDK/BackgroundProcessSample/SampleModule.cs index 7f92fe4..e7ebc3a 100644 --- a/Samples/Workspace SDK/BackgroundProcessSample/SampleModule.cs +++ b/Samples/Workspace SDK/BackgroundProcessSample/SampleModule.cs @@ -5,26 +5,25 @@ // Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -namespace Genetec.Dap.CodeSamples -{ - using Sdk; - using Sdk.Workspace.Modules; - using Sdk.Workspace.Tasks; +namespace Genetec.Dap.CodeSamples; + +using Sdk; +using Sdk.Workspace.Modules; +using Sdk.Workspace.Tasks; - public sealed class SampleModule : Module +public sealed class SampleModule : Module +{ + public override void Load() { - public override void Load() + if (Workspace.ApplicationType == ApplicationType.SecurityDesk) { - if (Workspace.ApplicationType == ApplicationType.SecurityDesk) - { - var task = new CreatePageTask(true); - task.Initialize(Workspace); - Workspace.Tasks.Register(task); - } + var task = new CreatePageTask(true); + task.Initialize(Workspace); + Workspace.Tasks.Register(task); } + } - public override void Unload() - { - } + public override void Unload() + { } } \ No newline at end of file diff --git a/Samples/Workspace SDK/BadgePrinterSample/SampleBadgePrinter.cs b/Samples/Workspace SDK/BadgePrinterSample/SampleBadgePrinter.cs index 775a96c..0ce15d2 100644 --- a/Samples/Workspace SDK/BadgePrinterSample/SampleBadgePrinter.cs +++ b/Samples/Workspace SDK/BadgePrinterSample/SampleBadgePrinter.cs @@ -5,56 +5,55 @@ // Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -namespace Genetec.Dap.CodeSamples +namespace Genetec.Dap.CodeSamples; + +using System; +using System.Windows.Controls; +using Genetec.Sdk.Workspace.Services; +using Genetec.Sdk.Entities; +using Genetec.Sdk.Workspace.Components.BadgePrinter; + +internal class SampleBadgePrinter : BadgePrinter { - using System; - using System.Windows.Controls; - using Genetec.Sdk.Workspace.Services; - using Genetec.Sdk.Entities; - using Genetec.Sdk.Workspace.Components.BadgePrinter; + public override string Name => "Badge Printer Sample"; - internal class SampleBadgePrinter : BadgePrinter - { - public override string Name => "Badge Printer Sample"; + public override int Priority => 0; - public override int Priority => 0; + public override Guid UniqueId { get; } = new Guid("9D4B5E78-9DE7-40EA-86C2-E70078DDC8D1"); // Replace with your own unique ID - public override Guid UniqueId { get; } = new Guid("9D4B5E78-9DE7-40EA-86C2-E70078DDC8D1"); // Replace with your own unique ID + public override bool SupportsDecoding => false; - public override bool SupportsDecoding => false; + public override bool SupportsEncoding => false; - public override bool SupportsEncoding => false; + public override bool Print(Guid credential, Guid badge, Guid cardholderGuid) + { + var credentialEntity = (Credential)Workspace.Sdk.GetEntity(credential); + var cardholder = (Cardholder)Workspace.Sdk.GetEntity(cardholderGuid); - public override bool Print(Guid credential, Guid badge, Guid cardholderGuid) + var printDialog = new PrintDialog(); + if (printDialog.ShowDialog() == true) { - var credentialEntity = (Credential)Workspace.Sdk.GetEntity(credential); - var cardholder = (Cardholder)Workspace.Sdk.GetEntity(cardholderGuid); - - var printDialog = new PrintDialog(); - if (printDialog.ShowDialog() == true) - { - var notificationService = Workspace.Services.Get(); + var notificationService = Workspace.Services.Get(); - notificationService.Notify($"Starting print job for {cardholder.Name}'s badge with credential {credentialEntity.Name}..."); + notificationService.Notify($"Starting print job for {cardholder.Name}'s badge with credential {credentialEntity.Name}..."); - IBadgeService service = Workspace.Services.Get(); - var badgeInformation = new BadgeInformation(badge, credential); + IBadgeService service = Workspace.Services.Get(); + var badgeInformation = new BadgeInformation(badge, credential); - service.BeginPrint(badgeInformation, printDialog, asyncResult => - { - service.EndPrint(asyncResult); - notificationService.Notify($"Print job for {cardholder.Name}'s badge with credential {credentialEntity.Name} completed successfully."); - }, null); - } - else + service.BeginPrint(badgeInformation, printDialog, asyncResult => { - // Notify the user that the print dialog was cancelled - var notificationService = Workspace.Services.Get(); - notificationService.Notify($"Print job for {cardholder.Name}'s badge with credential {credentialEntity.Name} was cancelled."); - return false; - } - - return true; + service.EndPrint(asyncResult); + notificationService.Notify($"Print job for {cardholder.Name}'s badge with credential {credentialEntity.Name} completed successfully."); + }, null); } + else + { + // Notify the user that the print dialog was cancelled + var notificationService = Workspace.Services.Get(); + notificationService.Notify($"Print job for {cardholder.Name}'s badge with credential {credentialEntity.Name} was cancelled."); + return false; + } + + return true; } -} +} \ No newline at end of file diff --git a/Samples/Workspace SDK/BadgePrinterSample/SampleModule.cs b/Samples/Workspace SDK/BadgePrinterSample/SampleModule.cs index abb1e08..2234b88 100644 --- a/Samples/Workspace SDK/BadgePrinterSample/SampleModule.cs +++ b/Samples/Workspace SDK/BadgePrinterSample/SampleModule.cs @@ -5,21 +5,20 @@ // Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -namespace Genetec.Dap.CodeSamples -{ - using Genetec.Sdk.Workspace.Modules; +namespace Genetec.Dap.CodeSamples; + +using Genetec.Sdk.Workspace.Modules; - public class SampleModule : Module +public class SampleModule : Module +{ + public override void Load() { - public override void Load() - { - var component = new SampleBadgePrinter(); - component.Initialize(Workspace); - Workspace.Components.Register(component); - } + var component = new SampleBadgePrinter(); + component.Initialize(Workspace); + Workspace.Components.Register(component); + } - public override void Unload() - { - } + public override void Unload() + { } } \ No newline at end of file diff --git a/Samples/Workspace SDK/CardholderCredentialReaderSample/CredentialFormatComparer.cs b/Samples/Workspace SDK/CardholderCredentialReaderSample/CredentialFormatComparer.cs index 793040f..370e143 100644 --- a/Samples/Workspace SDK/CardholderCredentialReaderSample/CredentialFormatComparer.cs +++ b/Samples/Workspace SDK/CardholderCredentialReaderSample/CredentialFormatComparer.cs @@ -1,23 +1,22 @@ // Copyright (C) 2024 by Genetec, Inc. All rights reserved. // May be used only in accordance with a valid Source Code License Agreement. -namespace Genetec.Dap.CodeSamples -{ - using System.Collections.Generic; - using Sdk.Credentials; +namespace Genetec.Dap.CodeSamples; - public class CredentialFormatComparer : IEqualityComparer - { - public bool Equals(CredentialFormat x, CredentialFormat y) - { - if (ReferenceEquals(x, y)) return true; - if (ReferenceEquals(x, null)) return false; - if (ReferenceEquals(y, null)) return false; - if (x.GetType() != y.GetType()) return false; +using System.Collections.Generic; +using Sdk.Credentials; - return x.UniqueId == y.UniqueId; - } +public class CredentialFormatComparer : IEqualityComparer +{ + public bool Equals(CredentialFormat x, CredentialFormat y) + { + if (ReferenceEquals(x, y)) return true; + if (ReferenceEquals(x, null)) return false; + if (ReferenceEquals(y, null)) return false; + if (x.GetType() != y.GetType()) return false; - public int GetHashCode(CredentialFormat obj) => obj.UniqueId.GetHashCode(); + return x.UniqueId == y.UniqueId; } + + public int GetHashCode(CredentialFormat obj) => obj.UniqueId.GetHashCode(); } \ No newline at end of file diff --git a/Samples/Workspace SDK/CardholderCredentialReaderSample/CredentialReaderView.xaml.cs b/Samples/Workspace SDK/CardholderCredentialReaderSample/CredentialReaderView.xaml.cs index 7f3b606..009214c 100644 --- a/Samples/Workspace SDK/CardholderCredentialReaderSample/CredentialReaderView.xaml.cs +++ b/Samples/Workspace SDK/CardholderCredentialReaderSample/CredentialReaderView.xaml.cs @@ -1,16 +1,15 @@ // Copyright (C) 2023 by Genetec, Inc. All rights reserved. // May be used only in accordance with a valid Source Code License Agreement. -namespace Genetec.Dap.CodeSamples -{ - using System.Windows.Controls; +namespace Genetec.Dap.CodeSamples; + +using System.Windows.Controls; - public partial class CredentialReaderView : UserControl +public partial class CredentialReaderView : UserControl +{ + public CredentialReaderView(SampleCardholderCredentialReader credentialReader) { - public CredentialReaderView(SampleCardholderCredentialReader credentialReader) - { - DataContext = credentialReader; - InitializeComponent(); - } + DataContext = credentialReader; + InitializeComponent(); } -} +} \ No newline at end of file diff --git a/Samples/Workspace SDK/CardholderCredentialReaderSample/SampleCardholderCredentialReader.cs b/Samples/Workspace SDK/CardholderCredentialReaderSample/SampleCardholderCredentialReader.cs index 571c467..18ed2f7 100644 --- a/Samples/Workspace SDK/CardholderCredentialReaderSample/SampleCardholderCredentialReader.cs +++ b/Samples/Workspace SDK/CardholderCredentialReaderSample/SampleCardholderCredentialReader.cs @@ -1,133 +1,132 @@ // Copyright (C) 2024 by Genetec, Inc. All rights reserved. // May be used only in accordance with a valid Source Code License Agreement. -namespace Genetec.Dap.CodeSamples +namespace Genetec.Dap.CodeSamples; + +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Linq; +using System.Runtime.CompilerServices; +using System.Threading.Tasks; +using System.Windows; +using Prism.Commands; +using Sdk; +using Sdk.Credentials; +using Sdk.Entities; +using Sdk.Queries; +using Sdk.Workspace.Components.CredentialReader; + +public class SampleCardholderCredentialReader : CardholderCredentialReader, INotifyPropertyChanged { - using System; - using System.Collections.Generic; - using System.ComponentModel; - using System.Data; - using System.Linq; - using System.Runtime.CompilerServices; - using System.Threading.Tasks; - using System.Windows; - using Prism.Commands; - using Sdk; - using Sdk.Credentials; - using Sdk.Entities; - using Sdk.Queries; - using Sdk.Workspace.Components.CredentialReader; - - public class SampleCardholderCredentialReader : CardholderCredentialReader, INotifyPropertyChanged - { - private int m_facilityCode; + private int m_facilityCode; - private int m_quantity; + private int m_quantity; - private int m_startNumber; + private int m_startNumber; - public SampleCardholderCredentialReader() + public SampleCardholderCredentialReader() + { + GenerateCommand = new DelegateCommand(async () => { - GenerateCommand = new DelegateCommand(async () => - { - List formats = Enumerable.Range(StartNumber, Quantity).Select(i => new WiegandStandardCredentialFormat(FacilityCode, i)).ToList(); + List formats = Enumerable.Range(StartNumber, Quantity).Select(i => new WiegandStandardCredentialFormat(FacilityCode, i)).ToList(); - var query = (CredentialConfigurationQuery)Workspace.Sdk.ReportManager.CreateReportQuery(ReportType.CredentialConfiguration); + var query = (CredentialConfigurationQuery)Workspace.Sdk.ReportManager.CreateReportQuery(ReportType.CredentialConfiguration); - foreach (WiegandStandardCredentialFormat format in formats) - { - query.UniqueIds.Add(format); - } + foreach (WiegandStandardCredentialFormat format in formats) + { + query.UniqueIds.Add(format); + } - QueryCompletedEventArgs result = await Task.Factory.FromAsync(query.BeginQuery, query.EndQuery, null); - var existing = result.Data.AsEnumerable().Select(row => row.Field(nameof(Guid))); + QueryCompletedEventArgs result = await Task.Factory.FromAsync(query.BeginQuery, query.EndQuery, null); + var existing = result.Data.AsEnumerable().Select(row => row.Field(nameof(Guid))); - foreach (Guid entityId in existing) - { - OnExistingCredentialRetrieved(new ExistingCredentialRetrievedEventArgs(entityId)); - } + foreach (Guid entityId in existing) + { + OnExistingCredentialRetrieved(new ExistingCredentialRetrievedEventArgs(entityId)); + } - var missing = formats - .Except(existing.Select(Workspace.Sdk.GetEntity).OfType().Select(credential => credential.Format), new CredentialFormatComparer()) - .OfType(); + var missing = formats + .Except(existing.Select(Workspace.Sdk.GetEntity).OfType().Select(credential => credential.Format), new CredentialFormatComparer()) + .OfType(); - await Workspace.Sdk.TransactionManager.ExecuteTransactionAsync(() => + await Workspace.Sdk.TransactionManager.ExecuteTransactionAsync(() => + { + foreach (WiegandStandardCredentialFormat format in missing) { - foreach (WiegandStandardCredentialFormat format in missing) - { - Dispatcher.Invoke(() => OnCredentialRetrieved(new CredentialRetrievedEventArgs(format))); - } - }); + Dispatcher.Invoke(() => OnCredentialRetrieved(new CredentialRetrievedEventArgs(format))); + } }); - } + }); + } - public override string Name => nameof(SampleCardholderCredentialReader); + public override string Name => nameof(SampleCardholderCredentialReader); - public override Guid UniqueId { get; } = new Guid("9B28081F-206B-41D4-AC26-B358DD9573EF"); + public override Guid UniqueId { get; } = new Guid("9B28081F-206B-41D4-AC26-B358DD9573EF"); - public override bool IsValid => true; + public override bool IsValid => true; - public override OperationMode OperationMode { get; set; } + public override OperationMode OperationMode { get; set; } - public int StartNumber - { - get => m_startNumber; - set => SetProperty(ref m_startNumber, value); - } + public int StartNumber + { + get => m_startNumber; + set => SetProperty(ref m_startNumber, value); + } - public int FacilityCode - { - get => m_facilityCode; - set => SetProperty(ref m_facilityCode, value); - } + public int FacilityCode + { + get => m_facilityCode; + set => SetProperty(ref m_facilityCode, value); + } - public int Quantity - { - get => m_quantity; - set => SetProperty(ref m_quantity, value); - } + public int Quantity + { + get => m_quantity; + set => SetProperty(ref m_quantity, value); + } - public DelegateCommand GenerateCommand { get; } + public DelegateCommand GenerateCommand { get; } - public event PropertyChangedEventHandler PropertyChanged; + public event PropertyChangedEventHandler PropertyChanged; - public override void Dispose() - { - } + public override void Dispose() + { + } - public override void Activate() - { - } + public override void Activate() + { + } - public override UIElement CreateView() - { - return new CredentialReaderView(this); - } + public override UIElement CreateView() + { + return new CredentialReaderView(this); + } - public override void Deactivate() - { - } + public override void Deactivate() + { + } - public override bool SupportsOperationMode(OperationMode mode) - { - return mode != OperationMode.Retrieval; - } + public override bool SupportsOperationMode(OperationMode mode) + { + return mode != OperationMode.Retrieval; + } - private bool SetProperty(ref T storage, T value, [CallerMemberName] string propertyName = null) - { - if (Equals(storage, value)) - return false; + private bool SetProperty(ref T storage, T value, [CallerMemberName] string propertyName = null) + { + if (Equals(storage, value)) + return false; - storage = value; - OnPropertyChanged(propertyName); + storage = value; + OnPropertyChanged(propertyName); - return true; - } + return true; + } - private void OnPropertyChanged([CallerMemberName] string propertyName = null) - { - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); - } + private void OnPropertyChanged([CallerMemberName] string propertyName = null) + { + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); } } \ No newline at end of file diff --git a/Samples/Workspace SDK/CardholderCredentialReaderSample/SampleModule.cs b/Samples/Workspace SDK/CardholderCredentialReaderSample/SampleModule.cs index 6659a84..409516b 100644 --- a/Samples/Workspace SDK/CardholderCredentialReaderSample/SampleModule.cs +++ b/Samples/Workspace SDK/CardholderCredentialReaderSample/SampleModule.cs @@ -1,21 +1,20 @@ // Copyright (C) 2023 by Genetec, Inc. All rights reserved. // May be used only in accordance with a valid Source Code License Agreement. -namespace Genetec.Dap.CodeSamples -{ - using Sdk.Workspace.Modules; +namespace Genetec.Dap.CodeSamples; + +using Sdk.Workspace.Modules; - public class SampleModule : Module +public class SampleModule : Module +{ + public override void Load() { - public override void Load() - { - var component = new SampleCardholderCredentialReader(); - component.Initialize(Workspace); - Workspace.Components.Register(component); - } + var component = new SampleCardholderCredentialReader(); + component.Initialize(Workspace); + Workspace.Components.Register(component); + } - public override void Unload() - { - } + public override void Unload() + { } } \ No newline at end of file diff --git a/Samples/Workspace SDK/CardholderFieldsExtractorSample/SampleCardholderFieldsExtractor.cs b/Samples/Workspace SDK/CardholderFieldsExtractorSample/SampleCardholderFieldsExtractor.cs index ce6d438..00f27d2 100644 --- a/Samples/Workspace SDK/CardholderFieldsExtractorSample/SampleCardholderFieldsExtractor.cs +++ b/Samples/Workspace SDK/CardholderFieldsExtractorSample/SampleCardholderFieldsExtractor.cs @@ -1,44 +1,43 @@ // Copyright (C) 2024 by Genetec, Inc. All rights reserved. // May be used only in accordance with a valid Source Code License Agreement. -namespace Genetec.Dap.CodeSamples -{ - using System; - using System.Linq; - using Microsoft.Win32; - using Sdk.Workspace.Components.CardholderFieldsExtractor; +namespace Genetec.Dap.CodeSamples; - public class SampleCardholderFieldsExtractor : CardholderFieldsExtractor - { - public override string Name => "Read vCard..."; +using System; +using System.Linq; +using Microsoft.Win32; +using Sdk.Workspace.Components.CardholderFieldsExtractor; - public override Guid UniqueId { get; } = new Guid("88F33E43-1E51-4504-95BF-ADD2FBCBA8AD"); +public class SampleCardholderFieldsExtractor : CardholderFieldsExtractor +{ + public override string Name => "Read vCard..."; - public override CardholderFields GetFields(CardholderFieldsExtractorData data) + public override Guid UniqueId { get; } = new Guid("88F33E43-1E51-4504-95BF-ADD2FBCBA8AD"); + + public override CardholderFields GetFields(CardholderFieldsExtractorData data) + { + var openFileDialog = new OpenFileDialog { - var openFileDialog = new OpenFileDialog - { - Filter = "vCard files (*.vcf)|*.vcf|All files (*.*)|*.*", - Title = "Open vCard File" - }; + Filter = "vCard files (*.vcf)|*.vcf|All files (*.*)|*.*", + Title = "Open vCard File" + }; - if (openFileDialog.ShowDialog() == true) + if (openFileDialog.ShowDialog() == true) + { + VCard vCardInfo = VCardReader.ReadVCard(openFileDialog.FileName); + if (vCardInfo != null) { - VCard vCardInfo = VCardReader.ReadVCard(openFileDialog.FileName); - if (vCardInfo != null) + return new CardholderFields { - return new CardholderFields - { - FirstName = vCardInfo.FirstName, - LastName = vCardInfo.LastName, - Email = vCardInfo.Emails.FirstOrDefault(), - Picture = vCardInfo.Picture, - Description = vCardInfo.Note - }; - } + FirstName = vCardInfo.FirstName, + LastName = vCardInfo.LastName, + Email = vCardInfo.Emails.FirstOrDefault(), + Picture = vCardInfo.Picture, + Description = vCardInfo.Note + }; } - - return null; } + + return null; } } \ No newline at end of file diff --git a/Samples/Workspace SDK/CardholderFieldsExtractorSample/SampleModule.cs b/Samples/Workspace SDK/CardholderFieldsExtractorSample/SampleModule.cs index 8588996..8bd049f 100644 --- a/Samples/Workspace SDK/CardholderFieldsExtractorSample/SampleModule.cs +++ b/Samples/Workspace SDK/CardholderFieldsExtractorSample/SampleModule.cs @@ -1,21 +1,20 @@ // Copyright (C) 2023 by Genetec, Inc. All rights reserved. // May be used only in accordance with a valid Source Code License Agreement. -namespace Genetec.Dap.CodeSamples -{ - using Sdk.Workspace.Modules; +namespace Genetec.Dap.CodeSamples; + +using Sdk.Workspace.Modules; - public class SampleModule : Module +public class SampleModule : Module +{ + public override void Load() { - public override void Load() - { - var component = new SampleCardholderFieldsExtractor(); - component.Initialize(Workspace); - Workspace.Components.Register(component); - } + var component = new SampleCardholderFieldsExtractor(); + component.Initialize(Workspace); + Workspace.Components.Register(component); + } - public override void Unload() - { - } + public override void Unload() + { } } \ No newline at end of file diff --git a/Samples/Workspace SDK/CardholderFieldsExtractorSample/VCard.cs b/Samples/Workspace SDK/CardholderFieldsExtractorSample/VCard.cs index 015f3f0..18d3a1f 100644 --- a/Samples/Workspace SDK/CardholderFieldsExtractorSample/VCard.cs +++ b/Samples/Workspace SDK/CardholderFieldsExtractorSample/VCard.cs @@ -1,21 +1,20 @@ // Copyright (C) 2023 by Genetec, Inc. All rights reserved. // May be used only in accordance with a valid Source Code License Agreement. -namespace Genetec.Dap.CodeSamples -{ - using System.Collections.Generic; - using System.Windows.Media; +namespace Genetec.Dap.CodeSamples; + +using System.Collections.Generic; +using System.Windows.Media; - public class VCard - { - public string FirstName { get; set; } +public class VCard +{ + public string FirstName { get; set; } - public string LastName { get; set; } + public string LastName { get; set; } - public List Emails { get; } = new List(); + public List Emails { get; } = new List(); - public string Note { get; set; } + public string Note { get; set; } - public ImageSource Picture { get; set; } - } + public ImageSource Picture { get; set; } } \ No newline at end of file diff --git a/Samples/Workspace SDK/CardholderFieldsExtractorSample/VCardReader.cs b/Samples/Workspace SDK/CardholderFieldsExtractorSample/VCardReader.cs index a8f1a7a..84354ee 100644 --- a/Samples/Workspace SDK/CardholderFieldsExtractorSample/VCardReader.cs +++ b/Samples/Workspace SDK/CardholderFieldsExtractorSample/VCardReader.cs @@ -1,63 +1,62 @@ // Copyright (C) 2023 by Genetec, Inc. All rights reserved. // May be used only in accordance with a valid Source Code License Agreement. -namespace Genetec.Dap.CodeSamples +namespace Genetec.Dap.CodeSamples; + +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text.RegularExpressions; +using System.Windows.Media; +using System.Windows.Media.Imaging; + +public class VCardReader { - using System; - using System.Collections.Generic; - using System.IO; - using System.Linq; - using System.Text.RegularExpressions; - using System.Windows.Media; - using System.Windows.Media.Imaging; - - public class VCardReader + public static VCard ReadVCard(string filePath) { - public static VCard ReadVCard(string filePath) + string vCardText = File.ReadAllText(filePath); + var vcard = new VCard { - string vCardText = File.ReadAllText(filePath); - var vcard = new VCard - { - FirstName = ExtractField(vCardText, "FN:"), - LastName = ExtractField(vCardText, "N:").Split(';')[0], // Assuming last name is the first component in the N: field - Note = ExtractField(vCardText, "NOTE:"), - Picture = ExtractPhoto(vCardText) - }; - - vcard.Emails.AddRange(ExtractEmails(vCardText)); - return vcard; - } + FirstName = ExtractField(vCardText, "FN:"), + LastName = ExtractField(vCardText, "N:").Split(';')[0], // Assuming last name is the first component in the N: field + Note = ExtractField(vCardText, "NOTE:"), + Picture = ExtractPhoto(vCardText) + }; + + vcard.Emails.AddRange(ExtractEmails(vCardText)); + return vcard; + } - private static string ExtractField(string vCardText, string fieldName) - { - Match match = Regex.Match(vCardText, $"{fieldName}(.*?)(\n(?![ \t])|\r\n(?![ \t])|$)", RegexOptions.Singleline); - return match.Success ? match.Groups[1].Value.Trim() : string.Empty; - } + private static string ExtractField(string vCardText, string fieldName) + { + Match match = Regex.Match(vCardText, $"{fieldName}(.*?)(\n(?![ \t])|\r\n(?![ \t])|$)", RegexOptions.Singleline); + return match.Success ? match.Groups[1].Value.Trim() : string.Empty; + } - private static List ExtractEmails(string vCardText) - { - MatchCollection matches = Regex.Matches(vCardText, "EMAIL;[^:]+:(.*?)\r?\n"); - return matches.Cast().Select(match => match.Groups[1].Value.Trim()).ToList(); - } + private static List ExtractEmails(string vCardText) + { + MatchCollection matches = Regex.Matches(vCardText, "EMAIL;[^:]+:(.*?)\r?\n"); + return matches.Cast().Select(match => match.Groups[1].Value.Trim()).ToList(); + } - private static ImageSource ExtractPhoto(string vCardText) + private static ImageSource ExtractPhoto(string vCardText) + { + Match photoMatch = Regex.Match(vCardText, @"PHOTO;ENCODING=b;TYPE=image/jpeg:(.*?)(\n(?![ \t])|\r\n(?![ \t])|$)", RegexOptions.Singleline); + if (photoMatch.Success) { - Match photoMatch = Regex.Match(vCardText, @"PHOTO;ENCODING=b;TYPE=image/jpeg:(.*?)(\n(?![ \t])|\r\n(?![ \t])|$)", RegexOptions.Singleline); - if (photoMatch.Success) - { - string base64Data = photoMatch.Groups[1].Value.Trim().Replace("\n", "").Replace("\r", ""); - - using var stream = new MemoryStream(Convert.FromBase64String(base64Data)); - var bitmap = new BitmapImage(); - bitmap.BeginInit(); - bitmap.StreamSource = stream; - bitmap.CacheOption = BitmapCacheOption.OnLoad; - bitmap.EndInit(); - bitmap.Freeze(); - return bitmap; - } - - return null; + string base64Data = photoMatch.Groups[1].Value.Trim().Replace("\n", "").Replace("\r", ""); + + using var stream = new MemoryStream(Convert.FromBase64String(base64Data)); + var bitmap = new BitmapImage(); + bitmap.BeginInit(); + bitmap.StreamSource = stream; + bitmap.CacheOption = BitmapCacheOption.OnLoad; + bitmap.EndInit(); + bitmap.Freeze(); + return bitmap; } + + return null; } } \ No newline at end of file diff --git a/Samples/Workspace SDK/CommandManagerSample/CommandManagerSampleModule.cs b/Samples/Workspace SDK/CommandManagerSample/CommandManagerSampleModule.cs index e081448..5e04ab9 100644 --- a/Samples/Workspace SDK/CommandManagerSample/CommandManagerSampleModule.cs +++ b/Samples/Workspace SDK/CommandManagerSample/CommandManagerSampleModule.cs @@ -1,62 +1,61 @@ // Copyright (C) 2024 by Genetec, Inc. All rights reserved. // May be used only in accordance with a valid Source Code License Agreement. -namespace Genetec.Dap.CodeSamples +namespace Genetec.Dap.CodeSamples; + +using Genetec.Sdk; +using Genetec.Sdk.Diagnostics.Logging.Core; +using Genetec.Sdk.Workspace.Commands; +using Genetec.Sdk.Workspace.Modules; + +public class CommandManagerSampleModule : Module { - using Genetec.Sdk; - using Genetec.Sdk.Diagnostics.Logging.Core; - using Genetec.Sdk.Workspace.Commands; - using Genetec.Sdk.Workspace.Modules; + private Logger m_logger; - public class CommandManagerSampleModule : Module + public override void Load() { - private Logger m_logger; - - public override void Load() - { - m_logger = Logger.CreateInstanceLogger(this); + m_logger = Logger.CreateInstanceLogger(this); - Workspace.Commands.Evaluating += OnCommandsOnEvaluating; - Workspace.Commands.Evaluated += OnCommandsOnEvaluated; - Workspace.Commands.Executing += OnCommandsOnExecuting; - Workspace.Commands.Executed += OnCommandsOnExecuted; - Workspace.Commands.Invalidated += OnInvalidated; - } - - private void OnCommandsOnExecuted(object sender, ExecutedEventArgs e) - { - m_logger.TraceDebug($"Command executed: {e.Command.Name}, Parameter {e.Parameter}"); - } - - private void OnCommandsOnExecuting(object sender, CommandCancelExecutionEventArgs e) - { - m_logger.TraceDebug($"Command executing: {e.Command.Name}, Parameter {e.Parameter}"); - } - - private void OnCommandsOnEvaluated(object sender, EvaluatedEventArgs e) - { - m_logger.TraceDebug($"Command evaluated: {e.Command.Name}, Parameter {e.Parameter}"); - } - - private void OnCommandsOnEvaluating(object sender, CommandCancelExecutionEventArgs e) - { - m_logger.TraceDebug($"Command evaluating: {e.Command.Name}, Parameter {e.Parameter}"); - } - - private void OnInvalidated(object sender, CommandEventArgs e) - { - m_logger.TraceDebug($"Command invalidated: {e.Command.Name}"); - } - - public override void Unload() - { - Workspace.Commands.Evaluating -= OnCommandsOnEvaluating; - Workspace.Commands.Evaluated -= OnCommandsOnEvaluated; - Workspace.Commands.Executing -= OnCommandsOnExecuting; - Workspace.Commands.Executed -= OnCommandsOnExecuted; - Workspace.Commands.Executed -= OnInvalidated; + Workspace.Commands.Evaluating += OnCommandsOnEvaluating; + Workspace.Commands.Evaluated += OnCommandsOnEvaluated; + Workspace.Commands.Executing += OnCommandsOnExecuting; + Workspace.Commands.Executed += OnCommandsOnExecuted; + Workspace.Commands.Invalidated += OnInvalidated; + } + + private void OnCommandsOnExecuted(object sender, ExecutedEventArgs e) + { + m_logger.TraceDebug($"Command executed: {e.Command.Name}, Parameter {e.Parameter}"); + } + + private void OnCommandsOnExecuting(object sender, CommandCancelExecutionEventArgs e) + { + m_logger.TraceDebug($"Command executing: {e.Command.Name}, Parameter {e.Parameter}"); + } + + private void OnCommandsOnEvaluated(object sender, EvaluatedEventArgs e) + { + m_logger.TraceDebug($"Command evaluated: {e.Command.Name}, Parameter {e.Parameter}"); + } + + private void OnCommandsOnEvaluating(object sender, CommandCancelExecutionEventArgs e) + { + m_logger.TraceDebug($"Command evaluating: {e.Command.Name}, Parameter {e.Parameter}"); + } + + private void OnInvalidated(object sender, CommandEventArgs e) + { + m_logger.TraceDebug($"Command invalidated: {e.Command.Name}"); + } + + public override void Unload() + { + Workspace.Commands.Evaluating -= OnCommandsOnEvaluating; + Workspace.Commands.Evaluated -= OnCommandsOnEvaluated; + Workspace.Commands.Executing -= OnCommandsOnExecuting; + Workspace.Commands.Executed -= OnCommandsOnExecuted; + Workspace.Commands.Executed -= OnInvalidated; - m_logger?.Dispose(); - } + m_logger?.Dispose(); } -} +} \ No newline at end of file diff --git a/Samples/Workspace SDK/ConfigPageSample/AedUnitCustomEntityType.cs b/Samples/Workspace SDK/ConfigPageSample/AedUnitCustomEntityType.cs index c11b560..a6e239d 100644 --- a/Samples/Workspace SDK/ConfigPageSample/AedUnitCustomEntityType.cs +++ b/Samples/Workspace SDK/ConfigPageSample/AedUnitCustomEntityType.cs @@ -5,13 +5,12 @@ // Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -namespace Genetec.Dap.CodeSamples -{ - using System; +namespace Genetec.Dap.CodeSamples; + +using System; - // TODO: Update the GUID in this class with your own custom entity type ID - public static class AedUnitCustomEntityType - { - public static Guid Id { get; } = new("8385D04C-F04A-4125-81E9-D1C66AFDE572"); - } +// TODO: Update the GUID in this class with your own custom entity type ID +public static class AedUnitCustomEntityType +{ + public static Guid Id { get; } = new("8385D04C-F04A-4125-81E9-D1C66AFDE572"); } \ No newline at end of file diff --git a/Samples/Workspace SDK/ConfigPageSample/AedUnitCustomPrivilege.cs b/Samples/Workspace SDK/ConfigPageSample/AedUnitCustomPrivilege.cs index 6cfa22d..e60c31a 100644 --- a/Samples/Workspace SDK/ConfigPageSample/AedUnitCustomPrivilege.cs +++ b/Samples/Workspace SDK/ConfigPageSample/AedUnitCustomPrivilege.cs @@ -5,20 +5,19 @@ // Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -namespace Genetec.Dap.CodeSamples -{ - using System; - using Sdk; +namespace Genetec.Dap.CodeSamples; + +using System; +using Sdk; - // TODO: Update the GUIDs in this class with your own SDK privilege IDs - public static class AedUnitCustomPrivilege - { - public static SdkPrivilege View { get; } = new(new Guid("0896B350-7225-4A53-8DDC-E8365CAE456E")); +// TODO: Update the GUIDs in this class with your own SDK privilege IDs +public static class AedUnitCustomPrivilege +{ + public static SdkPrivilege View { get; } = new(new Guid("0896B350-7225-4A53-8DDC-E8365CAE456E")); - public static SdkPrivilege Modify { get; } = new(new Guid("1938B316-B651-43B7-96B1-B94C3FDBB756")); + public static SdkPrivilege Modify { get; } = new(new Guid("1938B316-B651-43B7-96B1-B94C3FDBB756")); - public static SdkPrivilege Add { get; } = new(new Guid("0707B77A-1091-4AEB-877E-30EAA80E9626")); + public static SdkPrivilege Add { get; } = new(new Guid("0707B77A-1091-4AEB-877E-30EAA80E9626")); - public static SdkPrivilege Delete { get; } = new(new Guid("6008ECEB-024F-4D4C-BC54-0B8BC8C58D5B")); - } + public static SdkPrivilege Delete { get; } = new(new Guid("6008ECEB-024F-4D4C-BC54-0B8BC8C58D5B")); } \ No newline at end of file diff --git a/Samples/Workspace SDK/ConfigPageSample/AedUnitInformation.cs b/Samples/Workspace SDK/ConfigPageSample/AedUnitInformation.cs index 433d06c..14093ca 100644 --- a/Samples/Workspace SDK/ConfigPageSample/AedUnitInformation.cs +++ b/Samples/Workspace SDK/ConfigPageSample/AedUnitInformation.cs @@ -5,51 +5,50 @@ // Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -namespace Genetec.Dap.CodeSamples -{ - using System; - using System.IO; - using System.Runtime.Serialization; - using System.Xml; +namespace Genetec.Dap.CodeSamples; - [DataContract(Namespace = "")] - public class AedUnitInformation - { - private static readonly DataContractSerializer s_serializer = new(typeof(AedUnitInformation)); +using System; +using System.IO; +using System.Runtime.Serialization; +using System.Xml; - [DataMember] - public DateTime LastInspectionDate { get; set; } +[DataContract(Namespace = "")] +public class AedUnitInformation +{ + private static readonly DataContractSerializer s_serializer = new(typeof(AedUnitInformation)); - [DataMember] - public DateTime NextScheduledMaintenance { get; set; } + [DataMember] + public DateTime LastInspectionDate { get; set; } - [DataMember] - public DateTime BatteryExpirationDate { get; set; } + [DataMember] + public DateTime NextScheduledMaintenance { get; set; } - [DataMember] - public DateTime PadExpirationDate { get; set; } + [DataMember] + public DateTime BatteryExpirationDate { get; set; } - // Deserialize the data from an XML string - public static AedUnitInformation Deserialize(string data) - { - if (string.IsNullOrEmpty(data)) - { - return new AedUnitInformation(); - } - - using var stringReader = new StringReader(data); - using var xmlReader = XmlReader.Create(stringReader); - return (AedUnitInformation)s_serializer.ReadObject(xmlReader); - } + [DataMember] + public DateTime PadExpirationDate { get; set; } - // Serialize the data to an XML string - public string Serialize() + // Deserialize the data from an XML string + public static AedUnitInformation Deserialize(string data) + { + if (string.IsNullOrEmpty(data)) { - using var stringWriter = new StringWriter(); - using var xmlWriter = XmlWriter.Create(stringWriter); - s_serializer.WriteObject(xmlWriter, this); - xmlWriter.Flush(); - return stringWriter.ToString(); + return new AedUnitInformation(); } + + using var stringReader = new StringReader(data); + using var xmlReader = XmlReader.Create(stringReader); + return (AedUnitInformation)s_serializer.ReadObject(xmlReader); + } + + // Serialize the data to an XML string + public string Serialize() + { + using var stringWriter = new StringWriter(); + using var xmlWriter = XmlWriter.Create(stringWriter); + s_serializer.WriteObject(xmlWriter, this); + xmlWriter.Flush(); + return stringWriter.ToString(); } } \ No newline at end of file diff --git a/Samples/Workspace SDK/ConfigPageSample/CustomConfigPage.cs b/Samples/Workspace SDK/ConfigPageSample/CustomConfigPage.cs index 2ebfe2d..a374e80 100644 --- a/Samples/Workspace SDK/ConfigPageSample/CustomConfigPage.cs +++ b/Samples/Workspace SDK/ConfigPageSample/CustomConfigPage.cs @@ -5,148 +5,147 @@ // Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -namespace Genetec.Dap.CodeSamples +namespace Genetec.Dap.CodeSamples; + +using System; +using System.Runtime.CompilerServices; +using System.Windows.Media; +using Sdk; +using Sdk.Entities; +using Sdk.Workspace.Pages; + +internal class CustomConfigPage : ConfigPage { - using System; - using System.Runtime.CompilerServices; - using System.Windows.Media; - using Sdk; - using Sdk.Entities; - using Sdk.Workspace.Pages; - - internal class CustomConfigPage : ConfigPage - { - private DateTime m_batteryExpirationDate; + private DateTime m_batteryExpirationDate; - private CustomEntity m_customEntity; + private CustomEntity m_customEntity; - private DateTime m_lastInspectionDate; + private DateTime m_lastInspectionDate; - private DateTime m_nextScheduledMaintenance; + private DateTime m_nextScheduledMaintenance; - private DateTime m_padExpirationDate; + private DateTime m_padExpirationDate; - // Specify for which entity type this configuration page is intended - protected override EntityType EntityType => EntityType.CustomEntity; + // Specify for which entity type this configuration page is intended + protected override EntityType EntityType => EntityType.CustomEntity; - protected override Guid Entity + protected override Guid Entity + { + set { - set + // Check if the entity is a custom entity of the expected type + if (Workspace.Sdk.GetEntity(value) is CustomEntity entity && entity.CustomEntityType == AedUnitCustomEntityType.Id) + { + m_customEntity = entity; // Store the entity + IsVisible = true; // Show the configuration page + } + else { - // Check if the entity is a custom entity of the expected type - if (Workspace.Sdk.GetEntity(value) is CustomEntity entity && entity.CustomEntityType == AedUnitCustomEntityType.Id) - { - m_customEntity = entity; // Store the entity - IsVisible = true; // Show the configuration page - } - else - { - IsVisible = false; // Hide the configuration page - } + IsVisible = false; // Hide the configuration page } } + } - // A public default constructor is required - public CustomConfigPage() - { - } + // A public default constructor is required + public CustomConfigPage() + { + } - public DateTime LastInspectionDate + public DateTime LastInspectionDate + { + get => m_lastInspectionDate; + set { - get => m_lastInspectionDate; - set + if (SetProperty(ref m_lastInspectionDate, value)) { - if (SetProperty(ref m_lastInspectionDate, value)) - { - IsDirty = true; // Mark the configuration as dirty, triggering the Save button to be enabled - } + IsDirty = true; // Mark the configuration as dirty, triggering the Save button to be enabled } } + } - public DateTime NextScheduledMaintenance + public DateTime NextScheduledMaintenance + { + get => m_nextScheduledMaintenance; + set { - get => m_nextScheduledMaintenance; - set + if (SetProperty(ref m_nextScheduledMaintenance, value)) { - if (SetProperty(ref m_nextScheduledMaintenance, value)) - { - IsDirty = true; // Mark the configuration as dirty, triggering the Save button to be enabled - } + IsDirty = true; // Mark the configuration as dirty, triggering the Save button to be enabled } } + } - public DateTime BatteryExpirationDate + public DateTime BatteryExpirationDate + { + get => m_batteryExpirationDate; + set { - get => m_batteryExpirationDate; - set + if (SetProperty(ref m_batteryExpirationDate, value)) { - if (SetProperty(ref m_batteryExpirationDate, value)) - { - IsDirty = true; // Mark the configuration as dirty, triggering the Save button to be enabled - } + IsDirty = true; // Mark the configuration as dirty, triggering the Save button to be enabled } } + } - public DateTime PadExpirationDate + public DateTime PadExpirationDate + { + get => m_padExpirationDate; + set { - get => m_padExpirationDate; - set + if (SetProperty(ref m_padExpirationDate, value)) { - if (SetProperty(ref m_padExpirationDate, value)) - { - IsDirty = true; // Mark the configuration as dirty, triggering the Save button to be enabled - } + IsDirty = true; // Mark the configuration as dirty, triggering the Save button to be enabled } } + } - protected override string Name => base.Name; // Optional: The name of the configuration page. Default is "Properties". + protected override string Name => base.Name; // Optional: The name of the configuration page. Default is "Properties". - protected override ImageSource Image => base.Image; // Optional: The image of the configuration page. Default is the "Properties" image. + protected override ImageSource Image => base.Image; // Optional: The image of the configuration page. Default is the "Properties" image. - private bool SetProperty(ref T storage, T value, [CallerMemberName] string propertyName = null) + private bool SetProperty(ref T storage, T value, [CallerMemberName] string propertyName = null) + { + if (Equals(storage, value)) { - if (Equals(storage, value)) - { - return false; - } - - storage = value; - OnPropertyChanged(propertyName); - - return true; + return false; } - protected override void Initialize() - { - View = new CustomConfigPageView { DataContext = this }; // Assign the view to the config page and associate it with this view model - } + storage = value; + OnPropertyChanged(propertyName); - // Load the configuration from the custom entity - protected override void Refresh() - { - AedUnitInformation configuration = AedUnitInformation.Deserialize(m_customEntity.Xml); - LastInspectionDate = configuration.LastInspectionDate; - NextScheduledMaintenance = configuration.NextScheduledMaintenance; - BatteryExpirationDate = configuration.BatteryExpirationDate; - PadExpirationDate = configuration.PadExpirationDate; - IsDirty = false; - } + return true; + } - // Validate the configuration before saving - protected override void BeforeSave(bool beforeUnloading, out bool cancelSaveOperation) - { - if (NextScheduledMaintenance <= LastInspectionDate) - { - cancelSaveOperation = true; - } + protected override void Initialize() + { + View = new CustomConfigPageView { DataContext = this }; // Assign the view to the config page and associate it with this view model + } - cancelSaveOperation = false; - } + // Load the configuration from the custom entity + protected override void Refresh() + { + AedUnitInformation configuration = AedUnitInformation.Deserialize(m_customEntity.Xml); + LastInspectionDate = configuration.LastInspectionDate; + NextScheduledMaintenance = configuration.NextScheduledMaintenance; + BatteryExpirationDate = configuration.BatteryExpirationDate; + PadExpirationDate = configuration.PadExpirationDate; + IsDirty = false; + } - // Save the configuration to the custom entity - protected override void Save() + // Validate the configuration before saving + protected override void BeforeSave(bool beforeUnloading, out bool cancelSaveOperation) + { + if (NextScheduledMaintenance <= LastInspectionDate) { - m_customEntity.Xml = new AedUnitInformation { LastInspectionDate = LastInspectionDate, NextScheduledMaintenance = NextScheduledMaintenance, BatteryExpirationDate = BatteryExpirationDate, PadExpirationDate = PadExpirationDate }.Serialize(); + cancelSaveOperation = true; } + + cancelSaveOperation = false; + } + + // Save the configuration to the custom entity + protected override void Save() + { + m_customEntity.Xml = new AedUnitInformation { LastInspectionDate = LastInspectionDate, NextScheduledMaintenance = NextScheduledMaintenance, BatteryExpirationDate = BatteryExpirationDate, PadExpirationDate = PadExpirationDate }.Serialize(); } } \ No newline at end of file diff --git a/Samples/Workspace SDK/ConfigPageSample/CustomConfigPageView.xaml.cs b/Samples/Workspace SDK/ConfigPageSample/CustomConfigPageView.xaml.cs index 1080948..8c37e19 100644 --- a/Samples/Workspace SDK/ConfigPageSample/CustomConfigPageView.xaml.cs +++ b/Samples/Workspace SDK/ConfigPageSample/CustomConfigPageView.xaml.cs @@ -5,15 +5,14 @@ // Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -namespace Genetec.Dap.CodeSamples -{ - using System.Windows.Controls; +namespace Genetec.Dap.CodeSamples; + +using System.Windows.Controls; - public partial class CustomConfigPageView : UserControl +public partial class CustomConfigPageView : UserControl +{ + public CustomConfigPageView() { - public CustomConfigPageView() - { - InitializeComponent(); - } + InitializeComponent(); } -} +} \ No newline at end of file diff --git a/Samples/Workspace SDK/ConfigPageSample/SampleModule.cs b/Samples/Workspace SDK/ConfigPageSample/SampleModule.cs index d70bf4a..9228b12 100644 --- a/Samples/Workspace SDK/ConfigPageSample/SampleModule.cs +++ b/Samples/Workspace SDK/ConfigPageSample/SampleModule.cs @@ -5,149 +5,148 @@ // Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -namespace Genetec.Dap.CodeSamples -{ - using System; - using System.Collections.Generic; - using System.Windows.Media.Imaging; - using Genetec.Sdk.Privileges; - using Properties; - using Sdk; - using Sdk.Entities; - using Sdk.Workspace.Modules; - using Sdk.Workspace.Services; +namespace Genetec.Dap.CodeSamples; + +using System; +using System.Collections.Generic; +using System.Windows.Media.Imaging; +using Genetec.Sdk.Privileges; +using Properties; +using Sdk; +using Sdk.Entities; +using Sdk.Workspace.Modules; +using Sdk.Workspace.Services; - public class SampleModule : Module +public class SampleModule : Module +{ + public override void Load() { - public override void Load() + if (Workspace.ApplicationType is ApplicationType.ConfigTool) { - if (Workspace.ApplicationType is ApplicationType.ConfigTool) + Workspace.Sdk.LoggedOn += (sender, e) => { - Workspace.Sdk.LoggedOn += (sender, e) => + if (Workspace.Sdk.LoggedUser.IsAdministrator) { - if (Workspace.Sdk.LoggedUser.IsAdministrator) - { - CreateCustomPrivileges(); - CreateDeviceCustomEntity(); - } - }; + CreateCustomPrivileges(); + CreateDeviceCustomEntity(); + } + }; - // Initialize and register the custom configuration page - var page = new CustomConfigPage(); - page.Initialize(Workspace); - Workspace.Services.Get().Register(page); - } + // Initialize and register the custom configuration page + var page = new CustomConfigPage(); + page.Initialize(Workspace); + Workspace.Services.Get().Register(page); } + } - private void CreateDeviceCustomEntity() - { - var config = (SystemConfiguration)Workspace.Sdk.GetEntity(SystemConfiguration.SystemConfigurationGuid); + private void CreateDeviceCustomEntity() + { + var config = (SystemConfiguration)Workspace.Sdk.GetEntity(SystemConfiguration.SystemConfigurationGuid); - var capabilities = CustomEntityTypeCapabilities.CanBeFederated | - CustomEntityTypeCapabilities.IsVisible | - CustomEntityTypeCapabilities.MaintenanceMode | - CustomEntityTypeCapabilities.CreateDelete | - CustomEntityTypeCapabilities.MapSupport; + var capabilities = CustomEntityTypeCapabilities.CanBeFederated | + CustomEntityTypeCapabilities.IsVisible | + CustomEntityTypeCapabilities.MaintenanceMode | + CustomEntityTypeCapabilities.CreateDelete | + CustomEntityTypeCapabilities.MapSupport; - var descriptor = new CustomEntityTypeDescriptor(AedUnitCustomEntityType.Id, Resources.CustomEntityTypeName, - capabilities, new Version(1, 0)) + var descriptor = new CustomEntityTypeDescriptor(AedUnitCustomEntityType.Id, Resources.CustomEntityTypeName, + capabilities, new Version(1, 0)) + { + ViewPrivilege = AedUnitCustomPrivilege.View, + ModifyPrivilege = AedUnitCustomPrivilege.Modify, + AddPrivilege = AedUnitCustomPrivilege.Add, + DeletePrivilege = AedUnitCustomPrivilege.Delete, + SmallIcon = new BitmapImage(new Uri("pack://application:,,,/ConfigPageSample;component/Resources/Images/SmallLogo.png")), + LargeIcon = new BitmapImage(new Uri("pack://application:,,,/ConfigPageSample;component/Resources/Images/SmallLogo.png")), + NameKey = nameof(Resources.CustomEntityTypeName), + ResourceManagerTypeName = nameof(Resources), + HierarchicalChildTypes = new List { EntityType.Camera }, + AuditableProperties = new List { - ViewPrivilege = AedUnitCustomPrivilege.View, - ModifyPrivilege = AedUnitCustomPrivilege.Modify, - AddPrivilege = AedUnitCustomPrivilege.Add, - DeletePrivilege = AedUnitCustomPrivilege.Delete, - SmallIcon = new BitmapImage(new Uri("pack://application:,,,/ConfigPageSample;component/Resources/Images/SmallLogo.png")), - LargeIcon = new BitmapImage(new Uri("pack://application:,,,/ConfigPageSample;component/Resources/Images/SmallLogo.png")), - NameKey = nameof(Resources.CustomEntityTypeName), - ResourceManagerTypeName = nameof(Resources), - HierarchicalChildTypes = new List { EntityType.Camera }, - AuditableProperties = new List + new() + { + Hints = AuditPropertyHints.Xml, + Name = "Last inspection date", + NameKey = "LastInspectionDate", + Path = "AedUnitInformation/LastInspectionDate", + SourceProperty = AuditPropertySource.Xml + }, + new() + { + Hints = AuditPropertyHints.Xml, + Name = "Next scheduled maintenance", + NameKey = "NextScheduledMaintenance", + Path = "AedUnitInformation/NextScheduledMaintenance", + SourceProperty = AuditPropertySource.Xml + }, + new() + { + Hints = AuditPropertyHints.Xml, + Name = "Battery expiration date", + NameKey = "BatteryExpirationDate", + Path = "AedUnitInformation/BatteryExpirationDate", + SourceProperty = AuditPropertySource.Xml + }, + new() { - new() - { - Hints = AuditPropertyHints.Xml, - Name = "Last inspection date", - NameKey = "LastInspectionDate", - Path = "AedUnitInformation/LastInspectionDate", - SourceProperty = AuditPropertySource.Xml - }, - new() - { - Hints = AuditPropertyHints.Xml, - Name = "Next scheduled maintenance", - NameKey = "NextScheduledMaintenance", - Path = "AedUnitInformation/NextScheduledMaintenance", - SourceProperty = AuditPropertySource.Xml - }, - new() - { - Hints = AuditPropertyHints.Xml, - Name = "Battery expiration date", - NameKey = "BatteryExpirationDate", - Path = "AedUnitInformation/BatteryExpirationDate", - SourceProperty = AuditPropertySource.Xml - }, - new() - { - Hints = AuditPropertyHints.Xml, - Name = "Pad expiration date", - NameKey = "PadExpirationDate", - Path = "AedUnitInformation/PadExpirationDate", - SourceProperty = AuditPropertySource.Xml - } + Hints = AuditPropertyHints.Xml, + Name = "Pad expiration date", + NameKey = "PadExpirationDate", + Path = "AedUnitInformation/PadExpirationDate", + SourceProperty = AuditPropertySource.Xml } - }; - - config.AddOrUpdateCustomEntityType(descriptor); - } + } + }; - private void CreateCustomPrivileges() - { - Guid privilegeGroupId = Guid.Parse("864E018E-8B50-41B7-80F5-4F1BB2BBED6E"); + config.AddOrUpdateCustomEntityType(descriptor); + } - Workspace.Sdk.SecurityManager.RegisterPrivileges(new List - { - new(id: privilegeGroupId, - type: PrivilegeType.Group, - description: "AED Unit", - details: "AED Unit", - priority: 2, - icon: null, - parentId: Guid.Parse("38ACC600-4A32-44ff-8DF5-0797D888930B")), - new(id: AedUnitCustomPrivilege.View, - type: PrivilegeType.Entity, - description: "View AED unit properties", - details: "Allows the user to view the configuration of AED units.", - priority: 2, - icon: null, - parentId: privilegeGroupId), - new(id: AedUnitCustomPrivilege.Modify, - type: PrivilegeType.Entity, - description: "Modify AED unit properties", - details: "Allows the user to modify the configuration of AED units.", - priority: 2, - icon: null, - parentId: AedUnitCustomPrivilege.View), - new(id: AedUnitCustomPrivilege.Add, - type: PrivilegeType.Entity, - description: "Add AED units", - details: "Allows the user to add AED units.", - priority: 2, - icon: null, - parentId: AedUnitCustomPrivilege.Modify), - new(id: AedUnitCustomPrivilege.Delete, - type: PrivilegeType.Entity, - description: "Remove AED units", - details: "Allows the user to remove AED units.", - priority: 2, - icon: null, - parentId: AedUnitCustomPrivilege.Modify - ) - }); - } + private void CreateCustomPrivileges() + { + Guid privilegeGroupId = Guid.Parse("864E018E-8B50-41B7-80F5-4F1BB2BBED6E"); - public override void Unload() + Workspace.Sdk.SecurityManager.RegisterPrivileges(new List { - } + new(id: privilegeGroupId, + type: PrivilegeType.Group, + description: "AED Unit", + details: "AED Unit", + priority: 2, + icon: null, + parentId: Guid.Parse("38ACC600-4A32-44ff-8DF5-0797D888930B")), + new(id: AedUnitCustomPrivilege.View, + type: PrivilegeType.Entity, + description: "View AED unit properties", + details: "Allows the user to view the configuration of AED units.", + priority: 2, + icon: null, + parentId: privilegeGroupId), + new(id: AedUnitCustomPrivilege.Modify, + type: PrivilegeType.Entity, + description: "Modify AED unit properties", + details: "Allows the user to modify the configuration of AED units.", + priority: 2, + icon: null, + parentId: AedUnitCustomPrivilege.View), + new(id: AedUnitCustomPrivilege.Add, + type: PrivilegeType.Entity, + description: "Add AED units", + details: "Allows the user to add AED units.", + priority: 2, + icon: null, + parentId: AedUnitCustomPrivilege.Modify), + new(id: AedUnitCustomPrivilege.Delete, + type: PrivilegeType.Entity, + description: "Remove AED units", + details: "Allows the user to remove AED units.", + priority: 2, + icon: null, + parentId: AedUnitCustomPrivilege.Modify + ) + }); + } + + public override void Unload() + { } } \ No newline at end of file diff --git a/Samples/Workspace SDK/ControlsSample/Chart/ChartSamplePage.cs b/Samples/Workspace SDK/ControlsSample/Chart/ChartSamplePage.cs index 9209a55..6566fe5 100644 --- a/Samples/Workspace SDK/ControlsSample/Chart/ChartSamplePage.cs +++ b/Samples/Workspace SDK/ControlsSample/Chart/ChartSamplePage.cs @@ -5,16 +5,15 @@ // Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -namespace Genetec.Dap.CodeSamples -{ - using Sdk.Workspace.Pages; +namespace Genetec.Dap.CodeSamples; + +using Sdk.Workspace.Pages; - [Page(typeof(ChartSamplePageDescriptor))] - public class ChartSamplePage : Page +[Page(typeof(ChartSamplePageDescriptor))] +public class ChartSamplePage : Page +{ + public ChartSamplePage() { - public ChartSamplePage() - { - View = new ChartSampleView(); - } + View = new ChartSampleView(); } } \ No newline at end of file diff --git a/Samples/Workspace SDK/ControlsSample/Chart/ChartSamplePageDescriptor.cs b/Samples/Workspace SDK/ControlsSample/Chart/ChartSamplePageDescriptor.cs index 114100a..261cfb5 100644 --- a/Samples/Workspace SDK/ControlsSample/Chart/ChartSamplePageDescriptor.cs +++ b/Samples/Workspace SDK/ControlsSample/Chart/ChartSamplePageDescriptor.cs @@ -5,23 +5,22 @@ // Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -namespace Genetec.Dap.CodeSamples -{ - using System; - using Sdk.Workspace.Pages; +namespace Genetec.Dap.CodeSamples; + +using System; +using Sdk.Workspace.Pages; - public class ChartSamplePageDescriptor : PageDescriptor - { - public override string Name => "Chart Sample"; +public class ChartSamplePageDescriptor : PageDescriptor +{ + public override string Name => "Chart Sample"; - public override Guid Type { get; } = new("58FE9C39-5054-458D-9B22-2FD42FE3C224"); + public override Guid Type { get; } = new("58FE9C39-5054-458D-9B22-2FD42FE3C224"); - public override string Description => "This page provides a sample of the Chart control."; + public override string Description => "This page provides a sample of the Chart control."; - public override Guid CategoryId => CustomTaskCategories.SdkSamples; + public override Guid CategoryId => CustomTaskCategories.SdkSamples; - public override TaskIconColor IconColor => TaskIconColor.DefaultIconColor; + public override TaskIconColor IconColor => TaskIconColor.DefaultIconColor; - public override bool HasPrivilege() => true; - } + public override bool HasPrivilege() => true; } \ No newline at end of file diff --git a/Samples/Workspace SDK/ControlsSample/Chart/ChartSampleView.xaml.cs b/Samples/Workspace SDK/ControlsSample/Chart/ChartSampleView.xaml.cs index ce2120c..2195c41 100644 --- a/Samples/Workspace SDK/ControlsSample/Chart/ChartSampleView.xaml.cs +++ b/Samples/Workspace SDK/ControlsSample/Chart/ChartSampleView.xaml.cs @@ -5,13 +5,12 @@ // Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -namespace Genetec.Dap.CodeSamples +namespace Genetec.Dap.CodeSamples; + +public partial class ChartSampleView { - public partial class ChartSampleView + public ChartSampleView() { - public ChartSampleView() - { - InitializeComponent(); - } + InitializeComponent(); } } \ No newline at end of file diff --git a/Samples/Workspace SDK/ControlsSample/Chart/ChartSampleViewModel.cs b/Samples/Workspace SDK/ControlsSample/Chart/ChartSampleViewModel.cs index 65aed14..a686a34 100644 --- a/Samples/Workspace SDK/ControlsSample/Chart/ChartSampleViewModel.cs +++ b/Samples/Workspace SDK/ControlsSample/Chart/ChartSampleViewModel.cs @@ -12,138 +12,137 @@ using System.Windows.Media; using Genetec.Sdk.Controls.Charts; -namespace Genetec.Dap.CodeSamples +namespace Genetec.Dap.CodeSamples; + +public class ChartSampleViewModel : BindableBase { - public class ChartSampleViewModel : BindableBase - { - private readonly Dictionary m_chartData; - private readonly string[] m_labels = { "Label 1", "Label 2", "Label 3" }; - private Chart m_chart; - private bool m_disableAnimations; - private bool m_performanceMode; - private ChartType m_selectedChartType = ChartType.Bar; - private bool m_showChartGrid = true; - private bool m_showChartValue = true; - private bool m_showLegend = true; - private Color m_strokeColor = Colors.Black; + private readonly Dictionary m_chartData; + private readonly string[] m_labels = { "Label 1", "Label 2", "Label 3" }; + private Chart m_chart; + private bool m_disableAnimations; + private bool m_performanceMode; + private ChartType m_selectedChartType = ChartType.Bar; + private bool m_showChartGrid = true; + private bool m_showChartValue = true; + private bool m_showLegend = true; + private Color m_strokeColor = Colors.Black; - public ChartSampleViewModel() - { - m_chartData = InitializeChartData(); - CreateChart(); - } + public ChartSampleViewModel() + { + m_chartData = InitializeChartData(); + CreateChart(); + } - public Chart Chart - { - get => m_chart; - private set => SetProperty(ref m_chart, value); - } + public Chart Chart + { + get => m_chart; + private set => SetProperty(ref m_chart, value); + } - public IEnumerable ChartTypes => Enum.GetValues(typeof(ChartType)).Cast(); + public IEnumerable ChartTypes => Enum.GetValues(typeof(ChartType)).Cast(); - public ChartType SelectedChartType + public ChartType SelectedChartType + { + get => m_selectedChartType; + set { - get => m_selectedChartType; - set + if (SetProperty(ref m_selectedChartType, value)) { - if (SetProperty(ref m_selectedChartType, value)) - { - CreateChart(); - } + CreateChart(); } } + } - public bool DisableAnimations + public bool DisableAnimations + { + get => m_disableAnimations; + set { - get => m_disableAnimations; - set + if (SetProperty(ref m_disableAnimations, value) && Chart != null) { - if (SetProperty(ref m_disableAnimations, value) && Chart != null) - { - Chart.DisableAnimations = value; - } + Chart.DisableAnimations = value; } } + } - public bool PerformanceMode + public bool PerformanceMode + { + get => m_performanceMode; + set { - get => m_performanceMode; - set + if (SetProperty(ref m_performanceMode, value) && Chart != null) { - if (SetProperty(ref m_performanceMode, value) && Chart != null) - { - Chart.PerformanceMode = value; - } + Chart.PerformanceMode = value; } } + } - public bool ShowChartGrid + public bool ShowChartGrid + { + get => m_showChartGrid; + set { - get => m_showChartGrid; - set + if (SetProperty(ref m_showChartGrid, value) && Chart != null) { - if (SetProperty(ref m_showChartGrid, value) && Chart != null) - { - Chart.ShowChartGrid = value; - } + Chart.ShowChartGrid = value; } } + } - public bool ShowChartValue + public bool ShowChartValue + { + get => m_showChartValue; + set { - get => m_showChartValue; - set + if (SetProperty(ref m_showChartValue, value) && Chart != null) { - if (SetProperty(ref m_showChartValue, value) && Chart != null) - { - Chart.ShowChartValue = value; - } + Chart.ShowChartValue = value; } } + } - public bool ShowLegend + public bool ShowLegend + { + get => m_showLegend; + set { - get => m_showLegend; - set + if (SetProperty(ref m_showLegend, value) && Chart != null) { - if (SetProperty(ref m_showLegend, value) && Chart != null) - { - Chart.ShowLegend = value; - } + Chart.ShowLegend = value; } } + } - public Color StrokeColor + public Color StrokeColor + { + get => m_strokeColor; + set { - get => m_strokeColor; - set + if (SetProperty(ref m_strokeColor, value) && Chart != null) { - if (SetProperty(ref m_strokeColor, value) && Chart != null) - { - Chart.Stroke = new SolidColorBrush(value); - } + Chart.Stroke = new SolidColorBrush(value); } } + } - private Dictionary InitializeChartData() + private Dictionary InitializeChartData() + { + var random = new Random(); + return new Dictionary { - var random = new Random(); - return new Dictionary - { - { "Series 1", new ChartSeries(new double[] { random.Next(1, 100), random.Next(1, 100), random.Next(1, 100) }, Brushes.Blue) }, - { "Series 2", new ChartSeries(new double[] { random.Next(1, 100), random.Next(1, 100), random.Next(1, 100) }, Brushes.Red) } - }; - } + { "Series 1", new ChartSeries(new double[] { random.Next(1, 100), random.Next(1, 100), random.Next(1, 100) }, Brushes.Blue) }, + { "Series 2", new ChartSeries(new double[] { random.Next(1, 100), random.Next(1, 100), random.Next(1, 100) }, Brushes.Red) } + }; + } - private void CreateChart() - { - Chart = ChartFactory.CreateChart(SelectedChartType, m_labels, m_chartData); - Chart.DisableAnimations = DisableAnimations; - Chart.PerformanceMode = PerformanceMode; - Chart.ShowChartGrid = ShowChartGrid; - Chart.ShowChartValue = ShowChartValue; - Chart.ShowLegend = ShowLegend; - Chart.Stroke = new SolidColorBrush(StrokeColor); - } + private void CreateChart() + { + Chart = ChartFactory.CreateChart(SelectedChartType, m_labels, m_chartData); + Chart.DisableAnimations = DisableAnimations; + Chart.PerformanceMode = PerformanceMode; + Chart.ShowChartGrid = ShowChartGrid; + Chart.ShowChartValue = ShowChartValue; + Chart.ShowLegend = ShowLegend; + Chart.Stroke = new SolidColorBrush(StrokeColor); } } \ No newline at end of file diff --git a/Samples/Workspace SDK/ControlsSample/Controls/ControlsSamplePage.cs b/Samples/Workspace SDK/ControlsSample/Controls/ControlsSamplePage.cs index c72df41..5494f4e 100644 --- a/Samples/Workspace SDK/ControlsSample/Controls/ControlsSamplePage.cs +++ b/Samples/Workspace SDK/ControlsSample/Controls/ControlsSamplePage.cs @@ -5,16 +5,15 @@ // Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -namespace Genetec.Dap.CodeSamples -{ - using Sdk.Workspace.Pages; +namespace Genetec.Dap.CodeSamples; + +using Sdk.Workspace.Pages; - [Page(typeof(ControlsSamplePageDescriptor))] - public class ControlsSamplePage : Page +[Page(typeof(ControlsSamplePageDescriptor))] +public class ControlsSamplePage : Page +{ + public ControlsSamplePage() { - public ControlsSamplePage() - { - View = new ControlsSampleView(); - } + View = new ControlsSampleView(); } } \ No newline at end of file diff --git a/Samples/Workspace SDK/ControlsSample/Controls/ControlsSamplePageDescriptor.cs b/Samples/Workspace SDK/ControlsSample/Controls/ControlsSamplePageDescriptor.cs index 85564f3..2abca8c 100644 --- a/Samples/Workspace SDK/ControlsSample/Controls/ControlsSamplePageDescriptor.cs +++ b/Samples/Workspace SDK/ControlsSample/Controls/ControlsSamplePageDescriptor.cs @@ -5,23 +5,22 @@ // Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -namespace Genetec.Dap.CodeSamples -{ - using System; - using Sdk.Workspace.Pages; +namespace Genetec.Dap.CodeSamples; + +using System; +using Sdk.Workspace.Pages; - public class ControlsSamplePageDescriptor : PageDescriptor - { - public override string Name => "Controls Sample"; +public class ControlsSamplePageDescriptor : PageDescriptor +{ + public override string Name => "Controls Sample"; - public override Guid Type { get; } = new("B59AEC4B-D025-468F-9D58-65B56F96380E"); + public override Guid Type { get; } = new("B59AEC4B-D025-468F-9D58-65B56F96380E"); - public override Guid CategoryId => CustomTaskCategories.SdkSamples; + public override Guid CategoryId => CustomTaskCategories.SdkSamples; - public override string Description => "This page provides samples of the available controls."; + public override string Description => "This page provides samples of the available controls."; - public override TaskIconColor IconColor => TaskIconColor.DefaultIconColor; + public override TaskIconColor IconColor => TaskIconColor.DefaultIconColor; - public override bool HasPrivilege() => true; - } + public override bool HasPrivilege() => true; } \ No newline at end of file diff --git a/Samples/Workspace SDK/ControlsSample/Controls/ControlsSampleView.xaml.cs b/Samples/Workspace SDK/ControlsSample/Controls/ControlsSampleView.xaml.cs index 7173a58..dc926ce 100644 --- a/Samples/Workspace SDK/ControlsSample/Controls/ControlsSampleView.xaml.cs +++ b/Samples/Workspace SDK/ControlsSample/Controls/ControlsSampleView.xaml.cs @@ -5,13 +5,12 @@ // Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -namespace Genetec.Dap.CodeSamples +namespace Genetec.Dap.CodeSamples; + +public partial class ControlsSampleView { - public partial class ControlsSampleView + public ControlsSampleView() { - public ControlsSampleView() - { - InitializeComponent(); - } + InitializeComponent(); } -} +} \ No newline at end of file diff --git a/Samples/Workspace SDK/ControlsSample/CustomTaskCategories.cs b/Samples/Workspace SDK/ControlsSample/CustomTaskCategories.cs index 08087f0..9abb3a9 100644 --- a/Samples/Workspace SDK/ControlsSample/CustomTaskCategories.cs +++ b/Samples/Workspace SDK/ControlsSample/CustomTaskCategories.cs @@ -5,12 +5,11 @@ // Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -namespace Genetec.Dap.CodeSamples -{ - using System; +namespace Genetec.Dap.CodeSamples; + +using System; - public static class CustomTaskCategories - { - public static Guid SdkSamples = new("4F72E1E7-DEA8-4DA3-A0C6-90A37D37F146"); - } +public static class CustomTaskCategories +{ + public static Guid SdkSamples = new("4F72E1E7-DEA8-4DA3-A0C6-90A37D37F146"); } \ No newline at end of file diff --git a/Samples/Workspace SDK/ControlsSample/SampleModule.cs b/Samples/Workspace SDK/ControlsSample/SampleModule.cs index 3b87293..31a9a74 100644 --- a/Samples/Workspace SDK/ControlsSample/SampleModule.cs +++ b/Samples/Workspace SDK/ControlsSample/SampleModule.cs @@ -5,31 +5,30 @@ // Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -namespace Genetec.Dap.CodeSamples -{ - using Sdk.Workspace.Tasks; - using System; +namespace Genetec.Dap.CodeSamples; - public class SampleModule : Sdk.Workspace.Modules.Module - { - public override void Load() - { - RegisterTask(new TaskGroup(CustomTaskCategories.SdkSamples, Guid.Empty, "SDK Samples", null, int.MaxValue)); - RegisterTask(new CreatePageTask(isSingleton: true)); - RegisterTask(new CreatePageTask(isSingleton: true)); - RegisterTask(new CreatePageTask(isSingleton: true)); - RegisterTask(new CreatePageTask(isSingleton: false)); - - //Initialize the task and register it - void RegisterTask(Task task) - { - task.Initialize(Workspace); - Workspace.Tasks.Register(task); - } - } +using Sdk.Workspace.Tasks; +using System; - public override void Unload() +public class SampleModule : Sdk.Workspace.Modules.Module +{ + public override void Load() + { + RegisterTask(new TaskGroup(CustomTaskCategories.SdkSamples, Guid.Empty, "SDK Samples", null, int.MaxValue)); + RegisterTask(new CreatePageTask(isSingleton: true)); + RegisterTask(new CreatePageTask(isSingleton: true)); + RegisterTask(new CreatePageTask(isSingleton: true)); + RegisterTask(new CreatePageTask(isSingleton: false)); + + //Initialize the task and register it + void RegisterTask(Task task) { + task.Initialize(Workspace); + Workspace.Tasks.Register(task); } } + + public override void Unload() + { + } } \ No newline at end of file diff --git a/Samples/Workspace SDK/ControlsSample/Style/StylesSamplePage.cs b/Samples/Workspace SDK/ControlsSample/Style/StylesSamplePage.cs index 71a4c15..535fced 100644 --- a/Samples/Workspace SDK/ControlsSample/Style/StylesSamplePage.cs +++ b/Samples/Workspace SDK/ControlsSample/Style/StylesSamplePage.cs @@ -5,16 +5,15 @@ // Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -namespace Genetec.Dap.CodeSamples -{ - using Sdk.Workspace.Pages; +namespace Genetec.Dap.CodeSamples; + +using Sdk.Workspace.Pages; - [Page(typeof(StylesSamplePageDescriptor))] - public class StylesSamplePage : Page +[Page(typeof(StylesSamplePageDescriptor))] +public class StylesSamplePage : Page +{ + public StylesSamplePage() { - public StylesSamplePage() - { - View = new StylesSamplePageView(); - } + View = new StylesSamplePageView(); } } \ No newline at end of file diff --git a/Samples/Workspace SDK/ControlsSample/Style/StylesSamplePageDescriptor.cs b/Samples/Workspace SDK/ControlsSample/Style/StylesSamplePageDescriptor.cs index cc68510..e0bd48b 100644 --- a/Samples/Workspace SDK/ControlsSample/Style/StylesSamplePageDescriptor.cs +++ b/Samples/Workspace SDK/ControlsSample/Style/StylesSamplePageDescriptor.cs @@ -5,23 +5,22 @@ // Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -namespace Genetec.Dap.CodeSamples -{ - using System; - using Sdk.Workspace.Pages; +namespace Genetec.Dap.CodeSamples; + +using System; +using Sdk.Workspace.Pages; - public class StylesSamplePageDescriptor : PageDescriptor - { - public override string Name => "Styles Sample"; +public class StylesSamplePageDescriptor : PageDescriptor +{ + public override string Name => "Styles Sample"; - public override Guid Type { get; } = new("99470468-048A-4511-878B-CDDDE2B18AA7"); + public override Guid Type { get; } = new("99470468-048A-4511-878B-CDDDE2B18AA7"); - public override string Description => "This page provides samples of the available control styles."; + public override string Description => "This page provides samples of the available control styles."; - public override Guid CategoryId => CustomTaskCategories.SdkSamples; + public override Guid CategoryId => CustomTaskCategories.SdkSamples; - public override TaskIconColor IconColor => TaskIconColor.DefaultIconColor; + public override TaskIconColor IconColor => TaskIconColor.DefaultIconColor; - public override bool HasPrivilege() => true; - } + public override bool HasPrivilege() => true; } \ No newline at end of file diff --git a/Samples/Workspace SDK/ControlsSample/Style/StylesSamplePageView.xaml.cs b/Samples/Workspace SDK/ControlsSample/Style/StylesSamplePageView.xaml.cs index 4695f9b..2211448 100644 --- a/Samples/Workspace SDK/ControlsSample/Style/StylesSamplePageView.xaml.cs +++ b/Samples/Workspace SDK/ControlsSample/Style/StylesSamplePageView.xaml.cs @@ -5,13 +5,12 @@ // Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -namespace Genetec.Dap.CodeSamples +namespace Genetec.Dap.CodeSamples; + +public partial class StylesSamplePageView { - public partial class StylesSamplePageView + public StylesSamplePageView() { - public StylesSamplePageView() - { - InitializeComponent(); - } + InitializeComponent(); } -} +} \ No newline at end of file diff --git a/Samples/Workspace SDK/ControlsSample/WebBrowser/WebBrowserSamplePage.cs b/Samples/Workspace SDK/ControlsSample/WebBrowser/WebBrowserSamplePage.cs index c80a554..33ea531 100644 --- a/Samples/Workspace SDK/ControlsSample/WebBrowser/WebBrowserSamplePage.cs +++ b/Samples/Workspace SDK/ControlsSample/WebBrowser/WebBrowserSamplePage.cs @@ -5,16 +5,15 @@ // Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -namespace Genetec.Dap.CodeSamples -{ - using Sdk.Workspace.Pages; +namespace Genetec.Dap.CodeSamples; + +using Sdk.Workspace.Pages; - [Page(typeof(WebBrowserSamplePageDescriptor))] - public class WebBrowserSamplePage : Page +[Page(typeof(WebBrowserSamplePageDescriptor))] +public class WebBrowserSamplePage : Page +{ + public WebBrowserSamplePage() { - public WebBrowserSamplePage() - { - View = new WebBrowserSampleView(); - } + View = new WebBrowserSampleView(); } } \ No newline at end of file diff --git a/Samples/Workspace SDK/ControlsSample/WebBrowser/WebBrowserSamplePageDescriptor.cs b/Samples/Workspace SDK/ControlsSample/WebBrowser/WebBrowserSamplePageDescriptor.cs index bd3b0b5..2ba929e 100644 --- a/Samples/Workspace SDK/ControlsSample/WebBrowser/WebBrowserSamplePageDescriptor.cs +++ b/Samples/Workspace SDK/ControlsSample/WebBrowser/WebBrowserSamplePageDescriptor.cs @@ -5,23 +5,22 @@ // Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -namespace Genetec.Dap.CodeSamples -{ - using System; - using Sdk.Workspace.Pages; +namespace Genetec.Dap.CodeSamples; + +using System; +using Sdk.Workspace.Pages; - public class WebBrowserSamplePageDescriptor : PageDescriptor - { - public override string Name => "Web Browser Sample"; +public class WebBrowserSamplePageDescriptor : PageDescriptor +{ + public override string Name => "Web Browser Sample"; - public override Guid Type { get; } = new("F5866920-2AF8-423B-BBE3-5F9A07C28CE9"); + public override Guid Type { get; } = new("F5866920-2AF8-423B-BBE3-5F9A07C28CE9"); - public override Guid CategoryId => CustomTaskCategories.SdkSamples; + public override Guid CategoryId => CustomTaskCategories.SdkSamples; - public override string Description => "This page provides a sample of the WebBrowser control."; + public override string Description => "This page provides a sample of the WebBrowser control."; - public override TaskIconColor IconColor => TaskIconColor.DefaultIconColor; + public override TaskIconColor IconColor => TaskIconColor.DefaultIconColor; - public override bool HasPrivilege() => true; - } + public override bool HasPrivilege() => true; } \ No newline at end of file diff --git a/Samples/Workspace SDK/ControlsSample/WebBrowser/WebBrowserSampleView.xaml.cs b/Samples/Workspace SDK/ControlsSample/WebBrowser/WebBrowserSampleView.xaml.cs index 41e5fde..8c53cdf 100644 --- a/Samples/Workspace SDK/ControlsSample/WebBrowser/WebBrowserSampleView.xaml.cs +++ b/Samples/Workspace SDK/ControlsSample/WebBrowser/WebBrowserSampleView.xaml.cs @@ -5,30 +5,29 @@ // Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -namespace Genetec.Dap.CodeSamples -{ - using System.Windows.Controls; - using System.Windows.Input; +namespace Genetec.Dap.CodeSamples; + +using System.Windows.Controls; +using System.Windows.Input; - public partial class WebBrowserSampleView +public partial class WebBrowserSampleView +{ + public WebBrowserSampleView() { - public WebBrowserSampleView() - { - InitializeComponent(); - } + InitializeComponent(); + } - private void AddressBar_KeyDown(object sender, KeyEventArgs e) + private void AddressBar_KeyDown(object sender, KeyEventArgs e) + { + if (e.Key == Key.Enter) { - if (e.Key == Key.Enter) - { - TextBox textBox = (TextBox)sender; - Navigate(textBox.Text); - } + TextBox textBox = (TextBox)sender; + Navigate(textBox.Text); } + } - private void Navigate(string address) - { - (DataContext as WebBrowserSampleViewModel)?.NavigateCommand.Execute(address); - } + private void Navigate(string address) + { + (DataContext as WebBrowserSampleViewModel)?.NavigateCommand.Execute(address); } -} +} \ No newline at end of file diff --git a/Samples/Workspace SDK/ControlsSample/WebBrowser/WebBrowserSampleViewModel.cs b/Samples/Workspace SDK/ControlsSample/WebBrowser/WebBrowserSampleViewModel.cs index 50e2b9b..282aad1 100644 --- a/Samples/Workspace SDK/ControlsSample/WebBrowser/WebBrowserSampleViewModel.cs +++ b/Samples/Workspace SDK/ControlsSample/WebBrowser/WebBrowserSampleViewModel.cs @@ -5,36 +5,35 @@ // Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -namespace Genetec.Dap.CodeSamples -{ - using Prism.Commands; - using Prism.Mvvm; - using Sdk.Controls; +namespace Genetec.Dap.CodeSamples; - public class WebBrowserSampleViewModel : BindableBase - { - public WebBrowserSampleViewModel() - { - NavigateCommand = new DelegateCommand(address => WebBrowser.Navigate(address)); - ReloadCommand = new DelegateCommand(() => WebBrowser.Reload()); - GoBackCommand = new DelegateCommand(WebBrowser.GoBack, () => WebBrowser.CanGoBack); - GoForwardCommand = new DelegateCommand(WebBrowser.GoForward, () => WebBrowser.CanGoForward); +using Prism.Commands; +using Prism.Mvvm; +using Sdk.Controls; - WebBrowser.Navigated += (_, _) => - { - GoBackCommand.RaiseCanExecuteChanged(); - GoForwardCommand.RaiseCanExecuteChanged(); - }; - } +public class WebBrowserSampleViewModel : BindableBase +{ + public WebBrowserSampleViewModel() + { + NavigateCommand = new DelegateCommand(address => WebBrowser.Navigate(address)); + ReloadCommand = new DelegateCommand(() => WebBrowser.Reload()); + GoBackCommand = new DelegateCommand(WebBrowser.GoBack, () => WebBrowser.CanGoBack); + GoForwardCommand = new DelegateCommand(WebBrowser.GoForward, () => WebBrowser.CanGoForward); - public WebBrowser WebBrowser { get; } = new(); + WebBrowser.Navigated += (_, _) => + { + GoBackCommand.RaiseCanExecuteChanged(); + GoForwardCommand.RaiseCanExecuteChanged(); + }; + } - public DelegateCommand ReloadCommand { get; } + public WebBrowser WebBrowser { get; } = new(); + + public DelegateCommand ReloadCommand { get; } - public DelegateCommand GoBackCommand { get; } + public DelegateCommand GoBackCommand { get; } - public DelegateCommand GoForwardCommand { get; } + public DelegateCommand GoForwardCommand { get; } - public DelegateCommand NavigateCommand { get; } - } + public DelegateCommand NavigateCommand { get; } } \ No newline at end of file diff --git a/Samples/Workspace SDK/CredentialBuilderSample/Program.cs b/Samples/Workspace SDK/CredentialBuilderSample/Program.cs index 46b024c..84e3434 100644 --- a/Samples/Workspace SDK/CredentialBuilderSample/Program.cs +++ b/Samples/Workspace SDK/CredentialBuilderSample/Program.cs @@ -5,136 +5,135 @@ // Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -namespace Genetec.Dap.CodeSamples +namespace Genetec.Dap.CodeSamples; + +using System; +using System.Collections.Generic; +using System.Data; +using System.Linq; +using System.Threading.Tasks; +using Genetec.Sdk.AccessControl.Credentials.CardCredentials; +using Genetec.Sdk; +using Genetec.Sdk.Credentials; +using Genetec.Sdk.Entities; +using Genetec.Sdk.Entities.Builders; +using Genetec.Sdk.Queries; + +class Program { - using System; - using System.Collections.Generic; - using System.Data; - using System.Linq; - using System.Threading.Tasks; - using Genetec.Sdk.AccessControl.Credentials.CardCredentials; - using Genetec.Sdk; - using Genetec.Sdk.Credentials; - using Genetec.Sdk.Entities; - using Genetec.Sdk.Entities.Builders; - using Genetec.Sdk.Queries; - - class Program + static Program() => SdkResolver.Initialize(); + + static async Task Main() { - static Program() => SdkResolver.Initialize(); + const string server = "localhost"; + const string username = "admin"; + const string password = ""; + + using var engine = new Engine(); + + ConnectionStateCode state = await engine.LogOnAsync(server, username, password); + + if (state == ConnectionStateCode.Success) + { + DisplayCredentialFormats(); + + ICredentialBuilder credentialBuilder = engine.EntityManager.GetCredentialBuilder(); + + await BuildAndDisplayCredential(credentialBuilder, "Standard Wiegand Credential", new WiegandStandardCredentialFormat(facility: 1, cardId: 2)); + await BuildAndDisplayCredential(credentialBuilder, "H10306 Wiegand Credential", new WiegandH10306CredentialFormat(facility: 1, cardId: 2)); + await BuildAndDisplayCredential(credentialBuilder, "H10304 Wiegand Credential", new WiegandH10304CredentialFormat(facility: 1, cardId: 2)); + await BuildAndDisplayCredential(credentialBuilder, "H10302 Wiegand Credential", new WiegandH10302CredentialFormat(cardId: 1)); + await BuildAndDisplayCredential(credentialBuilder, "CSN32 Wiegand Credential", new WiegandCsn32CredentialFormat(cardId: 1)); + await BuildAndDisplayCredential(credentialBuilder, "48-Bit Corporate 1000 Wiegand Credential", new Wiegand48BitCorporate1000CredentialFormat(companyId: 1, cardId: 2)); + await BuildAndDisplayCredential(credentialBuilder, "Corporate 1000 Wiegand Credential", new WiegandCorporate1000CredentialFormat(companyId: 1, cardId: 2)); + await BuildAndDisplayCredential(credentialBuilder, "License Plate Credential", new LicensePlateCredentialFormat(licensePlate: "12345")); + await BuildAndDisplayCredential(credentialBuilder, "Keypad Credential", new KeypadCredentialFormat(credentialCode: 12345)); + await BuildAndDisplayCredential(credentialBuilder, "Raw Card Credential", new RawCardCredentialFormat(rawData: "1234", bitLength: 32)); + + var fascN75Dict = new Dictionary + { + { FascN75BitCardCredentialFormat.AGENCY_CODE_FIELD_NAME, "16383" }, + { FascN75BitCardCredentialFormat.SYSTEM_CODE_FIELD_NAME, "16383" }, + { FascN75BitCardCredentialFormat.CREDENTIAL_NUMBER_FIELD_NAME, "1234" }, + { FascN75BitCardCredentialFormat.EXP_DATE_FIELD_NAME, "9999" } + }; + + await BuildAndDisplayCredential(credentialBuilder, "FascN 75-Bit Card Credential", new FascN75BitCardCredentialFormat(fascN75Dict)); - static async Task Main() + var fascN200Dict = new Dictionary + { + { FascN200BitCardCredentialFormat.AGENCY_CODE_FIELD_NAME, "9999" }, + { FascN200BitCardCredentialFormat.SYSTEM_CODE_FIELD_NAME, "9999" }, + { FascN200BitCardCredentialFormat.CREDENTIAL_NUMBER_FIELD_NAME, "0" }, + { FascN200BitCardCredentialFormat.CS_FIELD_NAME, "0" }, + { FascN200BitCardCredentialFormat.ICI_FIELD_NAME, "0" }, + { FascN200BitCardCredentialFormat.PI_FIELD_NAME, "0" }, + { FascN200BitCardCredentialFormat.OC_FIELD_NAME, "0" }, + { FascN200BitCardCredentialFormat.OI_FIELD_NAME, "0" }, + { FascN200BitCardCredentialFormat.POA_FIELD_NAME, "0" }, + { FascN200BitCardCredentialFormat.LRC_FIELD_NAME, "F" } + }; + + await BuildAndDisplayCredential(credentialBuilder, "FascN 200-Bit Card Credential", new FascN200BitCardCredentialFormat(fascN200Dict)); + } + else { - const string server = "localhost"; - const string username = "admin"; - const string password = ""; + Console.WriteLine("Logon failed."); + } - using var engine = new Engine(); + Console.WriteLine("Press any key to exit..."); + Console.ReadKey(); - ConnectionStateCode state = await engine.LogOnAsync(server, username, password); + async Task BuildAndDisplayCredential(ICredentialBuilder credentialBuilder, string name, CredentialFormat format) + { + Console.WriteLine($"Creating credential with format: {format.UniqueId}."); + + Credential credential = await TryGetCredentialByFormat(); - if (state == ConnectionStateCode.Success) + if (credential != null) { - DisplayCredentialFormats(); - - ICredentialBuilder credentialBuilder = engine.EntityManager.GetCredentialBuilder(); - - await BuildAndDisplayCredential(credentialBuilder, "Standard Wiegand Credential", new WiegandStandardCredentialFormat(facility: 1, cardId: 2)); - await BuildAndDisplayCredential(credentialBuilder, "H10306 Wiegand Credential", new WiegandH10306CredentialFormat(facility: 1, cardId: 2)); - await BuildAndDisplayCredential(credentialBuilder, "H10304 Wiegand Credential", new WiegandH10304CredentialFormat(facility: 1, cardId: 2)); - await BuildAndDisplayCredential(credentialBuilder, "H10302 Wiegand Credential", new WiegandH10302CredentialFormat(cardId: 1)); - await BuildAndDisplayCredential(credentialBuilder, "CSN32 Wiegand Credential", new WiegandCsn32CredentialFormat(cardId: 1)); - await BuildAndDisplayCredential(credentialBuilder, "48-Bit Corporate 1000 Wiegand Credential", new Wiegand48BitCorporate1000CredentialFormat(companyId: 1, cardId: 2)); - await BuildAndDisplayCredential(credentialBuilder, "Corporate 1000 Wiegand Credential", new WiegandCorporate1000CredentialFormat(companyId: 1, cardId: 2)); - await BuildAndDisplayCredential(credentialBuilder, "License Plate Credential", new LicensePlateCredentialFormat(licensePlate: "12345")); - await BuildAndDisplayCredential(credentialBuilder, "Keypad Credential", new KeypadCredentialFormat(credentialCode: 12345)); - await BuildAndDisplayCredential(credentialBuilder, "Raw Card Credential", new RawCardCredentialFormat(rawData: "1234", bitLength: 32)); - - var fascN75Dict = new Dictionary - { - { FascN75BitCardCredentialFormat.AGENCY_CODE_FIELD_NAME, "16383" }, - { FascN75BitCardCredentialFormat.SYSTEM_CODE_FIELD_NAME, "16383" }, - { FascN75BitCardCredentialFormat.CREDENTIAL_NUMBER_FIELD_NAME, "1234" }, - { FascN75BitCardCredentialFormat.EXP_DATE_FIELD_NAME, "9999" } - }; - - await BuildAndDisplayCredential(credentialBuilder, "FascN 75-Bit Card Credential", new FascN75BitCardCredentialFormat(fascN75Dict)); - - var fascN200Dict = new Dictionary - { - { FascN200BitCardCredentialFormat.AGENCY_CODE_FIELD_NAME, "9999" }, - { FascN200BitCardCredentialFormat.SYSTEM_CODE_FIELD_NAME, "9999" }, - { FascN200BitCardCredentialFormat.CREDENTIAL_NUMBER_FIELD_NAME, "0" }, - { FascN200BitCardCredentialFormat.CS_FIELD_NAME, "0" }, - { FascN200BitCardCredentialFormat.ICI_FIELD_NAME, "0" }, - { FascN200BitCardCredentialFormat.PI_FIELD_NAME, "0" }, - { FascN200BitCardCredentialFormat.OC_FIELD_NAME, "0" }, - { FascN200BitCardCredentialFormat.OI_FIELD_NAME, "0" }, - { FascN200BitCardCredentialFormat.POA_FIELD_NAME, "0" }, - { FascN200BitCardCredentialFormat.LRC_FIELD_NAME, "F" } - }; - - await BuildAndDisplayCredential(credentialBuilder, "FascN 200-Bit Card Credential", new FascN200BitCardCredentialFormat(fascN200Dict)); + Console.WriteLine($"Credential with format {format.UniqueId} already exists."); } else { - Console.WriteLine("Logon failed."); + credential = credentialBuilder.SetName(name).SetFormat(format).Build(); } - Console.WriteLine("Press any key to exit..."); - Console.ReadKey(); - - async Task BuildAndDisplayCredential(ICredentialBuilder credentialBuilder, string name, CredentialFormat format) - { - Console.WriteLine($"Creating credential with format: {format.UniqueId}."); - - Credential credential = await TryGetCredentialByFormat(); - - if (credential != null) - { - Console.WriteLine($"Credential with format {format.UniqueId} already exists."); - } - else - { - credential = credentialBuilder.SetName(name).SetFormat(format).Build(); - } - - DisplayCredentialDetails(credential); - - async Task TryGetCredentialByFormat() - { - var query = (CredentialConfigurationQuery)engine.ReportManager.CreateReportQuery(ReportType.CredentialConfiguration); - query.UniqueIds.Add(format); - QueryCompletedEventArgs args = await Task.Factory.FromAsync(query.BeginQuery, query.EndQuery, null); - return args.Data.AsEnumerable().Select(row => engine.GetEntity(row.Field(nameof(Guid)))).OfType().FirstOrDefault(); - } - } + DisplayCredentialDetails(credential); - void DisplayCredentialFormats() + async Task TryGetCredentialByFormat() { - var config = (SystemConfiguration)engine.GetEntity(entityId: SystemConfiguration.SystemConfigurationGuid); - foreach (CredentialFormat format in config.CredentialFormats) - { - Console.WriteLine("Credential Format Details:"); - Console.WriteLine("---------------------------"); - Console.WriteLine($"Type Name : {format.GetType().Name}"); - Console.WriteLine($"Name : {format.Name}"); - Console.WriteLine($"Type : {format.Type}"); - Console.WriteLine($"Bit Length : {format.BitLength}"); - Console.WriteLine($"Custom Format : {format.IsCustomFormat}"); - Console.WriteLine(); - } + var query = (CredentialConfigurationQuery)engine.ReportManager.CreateReportQuery(ReportType.CredentialConfiguration); + query.UniqueIds.Add(format); + QueryCompletedEventArgs args = await Task.Factory.FromAsync(query.BeginQuery, query.EndQuery, null); + return args.Data.AsEnumerable().Select(row => engine.GetEntity(row.Field(nameof(Guid)))).OfType().FirstOrDefault(); } + } - void DisplayCredentialDetails(Credential credential) + void DisplayCredentialFormats() + { + var config = (SystemConfiguration)engine.GetEntity(entityId: SystemConfiguration.SystemConfigurationGuid); + foreach (CredentialFormat format in config.CredentialFormats) { - Console.WriteLine("Credential Details:"); - Console.WriteLine("-------------------"); - Console.WriteLine($"Name : {credential.Name}"); - Console.WriteLine($"Type : {credential.Format.GetType().Name}"); - Console.WriteLine($"Data : {credential.Format.UniqueId}"); + Console.WriteLine("Credential Format Details:"); + Console.WriteLine("---------------------------"); + Console.WriteLine($"Type Name : {format.GetType().Name}"); + Console.WriteLine($"Name : {format.Name}"); + Console.WriteLine($"Type : {format.Type}"); + Console.WriteLine($"Bit Length : {format.BitLength}"); + Console.WriteLine($"Custom Format : {format.IsCustomFormat}"); Console.WriteLine(); } } + + void DisplayCredentialDetails(Credential credential) + { + Console.WriteLine("Credential Details:"); + Console.WriteLine("-------------------"); + Console.WriteLine($"Name : {credential.Name}"); + Console.WriteLine($"Type : {credential.Format.GetType().Name}"); + Console.WriteLine($"Data : {credential.Format.UniqueId}"); + Console.WriteLine(); + } } } \ No newline at end of file diff --git a/Samples/Workspace SDK/CredentialReaderSample/CredentialFormatComparer.cs b/Samples/Workspace SDK/CredentialReaderSample/CredentialFormatComparer.cs index 793040f..370e143 100644 --- a/Samples/Workspace SDK/CredentialReaderSample/CredentialFormatComparer.cs +++ b/Samples/Workspace SDK/CredentialReaderSample/CredentialFormatComparer.cs @@ -1,23 +1,22 @@ // Copyright (C) 2024 by Genetec, Inc. All rights reserved. // May be used only in accordance with a valid Source Code License Agreement. -namespace Genetec.Dap.CodeSamples -{ - using System.Collections.Generic; - using Sdk.Credentials; +namespace Genetec.Dap.CodeSamples; - public class CredentialFormatComparer : IEqualityComparer - { - public bool Equals(CredentialFormat x, CredentialFormat y) - { - if (ReferenceEquals(x, y)) return true; - if (ReferenceEquals(x, null)) return false; - if (ReferenceEquals(y, null)) return false; - if (x.GetType() != y.GetType()) return false; +using System.Collections.Generic; +using Sdk.Credentials; - return x.UniqueId == y.UniqueId; - } +public class CredentialFormatComparer : IEqualityComparer +{ + public bool Equals(CredentialFormat x, CredentialFormat y) + { + if (ReferenceEquals(x, y)) return true; + if (ReferenceEquals(x, null)) return false; + if (ReferenceEquals(y, null)) return false; + if (x.GetType() != y.GetType()) return false; - public int GetHashCode(CredentialFormat obj) => obj.UniqueId.GetHashCode(); + return x.UniqueId == y.UniqueId; } + + public int GetHashCode(CredentialFormat obj) => obj.UniqueId.GetHashCode(); } \ No newline at end of file diff --git a/Samples/Workspace SDK/CredentialReaderSample/CredentialReaderView.xaml.cs b/Samples/Workspace SDK/CredentialReaderSample/CredentialReaderView.xaml.cs index 97f2da3..31db79b 100644 --- a/Samples/Workspace SDK/CredentialReaderSample/CredentialReaderView.xaml.cs +++ b/Samples/Workspace SDK/CredentialReaderSample/CredentialReaderView.xaml.cs @@ -1,13 +1,12 @@ -namespace Genetec.Dap.CodeSamples -{ - using System.Windows.Controls; +namespace Genetec.Dap.CodeSamples; + +using System.Windows.Controls; - public partial class CredentialReaderView : UserControl +public partial class CredentialReaderView : UserControl +{ + public CredentialReaderView(SampleCredentialReader credentialReader) { - public CredentialReaderView(SampleCredentialReader credentialReader) - { - DataContext = credentialReader; - InitializeComponent(); - } + DataContext = credentialReader; + InitializeComponent(); } -} +} \ No newline at end of file diff --git a/Samples/Workspace SDK/CredentialReaderSample/SampleCredentialReader.cs b/Samples/Workspace SDK/CredentialReaderSample/SampleCredentialReader.cs index 08fd433..23be15a 100644 --- a/Samples/Workspace SDK/CredentialReaderSample/SampleCredentialReader.cs +++ b/Samples/Workspace SDK/CredentialReaderSample/SampleCredentialReader.cs @@ -1,133 +1,132 @@ // Copyright (C) 2024 by Genetec, Inc. All rights reserved. // May be used only in accordance with a valid Source Code License Agreement. -namespace Genetec.Dap.CodeSamples +namespace Genetec.Dap.CodeSamples; + +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Linq; +using System.Runtime.CompilerServices; +using System.Threading.Tasks; +using System.Windows; +using Prism.Commands; +using Sdk; +using Sdk.Credentials; +using Sdk.Entities; +using Sdk.Queries; +using Sdk.Workspace.Components.CredentialReader; + +public class SampleCredentialReader : CredentialReader, INotifyPropertyChanged { - using System; - using System.Collections.Generic; - using System.ComponentModel; - using System.Data; - using System.Linq; - using System.Runtime.CompilerServices; - using System.Threading.Tasks; - using System.Windows; - using Prism.Commands; - using Sdk; - using Sdk.Credentials; - using Sdk.Entities; - using Sdk.Queries; - using Sdk.Workspace.Components.CredentialReader; - - public class SampleCredentialReader : CredentialReader, INotifyPropertyChanged - { - private int m_facilityCode; + private int m_facilityCode; - private int m_quantity; + private int m_quantity; - private int m_startNumber; + private int m_startNumber; - public SampleCredentialReader() + public SampleCredentialReader() + { + GenerateCommand = new DelegateCommand(async () => { - GenerateCommand = new DelegateCommand(async () => - { - List formats = Enumerable.Range(StartNumber, Quantity).Select(i => new WiegandStandardCredentialFormat(FacilityCode, i)).ToList(); + List formats = Enumerable.Range(StartNumber, Quantity).Select(i => new WiegandStandardCredentialFormat(FacilityCode, i)).ToList(); - var query = (CredentialConfigurationQuery)Workspace.Sdk.ReportManager.CreateReportQuery(ReportType.CredentialConfiguration); + var query = (CredentialConfigurationQuery)Workspace.Sdk.ReportManager.CreateReportQuery(ReportType.CredentialConfiguration); - foreach (WiegandStandardCredentialFormat format in formats) - { - query.UniqueIds.Add(format); - } + foreach (WiegandStandardCredentialFormat format in formats) + { + query.UniqueIds.Add(format); + } - QueryCompletedEventArgs result = await Task.Factory.FromAsync(query.BeginQuery, query.EndQuery, null); - var existing = result.Data.AsEnumerable().Select(row => row.Field(nameof(Guid))); + QueryCompletedEventArgs result = await Task.Factory.FromAsync(query.BeginQuery, query.EndQuery, null); + var existing = result.Data.AsEnumerable().Select(row => row.Field(nameof(Guid))); - foreach (Guid entityId in existing) - { - OnExistingCredentialRetrieved(new ExistingCredentialRetrievedEventArgs(entityId)); - } + foreach (Guid entityId in existing) + { + OnExistingCredentialRetrieved(new ExistingCredentialRetrievedEventArgs(entityId)); + } - var missing = formats - .Except(existing.Select(Workspace.Sdk.GetEntity).OfType().Select(credential => credential.Format), new CredentialFormatComparer()) - .OfType(); + var missing = formats + .Except(existing.Select(Workspace.Sdk.GetEntity).OfType().Select(credential => credential.Format), new CredentialFormatComparer()) + .OfType(); - await Workspace.Sdk.TransactionManager.ExecuteTransactionAsync(() => + await Workspace.Sdk.TransactionManager.ExecuteTransactionAsync(() => + { + foreach (WiegandStandardCredentialFormat format in missing) { - foreach (WiegandStandardCredentialFormat format in missing) - { - Dispatcher.Invoke(() => OnCredentialRetrieved(new CredentialRetrievedEventArgs(format))); - } - }); + Dispatcher.Invoke(() => OnCredentialRetrieved(new CredentialRetrievedEventArgs(format))); + } }); - } + }); + } - public override string Name => nameof(SampleCredentialReader); + public override string Name => nameof(SampleCredentialReader); - public override Guid UniqueId { get; } = new Guid("76104935-7793-4529-83D2-061BE6FB072F"); + public override Guid UniqueId { get; } = new Guid("76104935-7793-4529-83D2-061BE6FB072F"); - public override bool IsValid => true; + public override bool IsValid => true; - public override OperationMode OperationMode { get; set; } + public override OperationMode OperationMode { get; set; } - public int StartNumber - { - get => m_startNumber; - set => SetProperty(ref m_startNumber, value); - } + public int StartNumber + { + get => m_startNumber; + set => SetProperty(ref m_startNumber, value); + } - public int FacilityCode - { - get => m_facilityCode; - set => SetProperty(ref m_facilityCode, value); - } + public int FacilityCode + { + get => m_facilityCode; + set => SetProperty(ref m_facilityCode, value); + } - public int Quantity - { - get => m_quantity; - set => SetProperty(ref m_quantity, value); - } + public int Quantity + { + get => m_quantity; + set => SetProperty(ref m_quantity, value); + } - public DelegateCommand GenerateCommand { get; } + public DelegateCommand GenerateCommand { get; } - public event PropertyChangedEventHandler PropertyChanged; + public event PropertyChangedEventHandler PropertyChanged; - public override void Dispose() - { - } + public override void Dispose() + { + } - public override void Activate() - { - } + public override void Activate() + { + } - public override UIElement CreateView() - { - return new CredentialReaderView(this); - } + public override UIElement CreateView() + { + return new CredentialReaderView(this); + } - public override void Deactivate() - { - } + public override void Deactivate() + { + } - public override bool SupportsOperationMode(OperationMode mode) - { - return mode != OperationMode.Retrieval; - } + public override bool SupportsOperationMode(OperationMode mode) + { + return mode != OperationMode.Retrieval; + } - private bool SetProperty(ref T storage, T value, [CallerMemberName] string propertyName = null) - { - if (Equals(storage, value)) - return false; + private bool SetProperty(ref T storage, T value, [CallerMemberName] string propertyName = null) + { + if (Equals(storage, value)) + return false; - storage = value; - OnPropertyChanged(propertyName); + storage = value; + OnPropertyChanged(propertyName); - return true; - } + return true; + } - private void OnPropertyChanged([CallerMemberName] string propertyName = null) - { - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); - } + private void OnPropertyChanged([CallerMemberName] string propertyName = null) + { + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); } } \ No newline at end of file diff --git a/Samples/Workspace SDK/CredentialReaderSample/SampleModule.cs b/Samples/Workspace SDK/CredentialReaderSample/SampleModule.cs index 0eaaf06..89e2094 100644 --- a/Samples/Workspace SDK/CredentialReaderSample/SampleModule.cs +++ b/Samples/Workspace SDK/CredentialReaderSample/SampleModule.cs @@ -1,21 +1,20 @@ // Copyright (C) 2023 by Genetec, Inc. All rights reserved. // May be used only in accordance with a valid Source Code License Agreement. -namespace Genetec.Dap.CodeSamples -{ - using Sdk.Workspace.Modules; +namespace Genetec.Dap.CodeSamples; + +using Sdk.Workspace.Modules; - public class SampleModule : Module +public class SampleModule : Module +{ + public override void Load() { - public override void Load() - { - var component = new SampleCredentialReader(); - component.Initialize(Workspace); - Workspace.Components.Register(component); - } + var component = new SampleCredentialReader(); + component.Initialize(Workspace); + Workspace.Components.Register(component); + } - public override void Unload() - { - } + public override void Unload() + { } } \ No newline at end of file diff --git a/Samples/Workspace SDK/DashboardWidgetSample/ClockWidget.cs b/Samples/Workspace SDK/DashboardWidgetSample/ClockWidget.cs index 3e22fbb..f8dc260 100644 --- a/Samples/Workspace SDK/DashboardWidgetSample/ClockWidget.cs +++ b/Samples/Workspace SDK/DashboardWidgetSample/ClockWidget.cs @@ -1,137 +1,136 @@ // Copyright (C) 2023 by Genetec, Inc. All rights reserved. // May be used only in accordance with a valid Source Code License Agreement. -namespace Genetec.Dap.CodeSamples +namespace Genetec.Dap.CodeSamples; + +using System; +using System.ComponentModel; +using System.Runtime.CompilerServices; +using System.Windows; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Threading; +using Prism.Commands; +using Sdk.Workspace.Components; + +public class ClockWidget : DashboardWidget, INotifyPropertyChanged { - using System; - using System.ComponentModel; - using System.Runtime.CompilerServices; - using System.Windows; - using System.Windows.Input; - using System.Windows.Media; - using System.Windows.Threading; - using Prism.Commands; - using Sdk.Workspace.Components; - - public class ClockWidget : DashboardWidget, INotifyPropertyChanged - { - private readonly ClockWidgetView m_view; + private readonly ClockWidgetView m_view; - private bool m_showDigitalTime; + private bool m_showDigitalTime; - private string m_time; + private string m_time; - public override Color DefaultBackgroundColor => Color.FromRgb(0, 170, 255); + public override Color DefaultBackgroundColor => Color.FromRgb(0, 170, 255); - public override bool DefaultRefreshAutomatically => true; + public override bool DefaultRefreshAutomatically => true; - public override TimeSpan DefaultRefreshInterval => TimeSpan.FromMinutes(1); + public override TimeSpan DefaultRefreshInterval => TimeSpan.FromMinutes(1); - public override bool DefaultShowTitle => true; + public override bool DefaultShowTitle => true; - public override string DefaultTitle => "Clock Widget"; + public override string DefaultTitle => "Clock Widget"; - public override bool IsRefreshable => true; + public override bool IsRefreshable => true; - public override bool IsResizableHorizontally => false; + public override bool IsResizableHorizontally => false; - public override bool IsResizableVertically => false; + public override bool IsResizableVertically => false; - public override Size MaxWidgetSize { get; } = new Size(10, 10); + public override Size MaxWidgetSize { get; } = new Size(10, 10); - public override Size MinWidgetSize { get; } = new Size(3, 3); + public override Size MinWidgetSize { get; } = new Size(3, 3); - public bool ShowDigitalTime - { - get => m_showDigitalTime; - set => SetProperty(ref m_showDigitalTime, value); - } + public bool ShowDigitalTime + { + get => m_showDigitalTime; + set => SetProperty(ref m_showDigitalTime, value); + } - public string Time - { - get => m_time; - set => SetProperty(ref m_time, value); - } + public string Time + { + get => m_time; + set => SetProperty(ref m_time, value); + } - public ICommand ViewDigitalTimeCommand { get; } + public ICommand ViewDigitalTimeCommand { get; } - public override string WidgetName => "Custom Clock Widget"; + public override string WidgetName => "Custom Clock Widget"; - public override Size WidgetSize { get; set; } = new Size(8, 8); + public override Size WidgetSize { get; set; } = new Size(8, 8); - public override Guid WidgetTypeId => ClockWidgetBuilder.ClockWidgetTypeId; + public override Guid WidgetTypeId => ClockWidgetBuilder.ClockWidgetTypeId; - public event PropertyChangedEventHandler PropertyChanged; + public event PropertyChangedEventHandler PropertyChanged; - private bool SetProperty(ref T storage, T value, [CallerMemberName] string propertyName = null) - { - if (Equals(storage, value)) - return false; + private bool SetProperty(ref T storage, T value, [CallerMemberName] string propertyName = null) + { + if (Equals(storage, value)) + return false; - storage = value; - OnPropertyChanged(propertyName); + storage = value; + OnPropertyChanged(propertyName); - return true; - } + return true; + } - public ClockWidget() - { - ViewDigitalTimeCommand = new DelegateCommand(DigitalTimeCommand); - m_view = new ClockWidgetView { DataContext = this }; - } + public ClockWidget() + { + ViewDigitalTimeCommand = new DelegateCommand(DigitalTimeCommand); + m_view = new ClockWidgetView { DataContext = this }; + } - public override UIElement CreateOptionsView() - { - return new CustomWidgetSettings { DataContext = this }; - } + public override UIElement CreateOptionsView() + { + return new CustomWidgetSettings { DataContext = this }; + } - public override UIElement CreateView() - { - return m_view; - } + public override UIElement CreateView() + { + return m_view; + } - public override void Deserialize(string value) - { - ShowDigitalTime = ClockWidgetConfiguration.Deserialize(value).ShowDigitalTime; - } + public override void Deserialize(string value) + { + ShowDigitalTime = ClockWidgetConfiguration.Deserialize(value).ShowDigitalTime; + } - public override void Refresh() - { - Dispatcher?.BeginInvoke(DispatcherPriority.Render, (Action)(() => - { - DateTime now = DateTime.Now; - int hourRotateValue = now.Hour; - int minuteRotateValue = now.Minute; - int secondRotateValue = now.Second; - hourRotateValue = (hourRotateValue + minuteRotateValue / 60) * 30; - minuteRotateValue = (minuteRotateValue + secondRotateValue / 60) * 6; - m_view.MinuteRotate.Angle = minuteRotateValue; - m_view.HourRotate.Angle = hourRotateValue; - Time = now.ToString("h:mm tt"); - })); - } - - public override string Serialize() + public override void Refresh() + { + Dispatcher?.BeginInvoke(DispatcherPriority.Render, (Action)(() => { - return new ClockWidgetConfiguration { ShowDigitalTime = ShowDigitalTime }.Serialize(); - } + DateTime now = DateTime.Now; + int hourRotateValue = now.Hour; + int minuteRotateValue = now.Minute; + int secondRotateValue = now.Second; + hourRotateValue = (hourRotateValue + minuteRotateValue / 60) * 30; + minuteRotateValue = (minuteRotateValue + secondRotateValue / 60) * 6; + m_view.MinuteRotate.Angle = minuteRotateValue; + m_view.HourRotate.Angle = hourRotateValue; + Time = now.ToString("h:mm tt"); + })); + } - private void OnPropertyChanged([CallerMemberName] string propertyName = null) - { - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); - } + public override string Serialize() + { + return new ClockWidgetConfiguration { ShowDigitalTime = ShowDigitalTime }.Serialize(); + } - protected override void OnWidgetEndDrag(EventArgs e) - { - Refresh(); - } + private void OnPropertyChanged([CallerMemberName] string propertyName = null) + { + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); + } - private void DigitalTimeCommand() - { - ShowDigitalTime = !m_showDigitalTime; - Refresh(); - } + protected override void OnWidgetEndDrag(EventArgs e) + { + Refresh(); + } - + private void DigitalTimeCommand() + { + ShowDigitalTime = !m_showDigitalTime; + Refresh(); } + + } \ No newline at end of file diff --git a/Samples/Workspace SDK/DashboardWidgetSample/ClockWidgetBuilder.cs b/Samples/Workspace SDK/DashboardWidgetSample/ClockWidgetBuilder.cs index 9d2c195..594e680 100644 --- a/Samples/Workspace SDK/DashboardWidgetSample/ClockWidgetBuilder.cs +++ b/Samples/Workspace SDK/DashboardWidgetSample/ClockWidgetBuilder.cs @@ -4,35 +4,34 @@ // Copyright (C) 2023 by Genetec, Inc. All rights reserved. // May be used only in accordance with a valid Source Code License Agreement. -namespace Genetec.Dap.CodeSamples -{ - using System; - using System.Windows.Media.Imaging; - using Genetec.Sdk.Workspace.Components.Dashboard; - using Sdk.Workspace.Components; +namespace Genetec.Dap.CodeSamples; - public sealed class ClockWidgetBuilder : DashboardWidgetBuilder - { - public static Guid ClockWidgetTypeId = new Guid("3E27799F-2FE1-44B6-B131-0695D98503DE"); +using System; +using System.Windows.Media.Imaging; +using Genetec.Sdk.Workspace.Components.Dashboard; +using Sdk.Workspace.Components; - public override string Description => "Simple clock"; +public sealed class ClockWidgetBuilder : DashboardWidgetBuilder +{ + public static Guid ClockWidgetTypeId = new Guid("3E27799F-2FE1-44B6-B131-0695D98503DE"); - public override string Name => "Clock"; + public override string Description => "Simple clock"; - public override BitmapSource Thumbnail => new BitmapImage(new Uri("pack://application:,,,/DashboardWidgetSample;Component/Resources/AlarmClock.png", UriKind.RelativeOrAbsolute)); + public override string Name => "Clock"; - public override Guid UniqueId => ClockWidgetTypeId; + public override BitmapSource Thumbnail => new BitmapImage(new Uri("pack://application:,,,/DashboardWidgetSample;Component/Resources/AlarmClock.png", UriKind.RelativeOrAbsolute)); - public override Guid Category => DashboardWidgetCategories.GeneralId; + public override Guid UniqueId => ClockWidgetTypeId; - public override DashboardWidget CreateWidget(DashboardWidgetBuilderContext context) - { - return new ClockWidget(); - } + public override Guid Category => DashboardWidgetCategories.GeneralId; - public override bool IsSupported(DashboardWidgetBuilderContext context) - { - return context.Type == ClockWidgetTypeId; - } + public override DashboardWidget CreateWidget(DashboardWidgetBuilderContext context) + { + return new ClockWidget(); + } + + public override bool IsSupported(DashboardWidgetBuilderContext context) + { + return context.Type == ClockWidgetTypeId; } } \ No newline at end of file diff --git a/Samples/Workspace SDK/DashboardWidgetSample/ClockWidgetConfiguration.cs b/Samples/Workspace SDK/DashboardWidgetSample/ClockWidgetConfiguration.cs index 6be5e25..53bb720 100644 --- a/Samples/Workspace SDK/DashboardWidgetSample/ClockWidgetConfiguration.cs +++ b/Samples/Workspace SDK/DashboardWidgetSample/ClockWidgetConfiguration.cs @@ -1,39 +1,38 @@ // Copyright (C) 2023 by Genetec, Inc. All rights reserved. // May be used only in accordance with a valid Source Code License Agreement. -namespace Genetec.Dap.CodeSamples +namespace Genetec.Dap.CodeSamples; + +using System.IO; +using System.Runtime.Serialization; +using System.Runtime.Serialization.Json; +using System.Text; + +[DataContract] +class ClockWidgetConfiguration { - using System.IO; - using System.Runtime.Serialization; - using System.Runtime.Serialization.Json; - using System.Text; + [DataMember] + public bool ShowDigitalTime { get; set; } + + public static ClockWidgetConfiguration Deserialize(string data) + { + if (string.IsNullOrEmpty(data)) + return new ClockWidgetConfiguration(); - [DataContract] - class ClockWidgetConfiguration + using var stream = new MemoryStream(Encoding.UTF8.GetBytes(data)); + var serializer = new DataContractJsonSerializer(typeof(ClockWidgetConfiguration)); + + return (ClockWidgetConfiguration)serializer.ReadObject(stream); + } + + public string Serialize() { - [DataMember] - public bool ShowDigitalTime { get; set; } - - public static ClockWidgetConfiguration Deserialize(string data) - { - if (string.IsNullOrEmpty(data)) - return new ClockWidgetConfiguration(); - - using var stream = new MemoryStream(Encoding.UTF8.GetBytes(data)); - var serializer = new DataContractJsonSerializer(typeof(ClockWidgetConfiguration)); - - return (ClockWidgetConfiguration)serializer.ReadObject(stream); - } - - public string Serialize() - { - using var stream = new MemoryStream(); - var serializer = new DataContractJsonSerializer(typeof(ClockWidgetConfiguration)); - serializer.WriteObject(stream, this); - stream.Position = 0; - - using var reader = new StreamReader(stream); - return reader.ReadToEnd(); - } + using var stream = new MemoryStream(); + var serializer = new DataContractJsonSerializer(typeof(ClockWidgetConfiguration)); + serializer.WriteObject(stream, this); + stream.Position = 0; + + using var reader = new StreamReader(stream); + return reader.ReadToEnd(); } } \ No newline at end of file diff --git a/Samples/Workspace SDK/DashboardWidgetSample/ClockWidgetView.xaml.cs b/Samples/Workspace SDK/DashboardWidgetSample/ClockWidgetView.xaml.cs index 76c93af..e8912a2 100644 --- a/Samples/Workspace SDK/DashboardWidgetSample/ClockWidgetView.xaml.cs +++ b/Samples/Workspace SDK/DashboardWidgetSample/ClockWidgetView.xaml.cs @@ -1,13 +1,12 @@ // Copyright (C) 2023 by Genetec, Inc. All rights reserved. // May be used only in accordance with a valid Source Code License Agreement. -namespace Genetec.Dap.CodeSamples +namespace Genetec.Dap.CodeSamples; + +public partial class ClockWidgetView { - public partial class ClockWidgetView + public ClockWidgetView() { - public ClockWidgetView() - { - InitializeComponent(); - } + InitializeComponent(); } } \ No newline at end of file diff --git a/Samples/Workspace SDK/DashboardWidgetSample/CustomWidgetSettings.xaml.cs b/Samples/Workspace SDK/DashboardWidgetSample/CustomWidgetSettings.xaml.cs index d35230b..8492387 100644 --- a/Samples/Workspace SDK/DashboardWidgetSample/CustomWidgetSettings.xaml.cs +++ b/Samples/Workspace SDK/DashboardWidgetSample/CustomWidgetSettings.xaml.cs @@ -1,13 +1,12 @@ // Copyright (C) 2023 by Genetec, Inc. All rights reserved. // May be used only in accordance with a valid Source Code License Agreement. -namespace Genetec.Dap.CodeSamples +namespace Genetec.Dap.CodeSamples; + +public partial class CustomWidgetSettings { - public partial class CustomWidgetSettings + public CustomWidgetSettings() { - public CustomWidgetSettings() - { - InitializeComponent(); - } + InitializeComponent(); } } \ No newline at end of file diff --git a/Samples/Workspace SDK/DashboardWidgetSample/SampleModule.cs b/Samples/Workspace SDK/DashboardWidgetSample/SampleModule.cs index 7dd7013..f04ffaf 100644 --- a/Samples/Workspace SDK/DashboardWidgetSample/SampleModule.cs +++ b/Samples/Workspace SDK/DashboardWidgetSample/SampleModule.cs @@ -1,25 +1,24 @@ // Copyright (C) 2023 by Genetec, Inc. All rights reserved. // May be used only in accordance with a valid Source Code License Agreement. -namespace Genetec.Dap.CodeSamples -{ - using Sdk; - using Sdk.Workspace.Modules; +namespace Genetec.Dap.CodeSamples; + +using Sdk; +using Sdk.Workspace.Modules; - public class SampleModule : Module +public class SampleModule : Module +{ + public override void Load() { - public override void Load() + if (Workspace.ApplicationType == ApplicationType.SecurityDesk) { - if (Workspace.ApplicationType == ApplicationType.SecurityDesk) - { - var builder = new ClockWidgetBuilder(); - builder.Initialize(Workspace); - Workspace.Components.Register(builder); - } + var builder = new ClockWidgetBuilder(); + builder.Initialize(Workspace); + Workspace.Components.Register(builder); } + } - public override void Unload() - { - } + public override void Unload() + { } } \ No newline at end of file diff --git a/Samples/Workspace SDK/EventExtenderSample/CustomEventPayload.cs b/Samples/Workspace SDK/EventExtenderSample/CustomEventPayload.cs index ebf50a5..94bc1ff 100644 --- a/Samples/Workspace SDK/EventExtenderSample/CustomEventPayload.cs +++ b/Samples/Workspace SDK/EventExtenderSample/CustomEventPayload.cs @@ -5,33 +5,32 @@ // Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -namespace Genetec.Dap.CodeSamples -{ - using System; - using Newtonsoft.Json; +namespace Genetec.Dap.CodeSamples; - public class CustomEventPayload - { - public string Text { get; set; } - public int Numeric { get; set; } - public bool Boolean { get; set; } - public decimal Decimal { get; set; } - public DateTime DateTime { get; set; } +using System; +using Newtonsoft.Json; + +public class CustomEventPayload +{ + public string Text { get; set; } + public int Numeric { get; set; } + public bool Boolean { get; set; } + public decimal Decimal { get; set; } + public DateTime DateTime { get; set; } - public string Serialize() => JsonConvert.SerializeObject(this); + public string Serialize() => JsonConvert.SerializeObject(this); - public static bool TryDeserialize(string json, out CustomEventPayload payload) + public static bool TryDeserialize(string json, out CustomEventPayload payload) + { + try + { + payload = JsonConvert.DeserializeObject(json); + return true; + } + catch { - try - { - payload = JsonConvert.DeserializeObject(json); - return true; - } - catch - { - payload = null; - return false; - } + payload = null; + return false; } } } \ No newline at end of file diff --git a/Samples/Workspace SDK/EventExtenderSample/FieldName.cs b/Samples/Workspace SDK/EventExtenderSample/FieldName.cs index 81ec3e4..3b6fc9d 100644 --- a/Samples/Workspace SDK/EventExtenderSample/FieldName.cs +++ b/Samples/Workspace SDK/EventExtenderSample/FieldName.cs @@ -5,14 +5,13 @@ // Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -namespace Genetec.Dap.CodeSamples +namespace Genetec.Dap.CodeSamples; + +public static class FieldName { - public static class FieldName - { - public const string Text = "Text"; - public const string Numeric = "Numeric"; - public const string Boolean = "Boolean"; - public const string Decimal = "Decimal"; - public const string DateTime = "DateTime"; - } + public const string Text = "Text"; + public const string Numeric = "Numeric"; + public const string Boolean = "Boolean"; + public const string Decimal = "Decimal"; + public const string DateTime = "DateTime"; } \ No newline at end of file diff --git a/Samples/Workspace SDK/EventExtenderSample/SampleEventExtender.cs b/Samples/Workspace SDK/EventExtenderSample/SampleEventExtender.cs index 6d4eebb..de78d40 100644 --- a/Samples/Workspace SDK/EventExtenderSample/SampleEventExtender.cs +++ b/Samples/Workspace SDK/EventExtenderSample/SampleEventExtender.cs @@ -5,43 +5,42 @@ // Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -namespace Genetec.Dap.CodeSamples +namespace Genetec.Dap.CodeSamples; + +using System; +using System.Collections.Generic; +using Properties; +using Sdk.Events; +using Sdk.Workspace.Extenders; +using Sdk.Workspace.Fields; + +public class SampleEventExtender : EventExtender { - using System; - using System.Collections.Generic; - using Properties; - using Sdk.Events; - using Sdk.Workspace.Extenders; - using Sdk.Workspace.Fields; + /// + /// Defines the custom fields to be added in the Monitoring task. + /// + public override IList Fields { get; } = + [ + new(FieldName.Text, typeof(string)) { Title = Resources.Text, IsDisplayable = true }, + new(FieldName.Numeric, typeof(int)) { Title = Resources.Number, IsDisplayable = true }, + new(FieldName.Boolean, typeof(bool)) { Title = Resources.Boolean, IsDisplayable = true }, + new(FieldName.Decimal, typeof(decimal)) { Title = Resources.Decimal, IsDisplayable = true }, + new(FieldName.DateTime, typeof(DateTime)) { Title = Resources.DateTIme, IsDisplayable = true } + ]; - public class SampleEventExtender : EventExtender + public override bool Extend(Event @event, FieldsCollection fields) { - /// - /// Defines the custom fields to be added in the Monitoring task. - /// - public override IList Fields { get; } = - [ - new(FieldName.Text, typeof(string)) { Title = Resources.Text, IsDisplayable = true }, - new(FieldName.Numeric, typeof(int)) { Title = Resources.Number, IsDisplayable = true }, - new(FieldName.Boolean, typeof(bool)) { Title = Resources.Boolean, IsDisplayable = true }, - new(FieldName.Decimal, typeof(decimal)) { Title = Resources.Decimal, IsDisplayable = true }, - new(FieldName.DateTime, typeof(DateTime)) { Title = Resources.DateTIme, IsDisplayable = true } - ]; - - public override bool Extend(Event @event, FieldsCollection fields) + // Check if the event is a CustomEventInstance and try to deserialize its payload + if (@event is CustomEventInstance instance && CustomEventPayload.TryDeserialize(instance.ExtraHiddenPayload, out CustomEventPayload payload)) { - // Check if the event is a CustomEventInstance and try to deserialize its payload - if (@event is CustomEventInstance instance && CustomEventPayload.TryDeserialize(instance.ExtraHiddenPayload, out CustomEventPayload payload)) - { - // Populate the custom fields with data from the payload - fields[FieldName.Text] = payload.Text; - fields[FieldName.Numeric] = payload.Numeric; - fields[FieldName.Boolean] = payload.Boolean; - fields[FieldName.Decimal] = payload.Decimal; - fields[FieldName.DateTime] = payload.DateTime; - return true; - } - return false; + // Populate the custom fields with data from the payload + fields[FieldName.Text] = payload.Text; + fields[FieldName.Numeric] = payload.Numeric; + fields[FieldName.Boolean] = payload.Boolean; + fields[FieldName.Decimal] = payload.Decimal; + fields[FieldName.DateTime] = payload.DateTime; + return true; } + return false; } } \ No newline at end of file diff --git a/Samples/Workspace SDK/EventExtenderSample/SampleModule.cs b/Samples/Workspace SDK/EventExtenderSample/SampleModule.cs index ef933ea..2c33325 100644 --- a/Samples/Workspace SDK/EventExtenderSample/SampleModule.cs +++ b/Samples/Workspace SDK/EventExtenderSample/SampleModule.cs @@ -5,25 +5,24 @@ // Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -namespace Genetec.Dap.CodeSamples -{ - using Genetec.Sdk.Workspace.Services; - using Sdk.Workspace.Modules; +namespace Genetec.Dap.CodeSamples; + +using Genetec.Sdk.Workspace.Services; +using Sdk.Workspace.Modules; - public class SampleModule : Module +public class SampleModule : Module +{ + public override void Load() { - public override void Load() + if (Workspace.ApplicationType == Sdk.ApplicationType.SecurityDesk) { - if (Workspace.ApplicationType == Sdk.ApplicationType.SecurityDesk) - { - var extender = new SampleEventExtender(); - extender.Initialize(Workspace); - Workspace.Services.Get().RegisterEventExtender(extender); - } + var extender = new SampleEventExtender(); + extender.Initialize(Workspace); + Workspace.Services.Get().RegisterEventExtender(extender); } + } - public override void Unload() - { - } + public override void Unload() + { } } \ No newline at end of file diff --git a/Samples/Workspace SDK/ImageExtractorSample/SampleImageExtractor.cs b/Samples/Workspace SDK/ImageExtractorSample/SampleImageExtractor.cs index cf29851..4699a22 100644 --- a/Samples/Workspace SDK/ImageExtractorSample/SampleImageExtractor.cs +++ b/Samples/Workspace SDK/ImageExtractorSample/SampleImageExtractor.cs @@ -1,37 +1,36 @@ // Copyright (C) 2023 by Genetec, Inc. All rights reserved. // May be used only in accordance with a valid Source Code License Agreement. -namespace Genetec.Dap.CodeSamples -{ - using System; - using System.Windows.Media; - using System.Windows.Media.Imaging; - using Microsoft.Win32; - using Sdk.Workspace.Components.ImageExtractor; +namespace Genetec.Dap.CodeSamples; - public sealed class SampleImageExtractor : ImageExtractor - { - public override ImageSource Icon { get; } = new BitmapImage(new Uri("pack://application:,,,/ImageExtractorSample;Component/Resources/Icon.png", UriKind.RelativeOrAbsolute)); +using System; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using Microsoft.Win32; +using Sdk.Workspace.Components.ImageExtractor; + +public sealed class SampleImageExtractor : ImageExtractor +{ + public override ImageSource Icon { get; } = new BitmapImage(new Uri("pack://application:,,,/ImageExtractorSample;Component/Resources/Icon.png", UriKind.RelativeOrAbsolute)); - public override string Name => "Load from vCard..."; + public override string Name => "Load from vCard..."; - public override Guid UniqueId { get; } = new Guid("5EDBB0B6-8253-433E-99A1-9021E498437A"); + public override Guid UniqueId { get; } = new Guid("5EDBB0B6-8253-433E-99A1-9021E498437A"); - public override ImageSource GetImage() + public override ImageSource GetImage() + { + var openFileDialog = new OpenFileDialog { - var openFileDialog = new OpenFileDialog - { - Filter = "vCard files (*.vcf)|*.vcf|All files (*.*)|*.*", - Title = "Open vCard File" - }; + Filter = "vCard files (*.vcf)|*.vcf|All files (*.*)|*.*", + Title = "Open vCard File" + }; - return openFileDialog.ShowDialog() == true ? VCardReader.ReadVCard(openFileDialog.FileName)?.Picture : null; - } + return openFileDialog.ShowDialog() == true ? VCardReader.ReadVCard(openFileDialog.FileName)?.Picture : null; + } - public override bool SupportsContext(ImageExtractorContext context) - { - return context == ImageExtractorContext.CardholderPicture; - } + public override bool SupportsContext(ImageExtractorContext context) + { + return context == ImageExtractorContext.CardholderPicture; } } \ No newline at end of file diff --git a/Samples/Workspace SDK/ImageExtractorSample/SampleModule.cs b/Samples/Workspace SDK/ImageExtractorSample/SampleModule.cs index ed01229..be85069 100644 --- a/Samples/Workspace SDK/ImageExtractorSample/SampleModule.cs +++ b/Samples/Workspace SDK/ImageExtractorSample/SampleModule.cs @@ -1,21 +1,20 @@ // Copyright (C) 2023 by Genetec, Inc. All rights reserved. // May be used only in accordance with a valid Source Code License Agreement. -namespace Genetec.Dap.CodeSamples -{ - using Sdk.Workspace.Modules; +namespace Genetec.Dap.CodeSamples; + +using Sdk.Workspace.Modules; - public class SampleModule : Module +public class SampleModule : Module +{ + public override void Load() { - public override void Load() - { - var component = new SampleImageExtractor(); - component.Initialize(Workspace); - Workspace.Components.Register(component); - } + var component = new SampleImageExtractor(); + component.Initialize(Workspace); + Workspace.Components.Register(component); + } - public override void Unload() - { - } + public override void Unload() + { } } \ No newline at end of file diff --git a/Samples/Workspace SDK/ImageExtractorSample/VCard.cs b/Samples/Workspace SDK/ImageExtractorSample/VCard.cs index 015f3f0..18d3a1f 100644 --- a/Samples/Workspace SDK/ImageExtractorSample/VCard.cs +++ b/Samples/Workspace SDK/ImageExtractorSample/VCard.cs @@ -1,21 +1,20 @@ // Copyright (C) 2023 by Genetec, Inc. All rights reserved. // May be used only in accordance with a valid Source Code License Agreement. -namespace Genetec.Dap.CodeSamples -{ - using System.Collections.Generic; - using System.Windows.Media; +namespace Genetec.Dap.CodeSamples; + +using System.Collections.Generic; +using System.Windows.Media; - public class VCard - { - public string FirstName { get; set; } +public class VCard +{ + public string FirstName { get; set; } - public string LastName { get; set; } + public string LastName { get; set; } - public List Emails { get; } = new List(); + public List Emails { get; } = new List(); - public string Note { get; set; } + public string Note { get; set; } - public ImageSource Picture { get; set; } - } + public ImageSource Picture { get; set; } } \ No newline at end of file diff --git a/Samples/Workspace SDK/ImageExtractorSample/VCardReader.cs b/Samples/Workspace SDK/ImageExtractorSample/VCardReader.cs index a8f1a7a..84354ee 100644 --- a/Samples/Workspace SDK/ImageExtractorSample/VCardReader.cs +++ b/Samples/Workspace SDK/ImageExtractorSample/VCardReader.cs @@ -1,63 +1,62 @@ // Copyright (C) 2023 by Genetec, Inc. All rights reserved. // May be used only in accordance with a valid Source Code License Agreement. -namespace Genetec.Dap.CodeSamples +namespace Genetec.Dap.CodeSamples; + +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text.RegularExpressions; +using System.Windows.Media; +using System.Windows.Media.Imaging; + +public class VCardReader { - using System; - using System.Collections.Generic; - using System.IO; - using System.Linq; - using System.Text.RegularExpressions; - using System.Windows.Media; - using System.Windows.Media.Imaging; - - public class VCardReader + public static VCard ReadVCard(string filePath) { - public static VCard ReadVCard(string filePath) + string vCardText = File.ReadAllText(filePath); + var vcard = new VCard { - string vCardText = File.ReadAllText(filePath); - var vcard = new VCard - { - FirstName = ExtractField(vCardText, "FN:"), - LastName = ExtractField(vCardText, "N:").Split(';')[0], // Assuming last name is the first component in the N: field - Note = ExtractField(vCardText, "NOTE:"), - Picture = ExtractPhoto(vCardText) - }; - - vcard.Emails.AddRange(ExtractEmails(vCardText)); - return vcard; - } + FirstName = ExtractField(vCardText, "FN:"), + LastName = ExtractField(vCardText, "N:").Split(';')[0], // Assuming last name is the first component in the N: field + Note = ExtractField(vCardText, "NOTE:"), + Picture = ExtractPhoto(vCardText) + }; + + vcard.Emails.AddRange(ExtractEmails(vCardText)); + return vcard; + } - private static string ExtractField(string vCardText, string fieldName) - { - Match match = Regex.Match(vCardText, $"{fieldName}(.*?)(\n(?![ \t])|\r\n(?![ \t])|$)", RegexOptions.Singleline); - return match.Success ? match.Groups[1].Value.Trim() : string.Empty; - } + private static string ExtractField(string vCardText, string fieldName) + { + Match match = Regex.Match(vCardText, $"{fieldName}(.*?)(\n(?![ \t])|\r\n(?![ \t])|$)", RegexOptions.Singleline); + return match.Success ? match.Groups[1].Value.Trim() : string.Empty; + } - private static List ExtractEmails(string vCardText) - { - MatchCollection matches = Regex.Matches(vCardText, "EMAIL;[^:]+:(.*?)\r?\n"); - return matches.Cast().Select(match => match.Groups[1].Value.Trim()).ToList(); - } + private static List ExtractEmails(string vCardText) + { + MatchCollection matches = Regex.Matches(vCardText, "EMAIL;[^:]+:(.*?)\r?\n"); + return matches.Cast().Select(match => match.Groups[1].Value.Trim()).ToList(); + } - private static ImageSource ExtractPhoto(string vCardText) + private static ImageSource ExtractPhoto(string vCardText) + { + Match photoMatch = Regex.Match(vCardText, @"PHOTO;ENCODING=b;TYPE=image/jpeg:(.*?)(\n(?![ \t])|\r\n(?![ \t])|$)", RegexOptions.Singleline); + if (photoMatch.Success) { - Match photoMatch = Regex.Match(vCardText, @"PHOTO;ENCODING=b;TYPE=image/jpeg:(.*?)(\n(?![ \t])|\r\n(?![ \t])|$)", RegexOptions.Singleline); - if (photoMatch.Success) - { - string base64Data = photoMatch.Groups[1].Value.Trim().Replace("\n", "").Replace("\r", ""); - - using var stream = new MemoryStream(Convert.FromBase64String(base64Data)); - var bitmap = new BitmapImage(); - bitmap.BeginInit(); - bitmap.StreamSource = stream; - bitmap.CacheOption = BitmapCacheOption.OnLoad; - bitmap.EndInit(); - bitmap.Freeze(); - return bitmap; - } - - return null; + string base64Data = photoMatch.Groups[1].Value.Trim().Replace("\n", "").Replace("\r", ""); + + using var stream = new MemoryStream(Convert.FromBase64String(base64Data)); + var bitmap = new BitmapImage(); + bitmap.BeginInit(); + bitmap.StreamSource = stream; + bitmap.CacheOption = BitmapCacheOption.OnLoad; + bitmap.EndInit(); + bitmap.Freeze(); + return bitmap; } + + return null; } } \ No newline at end of file diff --git a/Samples/Workspace SDK/OptionsExtensionSample/SampleModule.cs b/Samples/Workspace SDK/OptionsExtensionSample/SampleModule.cs index 38fe9db..2f307ed 100644 --- a/Samples/Workspace SDK/OptionsExtensionSample/SampleModule.cs +++ b/Samples/Workspace SDK/OptionsExtensionSample/SampleModule.cs @@ -1,25 +1,24 @@ // Copyright (C) 2023 by Genetec, Inc. All rights reserved. // May be used only in accordance with a valid Source Code License Agreement. -namespace Genetec.Dap.CodeSamples -{ - using Sdk; - using Sdk.Workspace.Modules; +namespace Genetec.Dap.CodeSamples; + +using Sdk; +using Sdk.Workspace.Modules; - public class SampleModule : Module +public class SampleModule : Module +{ + public override void Load() { - public override void Load() + if (Workspace.ApplicationType == ApplicationType.SecurityDesk) { - if (Workspace.ApplicationType == ApplicationType.SecurityDesk) - { - var extensions = new SampleOptionsExtensions(); - extensions.Initialize(Workspace); - Workspace.Options.Register(extensions); - } + var extensions = new SampleOptionsExtensions(); + extensions.Initialize(Workspace); + Workspace.Options.Register(extensions); } + } - public override void Unload() - { - } + public override void Unload() + { } } \ No newline at end of file diff --git a/Samples/Workspace SDK/OptionsExtensionSample/SampleOptionPage.cs b/Samples/Workspace SDK/OptionsExtensionSample/SampleOptionPage.cs index 4c2877d..00a5741 100644 --- a/Samples/Workspace SDK/OptionsExtensionSample/SampleOptionPage.cs +++ b/Samples/Workspace SDK/OptionsExtensionSample/SampleOptionPage.cs @@ -1,122 +1,121 @@ // Copyright (C) 2023 by Genetec, Inc. All rights reserved. // May be used only in accordance with a valid Source Code License Agreement. -namespace Genetec.Dap.CodeSamples +namespace Genetec.Dap.CodeSamples; + +using System; +using System.ComponentModel; +using System.Runtime.CompilerServices; +using System.Windows; +using System.Windows.Media; +using Sdk.Workspace.Options; + +public class SampleOptionPage : OptionPage, INotifyPropertyChanged { - using System; - using System.ComponentModel; - using System.Runtime.CompilerServices; - using System.Windows; - using System.Windows.Media; - using Sdk.Workspace.Options; - - public class SampleOptionPage : OptionPage, INotifyPropertyChanged - { - private readonly SampleOptionsExtensions m_extension; + private readonly SampleOptionsExtensions m_extension; - private Color m_color; + private Color m_color; - private DateTime m_dateTime; + private DateTime m_dateTime; - private int m_number; + private int m_number; - private string m_text; + private string m_text; - public SampleOptionPage(SampleOptionsExtensions extension) - { - m_extension = extension; - View = new SampleOptionsView(this); - } + public SampleOptionPage(SampleOptionsExtensions extension) + { + m_extension = extension; + View = new SampleOptionsView(this); + } - public int Number + public int Number + { + get => m_number; + set { - get => m_number; - set + if (SetProperty(ref m_number, value)) { - if (SetProperty(ref m_number, value)) - { - OnModified(); - } + OnModified(); } } + } - public DateTime DateTime + public DateTime DateTime + { + get => m_dateTime; + set { - get => m_dateTime; - set + if (SetProperty(ref m_dateTime, value)) { - if (SetProperty(ref m_dateTime, value)) - { - OnModified(); - } + OnModified(); } } + } - public Color Color + public Color Color + { + get => m_color; + set { - get => m_color; - set + if (SetProperty(ref m_color, value)) { - if (SetProperty(ref m_color, value)) - { - OnModified(); - } + OnModified(); } } + } - public string Text + public string Text + { + get => m_text; + set { - get => m_text; - set + if (SetProperty(ref m_text, value)) { - if (SetProperty(ref m_text, value)) - { - OnModified(); - } + OnModified(); } } + } - public override UIElement View { get; } + public override UIElement View { get; } - public event PropertyChangedEventHandler PropertyChanged; + public event PropertyChangedEventHandler PropertyChanged; - public override void Load() - { - Text = m_extension.Text; - Number = m_extension.Number; - DateTime = m_extension.DateTime; - Color = m_extension.Color; - } + public override void Load() + { + Text = m_extension.Text; + Number = m_extension.Number; + DateTime = m_extension.DateTime; + Color = m_extension.Color; + } - public override void Save() - { - m_extension.Text = Text; - m_extension.Number = Number; - m_extension.DateTime = DateTime; - m_extension.Color = Color; - } + public override void Save() + { + m_extension.Text = Text; + m_extension.Number = Number; + m_extension.DateTime = DateTime; + m_extension.Color = Color; + } - public override bool Validate() - { - return true; - } + public override bool Validate() + { + return true; + } - private bool SetProperty(ref T storage, T value, [CallerMemberName] string propertyName = null) + private bool SetProperty(ref T storage, T value, [CallerMemberName] string propertyName = null) + { + if (Equals(storage, value)) { - if (Equals(storage, value)) - { - return false; - } + return false; + } - storage = value; - OnPropertyChanged(propertyName); + storage = value; + OnPropertyChanged(propertyName); - return true; - } + return true; + } - private void OnPropertyChanged([CallerMemberName] string propertyName = null) - { - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); - } + private void OnPropertyChanged([CallerMemberName] string propertyName = null) + { + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); } } \ No newline at end of file diff --git a/Samples/Workspace SDK/OptionsExtensionSample/SampleOptionsData.cs b/Samples/Workspace SDK/OptionsExtensionSample/SampleOptionsData.cs index 0700f34..5ebab91 100644 --- a/Samples/Workspace SDK/OptionsExtensionSample/SampleOptionsData.cs +++ b/Samples/Workspace SDK/OptionsExtensionSample/SampleOptionsData.cs @@ -1,48 +1,47 @@ // Copyright (C) 2023 by Genetec, Inc. All rights reserved. // May be used only in accordance with a valid Source Code License Agreement. -namespace Genetec.Dap.CodeSamples +namespace Genetec.Dap.CodeSamples; + +using System; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Windows.Media; + +[DataContract(Namespace = "")] +public class SampleOptionsData { - using System; - using System.IO; - using System.Runtime.Serialization; - using System.Text; - using System.Windows.Media; - - [DataContract(Namespace = "")] - public class SampleOptionsData + [DataMember] + public string Text { get; set; } + + [DataMember] + public int Number { get; set; } + + [DataMember] + public DateTime DateTime { get; set; } + + [DataMember] + public Color Color { get; set; } + + public static SampleOptionsData Deserialize(string data) { - [DataMember] - public string Text { get; set; } - - [DataMember] - public int Number { get; set; } - - [DataMember] - public DateTime DateTime { get; set; } - - [DataMember] - public Color Color { get; set; } - - public static SampleOptionsData Deserialize(string data) - { - if (string.IsNullOrEmpty(data)) - return new SampleOptionsData(); - - using var stream = new MemoryStream(Encoding.UTF8.GetBytes(data)); - var serializer = new DataContractSerializer(typeof(SampleOptionsData)); - return (SampleOptionsData)serializer.ReadObject(stream); - } - - public string Serialize() - { - using var stream = new MemoryStream(); - var serializer = new DataContractSerializer(typeof(SampleOptionsData)); - serializer.WriteObject(stream, this); - stream.Position = 0; - - using var reader = new StreamReader(stream); - return reader.ReadToEnd(); - } + if (string.IsNullOrEmpty(data)) + return new SampleOptionsData(); + + using var stream = new MemoryStream(Encoding.UTF8.GetBytes(data)); + var serializer = new DataContractSerializer(typeof(SampleOptionsData)); + return (SampleOptionsData)serializer.ReadObject(stream); + } + + public string Serialize() + { + using var stream = new MemoryStream(); + var serializer = new DataContractSerializer(typeof(SampleOptionsData)); + serializer.WriteObject(stream, this); + stream.Position = 0; + + using var reader = new StreamReader(stream); + return reader.ReadToEnd(); } } \ No newline at end of file diff --git a/Samples/Workspace SDK/OptionsExtensionSample/SampleOptionsExtensions.cs b/Samples/Workspace SDK/OptionsExtensionSample/SampleOptionsExtensions.cs index ee6eac5..36cc40a 100644 --- a/Samples/Workspace SDK/OptionsExtensionSample/SampleOptionsExtensions.cs +++ b/Samples/Workspace SDK/OptionsExtensionSample/SampleOptionsExtensions.cs @@ -1,88 +1,87 @@ // Copyright (C) 2023 by Genetec, Inc. All rights reserved. // May be used only in accordance with a valid Source Code License Agreement. -namespace Genetec.Dap.CodeSamples -{ - using System; - using System.Windows.Media; - using System.Windows.Media.Imaging; - using Sdk.Entities; - using Sdk.Workspace.Options; +namespace Genetec.Dap.CodeSamples; - public sealed class SampleOptionsExtensions : OptionsExtension - { - public static readonly Guid SampleOptionsSettings = new("4B329744-E082-43F8-8B9D-9043C90D6EEB"); +using System; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using Sdk.Entities; +using Sdk.Workspace.Options; - public const string ExtensionName = nameof(SampleOptionsExtensions); +public sealed class SampleOptionsExtensions : OptionsExtension +{ + public static readonly Guid SampleOptionsSettings = new("4B329744-E082-43F8-8B9D-9043C90D6EEB"); - public string Text - { - get => (string)this[nameof(Text)]; - set => this[nameof(Text)] = value; - } + public const string ExtensionName = nameof(SampleOptionsExtensions); - public int Number - { - get => (int)this[nameof(Number)]; - set => this[nameof(Number)] = value; - } + public string Text + { + get => (string)this[nameof(Text)]; + set => this[nameof(Text)] = value; + } - public DateTime DateTime - { - get => (DateTime)this[nameof(DateTime)]; - set => this[nameof(DateTime)] = value;} + public int Number + { + get => (int)this[nameof(Number)]; + set => this[nameof(Number)] = value; + } - public Color Color - { - get => (Color)this[nameof(Color)]; - set => this[nameof(Color)] = value; - } + public DateTime DateTime + { + get => (DateTime)this[nameof(DateTime)]; + set => this[nameof(DateTime)] = value;} - public override ImageSource Icon => new BitmapImage(new Uri("pack://application:,,,/OptionsExtensionSample;component/Resources/Icon.png", UriKind.RelativeOrAbsolute)); + public Color Color + { + get => (Color)this[nameof(Color)]; + set => this[nameof(Color)] = value; + } - public override string Name => ExtensionName; + public override ImageSource Icon => new BitmapImage(new Uri("pack://application:,,,/OptionsExtensionSample;component/Resources/Icon.png", UriKind.RelativeOrAbsolute)); - public override string Title => Properties.Resources.SampleOptionsTitle; + public override string Name => ExtensionName; - public SampleOptionsExtensions() - { - RegisterProperty(nameof(Text), typeof(string), default(string)); - RegisterProperty(nameof(Number), typeof(int), default(int)); - RegisterProperty(nameof(DateTime), typeof(DateTime), default(DateTime)); - RegisterProperty(nameof(Color), typeof(Color), default(Color)); - } + public override string Title => Properties.Resources.SampleOptionsTitle; - protected override void Initialize() - { - AddOptionPage(new SampleOptionPage(this)); - } + public SampleOptionsExtensions() + { + RegisterProperty(nameof(Text), typeof(string), default(string)); + RegisterProperty(nameof(Number), typeof(int), default(int)); + RegisterProperty(nameof(DateTime), typeof(DateTime), default(DateTime)); + RegisterProperty(nameof(Color), typeof(Color), default(Color)); + } - protected override void Load() + protected override void Initialize() + { + AddOptionPage(new SampleOptionPage(this)); + } + + protected override void Load() + { + User user = Workspace.Sdk.LoggedUser; + if (user != null) { - User user = Workspace.Sdk.LoggedUser; - if (user != null) - { - SampleOptionsData data = SampleOptionsData.Deserialize(user.Settings[SampleOptionsSettings]); - Text = data.Text; - Number = data.Number; - DateTime = data.DateTime; - Color = data.Color; - } + SampleOptionsData data = SampleOptionsData.Deserialize(user.Settings[SampleOptionsSettings]); + Text = data.Text; + Number = data.Number; + DateTime = data.DateTime; + Color = data.Color; } + } - protected override void Save() + protected override void Save() + { + User user = Workspace.Sdk.LoggedUser; + if (user is not null) { - User user = Workspace.Sdk.LoggedUser; - if (user is not null) + user.Settings[SampleOptionsSettings] = new SampleOptionsData { - user.Settings[SampleOptionsSettings] = new SampleOptionsData - { - Text = Text, - Number = Number, - DateTime = DateTime, - Color = Color - }.Serialize(); - } + Text = Text, + Number = Number, + DateTime = DateTime, + Color = Color + }.Serialize(); } } } \ No newline at end of file diff --git a/Samples/Workspace SDK/OptionsExtensionSample/SampleOptionsView.xaml.cs b/Samples/Workspace SDK/OptionsExtensionSample/SampleOptionsView.xaml.cs index 3d67c8b..26f61b6 100644 --- a/Samples/Workspace SDK/OptionsExtensionSample/SampleOptionsView.xaml.cs +++ b/Samples/Workspace SDK/OptionsExtensionSample/SampleOptionsView.xaml.cs @@ -1,13 +1,12 @@ -namespace Genetec.Dap.CodeSamples -{ - using System.Windows.Controls; +namespace Genetec.Dap.CodeSamples; + +using System.Windows.Controls; - public partial class SampleOptionsView : UserControl +public partial class SampleOptionsView : UserControl +{ + public SampleOptionsView(SampleOptionPage page) { - public SampleOptionsView(SampleOptionPage page) - { - InitializeComponent(); - DataContext = page; - } + InitializeComponent(); + DataContext = page; } -} +} \ No newline at end of file diff --git a/Samples/Workspace SDK/PageTaskSample/SampleModule.cs b/Samples/Workspace SDK/PageTaskSample/SampleModule.cs index 05e6c33..a4599f3 100644 --- a/Samples/Workspace SDK/PageTaskSample/SampleModule.cs +++ b/Samples/Workspace SDK/PageTaskSample/SampleModule.cs @@ -5,25 +5,24 @@ // Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -namespace Genetec.Dap.CodeSamples -{ - using Sdk.Workspace.Tasks; - using Sdk; +namespace Genetec.Dap.CodeSamples; + +using Sdk.Workspace.Tasks; +using Sdk; - public class SampleModule : Sdk.Workspace.Modules.Module +public class SampleModule : Sdk.Workspace.Modules.Module +{ + public override void Load() { - public override void Load() + if (Workspace.ApplicationType is ApplicationType.SecurityDesk or ApplicationType.ConfigTool) { - if (Workspace.ApplicationType is ApplicationType.SecurityDesk or ApplicationType.ConfigTool) - { - var task = new CreatePageTask(); - task.Initialize(Workspace); - Workspace.Tasks.Register(task); - } + var task = new CreatePageTask(); + task.Initialize(Workspace); + Workspace.Tasks.Register(task); } + } - public override void Unload() - { - } + public override void Unload() + { } } \ No newline at end of file diff --git a/Samples/Workspace SDK/PageTaskSample/SamplePage.cs b/Samples/Workspace SDK/PageTaskSample/SamplePage.cs index ab7e552..e610286 100644 --- a/Samples/Workspace SDK/PageTaskSample/SamplePage.cs +++ b/Samples/Workspace SDK/PageTaskSample/SamplePage.cs @@ -5,16 +5,15 @@ // Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -namespace Genetec.Dap.CodeSamples -{ - using Sdk.Workspace.Pages; +namespace Genetec.Dap.CodeSamples; + +using Sdk.Workspace.Pages; - [Page(typeof(SamplePageDescriptor))] - public class SamplePage : Page +[Page(typeof(SamplePageDescriptor))] +public class SamplePage : Page +{ + public SamplePage() { - public SamplePage() - { - View = new SamplePageView(); - } + View = new SamplePageView(); } } \ No newline at end of file diff --git a/Samples/Workspace SDK/PageTaskSample/SamplePageDescriptor.cs b/Samples/Workspace SDK/PageTaskSample/SamplePageDescriptor.cs index 3454728..bc157b3 100644 --- a/Samples/Workspace SDK/PageTaskSample/SamplePageDescriptor.cs +++ b/Samples/Workspace SDK/PageTaskSample/SamplePageDescriptor.cs @@ -5,27 +5,26 @@ // Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -namespace Genetec.Dap.CodeSamples -{ - using System; - using Sdk.Workspace.Pages; +namespace Genetec.Dap.CodeSamples; - public class SamplePageDescriptor : PageDescriptor - { - public override string Name => "Sample page task"; +using System; +using Sdk.Workspace.Pages; - public override Guid Type { get; } = new("10B5DC08-51DF-470E-9169-8344DF69F372"); +public class SamplePageDescriptor : PageDescriptor +{ + public override string Name => "Sample page task"; - public override string Description => "This sample illustrates a Task opening a page."; + public override Guid Type { get; } = new("10B5DC08-51DF-470E-9169-8344DF69F372"); - public override Guid CategoryId { get; } = Guid.Parse(Sdk.Workspace.Tasks.TaskCategories.Operation); + public override string Description => "This sample illustrates a Task opening a page."; - public override TaskIconColor IconColor => TaskIconColor.DefaultIconColor; + public override Guid CategoryId { get; } = Guid.Parse(Sdk.Workspace.Tasks.TaskCategories.Operation); + + public override TaskIconColor IconColor => TaskIconColor.DefaultIconColor; - public override bool HasPrivilege() - { - // Check if the user has the privilege to access the page. - return true; - } + public override bool HasPrivilege() + { + // Check if the user has the privilege to access the page. + return true; } } \ No newline at end of file diff --git a/Samples/Workspace SDK/PageTaskSample/SamplePageView.xaml.cs b/Samples/Workspace SDK/PageTaskSample/SamplePageView.xaml.cs index 359cfc6..474de0a 100644 --- a/Samples/Workspace SDK/PageTaskSample/SamplePageView.xaml.cs +++ b/Samples/Workspace SDK/PageTaskSample/SamplePageView.xaml.cs @@ -5,13 +5,12 @@ // Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -namespace Genetec.Dap.CodeSamples +namespace Genetec.Dap.CodeSamples; + +public partial class SamplePageView { - public partial class SamplePageView + public SamplePageView() { - public SamplePageView() - { - InitializeComponent(); - } + InitializeComponent(); } -} +} \ No newline at end of file diff --git a/Samples/Workspace SDK/ReportExporterSample/AggregateReportExporter.cs b/Samples/Workspace SDK/ReportExporterSample/AggregateReportExporter.cs index 017476f..87e4ecb 100644 --- a/Samples/Workspace SDK/ReportExporterSample/AggregateReportExporter.cs +++ b/Samples/Workspace SDK/ReportExporterSample/AggregateReportExporter.cs @@ -5,35 +5,33 @@ // Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -namespace Genetec.Dap.CodeSamples +namespace Genetec.Dap.CodeSamples; + +using System; +using System.Collections.Generic; +using System.Linq; +using Genetec.Sdk.ReportExport; + +public class AggregateReportExporter : ReportExporter { - using System; - using System.Collections.Generic; - using System.Linq; - using Genetec.Sdk.ReportExport; + private readonly List m_exporters; - public class AggregateReportExporter : ReportExporter + public AggregateReportExporter(params ReportExporter[] exporters) { - private readonly List m_exporters; - - public AggregateReportExporter(params ReportExporter[] exporters) - { - m_exporters = exporters.ToList(); - } + m_exporters = exporters.ToList(); + } - public override QueryExportResult OnDataReady(QueryResultsBlock dataBlock) - { - var exceptions = m_exporters.Select(exporter => exporter.OnDataReady(dataBlock)).Where(result => !result.Success).Select(result => result.Exception).ToList(); - return exceptions.Any() ? new QueryExportResult(false, new AggregateException(exceptions)) : new QueryExportResult(true); - } + public override QueryExportResult OnDataReady(QueryResultsBlock dataBlock) + { + var exceptions = m_exporters.Select(exporter => exporter.OnDataReady(dataBlock)).Where(result => !result.Success).Select(result => result.Exception).ToList(); + return exceptions.Any() ? new QueryExportResult(false, new AggregateException(exceptions)) : new QueryExportResult(true); + } - public override void OnExportCompleted() + public override void OnExportCompleted() + { + foreach (var exporter in m_exporters) { - foreach (var exporter in m_exporters) - { - exporter.OnExportCompleted(); - } + exporter.OnExportCompleted(); } } - -} +} \ No newline at end of file diff --git a/Samples/Workspace SDK/ReportExporterSample/CsvReportExporter.cs b/Samples/Workspace SDK/ReportExporterSample/CsvReportExporter.cs index 22f886b..b71e707 100644 --- a/Samples/Workspace SDK/ReportExporterSample/CsvReportExporter.cs +++ b/Samples/Workspace SDK/ReportExporterSample/CsvReportExporter.cs @@ -5,66 +5,65 @@ // Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -namespace Genetec.Dap.CodeSamples +namespace Genetec.Dap.CodeSamples; + +using System; +using System.Collections.Generic; +using System.Data; +using System.IO; +using System.Linq; +using Sdk.ReportExport; + +public class CsvReportExporter : ReportExporter { - using System; - using System.Collections.Generic; - using System.Data; - using System.IO; - using System.Linq; - using Sdk.ReportExport; + private bool m_headerWritten; + private readonly TextWriter m_writer; - public class CsvReportExporter : ReportExporter + public CsvReportExporter(TextWriter writer) { - private bool m_headerWritten; - private readonly TextWriter m_writer; - - public CsvReportExporter(TextWriter writer) - { - m_writer = writer; - } + m_writer = writer; + } - public override QueryExportResult OnDataReady(QueryResultsBlock dataBlock) + public override QueryExportResult OnDataReady(QueryResultsBlock dataBlock) + { + try { - try + if (!m_headerWritten) { - if (!m_headerWritten) - { - IEnumerable columnNames = dataBlock.Data.Columns.Cast().Select(column => column.ColumnName); - m_writer.WriteLine(string.Join(",", columnNames)); - m_headerWritten = true; - } - - foreach (DataRow row in dataBlock.Data.Rows) - { - IEnumerable fields = row.ItemArray.Select(field => $"\"{field.ToString().Replace("\"", "\"\"")}\""); - m_writer.WriteLine(string.Join(",", fields)); - } - - m_writer.Flush(); - - return new QueryExportResult(true); + IEnumerable columnNames = dataBlock.Data.Columns.Cast().Select(column => column.ColumnName); + m_writer.WriteLine(string.Join(",", columnNames)); + m_headerWritten = true; } - catch (Exception ex) + + foreach (DataRow row in dataBlock.Data.Rows) { - return new QueryExportResult(false, ex); + IEnumerable fields = row.ItemArray.Select(field => $"\"{field.ToString().Replace("\"", "\"\"")}\""); + m_writer.WriteLine(string.Join(",", fields)); } + + m_writer.Flush(); + + return new QueryExportResult(true); } + catch (Exception ex) + { + return new QueryExportResult(false, ex); + } + } - public override void OnExportCompleted() + public override void OnExportCompleted() + { + try { - try - { - m_writer.Close(); - } - catch - { - // Handle the exception if needed - } - finally - { - m_writer.Dispose(); - } + m_writer.Close(); + } + catch + { + // Handle the exception if needed + } + finally + { + m_writer.Dispose(); } } } \ No newline at end of file diff --git a/Samples/Workspace SDK/ReportExporterSample/HtmlReportExporter.cs b/Samples/Workspace SDK/ReportExporterSample/HtmlReportExporter.cs index bbfbdbc..8013a0f 100644 --- a/Samples/Workspace SDK/ReportExporterSample/HtmlReportExporter.cs +++ b/Samples/Workspace SDK/ReportExporterSample/HtmlReportExporter.cs @@ -5,87 +5,85 @@ // Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -namespace Genetec.Dap.CodeSamples +namespace Genetec.Dap.CodeSamples; + +using System; +using System.Data; +using System.IO; +using Genetec.Sdk.ReportExport; + +public class HtmlReportExporter : ReportExporter { - using System; - using System.Data; - using System.IO; - using Genetec.Sdk.ReportExport; + private readonly TextWriter m_writer; + private bool m_tableStarted; - public class HtmlReportExporter : ReportExporter + public HtmlReportExporter(TextWriter writer, string reportTitle) { - private readonly TextWriter m_writer; - private bool m_tableStarted; - - public HtmlReportExporter(TextWriter writer, string reportTitle) - { - m_writer = writer; - m_writer.WriteLine($"{reportTitle}"); - m_writer.WriteLine($"

{reportTitle}

"); - } + m_writer = writer; + m_writer.WriteLine($"{reportTitle}"); + m_writer.WriteLine($"

{reportTitle}

"); + } - public override QueryExportResult OnDataReady(QueryResultsBlock dataBlock) + public override QueryExportResult OnDataReady(QueryResultsBlock dataBlock) + { + try { - try + if (!m_tableStarted) { - if (!m_tableStarted) - { - m_writer.WriteLine(""); - m_writer.WriteLine(""); - m_writer.WriteLine(""); - - foreach (DataColumn column in dataBlock.Data.Columns) - { - m_writer.WriteLine($""); - } + m_writer.WriteLine("
{column.ColumnName}
"); + m_writer.WriteLine(""); + m_writer.WriteLine(""); - m_writer.WriteLine(""); - m_writer.WriteLine(""); - m_writer.WriteLine(""); - - m_tableStarted = true; - } - - foreach (DataRow row in dataBlock.Data.Rows) + foreach (DataColumn column in dataBlock.Data.Columns) { - m_writer.WriteLine(""); - foreach (var item in row.ItemArray) - { - m_writer.WriteLine($""); - } - m_writer.WriteLine(""); + m_writer.WriteLine($""); } - m_writer.Flush(); - return new QueryExportResult(true); - } - catch (Exception ex) - { - return new QueryExportResult(false, ex); + m_writer.WriteLine(""); + m_writer.WriteLine(""); + m_writer.WriteLine(""); + + m_tableStarted = true; } - } - public override void OnExportCompleted() - { - try + foreach (DataRow row in dataBlock.Data.Rows) { - if (m_tableStarted) + m_writer.WriteLine(""); + foreach (var item in row.ItemArray) { - m_writer.WriteLine(""); - m_writer.WriteLine("
{item}
{column.ColumnName}
"); + m_writer.WriteLine($"{item}"); } - - m_writer.WriteLine(""); - } - catch - { - // Handle the exception if needed + m_writer.WriteLine(""); } - finally + + m_writer.Flush(); + return new QueryExportResult(true); + } + catch (Exception ex) + { + return new QueryExportResult(false, ex); + } + } + + public override void OnExportCompleted() + { + try + { + if (m_tableStarted) { - m_writer.Dispose(); + m_writer.WriteLine(""); + m_writer.WriteLine(""); } + + m_writer.WriteLine(""); + } + catch + { + // Handle the exception if needed + } + finally + { + m_writer.Dispose(); } } - -} +} \ No newline at end of file diff --git a/Samples/Workspace SDK/ReportExporterSample/JsonReportExporter.cs b/Samples/Workspace SDK/ReportExporterSample/JsonReportExporter.cs index d04ddf4..951473b 100644 --- a/Samples/Workspace SDK/ReportExporterSample/JsonReportExporter.cs +++ b/Samples/Workspace SDK/ReportExporterSample/JsonReportExporter.cs @@ -5,53 +5,52 @@ // Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -namespace Genetec.Dap.CodeSamples +namespace Genetec.Dap.CodeSamples; + +using System; +using System.IO; +using Newtonsoft.Json; +using Sdk.ReportExport; + +public class JsonReportExporter : ReportExporter { - using System; - using System.IO; - using Newtonsoft.Json; - using Sdk.ReportExport; + private readonly TextWriter m_writer; - public class JsonReportExporter : ReportExporter + public JsonReportExporter(TextWriter writer) { - private readonly TextWriter m_writer; + m_writer = writer; + m_writer.Write("["); + } - public JsonReportExporter(TextWriter writer) + public override QueryExportResult OnDataReady(QueryResultsBlock dataBlock) + { + try { - m_writer = writer; - m_writer.Write("["); + string json = JsonConvert.SerializeObject(dataBlock.Data, Formatting.Indented); + m_writer.Write($"{json.TrimEnd(']', '\r', '\n')},"); + m_writer.Flush(); + return new QueryExportResult(true); } - - public override QueryExportResult OnDataReady(QueryResultsBlock dataBlock) + catch (Exception ex) { - try - { - string json = JsonConvert.SerializeObject(dataBlock.Data, Formatting.Indented); - m_writer.Write($"{json.TrimEnd(']', '\r', '\n')},"); - m_writer.Flush(); - return new QueryExportResult(true); - } - catch (Exception ex) - { - return new QueryExportResult(false, ex); - } + return new QueryExportResult(false, ex); } + } - public override void OnExportCompleted() + public override void OnExportCompleted() + { + try + { + m_writer.Write("]"); + m_writer.Close(); + } + catch + { + // Handle the exception if needed + } + finally { - try - { - m_writer.Write("]"); - m_writer.Close(); - } - catch - { - // Handle the exception if needed - } - finally - { - m_writer.Dispose(); - } + m_writer.Dispose(); } } -} +} \ No newline at end of file diff --git a/Samples/Workspace SDK/ReportExporterSample/MarkdownReportExporter.cs b/Samples/Workspace SDK/ReportExporterSample/MarkdownReportExporter.cs index 7e7e832..4ff6fe6 100644 --- a/Samples/Workspace SDK/ReportExporterSample/MarkdownReportExporter.cs +++ b/Samples/Workspace SDK/ReportExporterSample/MarkdownReportExporter.cs @@ -5,55 +5,54 @@ // Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -namespace Genetec.Dap.CodeSamples +namespace Genetec.Dap.CodeSamples; + +using System; +using System.Data; +using System.IO; +using System.Linq; +using Sdk.ReportExport; + +public class MarkdownReportExporter : ReportExporter { - using System; - using System.Data; - using System.IO; - using System.Linq; - using Sdk.ReportExport; + private readonly TextWriter m_writer; - public class MarkdownReportExporter : ReportExporter + public MarkdownReportExporter(TextWriter writer) { - private readonly TextWriter m_writer; + m_writer = writer; + } - public MarkdownReportExporter(TextWriter writer) + public override QueryExportResult OnDataReady(QueryResultsBlock dataBlock) + { + try { - m_writer = writer; - } + m_writer.WriteLine($"| {string.Join(" | ", dataBlock.Data.Columns.Cast().Select(c => c.ColumnName))} |"); + m_writer.WriteLine($"| {string.Join(" | ", dataBlock.Data.Columns.Cast().Select(c => "---"))} |"); + + foreach (DataRow row in dataBlock.Data.Rows) m_writer.WriteLine($"| {string.Join(" | ", row.ItemArray.Select(item => item.ToString().Replace("|", "\\|")))} |"); - public override QueryExportResult OnDataReady(QueryResultsBlock dataBlock) + m_writer.Flush(); + return new QueryExportResult(true); + } + catch (Exception ex) { - try - { - m_writer.WriteLine($"| {string.Join(" | ", dataBlock.Data.Columns.Cast().Select(c => c.ColumnName))} |"); - m_writer.WriteLine($"| {string.Join(" | ", dataBlock.Data.Columns.Cast().Select(c => "---"))} |"); - - foreach (DataRow row in dataBlock.Data.Rows) m_writer.WriteLine($"| {string.Join(" | ", row.ItemArray.Select(item => item.ToString().Replace("|", "\\|")))} |"); - - m_writer.Flush(); - return new QueryExportResult(true); - } - catch (Exception ex) - { - return new QueryExportResult(false, ex); - } + return new QueryExportResult(false, ex); } + } - public override void OnExportCompleted() + public override void OnExportCompleted() + { + try + { + m_writer.Close(); + } + catch + { + // Handle the exception if needed + } + finally { - try - { - m_writer.Close(); - } - catch - { - // Handle the exception if needed - } - finally - { - m_writer.Dispose(); - } + m_writer.Dispose(); } } } \ No newline at end of file diff --git a/Samples/Workspace SDK/ReportExporterSample/Program.cs b/Samples/Workspace SDK/ReportExporterSample/Program.cs index b043f18..d0b91cd 100644 --- a/Samples/Workspace SDK/ReportExporterSample/Program.cs +++ b/Samples/Workspace SDK/ReportExporterSample/Program.cs @@ -5,56 +5,55 @@ // Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -namespace Genetec.Dap.CodeSamples +namespace Genetec.Dap.CodeSamples; + +using System; +using System.IO; +using System.Text; +using System.Threading.Tasks; +using Genetec.Sdk.Queries; +using Sdk; + +class Program { - using System; - using System.IO; - using System.Text; - using System.Threading.Tasks; - using Genetec.Sdk.Queries; - using Sdk; - - class Program + static Program() => SdkResolver.Initialize(); + + static async Task Main() { - static Program() => SdkResolver.Initialize(); + const string server = "localhost"; + const string username = "admin"; + const string password = ""; + + using var engine = new Engine(); - static async Task Main() + ConnectionStateCode state = await engine.LogOnAsync(server, username, password); + + if (state == ConnectionStateCode.Success) + { + var query = (CardholderActivityQuery)engine.ReportManager.CreateReportQuery(ReportType.CardholderActivity); + query.MaximumResultCount = 10000; + + using var xmlWriter = new StreamWriter("CardholderActivity.xml", false, Encoding.UTF8); + using var jsonWriter = new StreamWriter("CardholderActivity.json", false, Encoding.UTF8); + using var csvWriter = new StreamWriter("CardholderActivity.csv", false, Encoding.UTF8); + using var markDownWriter = new StreamWriter("CardholderActivity.md", false, Encoding.UTF8); + using var htmlWriter = new StreamWriter("CardholderActivity.html", false, Encoding.UTF8); + + query.Exporter = new AggregateReportExporter( + new XmlReportExporter(xmlWriter), + new JsonReportExporter(jsonWriter), + new CsvReportExporter(csvWriter), + new MarkdownReportExporter(markDownWriter), + new HtmlReportExporter(htmlWriter, "Cardholder Activity")); + + await Task.Factory.FromAsync(query.BeginQuery, query.EndQuery, null); + } + else { - const string server = "localhost"; - const string username = "admin"; - const string password = ""; - - using var engine = new Engine(); - - ConnectionStateCode state = await engine.LogOnAsync(server, username, password); - - if (state == ConnectionStateCode.Success) - { - var query = (CardholderActivityQuery)engine.ReportManager.CreateReportQuery(ReportType.CardholderActivity); - query.MaximumResultCount = 10000; - - using var xmlWriter = new StreamWriter("CardholderActivity.xml", false, Encoding.UTF8); - using var jsonWriter = new StreamWriter("CardholderActivity.json", false, Encoding.UTF8); - using var csvWriter = new StreamWriter("CardholderActivity.csv", false, Encoding.UTF8); - using var markDownWriter = new StreamWriter("CardholderActivity.md", false, Encoding.UTF8); - using var htmlWriter = new StreamWriter("CardholderActivity.html", false, Encoding.UTF8); - - query.Exporter = new AggregateReportExporter( - new XmlReportExporter(xmlWriter), - new JsonReportExporter(jsonWriter), - new CsvReportExporter(csvWriter), - new MarkdownReportExporter(markDownWriter), - new HtmlReportExporter(htmlWriter, "Cardholder Activity")); - - await Task.Factory.FromAsync(query.BeginQuery, query.EndQuery, null); - } - else - { - Console.WriteLine($"Logon failed: {state}"); - } - - Console.WriteLine("Press any key to exit..."); - Console.ReadKey(); + Console.WriteLine($"Logon failed: {state}"); } + + Console.WriteLine("Press any key to exit..."); + Console.ReadKey(); } -} +} \ No newline at end of file diff --git a/Samples/Workspace SDK/ReportExporterSample/XmlReportExporter.cs b/Samples/Workspace SDK/ReportExporterSample/XmlReportExporter.cs index 33575a7..6d35f7a 100644 --- a/Samples/Workspace SDK/ReportExporterSample/XmlReportExporter.cs +++ b/Samples/Workspace SDK/ReportExporterSample/XmlReportExporter.cs @@ -5,65 +5,64 @@ // Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -namespace Genetec.Dap.CodeSamples +namespace Genetec.Dap.CodeSamples; + +using System; +using System.Data; +using System.IO; +using Sdk.ReportExport; +using System.Xml; + +public class XmlReportExporter : ReportExporter { - using System; - using System.Data; - using System.IO; - using Sdk.ReportExport; - using System.Xml; + private readonly DataTable m_dataTable; + private readonly XmlWriter m_xmlWriter; - public class XmlReportExporter : ReportExporter + public XmlReportExporter(TextWriter textWriter) { - private readonly DataTable m_dataTable; - private readonly XmlWriter m_xmlWriter; - - public XmlReportExporter(TextWriter textWriter) - { - m_xmlWriter = XmlWriter.Create(textWriter, new XmlWriterSettings { Indent = true }); - m_dataTable = new DataTable("Results"); - } + m_xmlWriter = XmlWriter.Create(textWriter, new XmlWriterSettings { Indent = true }); + m_dataTable = new DataTable("Results"); + } - public override QueryExportResult OnDataReady(QueryResultsBlock dataBlock) + public override QueryExportResult OnDataReady(QueryResultsBlock dataBlock) + { + try { - try + if (m_dataTable.Columns.Count == 0) { - if (m_dataTable.Columns.Count == 0) + foreach (DataColumn column in dataBlock.Data.Columns) { - foreach (DataColumn column in dataBlock.Data.Columns) - { - m_dataTable.Columns.Add(column.ColumnName, column.DataType); - } + m_dataTable.Columns.Add(column.ColumnName, column.DataType); } - - foreach (DataRow row in dataBlock.Data.Rows) - { - m_dataTable.ImportRow(row); - } - - return new QueryExportResult(true); } - catch (Exception ex) + + foreach (DataRow row in dataBlock.Data.Rows) { - return new QueryExportResult(false, ex); + m_dataTable.ImportRow(row); } + + return new QueryExportResult(true); } + catch (Exception ex) + { + return new QueryExportResult(false, ex); + } + } - public override void OnExportCompleted() + public override void OnExportCompleted() + { + try { - try - { - m_dataTable.WriteXml(m_xmlWriter); - m_xmlWriter.Flush(); - } - catch - { - // Handle the exception if needed - } - finally - { - m_xmlWriter.Dispose(); - } + m_dataTable.WriteXml(m_xmlWriter); + m_xmlWriter.Flush(); + } + catch + { + // Handle the exception if needed + } + finally + { + m_xmlWriter.Dispose(); } } } \ No newline at end of file diff --git a/Samples/Workspace SDK/TaskSample/NotepadTask.cs b/Samples/Workspace SDK/TaskSample/NotepadTask.cs index 3c83bfb..383f333 100644 --- a/Samples/Workspace SDK/TaskSample/NotepadTask.cs +++ b/Samples/Workspace SDK/TaskSample/NotepadTask.cs @@ -1,35 +1,34 @@ // Copyright (C) 2023 by Genetec, Inc. All rights reserved. // May be used only in accordance with a valid Source Code License Agreement. -namespace Genetec.Dap.CodeSamples -{ - using System; - using System.Diagnostics; - using System.Windows.Media.Imaging; - using Genetec.Sdk.Workspace.Tasks; +namespace Genetec.Dap.CodeSamples; + +using System; +using System.Diagnostics; +using System.Windows.Media.Imaging; +using Genetec.Sdk.Workspace.Tasks; - public class NotepadTask : Task +public class NotepadTask : Task +{ + public NotepadTask() { - public NotepadTask() - { - Icon = new BitmapImage(new Uri("pack://application:,,,/TaskSample;Component/Resources/Icon.png", UriKind.RelativeOrAbsolute)); - Thumbnail = new BitmapImage(new Uri("pack://application:,,,/TaskSample;Component/Resources/Thumbnail.png", UriKind.RelativeOrAbsolute)); - Name = "Launch notepad"; - Description = "Launch Notepad application. This sample illustrates a Task that executes without opening a page."; - CategoryId = new Guid(TaskCategories.Administration); - } + Icon = new BitmapImage(new Uri("pack://application:,,,/TaskSample;Component/Resources/Icon.png", UriKind.RelativeOrAbsolute)); + Thumbnail = new BitmapImage(new Uri("pack://application:,,,/TaskSample;Component/Resources/Thumbnail.png", UriKind.RelativeOrAbsolute)); + Name = "Launch notepad"; + Description = "Launch Notepad application. This sample illustrates a Task that executes without opening a page."; + CategoryId = new Guid(TaskCategories.Administration); + } - public override bool CanExecute() - { - // This task can be executed at any time. - return true; - } + public override bool CanExecute() + { + // This task can be executed at any time. + return true; + } - public override void Execute() - { - HideHomePageAfterExecution = false; // Do not hide the home page after the task is executed. - // This task will launch the Notepad application. - Process.Start("notepad.exe"); - } + public override void Execute() + { + HideHomePageAfterExecution = false; // Do not hide the home page after the task is executed. + // This task will launch the Notepad application. + Process.Start("notepad.exe"); } } \ No newline at end of file diff --git a/Samples/Workspace SDK/TaskSample/SampleModule.cs b/Samples/Workspace SDK/TaskSample/SampleModule.cs index ac8c9cd..bec9f57 100644 --- a/Samples/Workspace SDK/TaskSample/SampleModule.cs +++ b/Samples/Workspace SDK/TaskSample/SampleModule.cs @@ -1,25 +1,24 @@ // Copyright (C) 2023 by Genetec, Inc. All rights reserved. // May be used only in accordance with a valid Source Code License Agreement. -namespace Genetec.Dap.CodeSamples -{ - using Sdk; - using Sdk.Workspace.Modules; +namespace Genetec.Dap.CodeSamples; + +using Sdk; +using Sdk.Workspace.Modules; - public class SampleModule : Module +public class SampleModule : Module +{ + public override void Load() { - public override void Load() + if (Workspace.ApplicationType is ApplicationType.SecurityDesk or ApplicationType.ConfigTool) { - if (Workspace.ApplicationType is ApplicationType.SecurityDesk or ApplicationType.ConfigTool) - { - var task = new NotepadTask(); - task.Initialize(Workspace); - Workspace.Tasks.Register(task); - } + var task = new NotepadTask(); + task.Initialize(Workspace); + Workspace.Tasks.Register(task); } + } - public override void Unload() - { - } + public override void Unload() + { } } \ No newline at end of file diff --git a/Samples/Workspace SDK/TilePropertiesSample/SampleModule.cs b/Samples/Workspace SDK/TilePropertiesSample/SampleModule.cs index 65a64bb..d9461c6 100644 --- a/Samples/Workspace SDK/TilePropertiesSample/SampleModule.cs +++ b/Samples/Workspace SDK/TilePropertiesSample/SampleModule.cs @@ -1,24 +1,23 @@ // Copyright (C) 2023 by Genetec, Inc. All rights reserved. // May be used only in accordance with a valid Source Code License Agreement. -namespace Genetec.Dap.CodeSamples -{ - using Sdk; +namespace Genetec.Dap.CodeSamples; + +using Sdk; - public class SampleModule : Sdk.Workspace.Modules.Module +public class SampleModule : Sdk.Workspace.Modules.Module +{ + public override void Load() { - public override void Load() + if (Workspace.ApplicationType == ApplicationType.SecurityDesk) { - if (Workspace.ApplicationType == ApplicationType.SecurityDesk) - { - var builder = new SampleTilePropertiesBuilder(); - builder.Initialize(Workspace); - Workspace.Components.Register(builder); - } + var builder = new SampleTilePropertiesBuilder(); + builder.Initialize(Workspace); + Workspace.Components.Register(builder); } + } - public override void Unload() - { - } + public override void Unload() + { } } \ No newline at end of file diff --git a/Samples/Workspace SDK/TilePropertiesSample/SampleTileProperties.cs b/Samples/Workspace SDK/TilePropertiesSample/SampleTileProperties.cs index 5d13f5e..b9176c4 100644 --- a/Samples/Workspace SDK/TilePropertiesSample/SampleTileProperties.cs +++ b/Samples/Workspace SDK/TilePropertiesSample/SampleTileProperties.cs @@ -1,15 +1,14 @@ // Copyright (C) 2023 by Genetec, Inc. All rights reserved. // May be used only in accordance with a valid Source Code License Agreement. -namespace Genetec.Dap.CodeSamples -{ - using System.Windows; - using Sdk.Workspace.Components.TileProperties; +namespace Genetec.Dap.CodeSamples; + +using System.Windows; +using Sdk.Workspace.Components.TileProperties; - public class SampleTileProperties : TileProperties - { - private readonly SampleTilePropertiesView m_view = new SampleTilePropertiesView(); +public class SampleTileProperties : TileProperties +{ + private readonly SampleTilePropertiesView m_view = new SampleTilePropertiesView(); - public override UIElement View => m_view; - } + public override UIElement View => m_view; } \ No newline at end of file diff --git a/Samples/Workspace SDK/TilePropertiesSample/SampleTilePropertiesBuilder.cs b/Samples/Workspace SDK/TilePropertiesSample/SampleTilePropertiesBuilder.cs index c2dd844..768eaaf 100644 --- a/Samples/Workspace SDK/TilePropertiesSample/SampleTilePropertiesBuilder.cs +++ b/Samples/Workspace SDK/TilePropertiesSample/SampleTilePropertiesBuilder.cs @@ -1,29 +1,28 @@ // Copyright (C) 2023 by Genetec, Inc. All rights reserved. // May be used only in accordance with a valid Source Code License Agreement. -namespace Genetec.Dap.CodeSamples -{ - using System; - using Sdk.Workspace.Components; - using Sdk.Workspace.Components.TileProperties; - using Sdk.Workspace.Pages.Contents; +namespace Genetec.Dap.CodeSamples; - public class SampleTilePropertiesBuilder : TilePropertiesBuilder - { - public override string Name => nameof(SampleTilePropertiesBuilder); +using System; +using Sdk.Workspace.Components; +using Sdk.Workspace.Components.TileProperties; +using Sdk.Workspace.Pages.Contents; - public override Guid UniqueId { get; } = new Guid("25DD268E-A7AA-41DF-89FF-FAB6C0A74D57"); +public class SampleTilePropertiesBuilder : TilePropertiesBuilder +{ + public override string Name => nameof(SampleTilePropertiesBuilder); - public override TileProperties CreateView() - { - return new SampleTileProperties(); - } + public override Guid UniqueId { get; } = new Guid("25DD268E-A7AA-41DF-89FF-FAB6C0A74D57"); - public override bool IsSupported(TilePluginContext context) - { - return context.Content is EntityContent || context.ContentGroup is EntityContentGroup; - } + public override TileProperties CreateView() + { + return new SampleTileProperties(); + } - public override string Title => "Sample Tile Properties"; + public override bool IsSupported(TilePluginContext context) + { + return context.Content is EntityContent || context.ContentGroup is EntityContentGroup; } + + public override string Title => "Sample Tile Properties"; } \ No newline at end of file diff --git a/Samples/Workspace SDK/TilePropertiesSample/SampleTilePropertiesView.xaml.cs b/Samples/Workspace SDK/TilePropertiesSample/SampleTilePropertiesView.xaml.cs index 619a66e..9c124cc 100644 --- a/Samples/Workspace SDK/TilePropertiesSample/SampleTilePropertiesView.xaml.cs +++ b/Samples/Workspace SDK/TilePropertiesSample/SampleTilePropertiesView.xaml.cs @@ -1,15 +1,14 @@ // Copyright (C) 2023 by Genetec, Inc. All rights reserved. // May be used only in accordance with a valid Source Code License Agreement. -namespace Genetec.Dap.CodeSamples -{ - using System.Windows.Controls; +namespace Genetec.Dap.CodeSamples; + +using System.Windows.Controls; - public partial class SampleTilePropertiesView : UserControl +public partial class SampleTilePropertiesView : UserControl +{ + public SampleTilePropertiesView() { - public SampleTilePropertiesView() - { - InitializeComponent(); - } + InitializeComponent(); } -} +} \ No newline at end of file diff --git a/Samples/Workspace SDK/TileViewSample/SampleModule.cs b/Samples/Workspace SDK/TileViewSample/SampleModule.cs index b204d47..afd43b5 100644 --- a/Samples/Workspace SDK/TileViewSample/SampleModule.cs +++ b/Samples/Workspace SDK/TileViewSample/SampleModule.cs @@ -1,24 +1,23 @@ // Copyright (C) 2023 by Genetec, Inc. All rights reserved. // May be used only in accordance with a valid Source Code License Agreement. -namespace Genetec.Dap.CodeSamples -{ - using Sdk; +namespace Genetec.Dap.CodeSamples; + +using Sdk; - public class SampleModule : Sdk.Workspace.Modules.Module +public class SampleModule : Sdk.Workspace.Modules.Module +{ + public override void Load() { - public override void Load() + if (Workspace.ApplicationType == ApplicationType.SecurityDesk) { - if (Workspace.ApplicationType == ApplicationType.SecurityDesk) - { - var builder = new SampleTileViewBuilder(); - builder.Initialize(Workspace); - Workspace.Components.Register(builder); - } + var builder = new SampleTileViewBuilder(); + builder.Initialize(Workspace); + Workspace.Components.Register(builder); } + } - public override void Unload() - { - } + public override void Unload() + { } -} +} \ No newline at end of file diff --git a/Samples/Workspace SDK/TileViewSample/SampleTileView.cs b/Samples/Workspace SDK/TileViewSample/SampleTileView.cs index d099ae0..195ceeb 100644 --- a/Samples/Workspace SDK/TileViewSample/SampleTileView.cs +++ b/Samples/Workspace SDK/TileViewSample/SampleTileView.cs @@ -1,20 +1,19 @@ // Copyright (C) 2023 by Genetec, Inc. All rights reserved. // May be used only in accordance with a valid Source Code License Agreement. -namespace Genetec.Dap.CodeSamples -{ - using System.Windows; - using Sdk.Workspace.Components.TileView; +namespace Genetec.Dap.CodeSamples; - public class SampleTileView : TileView - { - private readonly SampleTileViewControl m_view; - - public SampleTileView() - { - m_view = new SampleTileViewControl(); - } +using System.Windows; +using Sdk.Workspace.Components.TileView; - public override UIElement View => m_view; +public class SampleTileView : TileView +{ + private readonly SampleTileViewControl m_view; + + public SampleTileView() + { + m_view = new SampleTileViewControl(); } + + public override UIElement View => m_view; } \ No newline at end of file diff --git a/Samples/Workspace SDK/TileViewSample/SampleTileViewBuilder.cs b/Samples/Workspace SDK/TileViewSample/SampleTileViewBuilder.cs index 540e600..ec12c9d 100644 --- a/Samples/Workspace SDK/TileViewSample/SampleTileViewBuilder.cs +++ b/Samples/Workspace SDK/TileViewSample/SampleTileViewBuilder.cs @@ -1,27 +1,26 @@ // Copyright (C) 2023 by Genetec, Inc. All rights reserved. // May be used only in accordance with a valid Source Code License Agreement. -namespace Genetec.Dap.CodeSamples -{ - using System; - using Sdk.Workspace.Components; - using Sdk.Workspace.Pages.Contents; - using Sdk.Workspace.Components.TileView; +namespace Genetec.Dap.CodeSamples; - public class SampleTileViewBuilder : TileViewBuilder - { - public override string Name => nameof(SampleTileViewBuilder); +using System; +using Sdk.Workspace.Components; +using Sdk.Workspace.Pages.Contents; +using Sdk.Workspace.Components.TileView; - public override Guid UniqueId { get; } = new Guid("BA77CE7D-51D5-4274-B75F-0BCEEC392F03"); +public class SampleTileViewBuilder : TileViewBuilder +{ + public override string Name => nameof(SampleTileViewBuilder); - public override TileView CreateView() - { - return new SampleTileView(); - } + public override Guid UniqueId { get; } = new Guid("BA77CE7D-51D5-4274-B75F-0BCEEC392F03"); - public override bool IsSupported(TilePluginContext context) - { - return context.Content is EntityContent || context.ContentGroup is EntityContentGroup; - } + public override TileView CreateView() + { + return new SampleTileView(); + } + + public override bool IsSupported(TilePluginContext context) + { + return context.Content is EntityContent || context.ContentGroup is EntityContentGroup; } } \ No newline at end of file diff --git a/Samples/Workspace SDK/TileViewSample/SampleTileViewControl.xaml.cs b/Samples/Workspace SDK/TileViewSample/SampleTileViewControl.xaml.cs index b1e5059..8d22931 100644 --- a/Samples/Workspace SDK/TileViewSample/SampleTileViewControl.xaml.cs +++ b/Samples/Workspace SDK/TileViewSample/SampleTileViewControl.xaml.cs @@ -1,15 +1,14 @@ // Copyright (C) 2023 by Genetec, Inc. All rights reserved. // May be used only in accordance with a valid Source Code License Agreement. -namespace Genetec.Dap.CodeSamples -{ - using System.Windows.Controls; +namespace Genetec.Dap.CodeSamples; + +using System.Windows.Controls; - public partial class SampleTileViewControl : UserControl +public partial class SampleTileViewControl : UserControl +{ + public SampleTileViewControl() { - public SampleTileViewControl() - { - InitializeComponent(); - } + InitializeComponent(); } -} +} \ No newline at end of file diff --git a/Samples/Workspace SDK/TileWidgetSample/SampleModule.cs b/Samples/Workspace SDK/TileWidgetSample/SampleModule.cs index 132958c..56aeda7 100644 --- a/Samples/Workspace SDK/TileWidgetSample/SampleModule.cs +++ b/Samples/Workspace SDK/TileWidgetSample/SampleModule.cs @@ -1,24 +1,23 @@ // Copyright (C) 2023 by Genetec, Inc. All rights reserved. // May be used only in accordance with a valid Source Code License Agreement. -namespace Genetec.Dap.CodeSamples -{ - using Sdk; +namespace Genetec.Dap.CodeSamples; + +using Sdk; - public class SampleModule : Sdk.Workspace.Modules.Module +public class SampleModule : Sdk.Workspace.Modules.Module +{ + public override void Load() { - public override void Load() + if (Workspace.ApplicationType == ApplicationType.SecurityDesk) { - if (Workspace.ApplicationType == ApplicationType.SecurityDesk) - { - var builder = new SampleTileWidgetBuilder(); - builder.Initialize(Workspace); - Workspace.Components.Register(builder); - } + var builder = new SampleTileWidgetBuilder(); + builder.Initialize(Workspace); + Workspace.Components.Register(builder); } + } - public override void Unload() - { - } + public override void Unload() + { } } \ No newline at end of file diff --git a/Samples/Workspace SDK/TileWidgetSample/SampleTileWidget.cs b/Samples/Workspace SDK/TileWidgetSample/SampleTileWidget.cs index 68d494b..659a1b8 100644 --- a/Samples/Workspace SDK/TileWidgetSample/SampleTileWidget.cs +++ b/Samples/Workspace SDK/TileWidgetSample/SampleTileWidget.cs @@ -1,16 +1,15 @@ // Copyright (C) 2023 by Genetec, Inc. All rights reserved. // May be used only in accordance with a valid Source Code License Agreement. -namespace Genetec.Dap.CodeSamples -{ - using System.Windows; - using Sdk.Workspace.Components.TileWidget; +namespace Genetec.Dap.CodeSamples; + +using System.Windows; +using Sdk.Workspace.Components.TileWidget; - public class SampleTileWidget : TileWidget - { - private readonly SampleTileWidgetView m_view = new SampleTileWidgetView(); +public class SampleTileWidget : TileWidget +{ + private readonly SampleTileWidgetView m_view = new SampleTileWidgetView(); - public override UIElement View => m_view; + public override UIElement View => m_view; - } } \ No newline at end of file diff --git a/Samples/Workspace SDK/TileWidgetSample/SampleTileWidgetBuilder.cs b/Samples/Workspace SDK/TileWidgetSample/SampleTileWidgetBuilder.cs index 2c6137c..e045f13 100644 --- a/Samples/Workspace SDK/TileWidgetSample/SampleTileWidgetBuilder.cs +++ b/Samples/Workspace SDK/TileWidgetSample/SampleTileWidgetBuilder.cs @@ -1,29 +1,28 @@ // Copyright (C) 2023 by Genetec, Inc. All rights reserved. // May be used only in accordance with a valid Source Code License Agreement. -namespace Genetec.Dap.CodeSamples -{ - using System; - using Sdk.Workspace.Components; - using Sdk.Workspace.Components.TileWidget; - using Sdk.Workspace.Pages.Contents; +namespace Genetec.Dap.CodeSamples; - public class SampleTileWidgetBuilder : TileWidgetBuilder - { - public override string Name => nameof(SampleTileWidgetBuilder); +using System; +using Sdk.Workspace.Components; +using Sdk.Workspace.Components.TileWidget; +using Sdk.Workspace.Pages.Contents; - public override Guid UniqueId { get; } = new Guid("AAF2CC2A-A731-4882-98C1-87DF91AC6734"); +public class SampleTileWidgetBuilder : TileWidgetBuilder +{ + public override string Name => nameof(SampleTileWidgetBuilder); - public override TileWidget CreateView() - { - return new SampleTileWidget(); - } + public override Guid UniqueId { get; } = new Guid("AAF2CC2A-A731-4882-98C1-87DF91AC6734"); - public override bool IsSupported(TilePluginContext context) - { - return context.Content is EntityContent || context.ContentGroup is EntityContentGroup; - } + public override TileWidget CreateView() + { + return new SampleTileWidget(); + } - public override string Title => "Sample Tile Widget"; + public override bool IsSupported(TilePluginContext context) + { + return context.Content is EntityContent || context.ContentGroup is EntityContentGroup; } + + public override string Title => "Sample Tile Widget"; } \ No newline at end of file diff --git a/Samples/Workspace SDK/TileWidgetSample/SampleTileWidgetView.xaml.cs b/Samples/Workspace SDK/TileWidgetSample/SampleTileWidgetView.xaml.cs index ee70108..b89c497 100644 --- a/Samples/Workspace SDK/TileWidgetSample/SampleTileWidgetView.xaml.cs +++ b/Samples/Workspace SDK/TileWidgetSample/SampleTileWidgetView.xaml.cs @@ -1,15 +1,14 @@ // Copyright (C) 2023 by Genetec, Inc. All rights reserved. // May be used only in accordance with a valid Source Code License Agreement. -namespace Genetec.Dap.CodeSamples -{ - using System.Windows.Controls; +namespace Genetec.Dap.CodeSamples; + +using System.Windows.Controls; - public partial class SampleTileWidgetView : UserControl +public partial class SampleTileWidgetView : UserControl +{ + public SampleTileWidgetView() { - public SampleTileWidgetView() - { - InitializeComponent(); - } + InitializeComponent(); } -} +} \ No newline at end of file diff --git a/Samples/Workspace SDK/TimelineProviderSample/AlarmTimelineEvent.cs b/Samples/Workspace SDK/TimelineProviderSample/AlarmTimelineEvent.cs index ba9dd39..a0688bc 100644 --- a/Samples/Workspace SDK/TimelineProviderSample/AlarmTimelineEvent.cs +++ b/Samples/Workspace SDK/TimelineProviderSample/AlarmTimelineEvent.cs @@ -1,52 +1,51 @@ // Copyright (C) 2023 by Genetec, Inc. All rights reserved. // May be used only in accordance with a valid Source Code License Agreement. -namespace Genetec.Dap.CodeSamples +namespace Genetec.Dap.CodeSamples; + +using System; +using System.Windows; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using Sdk; +using Sdk.Workspace.Components.TimelineProvider; + +public class AlarmTimelineEvent : TimelineEvent { - using System; - using System.Windows; - using System.Windows.Media; - using System.Windows.Media.Imaging; - using Sdk; - using Sdk.Workspace.Components.TimelineProvider; - - public class AlarmTimelineEvent : TimelineEvent - { - private static readonly Size s_size = new Size(16, 16); + private static readonly Size s_size = new Size(16, 16); - private static readonly BitmapImage s_image; + private static readonly BitmapImage s_image; - static AlarmTimelineEvent() - { - s_image = EntityType.Alarm.GetIcon(); - s_image.Freeze(); - } + static AlarmTimelineEvent() + { + s_image = EntityType.Alarm.GetIcon(); + s_image.Freeze(); + } - public AlarmTimelineEvent(Guid alarmGuid, int instanceId, DateTime dateTime) : base(dateTime) - { - AlarmGuid = alarmGuid; - InstanceId = instanceId; - } + public AlarmTimelineEvent(Guid alarmGuid, int instanceId, DateTime dateTime) : base(dateTime) + { + AlarmGuid = alarmGuid; + InstanceId = instanceId; + } - public Guid AlarmGuid { get; } + public Guid AlarmGuid { get; } - public int InstanceId { get; } + public int InstanceId { get; } - public override TimelineVisual GetVisual(Rect constraint, double msPerPixel) - { - var drawingVisual = new DrawingVisual(); + public override TimelineVisual GetVisual(Rect constraint, double msPerPixel) + { + var drawingVisual = new DrawingVisual(); - DrawingContext drawingContext = drawingVisual.RenderOpen(); + DrawingContext drawingContext = drawingVisual.RenderOpen(); - drawingContext.DrawImage(s_image, new Rect(new Point(constraint.X, (constraint.Height - 16) / 2), s_size)); + drawingContext.DrawImage(s_image, new Rect(new Point(constraint.X, (constraint.Height - 16) / 2), s_size)); - drawingContext.Close(); + drawingContext.Close(); - return new TimelineVisual(drawingVisual) - { - AlignmentY = AlignmentY.Center, - AlignmentX = AlignmentX.Center - }; - } + return new TimelineVisual(drawingVisual) + { + AlignmentY = AlignmentY.Center, + AlignmentX = AlignmentX.Center + }; } } \ No newline at end of file diff --git a/Samples/Workspace SDK/TimelineProviderSample/AlarmTimelineProvider.cs b/Samples/Workspace SDK/TimelineProviderSample/AlarmTimelineProvider.cs index 0ef1579..b0b8b45 100644 --- a/Samples/Workspace SDK/TimelineProviderSample/AlarmTimelineProvider.cs +++ b/Samples/Workspace SDK/TimelineProviderSample/AlarmTimelineProvider.cs @@ -1,61 +1,60 @@ // Copyright (C) 2023 by Genetec, Inc. All rights reserved. // May be used only in accordance with a valid Source Code License Agreement. -namespace Genetec.Dap.CodeSamples +namespace Genetec.Dap.CodeSamples; + +using System; +using System.Data; +using System.Linq; +using System.Threading.Tasks; +using Sdk; +using Sdk.Queries; +using Sdk.Workspace; +using Sdk.Workspace.Components.TimelineProvider; +using Sdk.Workspace.Pages.Contents; + +public class AlarmTimelineProvider : TimelineProvider { - using System; - using System.Data; - using System.Linq; - using System.Threading.Tasks; - using Sdk; - using Sdk.Queries; - using Sdk.Workspace; - using Sdk.Workspace.Components.TimelineProvider; - using Sdk.Workspace.Pages.Contents; - - public class AlarmTimelineProvider : TimelineProvider - { - private readonly Workspace m_workspace; + private readonly Workspace m_workspace; - public AlarmTimelineProvider(Workspace workspace) - { - m_workspace = workspace; + public AlarmTimelineProvider(Workspace workspace) + { + m_workspace = workspace; - workspace.Sdk.AlarmAcknowledged += OnAlarmAcknowledged; + workspace.Sdk.AlarmAcknowledged += OnAlarmAcknowledged; - void OnAlarmAcknowledged(object sender, AlarmAcknowledgedEventArgs e) + void OnAlarmAcknowledged(object sender, AlarmAcknowledgedEventArgs e) + { + foreach (AlarmTimelineEvent timelineEvent in GetEvents().OfType() + .Where(timelineEvent => timelineEvent.AlarmGuid == e.AlarmGuid && timelineEvent.InstanceId == e.InstanceId)) { - foreach (AlarmTimelineEvent timelineEvent in GetEvents().OfType() - .Where(timelineEvent => timelineEvent.AlarmGuid == e.AlarmGuid && timelineEvent.InstanceId == e.InstanceId)) - { - RemoveEvent(timelineEvent); - } + RemoveEvent(timelineEvent); } } + } - public override void Query(ContentGroup contentGroup, DateTime startTime, DateTime endTime) + public override void Query(ContentGroup contentGroup, DateTime startTime, DateTime endTime) + { + Task.Run(async () => { - Task.Run(async () => + var query = (AlarmActivityQuery)m_workspace.Sdk.ReportManager.CreateReportQuery(ReportType.AlarmActivity); + query.TriggeredTimeRange.SetTimeRange(startTime, endTime); + query.States.Add(AlarmState.Active); + query.States.Add(AlarmState.AknowledgeRequired); + query.States.Add(AlarmState.SourceConditionInvestigating); + + QueryCompletedEventArgs result = await Task.Factory.FromAsync(query.BeginQuery, query.EndQuery, null); + + var events = result.Data.AsEnumerable().Select(row => { - var query = (AlarmActivityQuery)m_workspace.Sdk.ReportManager.CreateReportQuery(ReportType.AlarmActivity); - query.TriggeredTimeRange.SetTimeRange(startTime, endTime); - query.States.Add(AlarmState.Active); - query.States.Add(AlarmState.AknowledgeRequired); - query.States.Add(AlarmState.SourceConditionInvestigating); - - QueryCompletedEventArgs result = await Task.Factory.FromAsync(query.BeginQuery, query.EndQuery, null); - - var events = result.Data.AsEnumerable().Select(row => - { - var alarmGuid = row.Field(AlarmActivityQuery.AlarmColumnName); - var instanceId = row.Field(AlarmActivityQuery.InstanceIdColumnName); - var triggerTime = row.Field(AlarmActivityQuery.TriggerTimeColumnName); + var alarmGuid = row.Field(AlarmActivityQuery.AlarmColumnName); + var instanceId = row.Field(AlarmActivityQuery.InstanceIdColumnName); + var triggerTime = row.Field(AlarmActivityQuery.TriggerTimeColumnName); - return new AlarmTimelineEvent(alarmGuid, instanceId, triggerTime); - }); - - InsertEvents(events); + return new AlarmTimelineEvent(alarmGuid, instanceId, triggerTime); }); - } + + InsertEvents(events); + }); } } \ No newline at end of file diff --git a/Samples/Workspace SDK/TimelineProviderSample/AlarmTimelineProviderBuilder.cs b/Samples/Workspace SDK/TimelineProviderSample/AlarmTimelineProviderBuilder.cs index 28c1725..ed74aa3 100644 --- a/Samples/Workspace SDK/TimelineProviderSample/AlarmTimelineProviderBuilder.cs +++ b/Samples/Workspace SDK/TimelineProviderSample/AlarmTimelineProviderBuilder.cs @@ -1,22 +1,21 @@ // Copyright (C) 2023 by Genetec, Inc. All rights reserved. // May be used only in accordance with a valid Source Code License Agreement. -namespace Genetec.Dap.CodeSamples -{ - using System; - using Sdk.Workspace.Components.TimelineProvider; +namespace Genetec.Dap.CodeSamples; - public class AlarmTimelineProviderBuilder : TimelineProviderBuilder - { - public override string Name => nameof(AlarmTimelineProviderBuilder); +using System; +using Sdk.Workspace.Components.TimelineProvider; - public override string Title => "Active Alarms"; +public class AlarmTimelineProviderBuilder : TimelineProviderBuilder +{ + public override string Name => nameof(AlarmTimelineProviderBuilder); - public override Guid UniqueId { get; } = new Guid("4765D714-2BD6-42A8-99E3-0A0767C76321"); + public override string Title => "Active Alarms"; - public override TimelineProvider CreateProvider() - { - return new AlarmTimelineProvider(Workspace); - } + public override Guid UniqueId { get; } = new Guid("4765D714-2BD6-42A8-99E3-0A0767C76321"); + + public override TimelineProvider CreateProvider() + { + return new AlarmTimelineProvider(Workspace); } } \ No newline at end of file diff --git a/Samples/Workspace SDK/TimelineProviderSample/SampleModule.cs b/Samples/Workspace SDK/TimelineProviderSample/SampleModule.cs index 889a5c3..121a0b9 100644 --- a/Samples/Workspace SDK/TimelineProviderSample/SampleModule.cs +++ b/Samples/Workspace SDK/TimelineProviderSample/SampleModule.cs @@ -1,25 +1,24 @@ // Copyright (C) 2023 by Genetec, Inc. All rights reserved. // May be used only in accordance with a valid Source Code License Agreement. -namespace Genetec.Dap.CodeSamples -{ - using Sdk; - using Sdk.Workspace.Modules; +namespace Genetec.Dap.CodeSamples; + +using Sdk; +using Sdk.Workspace.Modules; - public class SampleModule : Module +public class SampleModule : Module +{ + public override void Load() { - public override void Load() + if (Workspace.ApplicationType == ApplicationType.SecurityDesk) { - if (Workspace.ApplicationType == ApplicationType.SecurityDesk) - { - var builder = new AlarmTimelineProviderBuilder(); - builder.Initialize(Workspace); - Workspace.Components.Register(builder); - } + var builder = new AlarmTimelineProviderBuilder(); + builder.Initialize(Workspace); + Workspace.Components.Register(builder); } + } - public override void Unload() - { - } + public override void Unload() + { } -} +} \ No newline at end of file From 34fc4174e6fc13d1b178fa88da95f008ce179910 Mon Sep 17 00:00:00 2001 From: Andre Lafleur Date: Fri, 20 Sep 2024 23:03:13 +0800 Subject: [PATCH 02/22] Update copyright and license to Apache 2.0 --- Samples/Media SDK/FileCryptingManagerSample/Program.cs | 9 ++++++++- Samples/Media SDK/MediaFileSample/Program.cs | 9 ++++++++- Samples/Media SDK/OverlaySample/BouncingBall.cs | 8 ++++++-- Samples/Media SDK/OverlaySample/BouncingBallOverlay.cs | 8 ++++++-- Samples/Media SDK/OverlaySample/OverlayExtensions.cs | 8 ++++++-- Samples/Media SDK/OverlaySample/Program.cs | 8 ++++++-- Samples/Media SDK/OverlaySample/TimecodeOverlay.cs | 8 ++++++-- Samples/Media SDK/PlaybackStreamReaderSample/Program.cs | 8 ++++++-- Samples/Media SDK/VideoExportSample/ExportOption.cs | 8 ++++++-- .../VideoExportSample/G64ConverterBaseExtensions.cs | 8 ++++++-- Samples/Media SDK/VideoExportSample/Program.cs | 8 ++++++-- Samples/Media SDK/VideoExportSample/VideoExport.cs | 8 ++++++-- Samples/Media SDK/VideoExportSample/VideoExportFormat.cs | 8 ++++++-- Samples/Media SDK/VideoSourceFilterSample/Program.cs | 8 ++++++-- .../AccessControlUnitManagerSample/Program.cs | 8 ++++++-- Samples/Platform SDK/AccessVerifierSample/Program.cs | 8 ++++++-- Samples/Platform SDK/AlarmMonitoringSample/Program.cs | 8 ++++++-- .../Platform SDK/CameraConfigurationSample/Program.cs | 9 ++++++++- Samples/Platform SDK/CustomEntitySample/Icon.cs | 8 ++++++-- Samples/Platform SDK/CustomIconSample/Program.cs | 9 ++++++++- .../EntityCertificatesManagerSample/Program.cs | 8 ++++++-- Samples/Platform SDK/EntityMappingSample/Program.cs | 8 ++++++-- Samples/Platform SDK/EventToActionSample/Program.cs | 8 ++++++-- .../Platform SDK/IncidentManagerSample/IncidentData.cs | 8 +++++--- Samples/Platform SDK/IncidentManagerSample/Program.cs | 8 ++++++-- Samples/Platform SDK/LicenseManagerSample/Program.cs | 8 +++++--- Samples/Platform SDK/LoginManagerSample/Program.cs | 8 ++++++-- Samples/Platform SDK/SecurityManagerSample/Program.cs | 8 ++++++-- Samples/Platform SDK/TransactionManagerSample/Program.cs | 8 ++++++-- Samples/Platform SDK/TriggerAlarmSample/Program.cs | 9 ++++++++- .../Platform SDK/UnusedCredentialQuerySample/Program.cs | 8 ++++++-- Samples/Platform SDK/UserTaskSample/Program.cs | 8 ++++++-- Samples/Platform SDK/VideoUnitSample/Program.cs | 8 ++++++-- .../VisitorManagerSample/ArchivedVisitorData.cs | 8 +++++--- Samples/Platform SDK/VisitorManagerSample/Program.cs | 8 +++++--- Samples/Plugin SDK/BasicPluginTemplate/BasicPlugin.cs | 8 ++++++-- .../BasicPluginTemplate/BasicPluginDescriptor.cs | 8 ++++++-- .../CustomActionSample/Server/SamplePluginDescriptor.cs | 8 ++++++-- .../CustomReportSample/Client/CustomReportFilter.xaml.cs | 8 ++++++-- .../CustomReportSample/Client/CustomReportPage.cs | 8 ++++++-- .../Client/CustomReportPageDescriptor.cs | 8 ++++++-- .../Plugin SDK/CustomReportSample/Client/SampleModule.cs | 8 ++++++-- .../AccessControl/AccessControlReportRecord.cs | 1 - .../Server/SamplePluginDescriptor.cs | 8 ++++++-- Samples/Shared/CollectionExtensions.cs | 8 ++++++-- Samples/Shared/EnumerableExtensions.cs | 8 ++++++-- Samples/Shared/SdkResolver.cs | 8 ++++++-- .../CredentialFormatComparer.cs | 8 ++++++-- .../CredentialReaderView.xaml.cs | 8 ++++++-- .../SampleCardholderCredentialReader.cs | 8 ++++++-- .../CardholderCredentialReaderSample/SampleModule.cs | 8 ++++++-- .../SampleCardholderFieldsExtractor.cs | 8 ++++++-- .../CardholderFieldsExtractorSample/SampleModule.cs | 8 ++++++-- .../CardholderFieldsExtractorSample/VCard.cs | 8 ++++++-- .../CardholderFieldsExtractorSample/VCardReader.cs | 8 ++++++-- .../CommandManagerSample/CommandManagerSampleModule.cs | 8 ++++++-- .../CredentialReaderSample/CredentialFormatComparer.cs | 8 ++++++-- .../CredentialReaderSample/CredentialReaderView.xaml.cs | 9 ++++++++- .../CredentialReaderSample/SampleCredentialReader.cs | 8 ++++++-- .../Workspace SDK/CredentialReaderSample/SampleModule.cs | 8 ++++++-- .../Workspace SDK/DashboardWidgetSample/ClockWidget.cs | 8 ++++++-- .../DashboardWidgetSample/ClockWidgetBuilder.cs | 8 ++++++-- .../DashboardWidgetSample/ClockWidgetConfiguration.cs | 8 ++++++-- .../DashboardWidgetSample/ClockWidgetView.xaml.cs | 8 ++++++-- .../DashboardWidgetSample/CustomWidgetSettings.xaml.cs | 8 ++++++-- .../Workspace SDK/DashboardWidgetSample/SampleModule.cs | 8 ++++++-- .../ImageExtractorSample/SampleImageExtractor.cs | 8 ++++++-- .../Workspace SDK/ImageExtractorSample/SampleModule.cs | 8 ++++++-- Samples/Workspace SDK/ImageExtractorSample/VCard.cs | 8 ++++++-- .../Workspace SDK/ImageExtractorSample/VCardReader.cs | 8 ++++++-- .../Workspace SDK/OptionsExtensionSample/SampleModule.cs | 8 ++++++-- .../OptionsExtensionSample/SampleOptionPage.cs | 8 ++++++-- .../OptionsExtensionSample/SampleOptionsData.cs | 8 ++++++-- .../OptionsExtensionSample/SampleOptionsExtensions.cs | 8 ++++++-- .../OptionsExtensionSample/SampleOptionsView.xaml.cs | 9 ++++++++- Samples/Workspace SDK/TaskSample/NotepadTask.cs | 8 ++++++-- Samples/Workspace SDK/TaskSample/SampleModule.cs | 8 ++++++-- .../Workspace SDK/TilePropertiesSample/SampleModule.cs | 8 ++++++-- .../TilePropertiesSample/SampleTileProperties.cs | 8 ++++++-- .../TilePropertiesSample/SampleTilePropertiesBuilder.cs | 8 ++++++-- .../SampleTilePropertiesView.xaml.cs | 8 ++++++-- Samples/Workspace SDK/TileViewSample/SampleModule.cs | 8 ++++++-- Samples/Workspace SDK/TileViewSample/SampleTileView.cs | 8 ++++++-- .../TileViewSample/SampleTileViewBuilder.cs | 8 ++++++-- .../TileViewSample/SampleTileViewControl.xaml.cs | 8 ++++++-- Samples/Workspace SDK/TileWidgetSample/SampleModule.cs | 8 ++++++-- .../Workspace SDK/TileWidgetSample/SampleTileWidget.cs | 8 ++++++-- .../TileWidgetSample/SampleTileWidgetBuilder.cs | 8 ++++++-- .../TileWidgetSample/SampleTileWidgetView.xaml.cs | 8 ++++++-- .../TimelineProviderSample/AlarmTimelineEvent.cs | 8 ++++++-- .../TimelineProviderSample/AlarmTimelineProvider.cs | 8 ++++++-- .../AlarmTimelineProviderBuilder.cs | 8 ++++++-- .../Workspace SDK/TimelineProviderSample/SampleModule.cs | 8 ++++++-- 93 files changed, 562 insertions(+), 182 deletions(-) diff --git a/Samples/Media SDK/FileCryptingManagerSample/Program.cs b/Samples/Media SDK/FileCryptingManagerSample/Program.cs index 956fdad..7359078 100644 --- a/Samples/Media SDK/FileCryptingManagerSample/Program.cs +++ b/Samples/Media SDK/FileCryptingManagerSample/Program.cs @@ -1,4 +1,11 @@ -using System; +// Copyright 2024 Genetec Inc. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. + +using System; using System.IO; using System.Text; using System.Threading.Tasks; diff --git a/Samples/Media SDK/MediaFileSample/Program.cs b/Samples/Media SDK/MediaFileSample/Program.cs index 42da1e1..a7f8cdc 100644 --- a/Samples/Media SDK/MediaFileSample/Program.cs +++ b/Samples/Media SDK/MediaFileSample/Program.cs @@ -1,4 +1,11 @@ -using System; +// Copyright 2024 Genetec Inc. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. + +using System; using System.IO; using Genetec.Dap.CodeSamples; using Genetec.Sdk.Media; diff --git a/Samples/Media SDK/OverlaySample/BouncingBall.cs b/Samples/Media SDK/OverlaySample/BouncingBall.cs index d54c9f5..03f7d2f 100644 --- a/Samples/Media SDK/OverlaySample/BouncingBall.cs +++ b/Samples/Media SDK/OverlaySample/BouncingBall.cs @@ -1,5 +1,9 @@ -// Copyright (C) 2023 by Genetec, Inc. All rights reserved. -// May be used only in accordance with a valid Source Code License Agreement. +// Copyright 2024 Genetec Inc. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. namespace Genetec.Dap.CodeSamples; diff --git a/Samples/Media SDK/OverlaySample/BouncingBallOverlay.cs b/Samples/Media SDK/OverlaySample/BouncingBallOverlay.cs index f12d8cf..3103f69 100644 --- a/Samples/Media SDK/OverlaySample/BouncingBallOverlay.cs +++ b/Samples/Media SDK/OverlaySample/BouncingBallOverlay.cs @@ -1,5 +1,9 @@ -// Copyright (C) 2023 by Genetec, Inc. All rights reserved. -// May be used only in accordance with a valid Source Code License Agreement. +// Copyright 2024 Genetec Inc. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. namespace Genetec.Dap.CodeSamples; diff --git a/Samples/Media SDK/OverlaySample/OverlayExtensions.cs b/Samples/Media SDK/OverlaySample/OverlayExtensions.cs index f9b9b3c..d19ab1d 100644 --- a/Samples/Media SDK/OverlaySample/OverlayExtensions.cs +++ b/Samples/Media SDK/OverlaySample/OverlayExtensions.cs @@ -1,5 +1,9 @@ -// Copyright (C) 2023 by Genetec, Inc. All rights reserved. -// May be used only in accordance with a valid Source Code License Agreement. +// Copyright 2024 Genetec Inc. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. namespace Genetec.Dap.CodeSamples; diff --git a/Samples/Media SDK/OverlaySample/Program.cs b/Samples/Media SDK/OverlaySample/Program.cs index b36b3ad..976b70c 100644 --- a/Samples/Media SDK/OverlaySample/Program.cs +++ b/Samples/Media SDK/OverlaySample/Program.cs @@ -1,5 +1,9 @@ -// Copyright (C) 2023 by Genetec, Inc. All rights reserved. -// May be used only in accordance with a valid Source Code License Agreement. +// Copyright 2024 Genetec Inc. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. namespace Genetec.Dap.CodeSamples; diff --git a/Samples/Media SDK/OverlaySample/TimecodeOverlay.cs b/Samples/Media SDK/OverlaySample/TimecodeOverlay.cs index 981925f..2ea38b6 100644 --- a/Samples/Media SDK/OverlaySample/TimecodeOverlay.cs +++ b/Samples/Media SDK/OverlaySample/TimecodeOverlay.cs @@ -1,5 +1,9 @@ -// Copyright (C) 2023 by Genetec, Inc. All rights reserved. -// May be used only in accordance with a valid Source Code License Agreement. +// Copyright 2024 Genetec Inc. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. namespace Genetec.Dap.CodeSamples; diff --git a/Samples/Media SDK/PlaybackStreamReaderSample/Program.cs b/Samples/Media SDK/PlaybackStreamReaderSample/Program.cs index 40ca00c..fc27d94 100644 --- a/Samples/Media SDK/PlaybackStreamReaderSample/Program.cs +++ b/Samples/Media SDK/PlaybackStreamReaderSample/Program.cs @@ -1,5 +1,9 @@ -// Copyright (C) 2023 by Genetec, Inc. All rights reserved. -// May be used only in accordance with a valid Source Code License Agreement. +// Copyright 2024 Genetec Inc. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. namespace Genetec.Dap.CodeSamples; diff --git a/Samples/Media SDK/VideoExportSample/ExportOption.cs b/Samples/Media SDK/VideoExportSample/ExportOption.cs index 29054af..acef712 100644 --- a/Samples/Media SDK/VideoExportSample/ExportOption.cs +++ b/Samples/Media SDK/VideoExportSample/ExportOption.cs @@ -1,5 +1,9 @@ -// Copyright (C) 2023 by Genetec, Inc. All rights reserved. -// May be used only in accordance with a valid Source Code License Agreement. +// Copyright 2024 Genetec Inc. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. namespace Genetec.Dap.CodeSamples; diff --git a/Samples/Media SDK/VideoExportSample/G64ConverterBaseExtensions.cs b/Samples/Media SDK/VideoExportSample/G64ConverterBaseExtensions.cs index 3a17ce2..9c8a4ca 100644 --- a/Samples/Media SDK/VideoExportSample/G64ConverterBaseExtensions.cs +++ b/Samples/Media SDK/VideoExportSample/G64ConverterBaseExtensions.cs @@ -1,5 +1,9 @@ -// Copyright (C) 2023 by Genetec, Inc. All rights reserved. -// May be used only in accordance with a valid Source Code License Agreement. +// Copyright 2024 Genetec Inc. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. using System; using System.Collections.Generic; diff --git a/Samples/Media SDK/VideoExportSample/Program.cs b/Samples/Media SDK/VideoExportSample/Program.cs index 8ef89fe..e0016de 100644 --- a/Samples/Media SDK/VideoExportSample/Program.cs +++ b/Samples/Media SDK/VideoExportSample/Program.cs @@ -1,5 +1,9 @@ -// Copyright (C) 2023 by Genetec, Inc. All rights reserved. -// May be used only in accordance with a valid Source Code License Agreement. +// Copyright 2024 Genetec Inc. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. namespace Genetec.Dap.CodeSamples; diff --git a/Samples/Media SDK/VideoExportSample/VideoExport.cs b/Samples/Media SDK/VideoExportSample/VideoExport.cs index 2490233..8633e68 100644 --- a/Samples/Media SDK/VideoExportSample/VideoExport.cs +++ b/Samples/Media SDK/VideoExportSample/VideoExport.cs @@ -1,5 +1,9 @@ -// Copyright (C) 2023 by Genetec, Inc. All rights reserved. -// May be used only in accordance with a valid Source Code License Agreement. +// Copyright 2024 Genetec Inc. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. namespace Genetec.Dap.CodeSamples; diff --git a/Samples/Media SDK/VideoExportSample/VideoExportFormat.cs b/Samples/Media SDK/VideoExportSample/VideoExportFormat.cs index 5d747cd..0861f87 100644 --- a/Samples/Media SDK/VideoExportSample/VideoExportFormat.cs +++ b/Samples/Media SDK/VideoExportSample/VideoExportFormat.cs @@ -1,5 +1,9 @@ -// Copyright (C) 2023 by Genetec, Inc. All rights reserved. -// May be used only in accordance with a valid Source Code License Agreement. +// Copyright 2024 Genetec Inc. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. namespace Genetec.Dap.CodeSamples; diff --git a/Samples/Media SDK/VideoSourceFilterSample/Program.cs b/Samples/Media SDK/VideoSourceFilterSample/Program.cs index 6c2864f..530ebba 100644 --- a/Samples/Media SDK/VideoSourceFilterSample/Program.cs +++ b/Samples/Media SDK/VideoSourceFilterSample/Program.cs @@ -1,5 +1,9 @@ -// Copyright (C) 2023 by Genetec, Inc. All rights reserved. -// May be used only in accordance with a valid Source Code License Agreement. +// Copyright 2024 Genetec Inc. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. namespace Genetec.Dap.CodeSamples; diff --git a/Samples/Platform SDK/AccessControlUnitManagerSample/Program.cs b/Samples/Platform SDK/AccessControlUnitManagerSample/Program.cs index 4b360c0..9e48f77 100644 --- a/Samples/Platform SDK/AccessControlUnitManagerSample/Program.cs +++ b/Samples/Platform SDK/AccessControlUnitManagerSample/Program.cs @@ -1,5 +1,9 @@ -// Copyright (C) 2023 by Genetec, Inc. All rights reserved. -// May be used only in accordance with a valid Source Code License Agreement. +// Copyright 2024 Genetec Inc. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. namespace Genetec.Dap.CodeSamples; diff --git a/Samples/Platform SDK/AccessVerifierSample/Program.cs b/Samples/Platform SDK/AccessVerifierSample/Program.cs index f18db44..f0c7453 100644 --- a/Samples/Platform SDK/AccessVerifierSample/Program.cs +++ b/Samples/Platform SDK/AccessVerifierSample/Program.cs @@ -1,5 +1,9 @@ -// Copyright (C) 2023 by Genetec, Inc. All rights reserved. -// May be used only in accordance with a valid Source Code License Agreement. +// Copyright 2024 Genetec Inc. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. namespace Genetec.Dap.CodeSamples; diff --git a/Samples/Platform SDK/AlarmMonitoringSample/Program.cs b/Samples/Platform SDK/AlarmMonitoringSample/Program.cs index 101aa3b..38ef063 100644 --- a/Samples/Platform SDK/AlarmMonitoringSample/Program.cs +++ b/Samples/Platform SDK/AlarmMonitoringSample/Program.cs @@ -1,5 +1,9 @@ -// Copyright (C) 2023 by Genetec, Inc. All rights reserved. -// May be used only in accordance with a valid Source Code License Agreement. +// Copyright 2024 Genetec Inc. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. namespace Genetec.Dap.CodeSamples; diff --git a/Samples/Platform SDK/CameraConfigurationSample/Program.cs b/Samples/Platform SDK/CameraConfigurationSample/Program.cs index 7af3b03..191cec3 100644 --- a/Samples/Platform SDK/CameraConfigurationSample/Program.cs +++ b/Samples/Platform SDK/CameraConfigurationSample/Program.cs @@ -1,4 +1,11 @@ -using Genetec.Sdk; +// Copyright 2024 Genetec Inc. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. + +using Genetec.Sdk; using System; using Genetec.Dap.CodeSamples; using Genetec.Sdk.Queries; diff --git a/Samples/Platform SDK/CustomEntitySample/Icon.cs b/Samples/Platform SDK/CustomEntitySample/Icon.cs index 5174a33..f484ecb 100644 --- a/Samples/Platform SDK/CustomEntitySample/Icon.cs +++ b/Samples/Platform SDK/CustomEntitySample/Icon.cs @@ -1,5 +1,9 @@ -// Copyright (C) 2023 by Genetec, Inc. All rights reserved. -// May be used only in accordance with a valid Source Code License Agreement. +// Copyright 2024 Genetec Inc. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. namespace Genetec.Dap.CodeSamples; diff --git a/Samples/Platform SDK/CustomIconSample/Program.cs b/Samples/Platform SDK/CustomIconSample/Program.cs index 0766d08..442642b 100644 --- a/Samples/Platform SDK/CustomIconSample/Program.cs +++ b/Samples/Platform SDK/CustomIconSample/Program.cs @@ -1,4 +1,11 @@ -using System; +// Copyright 2024 Genetec Inc. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. + +using System; using System.Drawing; using System.IO; using System.Linq; diff --git a/Samples/Platform SDK/EntityCertificatesManagerSample/Program.cs b/Samples/Platform SDK/EntityCertificatesManagerSample/Program.cs index 1c7291e..d666fbe 100644 --- a/Samples/Platform SDK/EntityCertificatesManagerSample/Program.cs +++ b/Samples/Platform SDK/EntityCertificatesManagerSample/Program.cs @@ -1,5 +1,9 @@ -// Copyright (C) 2023 by Genetec, Inc. All rights reserved. -// May be used only in accordance with a valid Source Code License Agreement. +// Copyright 2024 Genetec Inc. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. namespace Genetec.Dap.CodeSamples; diff --git a/Samples/Platform SDK/EntityMappingSample/Program.cs b/Samples/Platform SDK/EntityMappingSample/Program.cs index fd234a7..46aa116 100644 --- a/Samples/Platform SDK/EntityMappingSample/Program.cs +++ b/Samples/Platform SDK/EntityMappingSample/Program.cs @@ -1,5 +1,9 @@ -// Copyright (C) 2023 by Genetec, Inc. All rights reserved. -// May be used only in accordance with a valid Source Code License Agreement. +// Copyright 2024 Genetec Inc. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. namespace Genetec.Dap.CodeSamples; diff --git a/Samples/Platform SDK/EventToActionSample/Program.cs b/Samples/Platform SDK/EventToActionSample/Program.cs index d699925..e0908bd 100644 --- a/Samples/Platform SDK/EventToActionSample/Program.cs +++ b/Samples/Platform SDK/EventToActionSample/Program.cs @@ -1,5 +1,9 @@ -// Copyright (C) 2023 by Genetec, Inc. All rights reserved. -// May be used only in accordance with a valid Source Code License Agreement. +// Copyright 2024 Genetec Inc. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. namespace Genetec.Dap.CodeSamples; diff --git a/Samples/Platform SDK/IncidentManagerSample/IncidentData.cs b/Samples/Platform SDK/IncidentManagerSample/IncidentData.cs index 3edd620..7265e00 100644 --- a/Samples/Platform SDK/IncidentManagerSample/IncidentData.cs +++ b/Samples/Platform SDK/IncidentManagerSample/IncidentData.cs @@ -1,7 +1,9 @@ -// Copyright 2024 Genetec -// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. +// Copyright 2024 Genetec Inc. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. // You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 -// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. +// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. namespace Genetec.Dap.CodeSamples; diff --git a/Samples/Platform SDK/IncidentManagerSample/Program.cs b/Samples/Platform SDK/IncidentManagerSample/Program.cs index 65dad6a..5cdb240 100644 --- a/Samples/Platform SDK/IncidentManagerSample/Program.cs +++ b/Samples/Platform SDK/IncidentManagerSample/Program.cs @@ -1,5 +1,9 @@ -// Copyright (C) 2023 by Genetec, Inc. All rights reserved. -// May be used only in accordance with a valid Source Code License Agreement. +// Copyright 2024 Genetec Inc. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. namespace Genetec.Dap.CodeSamples; diff --git a/Samples/Platform SDK/LicenseManagerSample/Program.cs b/Samples/Platform SDK/LicenseManagerSample/Program.cs index a8e45b6..35ddbe8 100644 --- a/Samples/Platform SDK/LicenseManagerSample/Program.cs +++ b/Samples/Platform SDK/LicenseManagerSample/Program.cs @@ -1,7 +1,9 @@ -// Copyright 2024 Genetec -// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. +// Copyright 2024 Genetec Inc. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. // You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 -// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. +// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. namespace Genetec.Dap.CodeSamples; diff --git a/Samples/Platform SDK/LoginManagerSample/Program.cs b/Samples/Platform SDK/LoginManagerSample/Program.cs index d68c0db..d2fbf93 100644 --- a/Samples/Platform SDK/LoginManagerSample/Program.cs +++ b/Samples/Platform SDK/LoginManagerSample/Program.cs @@ -1,5 +1,9 @@ -// Copyright (C) 2023 by Genetec, Inc. All rights reserved. -// May be used only in accordance with a valid Source Code License Agreement. +// Copyright 2024 Genetec Inc. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. namespace Genetec.Dap.CodeSamples; diff --git a/Samples/Platform SDK/SecurityManagerSample/Program.cs b/Samples/Platform SDK/SecurityManagerSample/Program.cs index c6679e5..d74d469 100644 --- a/Samples/Platform SDK/SecurityManagerSample/Program.cs +++ b/Samples/Platform SDK/SecurityManagerSample/Program.cs @@ -1,5 +1,9 @@ -// Copyright (C) 2023 by Genetec, Inc. All rights reserved. -// May be used only in accordance with a valid Source Code License Agreement. +// Copyright 2024 Genetec Inc. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. namespace Genetec.Dap.CodeSamples; diff --git a/Samples/Platform SDK/TransactionManagerSample/Program.cs b/Samples/Platform SDK/TransactionManagerSample/Program.cs index 966ad6c..cb80331 100644 --- a/Samples/Platform SDK/TransactionManagerSample/Program.cs +++ b/Samples/Platform SDK/TransactionManagerSample/Program.cs @@ -1,5 +1,9 @@ -// Copyright (C) 2023 by Genetec, Inc. All rights reserved. -// May be used only in accordance with a valid Source Code License Agreement. +// Copyright 2024 Genetec Inc. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. namespace Genetec.Dap.CodeSamples; diff --git a/Samples/Platform SDK/TriggerAlarmSample/Program.cs b/Samples/Platform SDK/TriggerAlarmSample/Program.cs index 5a47dc5..59a6ee2 100644 --- a/Samples/Platform SDK/TriggerAlarmSample/Program.cs +++ b/Samples/Platform SDK/TriggerAlarmSample/Program.cs @@ -1,4 +1,11 @@ -using Genetec.Sdk.Entities; +// Copyright 2024 Genetec Inc. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. + +using Genetec.Sdk.Entities; using Genetec.Sdk; using System; using System.Threading.Tasks; diff --git a/Samples/Platform SDK/UnusedCredentialQuerySample/Program.cs b/Samples/Platform SDK/UnusedCredentialQuerySample/Program.cs index 64fd253..5acb939 100644 --- a/Samples/Platform SDK/UnusedCredentialQuerySample/Program.cs +++ b/Samples/Platform SDK/UnusedCredentialQuerySample/Program.cs @@ -1,5 +1,9 @@ -// Copyright (C) 2023 by Genetec, Inc. All rights reserved. -// May be used only in accordance with a valid Source Code License Agreement. +// Copyright 2024 Genetec Inc. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. namespace Genetec.Dap.CodeSamples; diff --git a/Samples/Platform SDK/UserTaskSample/Program.cs b/Samples/Platform SDK/UserTaskSample/Program.cs index 6e938c8..19a9c22 100644 --- a/Samples/Platform SDK/UserTaskSample/Program.cs +++ b/Samples/Platform SDK/UserTaskSample/Program.cs @@ -1,5 +1,9 @@ -// Copyright (C) 2023 by Genetec, Inc. All rights reserved. -// May be used only in accordance with a valid Source Code License Agreement. +// Copyright 2024 Genetec Inc. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. namespace Genetec.Dap.CodeSamples; diff --git a/Samples/Platform SDK/VideoUnitSample/Program.cs b/Samples/Platform SDK/VideoUnitSample/Program.cs index cee2826..600cc96 100644 --- a/Samples/Platform SDK/VideoUnitSample/Program.cs +++ b/Samples/Platform SDK/VideoUnitSample/Program.cs @@ -1,5 +1,9 @@ -// Copyright (C) 2023 by Genetec, Inc. All rights reserved. -// May be used only in accordance with a valid Source Code License Agreement. +// Copyright 2024 Genetec Inc. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. namespace Genetec.Dap.CodeSamples; diff --git a/Samples/Platform SDK/VisitorManagerSample/ArchivedVisitorData.cs b/Samples/Platform SDK/VisitorManagerSample/ArchivedVisitorData.cs index fc09815..fb9519b 100644 --- a/Samples/Platform SDK/VisitorManagerSample/ArchivedVisitorData.cs +++ b/Samples/Platform SDK/VisitorManagerSample/ArchivedVisitorData.cs @@ -1,7 +1,9 @@ -// Copyright 2024 Genetec -// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. +// Copyright 2024 Genetec Inc. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. // You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 -// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. +// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. namespace Genetec.Dap.CodeSamples; diff --git a/Samples/Platform SDK/VisitorManagerSample/Program.cs b/Samples/Platform SDK/VisitorManagerSample/Program.cs index b1fb205..e8b53ce 100644 --- a/Samples/Platform SDK/VisitorManagerSample/Program.cs +++ b/Samples/Platform SDK/VisitorManagerSample/Program.cs @@ -1,7 +1,9 @@ -// Copyright 2024 Genetec -// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. +// Copyright 2024 Genetec Inc. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. // You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 -// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. +// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. namespace Genetec.Dap.CodeSamples; diff --git a/Samples/Plugin SDK/BasicPluginTemplate/BasicPlugin.cs b/Samples/Plugin SDK/BasicPluginTemplate/BasicPlugin.cs index 89cf910..26654da 100644 --- a/Samples/Plugin SDK/BasicPluginTemplate/BasicPlugin.cs +++ b/Samples/Plugin SDK/BasicPluginTemplate/BasicPlugin.cs @@ -1,5 +1,9 @@ -// Copyright (C) 2023 by Genetec, Inc. All rights reserved. -// May be used only in accordance with a valid Source Code License Agreement. +// Copyright 2024 Genetec Inc. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. namespace Genetec.Dap.CodeSamples; diff --git a/Samples/Plugin SDK/BasicPluginTemplate/BasicPluginDescriptor.cs b/Samples/Plugin SDK/BasicPluginTemplate/BasicPluginDescriptor.cs index 3455337..66178ef 100644 --- a/Samples/Plugin SDK/BasicPluginTemplate/BasicPluginDescriptor.cs +++ b/Samples/Plugin SDK/BasicPluginTemplate/BasicPluginDescriptor.cs @@ -1,5 +1,9 @@ -// Copyright (C) 2023 by Genetec, Inc. All rights reserved. -// May be used only in accordance with a valid Source Code License Agreement. +// Copyright 2024 Genetec Inc. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. namespace Genetec.Dap.CodeSamples; diff --git a/Samples/Plugin SDK/CustomActionSample/Server/SamplePluginDescriptor.cs b/Samples/Plugin SDK/CustomActionSample/Server/SamplePluginDescriptor.cs index 9190e07..f667474 100644 --- a/Samples/Plugin SDK/CustomActionSample/Server/SamplePluginDescriptor.cs +++ b/Samples/Plugin SDK/CustomActionSample/Server/SamplePluginDescriptor.cs @@ -1,5 +1,9 @@ -// Copyright (C) 2023 by Genetec, Inc. All rights reserved. -// May be used only in accordance with a valid Source Code License Agreement. +// Copyright 2024 Genetec Inc. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. namespace Genetec.Dap.CodeSamples.Server; diff --git a/Samples/Plugin SDK/CustomReportSample/Client/CustomReportFilter.xaml.cs b/Samples/Plugin SDK/CustomReportSample/Client/CustomReportFilter.xaml.cs index 0d7b926..22a9c5e 100644 --- a/Samples/Plugin SDK/CustomReportSample/Client/CustomReportFilter.xaml.cs +++ b/Samples/Plugin SDK/CustomReportSample/Client/CustomReportFilter.xaml.cs @@ -1,5 +1,9 @@ -// Copyright (C) 2023 by Genetec, Inc. All rights reserved. -// May be used only in accordance with a valid Source Code License Agreement. +// Copyright 2024 Genetec Inc. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. namespace Genetec.Dap.CodeSamples.Client; diff --git a/Samples/Plugin SDK/CustomReportSample/Client/CustomReportPage.cs b/Samples/Plugin SDK/CustomReportSample/Client/CustomReportPage.cs index 609341d..503e1ce 100644 --- a/Samples/Plugin SDK/CustomReportSample/Client/CustomReportPage.cs +++ b/Samples/Plugin SDK/CustomReportSample/Client/CustomReportPage.cs @@ -1,5 +1,9 @@ -// Copyright (C) 2023 by Genetec, Inc. All rights reserved. -// May be used only in accordance with a valid Source Code License Agreement. +// Copyright 2024 Genetec Inc. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. namespace Genetec.Dap.CodeSamples.Client; diff --git a/Samples/Plugin SDK/CustomReportSample/Client/CustomReportPageDescriptor.cs b/Samples/Plugin SDK/CustomReportSample/Client/CustomReportPageDescriptor.cs index 723fd0d..b9a979c 100644 --- a/Samples/Plugin SDK/CustomReportSample/Client/CustomReportPageDescriptor.cs +++ b/Samples/Plugin SDK/CustomReportSample/Client/CustomReportPageDescriptor.cs @@ -1,5 +1,9 @@ -// Copyright (C) 2023 by Genetec, Inc. All rights reserved. -// May be used only in accordance with a valid Source Code License Agreement. +// Copyright 2024 Genetec Inc. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. namespace Genetec.Dap.CodeSamples.Client; diff --git a/Samples/Plugin SDK/CustomReportSample/Client/SampleModule.cs b/Samples/Plugin SDK/CustomReportSample/Client/SampleModule.cs index c706935..fd59967 100644 --- a/Samples/Plugin SDK/CustomReportSample/Client/SampleModule.cs +++ b/Samples/Plugin SDK/CustomReportSample/Client/SampleModule.cs @@ -1,5 +1,9 @@ -// Copyright (C) 2023 by Genetec, Inc. All rights reserved. -// May be used only in accordance with a valid Source Code License Agreement. +// Copyright 2024 Genetec Inc. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. namespace Genetec.Dap.CodeSamples.Client; diff --git a/Samples/Plugin SDK/CustomReportSample/Server/ReportHandlers/AccessControl/AccessControlReportRecord.cs b/Samples/Plugin SDK/CustomReportSample/Server/ReportHandlers/AccessControl/AccessControlReportRecord.cs index bab7c83..402b2a3 100644 --- a/Samples/Plugin SDK/CustomReportSample/Server/ReportHandlers/AccessControl/AccessControlReportRecord.cs +++ b/Samples/Plugin SDK/CustomReportSample/Server/ReportHandlers/AccessControl/AccessControlReportRecord.cs @@ -5,7 +5,6 @@ // Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. - namespace Genetec.Dap.CodeSamples.Server.ReportHandlers.AccessControl; using System; diff --git a/Samples/Plugin SDK/PluginConfigurationSample/Server/SamplePluginDescriptor.cs b/Samples/Plugin SDK/PluginConfigurationSample/Server/SamplePluginDescriptor.cs index 2867a44..e38f816 100644 --- a/Samples/Plugin SDK/PluginConfigurationSample/Server/SamplePluginDescriptor.cs +++ b/Samples/Plugin SDK/PluginConfigurationSample/Server/SamplePluginDescriptor.cs @@ -1,5 +1,9 @@ -// Copyright (C) 2023 by Genetec, Inc. All rights reserved. -// May be used only in accordance with a valid Source Code License Agreement. +// Copyright 2024 Genetec Inc. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. namespace Genetec.Dap.CodeSamples.Server; diff --git a/Samples/Shared/CollectionExtensions.cs b/Samples/Shared/CollectionExtensions.cs index 72df0e6..404553e 100644 --- a/Samples/Shared/CollectionExtensions.cs +++ b/Samples/Shared/CollectionExtensions.cs @@ -1,5 +1,9 @@ -// Copyright (C) 2023 by Genetec, Inc. All rights reserved. -// May be used only in accordance with a valid Source Code License Agreement. +// Copyright 2024 Genetec Inc. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. namespace Genetec.Dap.CodeSamples; diff --git a/Samples/Shared/EnumerableExtensions.cs b/Samples/Shared/EnumerableExtensions.cs index 1ba470b..d599b1e 100644 --- a/Samples/Shared/EnumerableExtensions.cs +++ b/Samples/Shared/EnumerableExtensions.cs @@ -1,5 +1,9 @@ -// Copyright (C) 2023 by Genetec, Inc. All rights reserved. -// May be used only in accordance with a valid Source Code License Agreement. +// Copyright 2024 Genetec Inc. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. namespace Genetec.Dap.CodeSamples; diff --git a/Samples/Shared/SdkResolver.cs b/Samples/Shared/SdkResolver.cs index 5cf6316..8ad8125 100644 --- a/Samples/Shared/SdkResolver.cs +++ b/Samples/Shared/SdkResolver.cs @@ -1,5 +1,9 @@ -// Copyright (C) 2023 by Genetec, Inc. All rights reserved. -// May be used only in accordance with a valid Source Code License Agreement. +// Copyright 2024 Genetec Inc. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. namespace Genetec.Dap.CodeSamples; diff --git a/Samples/Workspace SDK/CardholderCredentialReaderSample/CredentialFormatComparer.cs b/Samples/Workspace SDK/CardholderCredentialReaderSample/CredentialFormatComparer.cs index 370e143..4cb2b30 100644 --- a/Samples/Workspace SDK/CardholderCredentialReaderSample/CredentialFormatComparer.cs +++ b/Samples/Workspace SDK/CardholderCredentialReaderSample/CredentialFormatComparer.cs @@ -1,5 +1,9 @@ -// Copyright (C) 2024 by Genetec, Inc. All rights reserved. -// May be used only in accordance with a valid Source Code License Agreement. +// Copyright 2024 Genetec Inc. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. namespace Genetec.Dap.CodeSamples; diff --git a/Samples/Workspace SDK/CardholderCredentialReaderSample/CredentialReaderView.xaml.cs b/Samples/Workspace SDK/CardholderCredentialReaderSample/CredentialReaderView.xaml.cs index 009214c..5a6a6f2 100644 --- a/Samples/Workspace SDK/CardholderCredentialReaderSample/CredentialReaderView.xaml.cs +++ b/Samples/Workspace SDK/CardholderCredentialReaderSample/CredentialReaderView.xaml.cs @@ -1,5 +1,9 @@ -// Copyright (C) 2023 by Genetec, Inc. All rights reserved. -// May be used only in accordance with a valid Source Code License Agreement. +// Copyright 2024 Genetec Inc. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. namespace Genetec.Dap.CodeSamples; diff --git a/Samples/Workspace SDK/CardholderCredentialReaderSample/SampleCardholderCredentialReader.cs b/Samples/Workspace SDK/CardholderCredentialReaderSample/SampleCardholderCredentialReader.cs index 18ed2f7..9cc447f 100644 --- a/Samples/Workspace SDK/CardholderCredentialReaderSample/SampleCardholderCredentialReader.cs +++ b/Samples/Workspace SDK/CardholderCredentialReaderSample/SampleCardholderCredentialReader.cs @@ -1,5 +1,9 @@ -// Copyright (C) 2024 by Genetec, Inc. All rights reserved. -// May be used only in accordance with a valid Source Code License Agreement. +// Copyright 2024 Genetec Inc. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. namespace Genetec.Dap.CodeSamples; diff --git a/Samples/Workspace SDK/CardholderCredentialReaderSample/SampleModule.cs b/Samples/Workspace SDK/CardholderCredentialReaderSample/SampleModule.cs index 409516b..d1ca8cf 100644 --- a/Samples/Workspace SDK/CardholderCredentialReaderSample/SampleModule.cs +++ b/Samples/Workspace SDK/CardholderCredentialReaderSample/SampleModule.cs @@ -1,5 +1,9 @@ -// Copyright (C) 2023 by Genetec, Inc. All rights reserved. -// May be used only in accordance with a valid Source Code License Agreement. +// Copyright 2024 Genetec Inc. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. namespace Genetec.Dap.CodeSamples; diff --git a/Samples/Workspace SDK/CardholderFieldsExtractorSample/SampleCardholderFieldsExtractor.cs b/Samples/Workspace SDK/CardholderFieldsExtractorSample/SampleCardholderFieldsExtractor.cs index 00f27d2..90d30ad 100644 --- a/Samples/Workspace SDK/CardholderFieldsExtractorSample/SampleCardholderFieldsExtractor.cs +++ b/Samples/Workspace SDK/CardholderFieldsExtractorSample/SampleCardholderFieldsExtractor.cs @@ -1,5 +1,9 @@ -// Copyright (C) 2024 by Genetec, Inc. All rights reserved. -// May be used only in accordance with a valid Source Code License Agreement. +// Copyright 2024 Genetec Inc. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. namespace Genetec.Dap.CodeSamples; diff --git a/Samples/Workspace SDK/CardholderFieldsExtractorSample/SampleModule.cs b/Samples/Workspace SDK/CardholderFieldsExtractorSample/SampleModule.cs index 8bd049f..7bb6b97 100644 --- a/Samples/Workspace SDK/CardholderFieldsExtractorSample/SampleModule.cs +++ b/Samples/Workspace SDK/CardholderFieldsExtractorSample/SampleModule.cs @@ -1,5 +1,9 @@ -// Copyright (C) 2023 by Genetec, Inc. All rights reserved. -// May be used only in accordance with a valid Source Code License Agreement. +// Copyright 2024 Genetec Inc. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. namespace Genetec.Dap.CodeSamples; diff --git a/Samples/Workspace SDK/CardholderFieldsExtractorSample/VCard.cs b/Samples/Workspace SDK/CardholderFieldsExtractorSample/VCard.cs index 18d3a1f..522d168 100644 --- a/Samples/Workspace SDK/CardholderFieldsExtractorSample/VCard.cs +++ b/Samples/Workspace SDK/CardholderFieldsExtractorSample/VCard.cs @@ -1,5 +1,9 @@ -// Copyright (C) 2023 by Genetec, Inc. All rights reserved. -// May be used only in accordance with a valid Source Code License Agreement. +// Copyright 2024 Genetec Inc. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. namespace Genetec.Dap.CodeSamples; diff --git a/Samples/Workspace SDK/CardholderFieldsExtractorSample/VCardReader.cs b/Samples/Workspace SDK/CardholderFieldsExtractorSample/VCardReader.cs index 84354ee..e1b4201 100644 --- a/Samples/Workspace SDK/CardholderFieldsExtractorSample/VCardReader.cs +++ b/Samples/Workspace SDK/CardholderFieldsExtractorSample/VCardReader.cs @@ -1,5 +1,9 @@ -// Copyright (C) 2023 by Genetec, Inc. All rights reserved. -// May be used only in accordance with a valid Source Code License Agreement. +// Copyright 2024 Genetec Inc. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. namespace Genetec.Dap.CodeSamples; diff --git a/Samples/Workspace SDK/CommandManagerSample/CommandManagerSampleModule.cs b/Samples/Workspace SDK/CommandManagerSample/CommandManagerSampleModule.cs index 5e04ab9..a98d689 100644 --- a/Samples/Workspace SDK/CommandManagerSample/CommandManagerSampleModule.cs +++ b/Samples/Workspace SDK/CommandManagerSample/CommandManagerSampleModule.cs @@ -1,5 +1,9 @@ -// Copyright (C) 2024 by Genetec, Inc. All rights reserved. -// May be used only in accordance with a valid Source Code License Agreement. +// Copyright 2024 Genetec Inc. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. namespace Genetec.Dap.CodeSamples; diff --git a/Samples/Workspace SDK/CredentialReaderSample/CredentialFormatComparer.cs b/Samples/Workspace SDK/CredentialReaderSample/CredentialFormatComparer.cs index 370e143..4cb2b30 100644 --- a/Samples/Workspace SDK/CredentialReaderSample/CredentialFormatComparer.cs +++ b/Samples/Workspace SDK/CredentialReaderSample/CredentialFormatComparer.cs @@ -1,5 +1,9 @@ -// Copyright (C) 2024 by Genetec, Inc. All rights reserved. -// May be used only in accordance with a valid Source Code License Agreement. +// Copyright 2024 Genetec Inc. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. namespace Genetec.Dap.CodeSamples; diff --git a/Samples/Workspace SDK/CredentialReaderSample/CredentialReaderView.xaml.cs b/Samples/Workspace SDK/CredentialReaderSample/CredentialReaderView.xaml.cs index 31db79b..d98fb69 100644 --- a/Samples/Workspace SDK/CredentialReaderSample/CredentialReaderView.xaml.cs +++ b/Samples/Workspace SDK/CredentialReaderSample/CredentialReaderView.xaml.cs @@ -1,4 +1,11 @@ -namespace Genetec.Dap.CodeSamples; +// Copyright 2024 Genetec Inc. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. + +namespace Genetec.Dap.CodeSamples; using System.Windows.Controls; diff --git a/Samples/Workspace SDK/CredentialReaderSample/SampleCredentialReader.cs b/Samples/Workspace SDK/CredentialReaderSample/SampleCredentialReader.cs index 23be15a..169de85 100644 --- a/Samples/Workspace SDK/CredentialReaderSample/SampleCredentialReader.cs +++ b/Samples/Workspace SDK/CredentialReaderSample/SampleCredentialReader.cs @@ -1,5 +1,9 @@ -// Copyright (C) 2024 by Genetec, Inc. All rights reserved. -// May be used only in accordance with a valid Source Code License Agreement. +// Copyright 2024 Genetec Inc. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. namespace Genetec.Dap.CodeSamples; diff --git a/Samples/Workspace SDK/CredentialReaderSample/SampleModule.cs b/Samples/Workspace SDK/CredentialReaderSample/SampleModule.cs index 89e2094..6bb8bdc 100644 --- a/Samples/Workspace SDK/CredentialReaderSample/SampleModule.cs +++ b/Samples/Workspace SDK/CredentialReaderSample/SampleModule.cs @@ -1,5 +1,9 @@ -// Copyright (C) 2023 by Genetec, Inc. All rights reserved. -// May be used only in accordance with a valid Source Code License Agreement. +// Copyright 2024 Genetec Inc. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. namespace Genetec.Dap.CodeSamples; diff --git a/Samples/Workspace SDK/DashboardWidgetSample/ClockWidget.cs b/Samples/Workspace SDK/DashboardWidgetSample/ClockWidget.cs index f8dc260..295a9e8 100644 --- a/Samples/Workspace SDK/DashboardWidgetSample/ClockWidget.cs +++ b/Samples/Workspace SDK/DashboardWidgetSample/ClockWidget.cs @@ -1,5 +1,9 @@ -// Copyright (C) 2023 by Genetec, Inc. All rights reserved. -// May be used only in accordance with a valid Source Code License Agreement. +// Copyright 2024 Genetec Inc. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. namespace Genetec.Dap.CodeSamples; diff --git a/Samples/Workspace SDK/DashboardWidgetSample/ClockWidgetBuilder.cs b/Samples/Workspace SDK/DashboardWidgetSample/ClockWidgetBuilder.cs index 594e680..2bacdc4 100644 --- a/Samples/Workspace SDK/DashboardWidgetSample/ClockWidgetBuilder.cs +++ b/Samples/Workspace SDK/DashboardWidgetSample/ClockWidgetBuilder.cs @@ -1,5 +1,9 @@ -// Copyright (C) 2023 by Genetec, Inc. All rights reserved. -// May be used only in accordance with a valid Source Code License Agreement. +// Copyright 2024 Genetec Inc. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. // Copyright (C) 2023 by Genetec, Inc. All rights reserved. // May be used only in accordance with a valid Source Code License Agreement. diff --git a/Samples/Workspace SDK/DashboardWidgetSample/ClockWidgetConfiguration.cs b/Samples/Workspace SDK/DashboardWidgetSample/ClockWidgetConfiguration.cs index 53bb720..56f20f0 100644 --- a/Samples/Workspace SDK/DashboardWidgetSample/ClockWidgetConfiguration.cs +++ b/Samples/Workspace SDK/DashboardWidgetSample/ClockWidgetConfiguration.cs @@ -1,5 +1,9 @@ -// Copyright (C) 2023 by Genetec, Inc. All rights reserved. -// May be used only in accordance with a valid Source Code License Agreement. +// Copyright 2024 Genetec Inc. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. namespace Genetec.Dap.CodeSamples; diff --git a/Samples/Workspace SDK/DashboardWidgetSample/ClockWidgetView.xaml.cs b/Samples/Workspace SDK/DashboardWidgetSample/ClockWidgetView.xaml.cs index e8912a2..489ad0b 100644 --- a/Samples/Workspace SDK/DashboardWidgetSample/ClockWidgetView.xaml.cs +++ b/Samples/Workspace SDK/DashboardWidgetSample/ClockWidgetView.xaml.cs @@ -1,5 +1,9 @@ -// Copyright (C) 2023 by Genetec, Inc. All rights reserved. -// May be used only in accordance with a valid Source Code License Agreement. +// Copyright 2024 Genetec Inc. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. namespace Genetec.Dap.CodeSamples; diff --git a/Samples/Workspace SDK/DashboardWidgetSample/CustomWidgetSettings.xaml.cs b/Samples/Workspace SDK/DashboardWidgetSample/CustomWidgetSettings.xaml.cs index 8492387..ed52c02 100644 --- a/Samples/Workspace SDK/DashboardWidgetSample/CustomWidgetSettings.xaml.cs +++ b/Samples/Workspace SDK/DashboardWidgetSample/CustomWidgetSettings.xaml.cs @@ -1,5 +1,9 @@ -// Copyright (C) 2023 by Genetec, Inc. All rights reserved. -// May be used only in accordance with a valid Source Code License Agreement. +// Copyright 2024 Genetec Inc. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. namespace Genetec.Dap.CodeSamples; diff --git a/Samples/Workspace SDK/DashboardWidgetSample/SampleModule.cs b/Samples/Workspace SDK/DashboardWidgetSample/SampleModule.cs index f04ffaf..60451d4 100644 --- a/Samples/Workspace SDK/DashboardWidgetSample/SampleModule.cs +++ b/Samples/Workspace SDK/DashboardWidgetSample/SampleModule.cs @@ -1,5 +1,9 @@ -// Copyright (C) 2023 by Genetec, Inc. All rights reserved. -// May be used only in accordance with a valid Source Code License Agreement. +// Copyright 2024 Genetec Inc. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. namespace Genetec.Dap.CodeSamples; diff --git a/Samples/Workspace SDK/ImageExtractorSample/SampleImageExtractor.cs b/Samples/Workspace SDK/ImageExtractorSample/SampleImageExtractor.cs index 4699a22..878f816 100644 --- a/Samples/Workspace SDK/ImageExtractorSample/SampleImageExtractor.cs +++ b/Samples/Workspace SDK/ImageExtractorSample/SampleImageExtractor.cs @@ -1,5 +1,9 @@ -// Copyright (C) 2023 by Genetec, Inc. All rights reserved. -// May be used only in accordance with a valid Source Code License Agreement. +// Copyright 2024 Genetec Inc. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. namespace Genetec.Dap.CodeSamples; diff --git a/Samples/Workspace SDK/ImageExtractorSample/SampleModule.cs b/Samples/Workspace SDK/ImageExtractorSample/SampleModule.cs index be85069..1bdacd2 100644 --- a/Samples/Workspace SDK/ImageExtractorSample/SampleModule.cs +++ b/Samples/Workspace SDK/ImageExtractorSample/SampleModule.cs @@ -1,5 +1,9 @@ -// Copyright (C) 2023 by Genetec, Inc. All rights reserved. -// May be used only in accordance with a valid Source Code License Agreement. +// Copyright 2024 Genetec Inc. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. namespace Genetec.Dap.CodeSamples; diff --git a/Samples/Workspace SDK/ImageExtractorSample/VCard.cs b/Samples/Workspace SDK/ImageExtractorSample/VCard.cs index 18d3a1f..522d168 100644 --- a/Samples/Workspace SDK/ImageExtractorSample/VCard.cs +++ b/Samples/Workspace SDK/ImageExtractorSample/VCard.cs @@ -1,5 +1,9 @@ -// Copyright (C) 2023 by Genetec, Inc. All rights reserved. -// May be used only in accordance with a valid Source Code License Agreement. +// Copyright 2024 Genetec Inc. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. namespace Genetec.Dap.CodeSamples; diff --git a/Samples/Workspace SDK/ImageExtractorSample/VCardReader.cs b/Samples/Workspace SDK/ImageExtractorSample/VCardReader.cs index 84354ee..e1b4201 100644 --- a/Samples/Workspace SDK/ImageExtractorSample/VCardReader.cs +++ b/Samples/Workspace SDK/ImageExtractorSample/VCardReader.cs @@ -1,5 +1,9 @@ -// Copyright (C) 2023 by Genetec, Inc. All rights reserved. -// May be used only in accordance with a valid Source Code License Agreement. +// Copyright 2024 Genetec Inc. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. namespace Genetec.Dap.CodeSamples; diff --git a/Samples/Workspace SDK/OptionsExtensionSample/SampleModule.cs b/Samples/Workspace SDK/OptionsExtensionSample/SampleModule.cs index 2f307ed..560e571 100644 --- a/Samples/Workspace SDK/OptionsExtensionSample/SampleModule.cs +++ b/Samples/Workspace SDK/OptionsExtensionSample/SampleModule.cs @@ -1,5 +1,9 @@ -// Copyright (C) 2023 by Genetec, Inc. All rights reserved. -// May be used only in accordance with a valid Source Code License Agreement. +// Copyright 2024 Genetec Inc. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. namespace Genetec.Dap.CodeSamples; diff --git a/Samples/Workspace SDK/OptionsExtensionSample/SampleOptionPage.cs b/Samples/Workspace SDK/OptionsExtensionSample/SampleOptionPage.cs index 00a5741..450d2eb 100644 --- a/Samples/Workspace SDK/OptionsExtensionSample/SampleOptionPage.cs +++ b/Samples/Workspace SDK/OptionsExtensionSample/SampleOptionPage.cs @@ -1,5 +1,9 @@ -// Copyright (C) 2023 by Genetec, Inc. All rights reserved. -// May be used only in accordance with a valid Source Code License Agreement. +// Copyright 2024 Genetec Inc. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. namespace Genetec.Dap.CodeSamples; diff --git a/Samples/Workspace SDK/OptionsExtensionSample/SampleOptionsData.cs b/Samples/Workspace SDK/OptionsExtensionSample/SampleOptionsData.cs index 5ebab91..5f0e7ea 100644 --- a/Samples/Workspace SDK/OptionsExtensionSample/SampleOptionsData.cs +++ b/Samples/Workspace SDK/OptionsExtensionSample/SampleOptionsData.cs @@ -1,5 +1,9 @@ -// Copyright (C) 2023 by Genetec, Inc. All rights reserved. -// May be used only in accordance with a valid Source Code License Agreement. +// Copyright 2024 Genetec Inc. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. namespace Genetec.Dap.CodeSamples; diff --git a/Samples/Workspace SDK/OptionsExtensionSample/SampleOptionsExtensions.cs b/Samples/Workspace SDK/OptionsExtensionSample/SampleOptionsExtensions.cs index 36cc40a..3576728 100644 --- a/Samples/Workspace SDK/OptionsExtensionSample/SampleOptionsExtensions.cs +++ b/Samples/Workspace SDK/OptionsExtensionSample/SampleOptionsExtensions.cs @@ -1,5 +1,9 @@ -// Copyright (C) 2023 by Genetec, Inc. All rights reserved. -// May be used only in accordance with a valid Source Code License Agreement. +// Copyright 2024 Genetec Inc. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. namespace Genetec.Dap.CodeSamples; diff --git a/Samples/Workspace SDK/OptionsExtensionSample/SampleOptionsView.xaml.cs b/Samples/Workspace SDK/OptionsExtensionSample/SampleOptionsView.xaml.cs index 26f61b6..74ed4e9 100644 --- a/Samples/Workspace SDK/OptionsExtensionSample/SampleOptionsView.xaml.cs +++ b/Samples/Workspace SDK/OptionsExtensionSample/SampleOptionsView.xaml.cs @@ -1,4 +1,11 @@ -namespace Genetec.Dap.CodeSamples; +// Copyright 2024 Genetec Inc. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. + +namespace Genetec.Dap.CodeSamples; using System.Windows.Controls; diff --git a/Samples/Workspace SDK/TaskSample/NotepadTask.cs b/Samples/Workspace SDK/TaskSample/NotepadTask.cs index 383f333..c3ca1f0 100644 --- a/Samples/Workspace SDK/TaskSample/NotepadTask.cs +++ b/Samples/Workspace SDK/TaskSample/NotepadTask.cs @@ -1,5 +1,9 @@ -// Copyright (C) 2023 by Genetec, Inc. All rights reserved. -// May be used only in accordance with a valid Source Code License Agreement. +// Copyright 2024 Genetec Inc. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. namespace Genetec.Dap.CodeSamples; diff --git a/Samples/Workspace SDK/TaskSample/SampleModule.cs b/Samples/Workspace SDK/TaskSample/SampleModule.cs index bec9f57..4cd2dfc 100644 --- a/Samples/Workspace SDK/TaskSample/SampleModule.cs +++ b/Samples/Workspace SDK/TaskSample/SampleModule.cs @@ -1,5 +1,9 @@ -// Copyright (C) 2023 by Genetec, Inc. All rights reserved. -// May be used only in accordance with a valid Source Code License Agreement. +// Copyright 2024 Genetec Inc. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. namespace Genetec.Dap.CodeSamples; diff --git a/Samples/Workspace SDK/TilePropertiesSample/SampleModule.cs b/Samples/Workspace SDK/TilePropertiesSample/SampleModule.cs index d9461c6..e9da9c5 100644 --- a/Samples/Workspace SDK/TilePropertiesSample/SampleModule.cs +++ b/Samples/Workspace SDK/TilePropertiesSample/SampleModule.cs @@ -1,5 +1,9 @@ -// Copyright (C) 2023 by Genetec, Inc. All rights reserved. -// May be used only in accordance with a valid Source Code License Agreement. +// Copyright 2024 Genetec Inc. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. namespace Genetec.Dap.CodeSamples; diff --git a/Samples/Workspace SDK/TilePropertiesSample/SampleTileProperties.cs b/Samples/Workspace SDK/TilePropertiesSample/SampleTileProperties.cs index b9176c4..99bb633 100644 --- a/Samples/Workspace SDK/TilePropertiesSample/SampleTileProperties.cs +++ b/Samples/Workspace SDK/TilePropertiesSample/SampleTileProperties.cs @@ -1,5 +1,9 @@ -// Copyright (C) 2023 by Genetec, Inc. All rights reserved. -// May be used only in accordance with a valid Source Code License Agreement. +// Copyright 2024 Genetec Inc. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. namespace Genetec.Dap.CodeSamples; diff --git a/Samples/Workspace SDK/TilePropertiesSample/SampleTilePropertiesBuilder.cs b/Samples/Workspace SDK/TilePropertiesSample/SampleTilePropertiesBuilder.cs index 768eaaf..37dac5a 100644 --- a/Samples/Workspace SDK/TilePropertiesSample/SampleTilePropertiesBuilder.cs +++ b/Samples/Workspace SDK/TilePropertiesSample/SampleTilePropertiesBuilder.cs @@ -1,5 +1,9 @@ -// Copyright (C) 2023 by Genetec, Inc. All rights reserved. -// May be used only in accordance with a valid Source Code License Agreement. +// Copyright 2024 Genetec Inc. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. namespace Genetec.Dap.CodeSamples; diff --git a/Samples/Workspace SDK/TilePropertiesSample/SampleTilePropertiesView.xaml.cs b/Samples/Workspace SDK/TilePropertiesSample/SampleTilePropertiesView.xaml.cs index 9c124cc..676d54b 100644 --- a/Samples/Workspace SDK/TilePropertiesSample/SampleTilePropertiesView.xaml.cs +++ b/Samples/Workspace SDK/TilePropertiesSample/SampleTilePropertiesView.xaml.cs @@ -1,5 +1,9 @@ -// Copyright (C) 2023 by Genetec, Inc. All rights reserved. -// May be used only in accordance with a valid Source Code License Agreement. +// Copyright 2024 Genetec Inc. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. namespace Genetec.Dap.CodeSamples; diff --git a/Samples/Workspace SDK/TileViewSample/SampleModule.cs b/Samples/Workspace SDK/TileViewSample/SampleModule.cs index afd43b5..a243b36 100644 --- a/Samples/Workspace SDK/TileViewSample/SampleModule.cs +++ b/Samples/Workspace SDK/TileViewSample/SampleModule.cs @@ -1,5 +1,9 @@ -// Copyright (C) 2023 by Genetec, Inc. All rights reserved. -// May be used only in accordance with a valid Source Code License Agreement. +// Copyright 2024 Genetec Inc. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. namespace Genetec.Dap.CodeSamples; diff --git a/Samples/Workspace SDK/TileViewSample/SampleTileView.cs b/Samples/Workspace SDK/TileViewSample/SampleTileView.cs index 195ceeb..7199231 100644 --- a/Samples/Workspace SDK/TileViewSample/SampleTileView.cs +++ b/Samples/Workspace SDK/TileViewSample/SampleTileView.cs @@ -1,5 +1,9 @@ -// Copyright (C) 2023 by Genetec, Inc. All rights reserved. -// May be used only in accordance with a valid Source Code License Agreement. +// Copyright 2024 Genetec Inc. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. namespace Genetec.Dap.CodeSamples; diff --git a/Samples/Workspace SDK/TileViewSample/SampleTileViewBuilder.cs b/Samples/Workspace SDK/TileViewSample/SampleTileViewBuilder.cs index ec12c9d..489915a 100644 --- a/Samples/Workspace SDK/TileViewSample/SampleTileViewBuilder.cs +++ b/Samples/Workspace SDK/TileViewSample/SampleTileViewBuilder.cs @@ -1,5 +1,9 @@ -// Copyright (C) 2023 by Genetec, Inc. All rights reserved. -// May be used only in accordance with a valid Source Code License Agreement. +// Copyright 2024 Genetec Inc. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. namespace Genetec.Dap.CodeSamples; diff --git a/Samples/Workspace SDK/TileViewSample/SampleTileViewControl.xaml.cs b/Samples/Workspace SDK/TileViewSample/SampleTileViewControl.xaml.cs index 8d22931..4c3e8fb 100644 --- a/Samples/Workspace SDK/TileViewSample/SampleTileViewControl.xaml.cs +++ b/Samples/Workspace SDK/TileViewSample/SampleTileViewControl.xaml.cs @@ -1,5 +1,9 @@ -// Copyright (C) 2023 by Genetec, Inc. All rights reserved. -// May be used only in accordance with a valid Source Code License Agreement. +// Copyright 2024 Genetec Inc. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. namespace Genetec.Dap.CodeSamples; diff --git a/Samples/Workspace SDK/TileWidgetSample/SampleModule.cs b/Samples/Workspace SDK/TileWidgetSample/SampleModule.cs index 56aeda7..82315aa 100644 --- a/Samples/Workspace SDK/TileWidgetSample/SampleModule.cs +++ b/Samples/Workspace SDK/TileWidgetSample/SampleModule.cs @@ -1,5 +1,9 @@ -// Copyright (C) 2023 by Genetec, Inc. All rights reserved. -// May be used only in accordance with a valid Source Code License Agreement. +// Copyright 2024 Genetec Inc. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. namespace Genetec.Dap.CodeSamples; diff --git a/Samples/Workspace SDK/TileWidgetSample/SampleTileWidget.cs b/Samples/Workspace SDK/TileWidgetSample/SampleTileWidget.cs index 659a1b8..8a8e6b9 100644 --- a/Samples/Workspace SDK/TileWidgetSample/SampleTileWidget.cs +++ b/Samples/Workspace SDK/TileWidgetSample/SampleTileWidget.cs @@ -1,5 +1,9 @@ -// Copyright (C) 2023 by Genetec, Inc. All rights reserved. -// May be used only in accordance with a valid Source Code License Agreement. +// Copyright 2024 Genetec Inc. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. namespace Genetec.Dap.CodeSamples; diff --git a/Samples/Workspace SDK/TileWidgetSample/SampleTileWidgetBuilder.cs b/Samples/Workspace SDK/TileWidgetSample/SampleTileWidgetBuilder.cs index e045f13..a953340 100644 --- a/Samples/Workspace SDK/TileWidgetSample/SampleTileWidgetBuilder.cs +++ b/Samples/Workspace SDK/TileWidgetSample/SampleTileWidgetBuilder.cs @@ -1,5 +1,9 @@ -// Copyright (C) 2023 by Genetec, Inc. All rights reserved. -// May be used only in accordance with a valid Source Code License Agreement. +// Copyright 2024 Genetec Inc. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. namespace Genetec.Dap.CodeSamples; diff --git a/Samples/Workspace SDK/TileWidgetSample/SampleTileWidgetView.xaml.cs b/Samples/Workspace SDK/TileWidgetSample/SampleTileWidgetView.xaml.cs index b89c497..2f2b187 100644 --- a/Samples/Workspace SDK/TileWidgetSample/SampleTileWidgetView.xaml.cs +++ b/Samples/Workspace SDK/TileWidgetSample/SampleTileWidgetView.xaml.cs @@ -1,5 +1,9 @@ -// Copyright (C) 2023 by Genetec, Inc. All rights reserved. -// May be used only in accordance with a valid Source Code License Agreement. +// Copyright 2024 Genetec Inc. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. namespace Genetec.Dap.CodeSamples; diff --git a/Samples/Workspace SDK/TimelineProviderSample/AlarmTimelineEvent.cs b/Samples/Workspace SDK/TimelineProviderSample/AlarmTimelineEvent.cs index a0688bc..07b02e1 100644 --- a/Samples/Workspace SDK/TimelineProviderSample/AlarmTimelineEvent.cs +++ b/Samples/Workspace SDK/TimelineProviderSample/AlarmTimelineEvent.cs @@ -1,5 +1,9 @@ -// Copyright (C) 2023 by Genetec, Inc. All rights reserved. -// May be used only in accordance with a valid Source Code License Agreement. +// Copyright 2024 Genetec Inc. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. namespace Genetec.Dap.CodeSamples; diff --git a/Samples/Workspace SDK/TimelineProviderSample/AlarmTimelineProvider.cs b/Samples/Workspace SDK/TimelineProviderSample/AlarmTimelineProvider.cs index b0b8b45..f2e13ee 100644 --- a/Samples/Workspace SDK/TimelineProviderSample/AlarmTimelineProvider.cs +++ b/Samples/Workspace SDK/TimelineProviderSample/AlarmTimelineProvider.cs @@ -1,5 +1,9 @@ -// Copyright (C) 2023 by Genetec, Inc. All rights reserved. -// May be used only in accordance with a valid Source Code License Agreement. +// Copyright 2024 Genetec Inc. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. namespace Genetec.Dap.CodeSamples; diff --git a/Samples/Workspace SDK/TimelineProviderSample/AlarmTimelineProviderBuilder.cs b/Samples/Workspace SDK/TimelineProviderSample/AlarmTimelineProviderBuilder.cs index ed74aa3..5823c6f 100644 --- a/Samples/Workspace SDK/TimelineProviderSample/AlarmTimelineProviderBuilder.cs +++ b/Samples/Workspace SDK/TimelineProviderSample/AlarmTimelineProviderBuilder.cs @@ -1,5 +1,9 @@ -// Copyright (C) 2023 by Genetec, Inc. All rights reserved. -// May be used only in accordance with a valid Source Code License Agreement. +// Copyright 2024 Genetec Inc. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. namespace Genetec.Dap.CodeSamples; diff --git a/Samples/Workspace SDK/TimelineProviderSample/SampleModule.cs b/Samples/Workspace SDK/TimelineProviderSample/SampleModule.cs index 121a0b9..d4229d4 100644 --- a/Samples/Workspace SDK/TimelineProviderSample/SampleModule.cs +++ b/Samples/Workspace SDK/TimelineProviderSample/SampleModule.cs @@ -1,5 +1,9 @@ -// Copyright (C) 2023 by Genetec, Inc. All rights reserved. -// May be used only in accordance with a valid Source Code License Agreement. +// Copyright 2024 Genetec Inc. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. namespace Genetec.Dap.CodeSamples; From 63475a82beb4b8c051af66270716e72c2417b298 Mon Sep 17 00:00:00 2001 From: Andre Lafleur Date: Fri, 20 Sep 2024 23:06:17 +0800 Subject: [PATCH 03/22] Add Genetec.Dap.CodeSamples namespace to classes Encapsulated FileCryptingManagerExtensions, StreamMediaType, and StreamUsageType classes within the new Genetec.Dap.CodeSamples namespace in their respective files. --- .../FileCryptingManagerSample/FileCryptingManagerExtensions.cs | 2 ++ Samples/Media SDK/MediaFileSample/StreamMediaType.cs | 2 ++ Samples/Media SDK/MediaFileSample/StreamUsageType.cs | 2 ++ 3 files changed, 6 insertions(+) diff --git a/Samples/Media SDK/FileCryptingManagerSample/FileCryptingManagerExtensions.cs b/Samples/Media SDK/FileCryptingManagerSample/FileCryptingManagerExtensions.cs index 304deb3..a494410 100644 --- a/Samples/Media SDK/FileCryptingManagerSample/FileCryptingManagerExtensions.cs +++ b/Samples/Media SDK/FileCryptingManagerSample/FileCryptingManagerExtensions.cs @@ -12,6 +12,8 @@ using System.Threading.Tasks; using Genetec.Sdk.Media.Export; +namespace Genetec.Dap.CodeSamples; + public static class FileCryptingManagerExtensions { /// diff --git a/Samples/Media SDK/MediaFileSample/StreamMediaType.cs b/Samples/Media SDK/MediaFileSample/StreamMediaType.cs index a91ff4d..3a87064 100644 --- a/Samples/Media SDK/MediaFileSample/StreamMediaType.cs +++ b/Samples/Media SDK/MediaFileSample/StreamMediaType.cs @@ -7,6 +7,8 @@ using System; +namespace Genetec.Dap.CodeSamples; + public static class StreamMediaType { public static readonly Guid Legacy = new("E5FDCEF3-0A63-4615-A2A2-BB34C892FB97"); diff --git a/Samples/Media SDK/MediaFileSample/StreamUsageType.cs b/Samples/Media SDK/MediaFileSample/StreamUsageType.cs index 5c24816..c5fab15 100644 --- a/Samples/Media SDK/MediaFileSample/StreamUsageType.cs +++ b/Samples/Media SDK/MediaFileSample/StreamUsageType.cs @@ -7,6 +7,8 @@ using System; +namespace Genetec.Dap.CodeSamples; + public static class StreamUsageType { public static readonly Guid Live = new("e30e6525-2202-4502-8101-5a75ee15f04b"); From 509245bf554e7cf4efab4b61df046b55bebc4f3f Mon Sep 17 00:00:00 2001 From: Andre Lafleur Date: Fri, 20 Sep 2024 23:08:09 +0800 Subject: [PATCH 04/22] Simplify null check and remove unused usings Simplified the null check for `LastExitTime` in `GetTimeAndAttendance` method in `Program.cs` by directly assigning `null` using the ternary operator. Removed unnecessary `using Client;` and `using Genetec.Sdk.Diagnostics.Logging.Core;` directives from `SamplePlugin.cs`. Note: The `VoidResponse` class in `VoidResponse.cs` was incorrectly changed to a semicolon-ended definition, which needs correction. --- Samples/Platform SDK/TimeAttendanceSample/Program.cs | 2 +- .../PluginConfigurationSample/Server/SamplePlugin.cs | 1 - Samples/Plugin SDK/PluginConfigurationSample/VoidResponse.cs | 4 +--- Samples/Plugin SDK/PluginDatabaseSample/SamplePlugin.cs | 1 - 4 files changed, 2 insertions(+), 6 deletions(-) diff --git a/Samples/Platform SDK/TimeAttendanceSample/Program.cs b/Samples/Platform SDK/TimeAttendanceSample/Program.cs index 6044d7c..388ef6d 100644 --- a/Samples/Platform SDK/TimeAttendanceSample/Program.cs +++ b/Samples/Platform SDK/TimeAttendanceSample/Program.cs @@ -79,7 +79,7 @@ async Task> GetTimeAndAttendance(Engine engine, Guid area, CardholderGuid = row.Field("CardholderGuid"), AreaGuid = row.Field("AreaGuid"), FirstTimeIn = DateTime.SpecifyKind(row.Field("FirstTimeIn"), DateTimeKind.Utc), - LastExitTime = row.IsNull("LastExitTime") ? (DateTime?)null : DateTime.SpecifyKind(row.Field("LastExitTime"), DateTimeKind.Utc), + LastExitTime = row.IsNull("LastExitTime") ? null : DateTime.SpecifyKind(row.Field("LastExitTime"), DateTimeKind.Utc), TotalMinutes = row.Field("TotalMinutes"), TotalMinutesInclusive = row.Field("TotalMinutesInclusive") }; diff --git a/Samples/Plugin SDK/PluginConfigurationSample/Server/SamplePlugin.cs b/Samples/Plugin SDK/PluginConfigurationSample/Server/SamplePlugin.cs index 63d4038..70af37f 100644 --- a/Samples/Plugin SDK/PluginConfigurationSample/Server/SamplePlugin.cs +++ b/Samples/Plugin SDK/PluginConfigurationSample/Server/SamplePlugin.cs @@ -13,7 +13,6 @@ namespace Genetec.Dap.CodeSamples.Server; using System; using System.ComponentModel; using System.Threading.Tasks; -using Client; using Sdk.Workflows; using System.Security; using Genetec.Dap.CodeSamples; diff --git a/Samples/Plugin SDK/PluginConfigurationSample/VoidResponse.cs b/Samples/Plugin SDK/PluginConfigurationSample/VoidResponse.cs index d65eb35..b9ce158 100644 --- a/Samples/Plugin SDK/PluginConfigurationSample/VoidResponse.cs +++ b/Samples/Plugin SDK/PluginConfigurationSample/VoidResponse.cs @@ -7,6 +7,4 @@ namespace Genetec.Dap.CodeSamples; -public class VoidResponse -{ -} \ No newline at end of file +public class VoidResponse; \ No newline at end of file diff --git a/Samples/Plugin SDK/PluginDatabaseSample/SamplePlugin.cs b/Samples/Plugin SDK/PluginDatabaseSample/SamplePlugin.cs index 68ca92f..ba44865 100644 --- a/Samples/Plugin SDK/PluginDatabaseSample/SamplePlugin.cs +++ b/Samples/Plugin SDK/PluginDatabaseSample/SamplePlugin.cs @@ -8,7 +8,6 @@ namespace Genetec.Dap.CodeSamples; using System; -using Genetec.Sdk.Diagnostics.Logging.Core; using Genetec.Sdk.EventsArgs; using Genetec.Sdk.Plugin; using Genetec.Sdk.Plugin.Interfaces; From a1fe44798fe90824b5da5ad2f0ae87ee9d8aef99 Mon Sep 17 00:00:00 2001 From: Andre Lafleur Date: Fri, 20 Sep 2024 23:08:55 +0800 Subject: [PATCH 05/22] Refactor array initializations to shorthand syntax Replaced the use of `new[] { ... }` with the shorthand array initialization syntax `[ ... ]` across various parts of the code. This includes changes in the initialization of `IEnumerable` collections, `Guid` arrays, and other array types. The changes improve code readability and consistency. --- .../AccessControlRawEventQuerySample/Program.cs | 2 +- Samples/Platform SDK/ActivityTrailsSample/Program.cs | 6 +++--- Samples/Platform SDK/AuditTrailsSample/Program.cs | 4 ++-- Samples/Platform SDK/CopyConfiguratonSample/Program.cs | 6 +++--- Samples/Platform SDK/CustomEntitySample/Program.cs | 2 +- Samples/Platform SDK/EntityCacheSample/Program.cs | 2 +- Samples/Platform SDK/EventMonitoringSample/Program.cs | 6 +++--- Samples/Platform SDK/TimeAttendanceSample/Program.cs | 2 +- .../Client/SampleCustomActionView.xaml.cs | 2 +- .../ControlsSample/Chart/ChartSampleViewModel.cs | 2 +- 10 files changed, 17 insertions(+), 17 deletions(-) diff --git a/Samples/Platform SDK/AccessControlRawEventQuerySample/Program.cs b/Samples/Platform SDK/AccessControlRawEventQuerySample/Program.cs index e6f00ab..dba9cb0 100644 --- a/Samples/Platform SDK/AccessControlRawEventQuerySample/Program.cs +++ b/Samples/Platform SDK/AccessControlRawEventQuerySample/Program.cs @@ -39,7 +39,7 @@ async Task RunSample() // Retrieve access granted events from the last 24 hours DateTime startDate = DateTime.UtcNow.AddDays(-1); DateTime endDate = DateTime.UtcNow; - IEnumerable eventTypes = new[] { EventType.AccessGranted }; + IEnumerable eventTypes = [EventType.AccessGranted]; // Retrieve access control raw events IList rawEvents = await GetAccessControlRawEvents(engine, startDate, endDate, eventTypes, accessManagers); diff --git a/Samples/Platform SDK/ActivityTrailsSample/Program.cs b/Samples/Platform SDK/ActivityTrailsSample/Program.cs index 9d61ec1..cf742f8 100644 --- a/Samples/Platform SDK/ActivityTrailsSample/Program.cs +++ b/Samples/Platform SDK/ActivityTrailsSample/Program.cs @@ -32,9 +32,9 @@ async Task RunSample() { DateTime from = DateTime.Now.AddDays(-30); DateTime to = DateTime.Now; - IEnumerable activities = new [] { ActivityType.UserLoggedOn, ActivityType.UserLogonFailed }; - IEnumerable applicationTypes = new [] { ApplicationType.Sdk }; - IEnumerable initiators = new[] { engine.LoggedUser.Guid }; + IEnumerable activities = [ActivityType.UserLoggedOn, ActivityType.UserLogonFailed]; + IEnumerable applicationTypes = [ApplicationType.Sdk]; + IEnumerable initiators = [engine.LoggedUser.Guid]; int maximumResultCount = 500; ICollection activityTrails = await GetActivityTrails(engine, from, to, activities, applicationTypes, initiators, maximumResultCount); diff --git a/Samples/Platform SDK/AuditTrailsSample/Program.cs b/Samples/Platform SDK/AuditTrailsSample/Program.cs index 2a2fd6d..9fc0bb8 100644 --- a/Samples/Platform SDK/AuditTrailsSample/Program.cs +++ b/Samples/Platform SDK/AuditTrailsSample/Program.cs @@ -32,8 +32,8 @@ async Task RunSample() { DateTime from = DateTime.Now.AddDays(-30); DateTime to = DateTime.Now; - IEnumerable applicationTypes = new[] { ApplicationType.Sdk }; - IEnumerable users = new[] { engine.LoggedUser.Guid }; + IEnumerable applicationTypes = [ApplicationType.Sdk]; + IEnumerable users = [engine.LoggedUser.Guid]; int maximumResultCount = 500; ICollection auditTrails = await GetAuditTrails(engine, from, to, applicationTypes, users, maximumResultCount); diff --git a/Samples/Platform SDK/CopyConfiguratonSample/Program.cs b/Samples/Platform SDK/CopyConfiguratonSample/Program.cs index bf00bc9..9ad4370 100644 --- a/Samples/Platform SDK/CopyConfiguratonSample/Program.cs +++ b/Samples/Platform SDK/CopyConfiguratonSample/Program.cs @@ -35,15 +35,15 @@ async Task RunSample() // TODO: Define any options required for the copy operation. // This array should contain the specific options you need for your copy configuration. - CopyConfigOption[] options = { + CopyConfigOption[] options = [ // Add your CopyConfigOption values here - }; + ]; var progress = new Progress(percent => Console.WriteLine($"Progress: {percent}%")); try { - CopyConfigResultEventArgs result = await engine.EntityManager.CopyConfigurationAsync(source, new[] { destination }, progress, options); + CopyConfigResultEventArgs result = await engine.EntityManager.CopyConfigurationAsync(source, [destination], progress, options); DisplayResult(result); } catch (Exception ex) diff --git a/Samples/Platform SDK/CustomEntitySample/Program.cs b/Samples/Platform SDK/CustomEntitySample/Program.cs index 85a3f96..1dd0f4c 100644 --- a/Samples/Platform SDK/CustomEntitySample/Program.cs +++ b/Samples/Platform SDK/CustomEntitySample/Program.cs @@ -100,7 +100,7 @@ void CreateOrUpdateCustomEntityType(SystemConfiguration config) SmallIcon = Icon.SmallIcon, LargeIcon = Icon.LargeIcon, SingleInstance = false, - HierarchicalChildTypes = new[] { EntityType.Camera } + HierarchicalChildTypes = [EntityType.Camera] }; config.AddOrUpdateCustomEntityType(descriptor); diff --git a/Samples/Platform SDK/EntityCacheSample/Program.cs b/Samples/Platform SDK/EntityCacheSample/Program.cs index 50985a9..4a7a75b 100644 --- a/Samples/Platform SDK/EntityCacheSample/Program.cs +++ b/Samples/Platform SDK/EntityCacheSample/Program.cs @@ -105,7 +105,7 @@ void PrintEntityCache(Engine engine) int totalEntities = 0; - foreach (var entityType in Enum.GetValues(typeof(EntityType)).OfType().Except(new[] { EntityType.None, EntityType.ReportTemplate }).OrderBy(type => type.ToString())) + foreach (var entityType in Enum.GetValues(typeof(EntityType)).OfType().Except([EntityType.None, EntityType.ReportTemplate]).OrderBy(type => type.ToString())) { int count = engine.GetEntities(entityType).Count; totalEntities += count; diff --git a/Samples/Platform SDK/EventMonitoringSample/Program.cs b/Samples/Platform SDK/EventMonitoringSample/Program.cs index fe5bd72..2d22ec2 100644 --- a/Samples/Platform SDK/EventMonitoringSample/Program.cs +++ b/Samples/Platform SDK/EventMonitoringSample/Program.cs @@ -25,14 +25,14 @@ static async Task Main() using var engine = new Engine(); - engine.SetEventFilter(new[] - { + engine.SetEventFilter( + [ EventType.UnitConnected, EventType.UnitDisconnected, EventType.InterfaceOnline, EventType.InterfaceOffline, EventType.EntityWarning - }); + ]); engine.EventReceived += (sender, e) => { diff --git a/Samples/Platform SDK/TimeAttendanceSample/Program.cs b/Samples/Platform SDK/TimeAttendanceSample/Program.cs index 388ef6d..4381be2 100644 --- a/Samples/Platform SDK/TimeAttendanceSample/Program.cs +++ b/Samples/Platform SDK/TimeAttendanceSample/Program.cs @@ -32,7 +32,7 @@ async Task RunSample() { // TOTO: Replace the following GUIDs with the actual GUIDs of the area and cardholder you want to query. Guid areaGuid = new Guid("ENTER_AREA_GUID_HERE"); - Guid[] cardholderGuids = { new("ENTER_CARDHOLDER_GUID_HERE") }; + Guid[] cardholderGuids = [new("ENTER_CARDHOLDER_GUID_HERE")]; TimeSpan startOfDay = TimeSpan.FromHours(9); // Start of day: 09:00 AM DateTime from = DateTime.Now.AddDays(-1); // Past day DateTime to = DateTime.Now; diff --git a/Samples/Plugin SDK/CustomActionSample/Client/SampleCustomActionView.xaml.cs b/Samples/Plugin SDK/CustomActionSample/Client/SampleCustomActionView.xaml.cs index a434d1c..28b1099 100644 --- a/Samples/Plugin SDK/CustomActionSample/Client/SampleCustomActionView.xaml.cs +++ b/Samples/Plugin SDK/CustomActionSample/Client/SampleCustomActionView.xaml.cs @@ -37,7 +37,7 @@ public SampleCustomActionView() SelectCameraCommand = new DelegateCommand(() => { // Federated cameras are not supported for this action. - List cameras = Workspace.Services.Get().ShowEntityBrowserDialog(new EntityTypeCollection(new[] { EntityType.Camera }), null, false, SelectionMode.Single); + List cameras = Workspace.Services.Get().ShowEntityBrowserDialog(new EntityTypeCollection([EntityType.Camera]), null, false, SelectionMode.Single); Camera = Workspace.Sdk.GetEntity(cameras.FirstOrDefault()) as Camera; }); diff --git a/Samples/Workspace SDK/ControlsSample/Chart/ChartSampleViewModel.cs b/Samples/Workspace SDK/ControlsSample/Chart/ChartSampleViewModel.cs index a686a34..fa61b2f 100644 --- a/Samples/Workspace SDK/ControlsSample/Chart/ChartSampleViewModel.cs +++ b/Samples/Workspace SDK/ControlsSample/Chart/ChartSampleViewModel.cs @@ -17,7 +17,7 @@ namespace Genetec.Dap.CodeSamples; public class ChartSampleViewModel : BindableBase { private readonly Dictionary m_chartData; - private readonly string[] m_labels = { "Label 1", "Label 2", "Label 3" }; + private readonly string[] m_labels = ["Label 1", "Label 2", "Label 3"]; private Chart m_chart; private bool m_disableAnimations; private bool m_performanceMode; From 5c5f8bb6a01adebe9735eaaa93b76171102cd545 Mon Sep 17 00:00:00 2001 From: Andre Lafleur Date: Fri, 20 Sep 2024 23:10:55 +0800 Subject: [PATCH 06/22] Refactor property initializations to use array syntax Changed the initialization of `List` and `ObservableCollection` properties from using the `new` keyword with constructors to using array initializer syntax `[]` across multiple classes and files. - **Program.cs**: - `AlarmInstance` class: Updated `AttachedEntities` and `DynamicUrls` properties. - `Program` class: Updated `References` property. - **BasicPluginDescriptor.cs**: - `BasicPluginDescriptor` class: Updated `ApplicationId` property. - **SampleCustomActionView.xaml.cs**: - `SampleCustomActionView` class: Updated `EncoderCommands` property. - **SamplePluginDescriptor.cs**: - `SamplePluginDescriptor` class: Updated `ApplicationId` property. - **CustomReportFilter.xaml.cs**: - `CustomReportFilter` class: Updated `CustomEvents` property. - **CustomReportPage.cs**: - `CustomReportPage` class: Updated `Fields` and `EntityTypes` properties. - **SamplePlugin.cs**: - `SamplePlugin` class: Updated `SupportedQueries` and `SupportedCustomReports` properties. - **VCard.cs**: - `VCard` class: Updated `Emails` property. --- .../AlarmActivityQuerySample/Program.cs | 4 ++-- .../IncidentManagerSample/Program.cs | 2 +- .../BasicPluginDescriptor.cs | 8 ++++---- .../Client/SampleCustomActionView.xaml.cs | 2 +- .../Server/SamplePluginDescriptor.cs | 8 ++++---- .../Client/CustomReportFilter.xaml.cs | 2 +- .../Client/CustomReportPage.cs | 20 +++++++++++++------ .../CustomReportSample/Server/SamplePlugin.cs | 8 ++++---- .../Server/SamplePluginDescriptor.cs | 6 +----- .../Server/SamplePluginDescriptor.cs | 8 ++++---- .../CardholderFieldsExtractorSample/VCard.cs | 2 +- .../ImageExtractorSample/VCard.cs | 2 +- 12 files changed, 38 insertions(+), 34 deletions(-) diff --git a/Samples/Platform SDK/AlarmActivityQuerySample/Program.cs b/Samples/Platform SDK/AlarmActivityQuerySample/Program.cs index 82b78dc..ae5f16a 100644 --- a/Samples/Platform SDK/AlarmActivityQuerySample/Program.cs +++ b/Samples/Platform SDK/AlarmActivityQuerySample/Program.cs @@ -182,6 +182,6 @@ class AlarmInstance public bool HasSourceCondition { get; set; } public byte Priority { get; set; } public string DynamicContext { get; set; } - public List AttachedEntities { get; set; } = new(); - public List DynamicUrls { get; set; } = new(); + public List AttachedEntities { get; set; } = []; + public List DynamicUrls { get; set; } = []; } \ No newline at end of file diff --git a/Samples/Platform SDK/IncidentManagerSample/Program.cs b/Samples/Platform SDK/IncidentManagerSample/Program.cs index 5cdb240..afa696f 100644 --- a/Samples/Platform SDK/IncidentManagerSample/Program.cs +++ b/Samples/Platform SDK/IncidentManagerSample/Program.cs @@ -114,7 +114,7 @@ static async Task Main() Timestamp = row.Field(IncidentSdkQuery.IncidentTimestamp), Event = row.Field(IncidentSdkQuery.EventTypeColumnName), LastModifiedBy = row.Field(IncidentSdkQuery.ModifiedByColumnName), - References = string.IsNullOrEmpty(row.Field(IncidentSdkQuery.GuidReferenceColumnName)) ? new Collection() : new Collection(row.Field(IncidentSdkQuery.GuidReferenceColumnName).Split(',').Select(Guid.Parse).ToList()) + References = string.IsNullOrEmpty(row.Field(IncidentSdkQuery.GuidReferenceColumnName)) ? [] : new Collection(row.Field(IncidentSdkQuery.GuidReferenceColumnName).Split(',').Select(Guid.Parse).ToList()) }; } diff --git a/Samples/Plugin SDK/BasicPluginTemplate/BasicPluginDescriptor.cs b/Samples/Plugin SDK/BasicPluginTemplate/BasicPluginDescriptor.cs index 66178ef..2de3596 100644 --- a/Samples/Plugin SDK/BasicPluginTemplate/BasicPluginDescriptor.cs +++ b/Samples/Plugin SDK/BasicPluginTemplate/BasicPluginDescriptor.cs @@ -24,9 +24,9 @@ public class BasicPluginDescriptor : PluginDescriptor public override bool IsSingleInstance => true; - public override List ApplicationId => new List - { - "KxsD11z743Hf5Gq9mv3+5ekxzemlCiUXkTFY5ba1NOGcLCmGstt2n0zYE9NsNimv", // Allow the plugin to run on a demo system + public override List ApplicationId => + [ + "KxsD11z743Hf5Gq9mv3+5ekxzemlCiUXkTFY5ba1NOGcLCmGstt2n0zYE9NsNimv" // Allow the plugin to run on a demo system //TODO: Add your SDK certificate application ID - }; + ]; } \ No newline at end of file diff --git a/Samples/Plugin SDK/CustomActionSample/Client/SampleCustomActionView.xaml.cs b/Samples/Plugin SDK/CustomActionSample/Client/SampleCustomActionView.xaml.cs index 28b1099..e1998d4 100644 --- a/Samples/Plugin SDK/CustomActionSample/Client/SampleCustomActionView.xaml.cs +++ b/Samples/Plugin SDK/CustomActionSample/Client/SampleCustomActionView.xaml.cs @@ -43,7 +43,7 @@ public SampleCustomActionView() }); } - public ObservableCollection EncoderCommands { get; } = new(); + public ObservableCollection EncoderCommands { get; } = []; public override bool IsStateValid => Camera is not null && EncoderCommand is not null; diff --git a/Samples/Plugin SDK/CustomActionSample/Server/SamplePluginDescriptor.cs b/Samples/Plugin SDK/CustomActionSample/Server/SamplePluginDescriptor.cs index f667474..4d805a9 100644 --- a/Samples/Plugin SDK/CustomActionSample/Server/SamplePluginDescriptor.cs +++ b/Samples/Plugin SDK/CustomActionSample/Server/SamplePluginDescriptor.cs @@ -24,9 +24,9 @@ public class SamplePluginDescriptor : PluginDescriptor public override bool IsSingleInstance => true; - public override List ApplicationId => new() - { - "KxsD11z743Hf5Gq9mv3+5ekxzemlCiUXkTFY5ba1NOGcLCmGstt2n0zYE9NsNimv", // Allow the plugin to run on a demo system + public override List ApplicationId => + [ + "KxsD11z743Hf5Gq9mv3+5ekxzemlCiUXkTFY5ba1NOGcLCmGstt2n0zYE9NsNimv" // Allow the plugin to run on a demo system //TODO: Add your SDK certificate application ID - }; + ]; } \ No newline at end of file diff --git a/Samples/Plugin SDK/CustomReportSample/Client/CustomReportFilter.xaml.cs b/Samples/Plugin SDK/CustomReportSample/Client/CustomReportFilter.xaml.cs index 22a9c5e..9d2e725 100644 --- a/Samples/Plugin SDK/CustomReportSample/Client/CustomReportFilter.xaml.cs +++ b/Samples/Plugin SDK/CustomReportSample/Client/CustomReportFilter.xaml.cs @@ -127,7 +127,7 @@ protected override string FilterData } } - public ObservableCollection CustomEvents { get; } = new(); + public ObservableCollection CustomEvents { get; } = []; public event PropertyChangedEventHandler PropertyChanged; diff --git a/Samples/Plugin SDK/CustomReportSample/Client/CustomReportPage.cs b/Samples/Plugin SDK/CustomReportSample/Client/CustomReportPage.cs index 503e1ce..3b8eb39 100644 --- a/Samples/Plugin SDK/CustomReportSample/Client/CustomReportPage.cs +++ b/Samples/Plugin SDK/CustomReportSample/Client/CustomReportPage.cs @@ -16,8 +16,8 @@ public class CustomReportPage : ReportPage { private readonly CustomReportFilter m_customReportFilter = new(); - public override List Fields { get; } = new() - { + public override List Fields { get; } = + [ new ReportField { Type = ReportFieldType.Entity, Name = CustomReportColumnName.SourceId, DisplayName = "Source", IsSource = true }, new ReportField { Type = ReportFieldType.DateTime, Name = CustomReportColumnName.EventTimestamp, DisplayName = "Timestamp", IsSource = true }, new ReportField { Type = ReportFieldType.Event, Name = CustomReportColumnName.EventId, DisplayName = "Event" }, @@ -26,9 +26,17 @@ public class CustomReportPage : ReportPage new ReportField { Type = ReportFieldType.Boolean, Name = CustomReportColumnName.Boolean, DisplayName = "Boolean" }, new ReportField { Type = ReportFieldType.Decimal, Name = CustomReportColumnName.Decimal, DisplayName = "Decimal" }, new ReportField { Type = ReportFieldType.TimeSpan, Name = CustomReportColumnName.Duration, DisplayName = "Duration" }, - new ReportField { Type = ReportFieldType.Image, Name = CustomReportColumnName.Picture, DisplayName = "Picture", ImageMaxHeight=256, ImageMaxWidth=256, InitialWidth=128 }, - new ReportField { Type = ReportFieldType.Text, Name = CustomReportColumnName.Hidden, IsVisible = false } // Hidden field - }; + new ReportField + { + Type = ReportFieldType.Image, + Name = CustomReportColumnName.Picture, + DisplayName = "Picture", + ImageMaxHeight = 256, + ImageMaxWidth = 256, + InitialWidth = 128 + }, + new ReportField { Type = ReportFieldType.Text, Name = CustomReportColumnName.Hidden, IsVisible = false } + ]; // Show the tiles public override bool SupportsTiles => true; @@ -42,5 +50,5 @@ public class CustomReportPage : ReportPage protected override bool DisplayEntityFilter => true; // Entity types that can be selected in the entity filter - protected override List EntityTypes { get; } = new() { EntityType.Cardholder }; + protected override List EntityTypes { get; } = [EntityType.Cardholder]; } \ No newline at end of file diff --git a/Samples/Plugin SDK/CustomReportSample/Server/SamplePlugin.cs b/Samples/Plugin SDK/CustomReportSample/Server/SamplePlugin.cs index 6ad33ad..1c2dc76 100644 --- a/Samples/Plugin SDK/CustomReportSample/Server/SamplePlugin.cs +++ b/Samples/Plugin SDK/CustomReportSample/Server/SamplePlugin.cs @@ -32,8 +32,8 @@ public class SamplePlugin : Plugin private readonly Dictionary m_reportHandlers = new(); // Returns the supported queries for this plugin. - public sealed override List SupportedQueries => new() - { + public sealed override List SupportedQueries => + [ ReportQueryType.ActivityTrails, ReportQueryType.AuditTrails, ReportQueryType.CardholderActivity, @@ -50,10 +50,10 @@ public class SamplePlugin : Plugin ReportQueryType.HealthEvent, ReportQueryType.HealthStatistics, ReportQueryType.Custom - }; + ]; // Returns the supported custom reports for this plugin. - public override List SupportedCustomReports => new() { CustomReportId.Value }; + public override List SupportedCustomReports => [CustomReportId.Value]; protected override void Dispose(bool disposing) { diff --git a/Samples/Plugin SDK/CustomReportSample/Server/SamplePluginDescriptor.cs b/Samples/Plugin SDK/CustomReportSample/Server/SamplePluginDescriptor.cs index 57f9850..121ace9 100644 --- a/Samples/Plugin SDK/CustomReportSample/Server/SamplePluginDescriptor.cs +++ b/Samples/Plugin SDK/CustomReportSample/Server/SamplePluginDescriptor.cs @@ -27,9 +27,5 @@ public class SamplePluginDescriptor : PluginDescriptor public override bool IsSingleInstance => false; - public override List ApplicationId => new() - { - "KxsD11z743Hf5Gq9mv3+5ekxzemlCiUXkTFY5ba1NOGcLCmGstt2n0zYE9NsNimv" // Allow the plugin to run on a development system - //TODO: Add your production SDK certificate application ID - }; + public override List ApplicationId => ["KxsD11z743Hf5Gq9mv3+5ekxzemlCiUXkTFY5ba1NOGcLCmGstt2n0zYE9NsNimv"]; } \ No newline at end of file diff --git a/Samples/Plugin SDK/PluginConfigurationSample/Server/SamplePluginDescriptor.cs b/Samples/Plugin SDK/PluginConfigurationSample/Server/SamplePluginDescriptor.cs index e38f816..0f415fc 100644 --- a/Samples/Plugin SDK/PluginConfigurationSample/Server/SamplePluginDescriptor.cs +++ b/Samples/Plugin SDK/PluginConfigurationSample/Server/SamplePluginDescriptor.cs @@ -24,9 +24,9 @@ public class SamplePluginDescriptor : PluginDescriptor public override bool IsSingleInstance => true; - public override List ApplicationId => new() - { - "KxsD11z743Hf5Gq9mv3+5ekxzemlCiUXkTFY5ba1NOGcLCmGstt2n0zYE9NsNimv", // Allow the plugin to run on a demo system + public override List ApplicationId => + [ + "KxsD11z743Hf5Gq9mv3+5ekxzemlCiUXkTFY5ba1NOGcLCmGstt2n0zYE9NsNimv" // Allow the plugin to run on a demo system //TODO: Add your SDK certificate application ID - }; + ]; } \ No newline at end of file diff --git a/Samples/Workspace SDK/CardholderFieldsExtractorSample/VCard.cs b/Samples/Workspace SDK/CardholderFieldsExtractorSample/VCard.cs index 522d168..43cf3ea 100644 --- a/Samples/Workspace SDK/CardholderFieldsExtractorSample/VCard.cs +++ b/Samples/Workspace SDK/CardholderFieldsExtractorSample/VCard.cs @@ -16,7 +16,7 @@ public class VCard public string LastName { get; set; } - public List Emails { get; } = new List(); + public List Emails { get; } = []; public string Note { get; set; } diff --git a/Samples/Workspace SDK/ImageExtractorSample/VCard.cs b/Samples/Workspace SDK/ImageExtractorSample/VCard.cs index 522d168..43cf3ea 100644 --- a/Samples/Workspace SDK/ImageExtractorSample/VCard.cs +++ b/Samples/Workspace SDK/ImageExtractorSample/VCard.cs @@ -16,7 +16,7 @@ public class VCard public string LastName { get; set; } - public List Emails { get; } = new List(); + public List Emails { get; } = []; public string Note { get; set; } From ec2baea6b3718300032466ce95b24c0d148ce02f Mon Sep 17 00:00:00 2001 From: Andre Lafleur Date: Fri, 20 Sep 2024 23:14:43 +0800 Subject: [PATCH 07/22] Improve string handling in video sequence and XML display Modified the `QueryAndDisplayVideoSequence` method to use a verbatim string literal for the `TimeSpan` format string, ensuring proper escaping of backslashes. Updated the `class Program` to construct XML content using a multi-line string literal, enhancing readability and maintainability by eliminating string concatenation. --- .../PlaybackSequenceQuerierSample/Program.cs | 2 +- .../Platform SDK/DisplayInTileSample/Program.cs | 14 ++++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/Samples/Media SDK/PlaybackSequenceQuerierSample/Program.cs b/Samples/Media SDK/PlaybackSequenceQuerierSample/Program.cs index 5745c42..95c5575 100644 --- a/Samples/Media SDK/PlaybackSequenceQuerierSample/Program.cs +++ b/Samples/Media SDK/PlaybackSequenceQuerierSample/Program.cs @@ -75,7 +75,7 @@ async Task QueryAndDisplayVideoSequence(Camera camera) foreach (PlaybackSequence sequence in sequences) { TimeSpan duration = sequence.Range.EndTime - sequence.Range.StartTime; - Console.WriteLine($" {sequence.Range.StartTime:yyyy-MM-dd HH:mm:ss} to {sequence.Range.EndTime:yyyy-MM-dd HH:mm:ss} (Duration: {duration:hh\\:mm\\:ss})"); + Console.WriteLine($@" {sequence.Range.StartTime:yyyy-MM-dd HH:mm:ss} to {sequence.Range.EndTime:yyyy-MM-dd HH:mm:ss} (Duration: {duration:hh\:mm\:ss})"); } } else diff --git a/Samples/Platform SDK/DisplayInTileSample/Program.cs b/Samples/Platform SDK/DisplayInTileSample/Program.cs index 0dc800e..d176f8b 100644 --- a/Samples/Platform SDK/DisplayInTileSample/Program.cs +++ b/Samples/Platform SDK/DisplayInTileSample/Program.cs @@ -81,12 +81,14 @@ void DisplayCameraInTiles() foreach (var monitor in monitors) { - string xmlContent = $@" - - - - -"; + string xmlContent = $""" + + + + + + + """; Console.WriteLine($"Displaying camera on monitor ID: {monitor}"); engine.ActionManager.DisplayInTile(monitor, xmlContent); From 246e024a671b4f57b3c031078cee00841286151b Mon Sep 17 00:00:00 2001 From: Andre Lafleur Date: Fri, 20 Sep 2024 23:18:51 +0800 Subject: [PATCH 08/22] Use explicit type declarations for clarity and safety Replaced `var` with explicit type declarations in `foreach` loops and variable assignments to enhance code readability, type safety, and maintainability. Added missing `using` directives for `System.Collections.Generic` and `System.Drawing` namespaces to ensure all necessary types are available. Ensured consistent use of explicit type declarations across various methods and classes. --- Samples/Media SDK/MediaFileSample/Program.cs | 4 ++-- Samples/Media SDK/OverlaySample/Program.cs | 4 ++-- .../Media SDK/OverlaySample/TimecodeOverlay.cs | 2 +- Samples/Media SDK/VideoExportSample/Program.cs | 2 +- .../Media SDK/VideoSourceFilterSample/Program.cs | 5 +++-- .../AccessEventMonitoringSample/Program.cs | 4 ++-- .../Platform SDK/AccessVerifierSample/Program.cs | 12 ++++++------ .../AlarmActivityQuerySample/Program.cs | 6 +++--- .../Platform SDK/CustomEntitySample/Program.cs | 12 ++++++------ Samples/Platform SDK/CustomEventSample/Program.cs | 4 ++-- .../Platform SDK/DisplayInTileSample/Program.cs | 7 ++++--- Samples/Platform SDK/EntityCacheSample/Program.cs | 2 +- .../EntityCertificatesManagerSample/Program.cs | 2 +- .../Platform SDK/IncidentManagerSample/Program.cs | 4 ++-- .../Platform SDK/LicenseManagerSample/Program.cs | 2 +- Samples/Platform SDK/MacroSample/Program.cs | 6 +++--- .../Platform SDK/PeopleCountingSample/Program.cs | 2 +- .../Platform SDK/SecurityManagerSample/Program.cs | 15 ++++++++------- .../UnusedCredentialQuerySample/Program.cs | 6 +++--- Samples/Platform SDK/UserTaskSample/Program.cs | 8 ++++---- Samples/Platform SDK/VideoUnitSample/Program.cs | 6 +++--- .../ReportHandlers/Custom/CustomReportHandler.cs | 2 +- .../RoleConfiguration.cs | 2 +- Samples/Shared/CollectionExtensions.cs | 2 +- Samples/Shared/SdkResolver.cs | 6 +++--- .../SampleCardholderCredentialReader.cs | 4 ++-- .../ConfigPageSample/SampleModule.cs | 10 +++++----- .../SampleCredentialReader.cs | 4 ++-- .../AggregateReportExporter.cs | 4 ++-- .../ReportExporterSample/HtmlReportExporter.cs | 2 +- .../AlarmTimelineProvider.cs | 2 +- 31 files changed, 78 insertions(+), 75 deletions(-) diff --git a/Samples/Media SDK/MediaFileSample/Program.cs b/Samples/Media SDK/MediaFileSample/Program.cs index a7f8cdc..4c6ffc4 100644 --- a/Samples/Media SDK/MediaFileSample/Program.cs +++ b/Samples/Media SDK/MediaFileSample/Program.cs @@ -24,7 +24,7 @@ void RunSample() Console.WriteLine($"\nMedia file path: {mediaFile}"); Console.WriteLine("\nUnique Sources:"); - foreach (var source in mediaFile.UniqueSources) + foreach (UniqueSource source in mediaFile.UniqueSources) { Console.WriteLine($"Collection: {source.Collection} ({source.CollectionName})"); Console.WriteLine($"Encoder: {source.Encoder} ({source.EncoderName})"); @@ -36,7 +36,7 @@ void RunSample() } Console.WriteLine("Contained Files:"); - foreach (var file in mediaFile.ContainedFiles) + foreach (MediaFile.ContainedFile file in mediaFile.ContainedFiles) { Console.WriteLine($"Filename: {file.Filename}"); Console.WriteLine($"Start Time: {file.StartTime}"); diff --git a/Samples/Media SDK/OverlaySample/Program.cs b/Samples/Media SDK/OverlaySample/Program.cs index 976b70c..2e58e1d 100644 --- a/Samples/Media SDK/OverlaySample/Program.cs +++ b/Samples/Media SDK/OverlaySample/Program.cs @@ -69,9 +69,9 @@ async Task FindSupportedCamera() QueryCompletedEventArgs args; do { - var result = args = await Task.Factory.FromAsync(query.BeginQuery, query.EndQuery, null); + QueryCompletedEventArgs result = args = await Task.Factory.FromAsync(query.BeginQuery, query.EndQuery, null); - var camera = result.Data.AsEnumerable().Take(query.PageSize) + Camera camera = result.Data.AsEnumerable().Take(query.PageSize) .Select(row => engine.GetEntity(row.Field(nameof(Guid)))) .OfType() .FirstOrDefault(camera => camera.IsOverlaySupported && camera.RunningState == State.Running); diff --git a/Samples/Media SDK/OverlaySample/TimecodeOverlay.cs b/Samples/Media SDK/OverlaySample/TimecodeOverlay.cs index 2ea38b6..024d8ca 100644 --- a/Samples/Media SDK/OverlaySample/TimecodeOverlay.cs +++ b/Samples/Media SDK/OverlaySample/TimecodeOverlay.cs @@ -36,7 +36,7 @@ public void Start() return; m_cancellationTokenSource = new CancellationTokenSource(); - var token = m_cancellationTokenSource.Token; + CancellationToken token = m_cancellationTokenSource.Token; m_task = Task.Run(async () => { diff --git a/Samples/Media SDK/VideoExportSample/Program.cs b/Samples/Media SDK/VideoExportSample/Program.cs index e0016de..a905697 100644 --- a/Samples/Media SDK/VideoExportSample/Program.cs +++ b/Samples/Media SDK/VideoExportSample/Program.cs @@ -37,7 +37,7 @@ static async Task Main() try { var progress = new Progress(percent => Console.WriteLine($"Export progress: {percent}")); - var exportedFile = await Export(engine, entity, DateTime.UtcNow.AddMinutes(-5), DateTime.UtcNow, "Export", progress); + string exportedFile = await Export(engine, entity, DateTime.UtcNow.AddMinutes(-5), DateTime.UtcNow, "Export", progress); Console.WriteLine($"Video file exported: {exportedFile}"); } catch (Exception ex) diff --git a/Samples/Media SDK/VideoSourceFilterSample/Program.cs b/Samples/Media SDK/VideoSourceFilterSample/Program.cs index 530ebba..f21546b 100644 --- a/Samples/Media SDK/VideoSourceFilterSample/Program.cs +++ b/Samples/Media SDK/VideoSourceFilterSample/Program.cs @@ -8,6 +8,7 @@ namespace Genetec.Dap.CodeSamples; using System; +using System.Drawing; using System.Drawing.Imaging; using System.IO; using System.Threading.Tasks; @@ -80,11 +81,11 @@ void OnFrameDecoded(object sender, FrameDecodedEventArgs args) { using (args) { - using var decodedFrame = args.DecodedFrameContent?.GetBitmap(); + using RgbDecodedFrame decodedFrame = args.DecodedFrameContent?.GetBitmap(); if (decodedFrame is null) return; - using var bitmap = decodedFrame.Bitmap; + using Bitmap bitmap = decodedFrame.Bitmap; using var memoryStream = new MemoryStream(); try diff --git a/Samples/Platform SDK/AccessEventMonitoringSample/Program.cs b/Samples/Platform SDK/AccessEventMonitoringSample/Program.cs index 7bd3027..3c050a1 100644 --- a/Samples/Platform SDK/AccessEventMonitoringSample/Program.cs +++ b/Samples/Platform SDK/AccessEventMonitoringSample/Program.cs @@ -61,7 +61,7 @@ IEnumerable GetCredentialFormats(AccessEvent accessEvent) IEnumerable formats = accessEvent.Credentials.Select(engine.GetEntity).OfType().Select(credential => credential.Format); - foreach (var format in formats) + foreach (CredentialFormat format in formats) { yield return format; } @@ -74,7 +74,7 @@ void OnEventReceived(object sender, EventReceivedEventArgs e) if (engine.GetEntity(accessEvent.AccessPoint) is AccessPoint accessPoint && engine.GetEntity(accessPoint.Device) is Device device) { var accessPointGroup = (AccessPointGroup)engine.GetEntity(accessPoint.AccessPointGroup); - var cardholder = engine.GetEntity(accessEvent.Cardholder); + Entity cardholder = engine.GetEntity(accessEvent.Cardholder); foreach (CredentialFormat format in GetCredentialFormats(accessEvent)) { diff --git a/Samples/Platform SDK/AccessVerifierSample/Program.cs b/Samples/Platform SDK/AccessVerifierSample/Program.cs index f0c7453..9e15e17 100644 --- a/Samples/Platform SDK/AccessVerifierSample/Program.cs +++ b/Samples/Platform SDK/AccessVerifierSample/Program.cs @@ -81,24 +81,24 @@ static async Task PrefetchEntities(IEngine engine) static void GenerateAccessMatrixCsv(IEngine engine, ICollection<(AccessPoint AccessPoint, Credential Credential, AccessResult Result)> accessResults, TextWriter textWriter) { - var accessPoints = accessResults.Select(tuple => tuple.AccessPoint).Distinct().ToList(); + List accessPoints = accessResults.Select(tuple => tuple.AccessPoint).Distinct().ToList(); - var resultLookup = accessResults.ToDictionary(tuple => (tuple.AccessPoint, tuple.Credential), tuple => tuple.Result); + Dictionary<(AccessPoint AccessPoint, Credential Credential), AccessResult> resultLookup = accessResults.ToDictionary(tuple => (tuple.AccessPoint, tuple.Credential), tuple => tuple.Result); textWriter.Write("Credential"); - foreach (var accessPoint in accessPoints) + foreach (AccessPoint accessPoint in accessPoints) { textWriter.Write($",{engine.GetEntity(accessPoint.AccessPointGroup).Name} ({accessPoint.Name})"); } textWriter.WriteLine(); - foreach (var credential in accessResults.Select(tuple => tuple.Credential).Distinct()) + foreach (Credential credential in accessResults.Select(tuple => tuple.Credential).Distinct()) { textWriter.Write(credential.Name); - foreach (var accessPoint in accessPoints) + foreach (AccessPoint accessPoint in accessPoints) { - textWriter.Write(resultLookup.TryGetValue((accessPoint, credential), out var result) ? $",{result}" : ","); + textWriter.Write(resultLookup.TryGetValue((accessPoint, credential), out AccessResult result) ? $",{result}" : ","); } textWriter.WriteLine(); diff --git a/Samples/Platform SDK/AlarmActivityQuerySample/Program.cs b/Samples/Platform SDK/AlarmActivityQuerySample/Program.cs index ae5f16a..4949055 100644 --- a/Samples/Platform SDK/AlarmActivityQuerySample/Program.cs +++ b/Samples/Platform SDK/AlarmActivityQuerySample/Program.cs @@ -35,8 +35,8 @@ async Task RunSample() Guid? specificAlarmId = null; // Set to a specific Guid if you want to filter by alarm ID int? specificInstanceId = null; // Set to a specific instance ID if you want to filter by it var alarmStates = new[] { AlarmState.Active, AlarmState.AknowledgeRequired }; // Filter by these active and acknowledge required states - var startTime = DateTime.Now.AddDays(-7); // Filter by alarms triggered in the last 7 days - var endTime = DateTime.Now; + DateTime startTime = DateTime.Now.AddDays(-7); // Filter by alarms triggered in the last 7 days + DateTime endTime = DateTime.Now; ICollection alarmInstances = await GetAlarmInstances( engine, @@ -63,7 +63,7 @@ void DisplayAlarmInstances(Engine engine, ICollection alarmInstan Console.WriteLine($"Total Alarm Instances: {alarmInstances.Count}"); Console.WriteLine(); - foreach (var alarm in alarmInstances) + foreach (AlarmInstance alarm in alarmInstances) { DisplayToConsole(alarm); Console.WriteLine(); diff --git a/Samples/Platform SDK/CustomEntitySample/Program.cs b/Samples/Platform SDK/CustomEntitySample/Program.cs index 1dd0f4c..88fed94 100644 --- a/Samples/Platform SDK/CustomEntitySample/Program.cs +++ b/Samples/Platform SDK/CustomEntitySample/Program.cs @@ -88,10 +88,10 @@ void CreateOrUpdateCustomEntityType(SystemConfiguration config) Console.WriteLine($"Creating new Custom Entity Type with ID: {customEntityId}"); - var capabilities = CustomEntityTypeCapabilities.CanBeFederated | - CustomEntityTypeCapabilities.IsVisible | - CustomEntityTypeCapabilities.CreateDelete | - CustomEntityTypeCapabilities.MapSupport; + CustomEntityTypeCapabilities capabilities = CustomEntityTypeCapabilities.CanBeFederated | + CustomEntityTypeCapabilities.IsVisible | + CustomEntityTypeCapabilities.CreateDelete | + CustomEntityTypeCapabilities.MapSupport; var descriptor = new CustomEntityTypeDescriptor(id, Resources.CustomEntityName, capabilities, new Version(1, 0)) { @@ -113,7 +113,7 @@ async Task CreateCustomEntity(Engine engine) CustomEntity customEntity = await engine.TransactionManager.ExecuteTransactionAsync(() => { - var entity = engine.CreateCustomEntity("Custom entity", new Guid(customEntityId)); + CustomEntity entity = engine.CreateCustomEntity("Custom entity", new Guid(customEntityId)); entity.RunningState = State.Running; return entity; }); @@ -143,7 +143,7 @@ async Task DisplayCustomEntities(Engine engine) Console.WriteLine("\nCustom Entities:"); Console.WriteLine(new string('-', 30)); - foreach (var entity in entities) + foreach (CustomEntity entity in entities) { Console.WriteLine($"Name: {entity.Name}"); Console.WriteLine($"GUID: {entity.Guid}"); diff --git a/Samples/Platform SDK/CustomEventSample/Program.cs b/Samples/Platform SDK/CustomEventSample/Program.cs index a13c135..eb60d53 100644 --- a/Samples/Platform SDK/CustomEventSample/Program.cs +++ b/Samples/Platform SDK/CustomEventSample/Program.cs @@ -59,12 +59,12 @@ void DisplayCustomEvents(IReadOnlyList events) { Console.WriteLine($"Total Number of Custom Events: {events.Count}"); - foreach (var group in events.GroupBy(e => e.SourceEntityType).OrderBy(g => g.Key)) + foreach (IGrouping group in events.GroupBy(e => e.SourceEntityType).OrderBy(g => g.Key)) { Console.WriteLine($"\nSource Entity Type: {group.Key}"); Console.WriteLine(new string('-', 30)); - foreach (var customEvent in group.OrderBy(e => e.Id)) + foreach (CustomEvent customEvent in group.OrderBy(e => e.Id)) { Console.WriteLine($"Name: {customEvent.Name}"); Console.WriteLine($" ID: {customEvent.Id}"); diff --git a/Samples/Platform SDK/DisplayInTileSample/Program.cs b/Samples/Platform SDK/DisplayInTileSample/Program.cs index d176f8b..108469d 100644 --- a/Samples/Platform SDK/DisplayInTileSample/Program.cs +++ b/Samples/Platform SDK/DisplayInTileSample/Program.cs @@ -8,6 +8,7 @@ namespace Genetec.Dap.CodeSamples; using System; +using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Genetec.Sdk; @@ -59,7 +60,7 @@ void DisplayCameraInTiles() Console.WriteLine("Searching for online Security Desk applications..."); // Get all online Security Desk applications - var securityDeskApps = engine.GetEntities(EntityType.Application) + List securityDeskApps = engine.GetEntities(EntityType.Application) .OfType() .Where(app => app.ApplicationType == ApplicationType.SecurityDesk && app.IsOnline) .ToList(); @@ -69,7 +70,7 @@ void DisplayCameraInTiles() Console.WriteLine("Retrieving monitors from Security Desk applications..."); // Get all monitors from these applications - var monitors = securityDeskApps.SelectMany(app => app.Monitors) + List monitors = securityDeskApps.SelectMany(app => app.Monitors) .Select(engine.GetEntity) .OfType() .Select(monitor => monitor.MonitorId) @@ -78,7 +79,7 @@ void DisplayCameraInTiles() Console.WriteLine($"Found {monitors.Count} monitor(s)."); // Display camera on each monitor - foreach (var monitor in monitors) + foreach (int monitor in monitors) { string xmlContent = $""" diff --git a/Samples/Platform SDK/EntityCacheSample/Program.cs b/Samples/Platform SDK/EntityCacheSample/Program.cs index 4a7a75b..f914be7 100644 --- a/Samples/Platform SDK/EntityCacheSample/Program.cs +++ b/Samples/Platform SDK/EntityCacheSample/Program.cs @@ -105,7 +105,7 @@ void PrintEntityCache(Engine engine) int totalEntities = 0; - foreach (var entityType in Enum.GetValues(typeof(EntityType)).OfType().Except([EntityType.None, EntityType.ReportTemplate]).OrderBy(type => type.ToString())) + foreach (EntityType entityType in Enum.GetValues(typeof(EntityType)).OfType().Except([EntityType.None, EntityType.ReportTemplate]).OrderBy(type => type.ToString())) { int count = engine.GetEntities(entityType).Count; totalEntities += count; diff --git a/Samples/Platform SDK/EntityCertificatesManagerSample/Program.cs b/Samples/Platform SDK/EntityCertificatesManagerSample/Program.cs index d666fbe..627d6ae 100644 --- a/Samples/Platform SDK/EntityCertificatesManagerSample/Program.cs +++ b/Samples/Platform SDK/EntityCertificatesManagerSample/Program.cs @@ -85,7 +85,7 @@ public static X509Certificate2 CreateSelfSignedCertificate() request.CertificateExtensions.Add(new X509KeyUsageExtension(X509KeyUsageFlags.DataEncipherment, false)); request.CertificateExtensions.Add(new X509BasicConstraintsExtension(false, false, 0, false)); - var certificate = request.CreateSelfSigned(DateTimeOffset.Now, DateTimeOffset.Now.AddYears(1)); + X509Certificate2 certificate = request.CreateSelfSigned(DateTimeOffset.Now, DateTimeOffset.Now.AddYears(1)); byte[] certData = certificate.Export(X509ContentType.Pfx); return new X509Certificate2(certData, "", X509KeyStorageFlags.Exportable | X509KeyStorageFlags.PersistKeySet); diff --git a/Samples/Platform SDK/IncidentManagerSample/Program.cs b/Samples/Platform SDK/IncidentManagerSample/Program.cs index afa696f..2c74af9 100644 --- a/Samples/Platform SDK/IncidentManagerSample/Program.cs +++ b/Samples/Platform SDK/IncidentManagerSample/Program.cs @@ -40,7 +40,7 @@ static async Task Main() IEnumerable incidentData = args.Data.AsEnumerable().Select(CreateIncidentData); - foreach (var data in incidentData) + foreach (IncidentData data in incidentData) { PrintIncidentDetails(data); } @@ -135,7 +135,7 @@ static void PrintIncidentDetails(IncidentData data) Console.WriteLine($"Attached Data: {data.AttachedData}"); Console.WriteLine("References:"); - foreach (var reference in data.References) + foreach (Guid reference in data.References) { Console.WriteLine($"- {reference}"); } diff --git a/Samples/Platform SDK/LicenseManagerSample/Program.cs b/Samples/Platform SDK/LicenseManagerSample/Program.cs index 35ddbe8..1c86090 100644 --- a/Samples/Platform SDK/LicenseManagerSample/Program.cs +++ b/Samples/Platform SDK/LicenseManagerSample/Program.cs @@ -44,7 +44,7 @@ async Task DisplayLicenseUsageAsync() Console.WriteLine("License Usage Information:"); Dictionary usages = await engine.LicenseManager.GetEveryLicenseItemUsageAsync(); - foreach (var usage in usages) + foreach (KeyValuePair usage in usages) { Console.WriteLine($"{usage.Key,-40} {usage.Value.CurrentCount} / {usage.Value.MaximumCount}"); } diff --git a/Samples/Platform SDK/MacroSample/Program.cs b/Samples/Platform SDK/MacroSample/Program.cs index 2c50479..d087afb 100644 --- a/Samples/Platform SDK/MacroSample/Program.cs +++ b/Samples/Platform SDK/MacroSample/Program.cs @@ -66,7 +66,7 @@ async Task RunSample() void DisplayMacros(List macros) { - foreach (var macro in macros) + foreach (Macro macro in macros) { Console.WriteLine($"Macro: {macro.Name}"); Console.WriteLine($"Description: {macro.Description}"); @@ -74,7 +74,7 @@ void DisplayMacros(List macros) if (macro.DefaultParameters.Any()) { Console.WriteLine("Parameters:"); - foreach (var parameter in macro.DefaultParameters) + foreach (Macro.MacroParameter parameter in macro.DefaultParameters) { Console.WriteLine($" - Name: {parameter.Name}"); Console.WriteLine($" Type: {parameter.Type.Name}"); @@ -130,7 +130,7 @@ void ExecuteMacro(Macro macro) macro.Completed += OnMacroOnCompleted; macro.Aborted += OnMacroOnAborted; - var parameters = macro.DefaultParameters; + Macro.ReadOnlyMacroParameterCollection parameters = macro.DefaultParameters; parameters["Entity"].Value = Guid.NewGuid(); parameters["Boolean"].Value = true; parameters["Text"].Value = "ABC"; diff --git a/Samples/Platform SDK/PeopleCountingSample/Program.cs b/Samples/Platform SDK/PeopleCountingSample/Program.cs index c3b756a..3fd9733 100644 --- a/Samples/Platform SDK/PeopleCountingSample/Program.cs +++ b/Samples/Platform SDK/PeopleCountingSample/Program.cs @@ -32,7 +32,7 @@ // Retrieve areas from the entity cache IEnumerable areas = engine.GetEntities(EntityType.Area).OfType(); - foreach (var area in areas) + foreach (Area area in areas) { DisplayToConsole(area); } diff --git a/Samples/Platform SDK/SecurityManagerSample/Program.cs b/Samples/Platform SDK/SecurityManagerSample/Program.cs index d74d469..27f1223 100644 --- a/Samples/Platform SDK/SecurityManagerSample/Program.cs +++ b/Samples/Platform SDK/SecurityManagerSample/Program.cs @@ -8,6 +8,7 @@ namespace Genetec.Dap.CodeSamples; using System; +using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Genetec.Sdk; @@ -48,15 +49,15 @@ static async Task PrintUsersPrivileges(Engine engine) query.EntityTypeFilter.Add(EntityType.User); await Task.Factory.FromAsync(query.BeginQuery, query.EndQuery, null); - var definitions = engine.SecurityManager.GetPrivilegeDefinitions().ToDictionary(information => information.Id); + Dictionary definitions = engine.SecurityManager.GetPrivilegeDefinitions().ToDictionary(information => information.Id); foreach (User user in engine.GetEntities(EntityType.User).OfType()) { Console.WriteLine($"User: {user.Name}"); - foreach (var privilegeInformation in user.Privileges.Where(e => e.State == PrivilegeAccess.Granted)) + foreach (PrivilegeInformation privilegeInformation in user.Privileges.Where(e => e.State == PrivilegeAccess.Granted)) { - if (definitions.TryGetValue(privilegeInformation.PrivilegeGuid, out var definition) && definition.Type != PrivilegeType.Group) + if (definitions.TryGetValue(privilegeInformation.PrivilegeGuid, out PrivilegeDefinitionInformation definition) && definition.Type != PrivilegeType.Group) { Console.WriteLine($"{definition.Description}"); } @@ -66,9 +67,9 @@ static async Task PrintUsersPrivileges(Engine engine) static void PrintPrivileges(Engine engine) { - var definitions = engine.SecurityManager.GetPrivilegeDefinitions().ToDictionary(information => information.Id); + Dictionary definitions = engine.SecurityManager.GetPrivilegeDefinitions().ToDictionary(information => information.Id); - foreach (var privilege in definitions.Values.Where(p => p.ParentId == Guid.Empty)) + foreach (PrivilegeDefinitionInformation privilege in definitions.Values.Where(p => p.ParentId == Guid.Empty)) { PrintPrivilege(privilege, 0); } @@ -77,9 +78,9 @@ void PrintPrivilege(PrivilegeDefinitionInformation privilege, int depth) { Console.WriteLine($"{new string(' ', depth * 2)}({privilege.Type}) {privilege.Description}"); - foreach (var child in privilege.Children) + foreach (Guid child in privilege.Children) { - if (definitions.TryGetValue(child, out var value)) + if (definitions.TryGetValue(child, out PrivilegeDefinitionInformation value)) { PrintPrivilege(value, depth + 1); } diff --git a/Samples/Platform SDK/UnusedCredentialQuerySample/Program.cs b/Samples/Platform SDK/UnusedCredentialQuerySample/Program.cs index 5acb939..24fd44b 100644 --- a/Samples/Platform SDK/UnusedCredentialQuerySample/Program.cs +++ b/Samples/Platform SDK/UnusedCredentialQuerySample/Program.cs @@ -33,7 +33,7 @@ static async Task Main() if (status == ConnectionStateCode.Success) { - var credentialsToDeactivate = await FetchUnusedCredentials(TimeSpan.FromDays(30)); + List credentialsToDeactivate = await FetchUnusedCredentials(TimeSpan.FromDays(30)); Console.WriteLine($"{credentialsToDeactivate.Count} credentials have not been used in the last 30 days."); @@ -67,7 +67,7 @@ async Task DeactivateCredentials(IEnumerable credentials) { await engine.TransactionManager.ExecuteTransactionAsync(() => { - foreach (var credential in credentials.Where(credential => credential.Status.State == CredentialState.Active)) + foreach (Credential credential in credentials.Where(credential => credential.Status.State == CredentialState.Active)) { Console.WriteLine($"Deactivating {credential.Name}"); credential.Status.Deactivate(); @@ -77,7 +77,7 @@ await engine.TransactionManager.ExecuteTransactionAsync(() => async Task PrefetchEntities(IEnumerable entityGuids) { - foreach (var batch in entityGuids.Split(2000)) + foreach (List batch in entityGuids.Split(2000)) { var query = (EntityConfigurationQuery)engine.ReportManager.CreateReportQuery(ReportType.EntityConfiguration); query.EntityGuids.AddRange(batch); diff --git a/Samples/Platform SDK/UserTaskSample/Program.cs b/Samples/Platform SDK/UserTaskSample/Program.cs index 19a9c22..2180f17 100644 --- a/Samples/Platform SDK/UserTaskSample/Program.cs +++ b/Samples/Platform SDK/UserTaskSample/Program.cs @@ -33,10 +33,10 @@ static async Task Main() { IEnumerable privateTasks = engine.UserTaskManager.GetPrivateTasks().OfType().ToList(); Console.WriteLine($"Number of private tasks: {privateTasks.Count()}"); - foreach (var task in privateTasks) + foreach (PrivateUserTask task in privateTasks) { Console.WriteLine($"Task Name: {task.Name}, Task Type: {GetTaskTypeName(task.TaskType)}"); - foreach (var item in task.Content.Where(item => item.Type != EntityType.None)) + foreach (IUserTaskItem item in task.Content.Where(item => item.Type != EntityType.None)) { Console.WriteLine($" Content Item ID: {item.Id}, Type: {item.Type}"); } @@ -46,10 +46,10 @@ static async Task Main() IEnumerable publicTasks = engine.UserTaskManager.GetPublicTasks().OfType().ToList(); Console.WriteLine($"Number of public tasks: {publicTasks.Count()}"); - foreach (var task in publicTasks) + foreach (UserTask task in publicTasks) { Console.WriteLine($"Task Name: {task.Name}, Task Type: {GetTaskTypeName(task.TaskType)}"); - foreach (var item in task.Content.Where(item => item.Type != EntityType.None)) + foreach (IUserTaskItem item in task.Content.Where(item => item.Type != EntityType.None)) { Console.WriteLine($" Content Item ID: {item.Id}, Type: {item.Type}"); } diff --git a/Samples/Platform SDK/VideoUnitSample/Program.cs b/Samples/Platform SDK/VideoUnitSample/Program.cs index 600cc96..b6d6964 100644 --- a/Samples/Platform SDK/VideoUnitSample/Program.cs +++ b/Samples/Platform SDK/VideoUnitSample/Program.cs @@ -76,18 +76,18 @@ static async Task GetArchiverRole(Engine engine) { var query = (EntityConfigurationQuery)engine.ReportManager.CreateReportQuery(ReportType.EntityConfiguration); query.EntityTypeFilter.Add(EntityType.Role); - var result = await Task.Factory.FromAsync(query.BeginQuery, query.EndQuery, null); + QueryCompletedEventArgs result = await Task.Factory.FromAsync(query.BeginQuery, query.EndQuery, null); return result.Data.AsEnumerable().Select(row => engine.GetEntity(row.Field(nameof(Guid)))).OfType().FirstOrDefault(); } static void PrintSupportedCameras(IVideoUnitManager manager) { - foreach (var grouping in ListSupportedCameras(manager).GroupBy(productInfo => productInfo.Manufacturer)) + foreach (IGrouping grouping in ListSupportedCameras(manager).GroupBy(productInfo => productInfo.Manufacturer)) { Console.WriteLine($"Manufacturer: {grouping.Key}"); Console.WriteLine(new string('-', 20)); - foreach (var productInfo in grouping) + foreach (VideoUnitProductInfo productInfo in grouping) { Console.WriteLine($" - Product Type: {productInfo.ProductType}"); Console.WriteLine($" Description: {productInfo.Description}"); diff --git a/Samples/Plugin SDK/CustomReportSample/Server/ReportHandlers/Custom/CustomReportHandler.cs b/Samples/Plugin SDK/CustomReportSample/Server/ReportHandlers/Custom/CustomReportHandler.cs index fe2de6a..dc572b6 100644 --- a/Samples/Plugin SDK/CustomReportSample/Server/ReportHandlers/Custom/CustomReportHandler.cs +++ b/Samples/Plugin SDK/CustomReportSample/Server/ReportHandlers/Custom/CustomReportHandler.cs @@ -74,7 +74,7 @@ protected override async IAsyncEnumerable GetRecordsAsync(Cu // This is an example of how to return a record - foreach (var guid in query.QueryEntities) + foreach (Guid guid in query.QueryEntities) { yield return new CustomReportRecord { diff --git a/Samples/Plugin SDK/PluginConfigurationSample/RoleConfiguration.cs b/Samples/Plugin SDK/PluginConfigurationSample/RoleConfiguration.cs index e7eae26..4b41b33 100644 --- a/Samples/Plugin SDK/PluginConfigurationSample/RoleConfiguration.cs +++ b/Samples/Plugin SDK/PluginConfigurationSample/RoleConfiguration.cs @@ -46,7 +46,7 @@ private string IPAddressString get => m_ipAddress.ToString(); set { - if (IPAddress.TryParse(value, out var ipAddress)) + if (IPAddress.TryParse(value, out IPAddress ipAddress)) { IPAddress = ipAddress; } diff --git a/Samples/Shared/CollectionExtensions.cs b/Samples/Shared/CollectionExtensions.cs index 404553e..c310f2c 100644 --- a/Samples/Shared/CollectionExtensions.cs +++ b/Samples/Shared/CollectionExtensions.cs @@ -13,7 +13,7 @@ public static class CollectionExtensions { public static void AddRange(this ICollection collection, IEnumerable items) { - foreach (var item in items) + foreach (T item in items) { collection.Add(item); } diff --git a/Samples/Shared/SdkResolver.cs b/Samples/Shared/SdkResolver.cs index 8ad8125..f51faea 100644 --- a/Samples/Shared/SdkResolver.cs +++ b/Samples/Shared/SdkResolver.cs @@ -35,7 +35,7 @@ private static string GetProbingPath() IEnumerable<(Version Version, string Folder)> GetInstallationFolders() { - foreach (var root in new[] { @"SOFTWARE\Genetec\Security Center\", @"SOFTWARE\Wow6432Node\Genetec\Security Center\" }) + foreach (string root in new[] { @"SOFTWARE\Genetec\Security Center\", @"SOFTWARE\Wow6432Node\Genetec\Security Center\" }) { using RegistryKey key = Registry.LocalMachine.OpenSubKey(root); if (key is null) @@ -43,7 +43,7 @@ private static string GetProbingPath() continue; } - foreach (var name in key.GetSubKeyNames()) + foreach (string name in key.GetSubKeyNames()) { if (Version.TryParse(name, out Version version)) { @@ -69,7 +69,7 @@ private static string GetProbingPath() private static Assembly OnAssemblyResolve(object sender, ResolveEventArgs args) { - foreach (var assemblyFile in GetAssemblyPaths(s_probingPath).Where(File.Exists)) + foreach (string assemblyFile in GetAssemblyPaths(s_probingPath).Where(File.Exists)) { try { diff --git a/Samples/Workspace SDK/CardholderCredentialReaderSample/SampleCardholderCredentialReader.cs b/Samples/Workspace SDK/CardholderCredentialReaderSample/SampleCardholderCredentialReader.cs index 9cc447f..77f2da7 100644 --- a/Samples/Workspace SDK/CardholderCredentialReaderSample/SampleCardholderCredentialReader.cs +++ b/Samples/Workspace SDK/CardholderCredentialReaderSample/SampleCardholderCredentialReader.cs @@ -44,14 +44,14 @@ public SampleCardholderCredentialReader() } QueryCompletedEventArgs result = await Task.Factory.FromAsync(query.BeginQuery, query.EndQuery, null); - var existing = result.Data.AsEnumerable().Select(row => row.Field(nameof(Guid))); + EnumerableRowCollection existing = result.Data.AsEnumerable().Select(row => row.Field(nameof(Guid))); foreach (Guid entityId in existing) { OnExistingCredentialRetrieved(new ExistingCredentialRetrievedEventArgs(entityId)); } - var missing = formats + IEnumerable missing = formats .Except(existing.Select(Workspace.Sdk.GetEntity).OfType().Select(credential => credential.Format), new CredentialFormatComparer()) .OfType(); diff --git a/Samples/Workspace SDK/ConfigPageSample/SampleModule.cs b/Samples/Workspace SDK/ConfigPageSample/SampleModule.cs index 9228b12..b018d8e 100644 --- a/Samples/Workspace SDK/ConfigPageSample/SampleModule.cs +++ b/Samples/Workspace SDK/ConfigPageSample/SampleModule.cs @@ -43,11 +43,11 @@ private void CreateDeviceCustomEntity() { var config = (SystemConfiguration)Workspace.Sdk.GetEntity(SystemConfiguration.SystemConfigurationGuid); - var capabilities = CustomEntityTypeCapabilities.CanBeFederated | - CustomEntityTypeCapabilities.IsVisible | - CustomEntityTypeCapabilities.MaintenanceMode | - CustomEntityTypeCapabilities.CreateDelete | - CustomEntityTypeCapabilities.MapSupport; + CustomEntityTypeCapabilities capabilities = CustomEntityTypeCapabilities.CanBeFederated | + CustomEntityTypeCapabilities.IsVisible | + CustomEntityTypeCapabilities.MaintenanceMode | + CustomEntityTypeCapabilities.CreateDelete | + CustomEntityTypeCapabilities.MapSupport; var descriptor = new CustomEntityTypeDescriptor(AedUnitCustomEntityType.Id, Resources.CustomEntityTypeName, capabilities, new Version(1, 0)) diff --git a/Samples/Workspace SDK/CredentialReaderSample/SampleCredentialReader.cs b/Samples/Workspace SDK/CredentialReaderSample/SampleCredentialReader.cs index 169de85..70b5e33 100644 --- a/Samples/Workspace SDK/CredentialReaderSample/SampleCredentialReader.cs +++ b/Samples/Workspace SDK/CredentialReaderSample/SampleCredentialReader.cs @@ -44,14 +44,14 @@ public SampleCredentialReader() } QueryCompletedEventArgs result = await Task.Factory.FromAsync(query.BeginQuery, query.EndQuery, null); - var existing = result.Data.AsEnumerable().Select(row => row.Field(nameof(Guid))); + EnumerableRowCollection existing = result.Data.AsEnumerable().Select(row => row.Field(nameof(Guid))); foreach (Guid entityId in existing) { OnExistingCredentialRetrieved(new ExistingCredentialRetrievedEventArgs(entityId)); } - var missing = formats + IEnumerable missing = formats .Except(existing.Select(Workspace.Sdk.GetEntity).OfType().Select(credential => credential.Format), new CredentialFormatComparer()) .OfType(); diff --git a/Samples/Workspace SDK/ReportExporterSample/AggregateReportExporter.cs b/Samples/Workspace SDK/ReportExporterSample/AggregateReportExporter.cs index 87e4ecb..f8ddc1e 100644 --- a/Samples/Workspace SDK/ReportExporterSample/AggregateReportExporter.cs +++ b/Samples/Workspace SDK/ReportExporterSample/AggregateReportExporter.cs @@ -23,13 +23,13 @@ public AggregateReportExporter(params ReportExporter[] exporters) public override QueryExportResult OnDataReady(QueryResultsBlock dataBlock) { - var exceptions = m_exporters.Select(exporter => exporter.OnDataReady(dataBlock)).Where(result => !result.Success).Select(result => result.Exception).ToList(); + List exceptions = m_exporters.Select(exporter => exporter.OnDataReady(dataBlock)).Where(result => !result.Success).Select(result => result.Exception).ToList(); return exceptions.Any() ? new QueryExportResult(false, new AggregateException(exceptions)) : new QueryExportResult(true); } public override void OnExportCompleted() { - foreach (var exporter in m_exporters) + foreach (ReportExporter exporter in m_exporters) { exporter.OnExportCompleted(); } diff --git a/Samples/Workspace SDK/ReportExporterSample/HtmlReportExporter.cs b/Samples/Workspace SDK/ReportExporterSample/HtmlReportExporter.cs index 8013a0f..96a1722 100644 --- a/Samples/Workspace SDK/ReportExporterSample/HtmlReportExporter.cs +++ b/Samples/Workspace SDK/ReportExporterSample/HtmlReportExporter.cs @@ -49,7 +49,7 @@ public override QueryExportResult OnDataReady(QueryResultsBlock dataBlock) foreach (DataRow row in dataBlock.Data.Rows) { m_writer.WriteLine(""); - foreach (var item in row.ItemArray) + foreach (object item in row.ItemArray) { m_writer.WriteLine($"{item}"); } diff --git a/Samples/Workspace SDK/TimelineProviderSample/AlarmTimelineProvider.cs b/Samples/Workspace SDK/TimelineProviderSample/AlarmTimelineProvider.cs index f2e13ee..39f4622 100644 --- a/Samples/Workspace SDK/TimelineProviderSample/AlarmTimelineProvider.cs +++ b/Samples/Workspace SDK/TimelineProviderSample/AlarmTimelineProvider.cs @@ -49,7 +49,7 @@ public override void Query(ContentGroup contentGroup, DateTime startTime, DateTi QueryCompletedEventArgs result = await Task.Factory.FromAsync(query.BeginQuery, query.EndQuery, null); - var events = result.Data.AsEnumerable().Select(row => + EnumerableRowCollection events = result.Data.AsEnumerable().Select(row => { var alarmGuid = row.Field(AlarmActivityQuery.AlarmColumnName); var instanceId = row.Field(AlarmActivityQuery.InstanceIdColumnName); From cddfbe6912bd94fc4ce89e01d14f59df14987e24 Mon Sep 17 00:00:00 2001 From: Andre Lafleur Date: Fri, 20 Sep 2024 23:27:14 +0800 Subject: [PATCH 09/22] Refactor constructors to use parameters directly Simplified constructors across multiple classes by directly using parameters for initialization, removing the need for private fields. Key changes include: - `BouncingBallOverlay` and `TimecodeOverlay` now use `cameraId` directly. - `VideoExport` now uses `engine` directly. - Various report handlers now pass parameters directly to the base class constructor. - `AggregateReportExporter` initializes `m_exporters` list directly. - `CsvReportExporter`, `MarkdownReportExporter`, and `XmlReportExporter` now use `writer` directly. - `SampleTileView` initializes `m_view` inline. - `AlarmTimelineEvent` uses constructor parameters to initialize properties. --- .../OverlaySample/BouncingBallOverlay.cs | 10 ++------- .../OverlaySample/TimecodeOverlay.cs | 12 +++-------- .../VideoExportSample/VideoExport.cs | 12 ++++------- .../AccessControlReportHandler.cs | 6 +----- .../ZoneActivityReportHandler.cs | 4 +--- .../ActivityTrailsReportHandler.cs | 6 +----- .../AuditTrailsReportHandler.cs | 6 +----- .../Custom/CustomReportHandler.cs | 6 +----- .../HealthEventsReportHandler.cs | 6 +----- .../HealthStatisticsReportHandler.cs | 6 +----- .../IntrusionDetectionReportHandler.cs | 4 +--- .../Video/VideoEventReportHandler.cs | 6 +----- .../AggregateReportExporter.cs | 9 ++------ .../ReportExporterSample/CsvReportExporter.cs | 18 ++++++---------- .../MarkdownReportExporter.cs | 21 +++++++------------ .../ReportExporterSample/XmlReportExporter.cs | 12 +++-------- .../TileViewSample/SampleTileView.cs | 7 +------ .../AlarmTimelineEvent.cs | 12 +++-------- 18 files changed, 40 insertions(+), 123 deletions(-) diff --git a/Samples/Media SDK/OverlaySample/BouncingBallOverlay.cs b/Samples/Media SDK/OverlaySample/BouncingBallOverlay.cs index 3103f69..1163062 100644 --- a/Samples/Media SDK/OverlaySample/BouncingBallOverlay.cs +++ b/Samples/Media SDK/OverlaySample/BouncingBallOverlay.cs @@ -12,18 +12,12 @@ namespace Genetec.Dap.CodeSamples; using System.Threading.Tasks; using Sdk.Media.Overlay; -public class BouncingBallOverlay +public class BouncingBallOverlay(Guid cameraId) { - private readonly Guid m_cameraId; private readonly Guid m_layerId = new Guid("69A64ACE-6DDC-4142-AD04-06690D8591B3"); private Task m_task; private CancellationTokenSource m_cancellationTokenSource; - public BouncingBallOverlay(Guid cameraId) - { - m_cameraId = cameraId; - } - public void Stop() { m_cancellationTokenSource?.Cancel(); @@ -48,7 +42,7 @@ public void Start() CanvasWidth = 1280 }; - Overlay overlay = OverlayFactory.Get(m_cameraId, "Bouncing ball"); + Overlay overlay = OverlayFactory.Get(cameraId, "Bouncing ball"); if (overlay.DrawingSurfaceWidth == 0 || overlay.DrawingSurfaceHeight == 0) { diff --git a/Samples/Media SDK/OverlaySample/TimecodeOverlay.cs b/Samples/Media SDK/OverlaySample/TimecodeOverlay.cs index 024d8ca..2afbff5 100644 --- a/Samples/Media SDK/OverlaySample/TimecodeOverlay.cs +++ b/Samples/Media SDK/OverlaySample/TimecodeOverlay.cs @@ -12,17 +12,11 @@ namespace Genetec.Dap.CodeSamples; using System.Threading.Tasks; using Sdk.Media.Overlay; -public class TimecodeOverlay +public class TimecodeOverlay(Guid cameraId) { - private readonly Guid m_cameraId; private readonly Guid m_layerId = new Guid("69A64ACE-6DDC-4142-AD04-06690D8591B3"); private CancellationTokenSource m_cancellationTokenSource; - private Task m_task; - - public TimecodeOverlay(Guid cameraId) - { - m_cameraId = cameraId; - } + private Task m_task; public void Stop() { @@ -40,7 +34,7 @@ public void Start() m_task = Task.Run(async () => { - Overlay overlay = OverlayFactory.Get(m_cameraId, "Timecode"); + Overlay overlay = OverlayFactory.Get(cameraId, "Timecode"); if (overlay.DrawingSurfaceWidth == 0 || overlay.DrawingSurfaceHeight == 0) overlay.Initialize(1280, 960); diff --git a/Samples/Media SDK/VideoExportSample/VideoExport.cs b/Samples/Media SDK/VideoExportSample/VideoExport.cs index 8633e68..f3ccbba 100644 --- a/Samples/Media SDK/VideoExportSample/VideoExport.cs +++ b/Samples/Media SDK/VideoExportSample/VideoExport.cs @@ -18,12 +18,8 @@ namespace Genetec.Dap.CodeSamples; using Sdk.Media.Export; using File = System.IO.File; -public class VideoExport +public class VideoExport(IEngine engine) { - private readonly IEngine m_engine; - - public VideoExport(IEngine engine) => m_engine = engine; - public Task Export(IEnumerable cameras, Sdk.Media.DateTimeRange range, string fileName, ExportOption option, IProgress progress = null, CancellationToken cancellationToken = default) { IEnumerable configs = cameras.Select(camera => new CameraExportConfig(camera.Guid, Enumerable.Repeat(range, 1))); @@ -39,7 +35,7 @@ public async Task Export(IEnumerable configs, string fileNam exporter.StatisticsReceived += OnStatisticsReceived; try { - exporter.Initialize(m_engine, Path.GetDirectoryName(fileName)); + exporter.Initialize(engine, Path.GetDirectoryName(fileName)); exporter.SetExportFileFormat(option.Format == VideoExportFormat.G64 ? MediaExportFileFormat.G64 : MediaExportFileFormat.G64X); ExportEndedResult result = await exporter.ExportAsync(configs, option.PlaybackMode, Path.GetFileNameWithoutExtension(fileName), option.IncludeWatermark); @@ -65,7 +61,7 @@ async Task Convert(string filePath, VideoExportFormat format, IProgress con using (var converter = new G64ToAsfConverter()) { converter.Initialize( - m_engine, + engine, filePath, false, false, @@ -81,7 +77,7 @@ async Task Convert(string filePath, VideoExportFormat format, IProgress con using (var converter = new G64ToMp4Converter()) { converter.Initialize( - m_engine, + engine, filePath, option.ExportAudio, GetOutputFilePath()); diff --git a/Samples/Plugin SDK/CustomReportSample/Server/ReportHandlers/AccessControl/AccessControlReportHandler.cs b/Samples/Plugin SDK/CustomReportSample/Server/ReportHandlers/AccessControl/AccessControlReportHandler.cs index d8345b8..b5b8fc5 100644 --- a/Samples/Plugin SDK/CustomReportSample/Server/ReportHandlers/AccessControl/AccessControlReportHandler.cs +++ b/Samples/Plugin SDK/CustomReportSample/Server/ReportHandlers/AccessControl/AccessControlReportHandler.cs @@ -14,12 +14,8 @@ namespace Genetec.Dap.CodeSamples.Server.ReportHandlers.AccessControl; using Genetec.Sdk.Entities; using Genetec.Sdk.Queries.AccessControl; -public class AccessControlReportHandler : ReportHandler +public class AccessControlReportHandler(IEngine engine, Role role) : ReportHandler(engine, role) { - public AccessControlReportHandler(IEngine engine, Role role) : base(engine, role) - { - } - protected override void FillDataRow(DataRow row, AccessControlReportRecord record) { row[AccessControlReportQuery.TimestampColumnName] = record.Timestamp; diff --git a/Samples/Plugin SDK/CustomReportSample/Server/ReportHandlers/AccessControl/ZoneActivityReportHandler.cs b/Samples/Plugin SDK/CustomReportSample/Server/ReportHandlers/AccessControl/ZoneActivityReportHandler.cs index 55ffd37..953199c 100644 --- a/Samples/Plugin SDK/CustomReportSample/Server/ReportHandlers/AccessControl/ZoneActivityReportHandler.cs +++ b/Samples/Plugin SDK/CustomReportSample/Server/ReportHandlers/AccessControl/ZoneActivityReportHandler.cs @@ -14,10 +14,8 @@ namespace Genetec.Dap.CodeSamples.Server.ReportHandlers.AccessControl; using Genetec.Sdk.Entities; using Genetec.Sdk.Queries; -public class ZoneActivityReportHandler : ReportHandler +public class ZoneActivityReportHandler(IEngine engine, Role role) : ReportHandler(engine, role) { - public ZoneActivityReportHandler(IEngine engine, Role role) : base(engine, role) { } - protected override async IAsyncEnumerable GetRecordsAsync(ZoneActivityQuery query) { // TODO: Implement the actual data retrieval logic here. diff --git a/Samples/Plugin SDK/CustomReportSample/Server/ReportHandlers/ActivityTrailsReportHandler.cs b/Samples/Plugin SDK/CustomReportSample/Server/ReportHandlers/ActivityTrailsReportHandler.cs index 8c9eeb8..5c77dd3 100644 --- a/Samples/Plugin SDK/CustomReportSample/Server/ReportHandlers/ActivityTrailsReportHandler.cs +++ b/Samples/Plugin SDK/CustomReportSample/Server/ReportHandlers/ActivityTrailsReportHandler.cs @@ -17,12 +17,8 @@ namespace Genetec.Dap.CodeSamples.Server.ReportHandlers; using Sdk.Plugin.Queries.Rows.Trails; using Sdk.Queries; -public class ActivityTrailsReportHandler : ReportHandler +public class ActivityTrailsReportHandler(IEngine engine, Role role) : ReportHandler(engine, role) { - public ActivityTrailsReportHandler(IEngine engine, Role role) : base(engine, role) - { - } - protected override async Task ProcessBatch(DataTable table, IAsyncEnumerable batch) { await foreach (ActivityTrailRow row in batch) diff --git a/Samples/Plugin SDK/CustomReportSample/Server/ReportHandlers/AuditTrailsReportHandler.cs b/Samples/Plugin SDK/CustomReportSample/Server/ReportHandlers/AuditTrailsReportHandler.cs index 279d4a2..be89504 100644 --- a/Samples/Plugin SDK/CustomReportSample/Server/ReportHandlers/AuditTrailsReportHandler.cs +++ b/Samples/Plugin SDK/CustomReportSample/Server/ReportHandlers/AuditTrailsReportHandler.cs @@ -17,12 +17,8 @@ namespace Genetec.Dap.CodeSamples.Server.ReportHandlers; using Sdk.Plugin.Queries.Rows.Trails; using Sdk.Queries; -public class AuditTrailsReportHandler : ReportHandler +public class AuditTrailsReportHandler(IEngine engine, Role role) : ReportHandler(engine, role) { - public AuditTrailsReportHandler(IEngine engine, Role role) : base(engine, role) - { - } - protected override async Task ProcessBatch(DataTable table, IAsyncEnumerable batch) { await foreach (AuditTrailRow row in batch) diff --git a/Samples/Plugin SDK/CustomReportSample/Server/ReportHandlers/Custom/CustomReportHandler.cs b/Samples/Plugin SDK/CustomReportSample/Server/ReportHandlers/Custom/CustomReportHandler.cs index dc572b6..ff3930a 100644 --- a/Samples/Plugin SDK/CustomReportSample/Server/ReportHandlers/Custom/CustomReportHandler.cs +++ b/Samples/Plugin SDK/CustomReportSample/Server/ReportHandlers/Custom/CustomReportHandler.cs @@ -17,12 +17,8 @@ namespace Genetec.Dap.CodeSamples.Server.ReportHandlers.Custom; using Sdk.Entities; using Sdk.Queries; -public class CustomReportHandler : ReportHandler +public class CustomReportHandler(IEngine engine, Role role) : ReportHandler(engine, role) { - public CustomReportHandler(IEngine engine, Role role) : base(engine, role) - { - } - // Ensure that the custom report handler only handles the custom report with the specified identifier protected override bool IsQuerySupported(CustomQuery query) { diff --git a/Samples/Plugin SDK/CustomReportSample/Server/ReportHandlers/HealthEventsReportHandler.cs b/Samples/Plugin SDK/CustomReportSample/Server/ReportHandlers/HealthEventsReportHandler.cs index a16e90f..6a204e0 100644 --- a/Samples/Plugin SDK/CustomReportSample/Server/ReportHandlers/HealthEventsReportHandler.cs +++ b/Samples/Plugin SDK/CustomReportSample/Server/ReportHandlers/HealthEventsReportHandler.cs @@ -14,12 +14,8 @@ namespace Genetec.Dap.CodeSamples.Server.ReportHandlers; using Genetec.Sdk.Entities; using Genetec.Sdk.Queries.HealthMonitoring; -public class HealthEventsReportHandler : ReportHandler +public class HealthEventsReportHandler(IEngine engine, Role role) : ReportHandler(engine, role) { - public HealthEventsReportHandler(IEngine engine, Role role) : base(engine, role) - { - } - protected override void FillDataRow(DataRow row, HealthEvent record) { row[HealthEventQuery.HealthEventIdColumnName] = record.HealthEventId; diff --git a/Samples/Plugin SDK/CustomReportSample/Server/ReportHandlers/HealthStatisticsReportHandler.cs b/Samples/Plugin SDK/CustomReportSample/Server/ReportHandlers/HealthStatisticsReportHandler.cs index 75c16f0..01bc54f 100644 --- a/Samples/Plugin SDK/CustomReportSample/Server/ReportHandlers/HealthStatisticsReportHandler.cs +++ b/Samples/Plugin SDK/CustomReportSample/Server/ReportHandlers/HealthStatisticsReportHandler.cs @@ -14,12 +14,8 @@ namespace Genetec.Dap.CodeSamples.Server.ReportHandlers; using Genetec.Sdk.Entities; using Genetec.Sdk.Queries.HealthMonitoring; -public class HealthStatisticsReportHandler : ReportHandler +public class HealthStatisticsReportHandler(IEngine engine, Role role) : ReportHandler(engine, role) { - public HealthStatisticsReportHandler(IEngine engine, Role role) : base(engine, role) - { - } - protected override void FillDataRow(DataRow row, HealthStatistics record) { row[HealthStatisticsQuery.FailureCountColumnName] = record.FailureCount; diff --git a/Samples/Plugin SDK/CustomReportSample/Server/ReportHandlers/IntrusionDetectionReportHandler.cs b/Samples/Plugin SDK/CustomReportSample/Server/ReportHandlers/IntrusionDetectionReportHandler.cs index 56aa8c1..115255b 100644 --- a/Samples/Plugin SDK/CustomReportSample/Server/ReportHandlers/IntrusionDetectionReportHandler.cs +++ b/Samples/Plugin SDK/CustomReportSample/Server/ReportHandlers/IntrusionDetectionReportHandler.cs @@ -14,10 +14,8 @@ namespace Genetec.Dap.CodeSamples.Server.ReportHandlers; using Genetec.Sdk.Entities; using Genetec.Sdk.Queries.IntrusionDetection; -public class IntrusionDetectionReportHandler : ReportHandler +public class IntrusionDetectionReportHandler(IEngine engine, Role role) : ReportHandler(engine, role) { - public IntrusionDetectionReportHandler(IEngine engine, Role role) : base(engine, role) { } - protected override void FillDataRow(DataRow row, IntrusionDetectionRecord record) { row[IntrusionDetectionReportQuery.TimestampUtcColumnName] = record.Timestamp; diff --git a/Samples/Plugin SDK/CustomReportSample/Server/ReportHandlers/Video/VideoEventReportHandler.cs b/Samples/Plugin SDK/CustomReportSample/Server/ReportHandlers/Video/VideoEventReportHandler.cs index 4af9161..9eaaceb 100644 --- a/Samples/Plugin SDK/CustomReportSample/Server/ReportHandlers/Video/VideoEventReportHandler.cs +++ b/Samples/Plugin SDK/CustomReportSample/Server/ReportHandlers/Video/VideoEventReportHandler.cs @@ -14,12 +14,8 @@ namespace Genetec.Dap.CodeSamples.Server.ReportHandlers.Video; using Genetec.Sdk.Entities; using Genetec.Sdk.Queries.Video; -public class VideoEventReportHandler : ReportHandler +public class VideoEventReportHandler(IEngine engine, Role role) : ReportHandler(engine, role) { - public VideoEventReportHandler(IEngine engine, Role role) : base(engine, role) - { - } - protected override void FillDataRow(DataRow row, VideoEvent record) { row[VideoEventQuery.CameraGuidColumnName] = record.CameraGuid; diff --git a/Samples/Workspace SDK/ReportExporterSample/AggregateReportExporter.cs b/Samples/Workspace SDK/ReportExporterSample/AggregateReportExporter.cs index f8ddc1e..061e234 100644 --- a/Samples/Workspace SDK/ReportExporterSample/AggregateReportExporter.cs +++ b/Samples/Workspace SDK/ReportExporterSample/AggregateReportExporter.cs @@ -12,14 +12,9 @@ namespace Genetec.Dap.CodeSamples; using System.Linq; using Genetec.Sdk.ReportExport; -public class AggregateReportExporter : ReportExporter +public class AggregateReportExporter(params ReportExporter[] exporters) : ReportExporter { - private readonly List m_exporters; - - public AggregateReportExporter(params ReportExporter[] exporters) - { - m_exporters = exporters.ToList(); - } + private readonly List m_exporters = exporters.ToList(); public override QueryExportResult OnDataReady(QueryResultsBlock dataBlock) { diff --git a/Samples/Workspace SDK/ReportExporterSample/CsvReportExporter.cs b/Samples/Workspace SDK/ReportExporterSample/CsvReportExporter.cs index b71e707..a1ecb87 100644 --- a/Samples/Workspace SDK/ReportExporterSample/CsvReportExporter.cs +++ b/Samples/Workspace SDK/ReportExporterSample/CsvReportExporter.cs @@ -14,15 +14,9 @@ namespace Genetec.Dap.CodeSamples; using System.Linq; using Sdk.ReportExport; -public class CsvReportExporter : ReportExporter +public class CsvReportExporter(TextWriter writer) : ReportExporter { private bool m_headerWritten; - private readonly TextWriter m_writer; - - public CsvReportExporter(TextWriter writer) - { - m_writer = writer; - } public override QueryExportResult OnDataReady(QueryResultsBlock dataBlock) { @@ -31,17 +25,17 @@ public override QueryExportResult OnDataReady(QueryResultsBlock dataBlock) if (!m_headerWritten) { IEnumerable columnNames = dataBlock.Data.Columns.Cast().Select(column => column.ColumnName); - m_writer.WriteLine(string.Join(",", columnNames)); + writer.WriteLine(string.Join(",", columnNames)); m_headerWritten = true; } foreach (DataRow row in dataBlock.Data.Rows) { IEnumerable fields = row.ItemArray.Select(field => $"\"{field.ToString().Replace("\"", "\"\"")}\""); - m_writer.WriteLine(string.Join(",", fields)); + writer.WriteLine(string.Join(",", fields)); } - m_writer.Flush(); + writer.Flush(); return new QueryExportResult(true); } @@ -55,7 +49,7 @@ public override void OnExportCompleted() { try { - m_writer.Close(); + writer.Close(); } catch { @@ -63,7 +57,7 @@ public override void OnExportCompleted() } finally { - m_writer.Dispose(); + writer.Dispose(); } } } \ No newline at end of file diff --git a/Samples/Workspace SDK/ReportExporterSample/MarkdownReportExporter.cs b/Samples/Workspace SDK/ReportExporterSample/MarkdownReportExporter.cs index 4ff6fe6..1d4f162 100644 --- a/Samples/Workspace SDK/ReportExporterSample/MarkdownReportExporter.cs +++ b/Samples/Workspace SDK/ReportExporterSample/MarkdownReportExporter.cs @@ -13,25 +13,18 @@ namespace Genetec.Dap.CodeSamples; using System.Linq; using Sdk.ReportExport; -public class MarkdownReportExporter : ReportExporter +public class MarkdownReportExporter(TextWriter writer) : ReportExporter { - private readonly TextWriter m_writer; - - public MarkdownReportExporter(TextWriter writer) - { - m_writer = writer; - } - public override QueryExportResult OnDataReady(QueryResultsBlock dataBlock) { try { - m_writer.WriteLine($"| {string.Join(" | ", dataBlock.Data.Columns.Cast().Select(c => c.ColumnName))} |"); - m_writer.WriteLine($"| {string.Join(" | ", dataBlock.Data.Columns.Cast().Select(c => "---"))} |"); + writer.WriteLine($"| {string.Join(" | ", dataBlock.Data.Columns.Cast().Select(c => c.ColumnName))} |"); + writer.WriteLine($"| {string.Join(" | ", dataBlock.Data.Columns.Cast().Select(c => "---"))} |"); - foreach (DataRow row in dataBlock.Data.Rows) m_writer.WriteLine($"| {string.Join(" | ", row.ItemArray.Select(item => item.ToString().Replace("|", "\\|")))} |"); + foreach (DataRow row in dataBlock.Data.Rows) writer.WriteLine($"| {string.Join(" | ", row.ItemArray.Select(item => item.ToString().Replace("|", "\\|")))} |"); - m_writer.Flush(); + writer.Flush(); return new QueryExportResult(true); } catch (Exception ex) @@ -44,7 +37,7 @@ public override void OnExportCompleted() { try { - m_writer.Close(); + writer.Close(); } catch { @@ -52,7 +45,7 @@ public override void OnExportCompleted() } finally { - m_writer.Dispose(); + writer.Dispose(); } } } \ No newline at end of file diff --git a/Samples/Workspace SDK/ReportExporterSample/XmlReportExporter.cs b/Samples/Workspace SDK/ReportExporterSample/XmlReportExporter.cs index 6d35f7a..0a8f653 100644 --- a/Samples/Workspace SDK/ReportExporterSample/XmlReportExporter.cs +++ b/Samples/Workspace SDK/ReportExporterSample/XmlReportExporter.cs @@ -13,16 +13,10 @@ namespace Genetec.Dap.CodeSamples; using Sdk.ReportExport; using System.Xml; -public class XmlReportExporter : ReportExporter +public class XmlReportExporter(TextWriter textWriter) : ReportExporter { - private readonly DataTable m_dataTable; - private readonly XmlWriter m_xmlWriter; - - public XmlReportExporter(TextWriter textWriter) - { - m_xmlWriter = XmlWriter.Create(textWriter, new XmlWriterSettings { Indent = true }); - m_dataTable = new DataTable("Results"); - } + private readonly DataTable m_dataTable = new("Results"); + private readonly XmlWriter m_xmlWriter = XmlWriter.Create(textWriter, new XmlWriterSettings { Indent = true }); public override QueryExportResult OnDataReady(QueryResultsBlock dataBlock) { diff --git a/Samples/Workspace SDK/TileViewSample/SampleTileView.cs b/Samples/Workspace SDK/TileViewSample/SampleTileView.cs index 7199231..9a7b662 100644 --- a/Samples/Workspace SDK/TileViewSample/SampleTileView.cs +++ b/Samples/Workspace SDK/TileViewSample/SampleTileView.cs @@ -12,12 +12,7 @@ namespace Genetec.Dap.CodeSamples; public class SampleTileView : TileView { - private readonly SampleTileViewControl m_view; - - public SampleTileView() - { - m_view = new SampleTileViewControl(); - } + private readonly SampleTileViewControl m_view = new(); public override UIElement View => m_view; } \ No newline at end of file diff --git a/Samples/Workspace SDK/TimelineProviderSample/AlarmTimelineEvent.cs b/Samples/Workspace SDK/TimelineProviderSample/AlarmTimelineEvent.cs index 07b02e1..bb35376 100644 --- a/Samples/Workspace SDK/TimelineProviderSample/AlarmTimelineEvent.cs +++ b/Samples/Workspace SDK/TimelineProviderSample/AlarmTimelineEvent.cs @@ -14,7 +14,7 @@ namespace Genetec.Dap.CodeSamples; using Sdk; using Sdk.Workspace.Components.TimelineProvider; -public class AlarmTimelineEvent : TimelineEvent +public class AlarmTimelineEvent(Guid alarmGuid, int instanceId, DateTime dateTime) : TimelineEvent(dateTime) { private static readonly Size s_size = new Size(16, 16); @@ -26,15 +26,9 @@ static AlarmTimelineEvent() s_image.Freeze(); } - public AlarmTimelineEvent(Guid alarmGuid, int instanceId, DateTime dateTime) : base(dateTime) - { - AlarmGuid = alarmGuid; - InstanceId = instanceId; - } - - public Guid AlarmGuid { get; } + public Guid AlarmGuid { get; } = alarmGuid; - public int InstanceId { get; } + public int InstanceId { get; } = instanceId; public override TimelineVisual GetVisual(Rect constraint, double msPerPixel) { From 095e3fe0a224d6e4263b2dc4eb4114611dbca773 Mon Sep 17 00:00:00 2001 From: Andre Lafleur Date: Fri, 20 Sep 2024 23:28:52 +0800 Subject: [PATCH 10/22] Refactor CustomActionTypeDescriptor initialization Refactored the initialization of the CustomActionTypeDescriptor object for the LaunchEncoderCommand action. Properties Description, SupportedActionUsage, and HandleByServer are now set using an object initializer, enhancing code conciseness and readability. --- .../CustomActionSample/Server/SamplePlugin.cs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Samples/Plugin SDK/CustomActionSample/Server/SamplePlugin.cs b/Samples/Plugin SDK/CustomActionSample/Server/SamplePlugin.cs index 4dbdd9c..cbd6a9a 100644 --- a/Samples/Plugin SDK/CustomActionSample/Server/SamplePlugin.cs +++ b/Samples/Plugin SDK/CustomActionSample/Server/SamplePlugin.cs @@ -24,10 +24,12 @@ protected override void OnPluginLoaded() protected override void OnPluginStart() { - CustomActionTypeDescriptor descriptor = new(CustomActionTypes.LaunchEncoderCommand, "Launch encoder command"); - descriptor.Description = "Launches an encoder command on a camera"; - descriptor.SupportedActionUsage = ActionUsage.All; - descriptor.HandleByServer = true; + CustomActionTypeDescriptor descriptor = new(CustomActionTypes.LaunchEncoderCommand, "Launch encoder command") + { + Description = "Launches an encoder command on a camera", + SupportedActionUsage = ActionUsage.All, + HandleByServer = true + }; descriptor.SetIcon(Properties.Resources.SmallLogo); var config = (SystemConfiguration)Engine.GetEntity(SystemConfiguration.SystemConfigurationGuid); From 39ee0673892341d9af524ec30b59ec00e3ff4799 Mon Sep 17 00:00:00 2001 From: Andre Lafleur Date: Sat, 21 Sep 2024 17:15:01 +0800 Subject: [PATCH 11/22] Refactor namespaces and access modifiers Changed namespaces in HtmlReportExporter.cs and JsonReportExporter.cs from Genetec.Dap.CodeSamples to Genetec.Sdk.ReportExport. Removed public access modifiers from class declarations in HtmlReportExporter.cs, JsonReportExporter.cs, MarkdownReportExporter.cs, and XmlReportExporter.cs, making them internal. Updated constructors in MarkdownReportExporter and XmlReportExporter to use class keyword without public access modifier. --- .../FileCryptingManagerExtensions.cs | 2 +- .../MediaFileSample/StreamMediaType.cs | 2 +- .../MediaFileSample/StreamUsageType.cs | 2 +- .../Media SDK/OverlaySample/BouncingBall.cs | 2 +- .../OverlaySample/BouncingBallOverlay.cs | 2 +- .../OverlaySample/OverlayExtensions.cs | 2 +- .../OverlaySample/TimecodeOverlay.cs | 4 +- .../G64ConverterBaseExtensions.cs | 2 +- .../VideoExportSample/VideoExport.cs | 2 +- .../Program.cs | 2 +- .../AccessControlReportQuerySample/Program.cs | 4 +- .../Platform SDK/CustomEntitySample/Icon.cs | 2 +- .../Platform SDK/CustomEventSample/Program.cs | 2 +- .../IncidentManagerSample/IncidentData.cs | 2 +- .../SecurityManagerSample/Program.cs | 2 +- .../Platform SDK/VideoUnitSample/Program.cs | 2 +- .../CustomActionSample/CustomActionTypes.cs | 2 +- .../CustomActionSample/PluginTypes.cs | 2 +- .../AsyncEnumerableExtensions.cs | 2 +- .../CustomReportSample/CustomReportId.cs | 2 +- .../AccessControlReportHandler.cs | 2 +- .../AccessControlReportRecord.cs | 2 +- .../AccessControl/ZoneActivityRecord.cs | 2 +- .../ZoneActivityReportHandler.cs | 2 +- .../ActivityTrailsReportHandler.cs | 2 +- .../AuditTrailsReportHandler.cs | 14 ++--- .../Custom/CustomReportHandler.cs | 2 +- .../Server/ReportHandlers/HealthEvent.cs | 2 +- .../HealthEventsReportHandler.cs | 2 +- .../Server/ReportHandlers/HealthStatistics.cs | 2 +- .../HealthStatisticsReportHandler.cs | 2 +- .../IntrusionDetectionRecord.cs | 2 +- .../IntrusionDetectionReportHandler.cs | 2 +- .../Server/ReportHandlers/Video/VideoEvent.cs | 2 +- .../Video/VideoEventReportHandler.cs | 52 +++++++++---------- .../Client/CustomConfigPage.cs | 4 +- .../EntityExtensions.cs | 2 +- .../PluginConfigurationSample/PluginTypes.cs | 2 +- .../SampleDatabaseManager.cs | 2 +- Samples/Shared/SdkResolver.cs | 1 + .../BackgroundProcessPageViewModel.cs | 4 +- .../BadgePrinterSample/SampleBadgePrinter.cs | 2 +- .../CredentialFormatComparer.cs | 2 +- .../CardholderFieldsExtractorSample/VCard.cs | 10 ++-- .../VCardReader.cs | 2 +- .../AedUnitCustomEntityType.cs | 2 +- .../AedUnitCustomPrivilege.cs | 2 +- .../ConfigPageSample/AedUnitInformation.cs | 10 ++-- .../ConfigPageSample/CustomConfigPage.cs | 2 +- .../Chart/ChartSampleViewModel.cs | 2 +- .../ControlsSample/CustomTaskCategories.cs | 2 +- .../EventExtenderSample/FieldName.cs | 2 +- .../ImageExtractorSample/VCard.cs | 10 ++-- .../ImageExtractorSample/VCardReader.cs | 2 +- .../SampleOptionsData.cs | 4 +- .../AggregateReportExporter.cs | 2 +- .../ReportExporterSample/CsvReportExporter.cs | 2 +- .../HtmlReportExporter.cs | 2 +- .../JsonReportExporter.cs | 2 +- .../MarkdownReportExporter.cs | 2 +- .../ReportExporterSample/XmlReportExporter.cs | 2 +- 61 files changed, 109 insertions(+), 108 deletions(-) diff --git a/Samples/Media SDK/FileCryptingManagerSample/FileCryptingManagerExtensions.cs b/Samples/Media SDK/FileCryptingManagerSample/FileCryptingManagerExtensions.cs index a494410..45b80eb 100644 --- a/Samples/Media SDK/FileCryptingManagerSample/FileCryptingManagerExtensions.cs +++ b/Samples/Media SDK/FileCryptingManagerSample/FileCryptingManagerExtensions.cs @@ -14,7 +14,7 @@ namespace Genetec.Dap.CodeSamples; -public static class FileCryptingManagerExtensions +static class FileCryptingManagerExtensions { /// /// Encrypts a file asynchronously using the specified password. diff --git a/Samples/Media SDK/MediaFileSample/StreamMediaType.cs b/Samples/Media SDK/MediaFileSample/StreamMediaType.cs index 3a87064..35cc4cc 100644 --- a/Samples/Media SDK/MediaFileSample/StreamMediaType.cs +++ b/Samples/Media SDK/MediaFileSample/StreamMediaType.cs @@ -9,7 +9,7 @@ namespace Genetec.Dap.CodeSamples; -public static class StreamMediaType +static class StreamMediaType { public static readonly Guid Legacy = new("E5FDCEF3-0A63-4615-A2A2-BB34C892FB97"); public static readonly Guid Video = new("4A0425E9-5F15-4675-83EB-2777CE199CB3"); diff --git a/Samples/Media SDK/MediaFileSample/StreamUsageType.cs b/Samples/Media SDK/MediaFileSample/StreamUsageType.cs index c5fab15..04aaaa6 100644 --- a/Samples/Media SDK/MediaFileSample/StreamUsageType.cs +++ b/Samples/Media SDK/MediaFileSample/StreamUsageType.cs @@ -9,7 +9,7 @@ namespace Genetec.Dap.CodeSamples; -public static class StreamUsageType +static class StreamUsageType { public static readonly Guid Live = new("e30e6525-2202-4502-8101-5a75ee15f04b"); public static readonly Guid Archiving = new("bac8d8bf-ee2a-41ac-b62c-3c2dd00020a5"); diff --git a/Samples/Media SDK/OverlaySample/BouncingBall.cs b/Samples/Media SDK/OverlaySample/BouncingBall.cs index 03f7d2f..5155feb 100644 --- a/Samples/Media SDK/OverlaySample/BouncingBall.cs +++ b/Samples/Media SDK/OverlaySample/BouncingBall.cs @@ -11,7 +11,7 @@ namespace Genetec.Dap.CodeSamples; using System.Windows.Media; using Sdk.Media.Overlay; -public class BouncingBall +class BouncingBall { public double CanvasWidth = 1290; diff --git a/Samples/Media SDK/OverlaySample/BouncingBallOverlay.cs b/Samples/Media SDK/OverlaySample/BouncingBallOverlay.cs index 1163062..a658025 100644 --- a/Samples/Media SDK/OverlaySample/BouncingBallOverlay.cs +++ b/Samples/Media SDK/OverlaySample/BouncingBallOverlay.cs @@ -12,7 +12,7 @@ namespace Genetec.Dap.CodeSamples; using System.Threading.Tasks; using Sdk.Media.Overlay; -public class BouncingBallOverlay(Guid cameraId) +class BouncingBallOverlay(Guid cameraId) { private readonly Guid m_layerId = new Guid("69A64ACE-6DDC-4142-AD04-06690D8591B3"); private Task m_task; diff --git a/Samples/Media SDK/OverlaySample/OverlayExtensions.cs b/Samples/Media SDK/OverlaySample/OverlayExtensions.cs index d19ab1d..b95f6c0 100644 --- a/Samples/Media SDK/OverlaySample/OverlayExtensions.cs +++ b/Samples/Media SDK/OverlaySample/OverlayExtensions.cs @@ -10,7 +10,7 @@ namespace Genetec.Dap.CodeSamples; using System.Threading.Tasks; using Sdk.Media.Overlay; -public static class OverlayExtensions +static class OverlayExtensions { public static async Task WaitUntilReadyForUpdate(this Overlay overlay) { diff --git a/Samples/Media SDK/OverlaySample/TimecodeOverlay.cs b/Samples/Media SDK/OverlaySample/TimecodeOverlay.cs index 2afbff5..16cea95 100644 --- a/Samples/Media SDK/OverlaySample/TimecodeOverlay.cs +++ b/Samples/Media SDK/OverlaySample/TimecodeOverlay.cs @@ -12,7 +12,7 @@ namespace Genetec.Dap.CodeSamples; using System.Threading.Tasks; using Sdk.Media.Overlay; -public class TimecodeOverlay(Guid cameraId) +class TimecodeOverlay(Guid cameraId) { private readonly Guid m_layerId = new Guid("69A64ACE-6DDC-4142-AD04-06690D8591B3"); private CancellationTokenSource m_cancellationTokenSource; @@ -26,7 +26,7 @@ public void Stop() public void Start() { - if (m_task is { IsCompleted: false }) + if (m_task is { IsCompleted: false }) return; m_cancellationTokenSource = new CancellationTokenSource(); diff --git a/Samples/Media SDK/VideoExportSample/G64ConverterBaseExtensions.cs b/Samples/Media SDK/VideoExportSample/G64ConverterBaseExtensions.cs index 9c8a4ca..ccea11a 100644 --- a/Samples/Media SDK/VideoExportSample/G64ConverterBaseExtensions.cs +++ b/Samples/Media SDK/VideoExportSample/G64ConverterBaseExtensions.cs @@ -14,7 +14,7 @@ namespace Genetec.Dap.CodeSamples; -public static class G64ConverterBaseExtensions +static class G64ConverterBaseExtensions { public static async Task> ConvertAsync(this G64ConverterBase converter, IProgress progress, CancellationToken token) { diff --git a/Samples/Media SDK/VideoExportSample/VideoExport.cs b/Samples/Media SDK/VideoExportSample/VideoExport.cs index f3ccbba..050440d 100644 --- a/Samples/Media SDK/VideoExportSample/VideoExport.cs +++ b/Samples/Media SDK/VideoExportSample/VideoExport.cs @@ -18,7 +18,7 @@ namespace Genetec.Dap.CodeSamples; using Sdk.Media.Export; using File = System.IO.File; -public class VideoExport(IEngine engine) +class VideoExport(IEngine engine) { public Task Export(IEnumerable cameras, Sdk.Media.DateTimeRange range, string fileName, ExportOption option, IProgress progress = null, CancellationToken cancellationToken = default) { diff --git a/Samples/Platform SDK/AccessControlRawEventQuerySample/Program.cs b/Samples/Platform SDK/AccessControlRawEventQuerySample/Program.cs index dba9cb0..88fac45 100644 --- a/Samples/Platform SDK/AccessControlRawEventQuerySample/Program.cs +++ b/Samples/Platform SDK/AccessControlRawEventQuerySample/Program.cs @@ -144,7 +144,7 @@ void DisplayToConsole(AccessControlRawEvent rawEvent) Console.WriteLine(); } -class AccessControlRawEvent +record AccessControlRawEvent { public Guid? SourceGuid { get; set; } public Guid? AccessPointGuid { get; set; } diff --git a/Samples/Platform SDK/AccessControlReportQuerySample/Program.cs b/Samples/Platform SDK/AccessControlReportQuerySample/Program.cs index b866607..a9f7e59 100644 --- a/Samples/Platform SDK/AccessControlReportQuerySample/Program.cs +++ b/Samples/Platform SDK/AccessControlReportQuerySample/Program.cs @@ -48,7 +48,7 @@ async Task RunSample() ReportType.ElevatorActivity, ReportType.VisitorActivity }; - + foreach (ReportType reportType in reportTypes) { List activities = await GetActivities(engine, reportType, from, to, maxResultCount, entity); @@ -126,7 +126,7 @@ void DisplayToConsole(Engine engine, List activities) string GetEntityName(Guid? entityId) => engine.GetEntity(entityId.GetValueOrDefault())?.Name; } -class AccessControlEvent +record AccessControlEvent { public DateTime Timestamp { get; set; } public Guid? Unit { get; set; } diff --git a/Samples/Platform SDK/CustomEntitySample/Icon.cs b/Samples/Platform SDK/CustomEntitySample/Icon.cs index f484ecb..584eabd 100644 --- a/Samples/Platform SDK/CustomEntitySample/Icon.cs +++ b/Samples/Platform SDK/CustomEntitySample/Icon.cs @@ -10,7 +10,7 @@ namespace Genetec.Dap.CodeSamples; using System; using System.Windows.Media.Imaging; -public static class Icon +static class Icon { private static BitmapImage LoadIcon(string resourceName) { diff --git a/Samples/Platform SDK/CustomEventSample/Program.cs b/Samples/Platform SDK/CustomEventSample/Program.cs index eb60d53..ddd122a 100644 --- a/Samples/Platform SDK/CustomEventSample/Program.cs +++ b/Samples/Platform SDK/CustomEventSample/Program.cs @@ -55,7 +55,7 @@ static async Task Main() Console.WriteLine("Press any key to exit..."); Console.ReadKey(); - void DisplayCustomEvents(IReadOnlyList events) + void DisplayCustomEvents(IReadOnlyCollection events) { Console.WriteLine($"Total Number of Custom Events: {events.Count}"); diff --git a/Samples/Platform SDK/IncidentManagerSample/IncidentData.cs b/Samples/Platform SDK/IncidentManagerSample/IncidentData.cs index 7265e00..85ad042 100644 --- a/Samples/Platform SDK/IncidentManagerSample/IncidentData.cs +++ b/Samples/Platform SDK/IncidentManagerSample/IncidentData.cs @@ -11,7 +11,7 @@ namespace Genetec.Dap.CodeSamples; using System.Collections.ObjectModel; using Sdk; -public class IncidentData +record IncidentData { public Guid InstanceGuid { get; set; } public double Latitude { get; set; } diff --git a/Samples/Platform SDK/SecurityManagerSample/Program.cs b/Samples/Platform SDK/SecurityManagerSample/Program.cs index 27f1223..a1ad5d3 100644 --- a/Samples/Platform SDK/SecurityManagerSample/Program.cs +++ b/Samples/Platform SDK/SecurityManagerSample/Program.cs @@ -15,7 +15,7 @@ namespace Genetec.Dap.CodeSamples; using Sdk.Entities; using Sdk.Queries; -internal class Program +class Program { static Program() => SdkResolver.Initialize(); diff --git a/Samples/Platform SDK/VideoUnitSample/Program.cs b/Samples/Platform SDK/VideoUnitSample/Program.cs index b6d6964..e0ff10f 100644 --- a/Samples/Platform SDK/VideoUnitSample/Program.cs +++ b/Samples/Platform SDK/VideoUnitSample/Program.cs @@ -20,7 +20,7 @@ namespace Genetec.Dap.CodeSamples; using Sdk.Workflows; using Sdk.Workflows.UnitManager; -internal class Program +class Program { static Program() => SdkResolver.Initialize(); diff --git a/Samples/Plugin SDK/CustomActionSample/CustomActionTypes.cs b/Samples/Plugin SDK/CustomActionSample/CustomActionTypes.cs index 6b5a007..c703a45 100644 --- a/Samples/Plugin SDK/CustomActionSample/CustomActionTypes.cs +++ b/Samples/Plugin SDK/CustomActionSample/CustomActionTypes.cs @@ -10,7 +10,7 @@ namespace Genetec.Dap.CodeSamples; using System; // The CustomActionTypes class contains the unique identifiers for the custom action types used in the sample. -public static class CustomActionTypes +static class CustomActionTypes { // TODO: Replace with your own unique custom action type GUID public static Guid LaunchEncoderCommand { get; } = new("CD273EDD-97F6-4F1F-A1B4-3A3145801323"); diff --git a/Samples/Plugin SDK/CustomActionSample/PluginTypes.cs b/Samples/Plugin SDK/CustomActionSample/PluginTypes.cs index a3ed60f..de32e79 100644 --- a/Samples/Plugin SDK/CustomActionSample/PluginTypes.cs +++ b/Samples/Plugin SDK/CustomActionSample/PluginTypes.cs @@ -10,7 +10,7 @@ namespace Genetec.Dap.CodeSamples; using System; // The PluginTypes class contains the unique identifiers for the plugin types used in the sample. -public static class PluginTypes +static class PluginTypes { // TODO: Replace with your own unique plugin type GUID public static Guid SamplePlugin { get; } = new("915A18DB-4DBE-48BB-8E0D-8A8A6BC0A077"); diff --git a/Samples/Plugin SDK/CustomReportSample/AsyncEnumerableExtensions.cs b/Samples/Plugin SDK/CustomReportSample/AsyncEnumerableExtensions.cs index e067b06..c237922 100644 --- a/Samples/Plugin SDK/CustomReportSample/AsyncEnumerableExtensions.cs +++ b/Samples/Plugin SDK/CustomReportSample/AsyncEnumerableExtensions.cs @@ -11,7 +11,7 @@ namespace Genetec.Dap.CodeSamples; using System.Runtime.CompilerServices; using System.Threading; -public static class AsyncEnumerableExtensions +static class AsyncEnumerableExtensions { /// /// Buffers the elements of the into chunks of a specified size. diff --git a/Samples/Plugin SDK/CustomReportSample/CustomReportId.cs b/Samples/Plugin SDK/CustomReportSample/CustomReportId.cs index 8e86ab6..12cbfe8 100644 --- a/Samples/Plugin SDK/CustomReportSample/CustomReportId.cs +++ b/Samples/Plugin SDK/CustomReportSample/CustomReportId.cs @@ -9,7 +9,7 @@ namespace Genetec.Dap.CodeSamples; using System; -public static class CustomReportId +static class CustomReportId { // Unique identifier for this custom report sample public static Guid Value { get; } = new("5923ECF7-E8BF-42D7-9E30-F14EECC49DBA"); // TODO: Replace this with your own unique custom report identifier diff --git a/Samples/Plugin SDK/CustomReportSample/Server/ReportHandlers/AccessControl/AccessControlReportHandler.cs b/Samples/Plugin SDK/CustomReportSample/Server/ReportHandlers/AccessControl/AccessControlReportHandler.cs index b5b8fc5..0e27801 100644 --- a/Samples/Plugin SDK/CustomReportSample/Server/ReportHandlers/AccessControl/AccessControlReportHandler.cs +++ b/Samples/Plugin SDK/CustomReportSample/Server/ReportHandlers/AccessControl/AccessControlReportHandler.cs @@ -14,7 +14,7 @@ namespace Genetec.Dap.CodeSamples.Server.ReportHandlers.AccessControl; using Genetec.Sdk.Entities; using Genetec.Sdk.Queries.AccessControl; -public class AccessControlReportHandler(IEngine engine, Role role) : ReportHandler(engine, role) +class AccessControlReportHandler(IEngine engine, Role role) : ReportHandler(engine, role) { protected override void FillDataRow(DataRow row, AccessControlReportRecord record) { diff --git a/Samples/Plugin SDK/CustomReportSample/Server/ReportHandlers/AccessControl/AccessControlReportRecord.cs b/Samples/Plugin SDK/CustomReportSample/Server/ReportHandlers/AccessControl/AccessControlReportRecord.cs index 402b2a3..c1fb12c 100644 --- a/Samples/Plugin SDK/CustomReportSample/Server/ReportHandlers/AccessControl/AccessControlReportRecord.cs +++ b/Samples/Plugin SDK/CustomReportSample/Server/ReportHandlers/AccessControl/AccessControlReportRecord.cs @@ -10,7 +10,7 @@ namespace Genetec.Dap.CodeSamples.Server.ReportHandlers.AccessControl; using System; using Genetec.Sdk; -public class AccessControlReportRecord +class AccessControlReportRecord { public DateTime Timestamp { get; set; } public EventType EventType { get; set; } diff --git a/Samples/Plugin SDK/CustomReportSample/Server/ReportHandlers/AccessControl/ZoneActivityRecord.cs b/Samples/Plugin SDK/CustomReportSample/Server/ReportHandlers/AccessControl/ZoneActivityRecord.cs index 6fe4d96..6f5024a 100644 --- a/Samples/Plugin SDK/CustomReportSample/Server/ReportHandlers/AccessControl/ZoneActivityRecord.cs +++ b/Samples/Plugin SDK/CustomReportSample/Server/ReportHandlers/AccessControl/ZoneActivityRecord.cs @@ -9,7 +9,7 @@ namespace Genetec.Dap.CodeSamples.Server.ReportHandlers.AccessControl; using System; -public class ZoneActivityRecord +class ZoneActivityRecord { public DateTime Timestamp { get; set; } public int EventType { get; set; } diff --git a/Samples/Plugin SDK/CustomReportSample/Server/ReportHandlers/AccessControl/ZoneActivityReportHandler.cs b/Samples/Plugin SDK/CustomReportSample/Server/ReportHandlers/AccessControl/ZoneActivityReportHandler.cs index 953199c..347e680 100644 --- a/Samples/Plugin SDK/CustomReportSample/Server/ReportHandlers/AccessControl/ZoneActivityReportHandler.cs +++ b/Samples/Plugin SDK/CustomReportSample/Server/ReportHandlers/AccessControl/ZoneActivityReportHandler.cs @@ -14,7 +14,7 @@ namespace Genetec.Dap.CodeSamples.Server.ReportHandlers.AccessControl; using Genetec.Sdk.Entities; using Genetec.Sdk.Queries; -public class ZoneActivityReportHandler(IEngine engine, Role role) : ReportHandler(engine, role) +class ZoneActivityReportHandler(IEngine engine, Role role) : ReportHandler(engine, role) { protected override async IAsyncEnumerable GetRecordsAsync(ZoneActivityQuery query) { diff --git a/Samples/Plugin SDK/CustomReportSample/Server/ReportHandlers/ActivityTrailsReportHandler.cs b/Samples/Plugin SDK/CustomReportSample/Server/ReportHandlers/ActivityTrailsReportHandler.cs index 5c77dd3..4ac9ae7 100644 --- a/Samples/Plugin SDK/CustomReportSample/Server/ReportHandlers/ActivityTrailsReportHandler.cs +++ b/Samples/Plugin SDK/CustomReportSample/Server/ReportHandlers/ActivityTrailsReportHandler.cs @@ -17,7 +17,7 @@ namespace Genetec.Dap.CodeSamples.Server.ReportHandlers; using Sdk.Plugin.Queries.Rows.Trails; using Sdk.Queries; -public class ActivityTrailsReportHandler(IEngine engine, Role role) : ReportHandler(engine, role) +class ActivityTrailsReportHandler(IEngine engine, Role role) : ReportHandler(engine, role) { protected override async Task ProcessBatch(DataTable table, IAsyncEnumerable batch) { diff --git a/Samples/Plugin SDK/CustomReportSample/Server/ReportHandlers/AuditTrailsReportHandler.cs b/Samples/Plugin SDK/CustomReportSample/Server/ReportHandlers/AuditTrailsReportHandler.cs index be89504..573099d 100644 --- a/Samples/Plugin SDK/CustomReportSample/Server/ReportHandlers/AuditTrailsReportHandler.cs +++ b/Samples/Plugin SDK/CustomReportSample/Server/ReportHandlers/AuditTrailsReportHandler.cs @@ -17,7 +17,7 @@ namespace Genetec.Dap.CodeSamples.Server.ReportHandlers; using Sdk.Plugin.Queries.Rows.Trails; using Sdk.Queries; -public class AuditTrailsReportHandler(IEngine engine, Role role) : ReportHandler(engine, role) +class AuditTrailsReportHandler(IEngine engine, Role role) : ReportHandler(engine, role) { protected override async Task ProcessBatch(DataTable table, IAsyncEnumerable batch) { @@ -62,12 +62,12 @@ protected override async IAsyncEnumerable GetRecordsAsync(AuditTr foreach ((AuditTrailModificationType ModificationType, AuditFormat Format, string OldValue, string NewValue, string Description, DateTime Timestamp, EntityType EntityType, string EntityName, string InitiatorName) record in records) { - yield return new AuditTrailRow(Engine) - .SetAuditAttributes(record.ModificationType, record.Format) - .SetModification(record.OldValue, record.NewValue, record.Description, record.Timestamp) - .SetEntity(record.EntityType, record.EntityName) - .SetInitiator(EntityType.User, record.InitiatorName) - .SetInitiatorApplication(ApplicationType.SecurityDesk, "Security Desk", Environment.MachineName); + yield return new AuditTrailRow(Engine) + .SetAuditAttributes(record.ModificationType, record.Format) + .SetModification(record.OldValue, record.NewValue, record.Description, record.Timestamp) + .SetEntity(record.EntityType, record.EntityName) + .SetInitiator(EntityType.User, record.InitiatorName) + .SetInitiatorApplication(ApplicationType.SecurityDesk, "Security Desk", Environment.MachineName); } } } \ No newline at end of file diff --git a/Samples/Plugin SDK/CustomReportSample/Server/ReportHandlers/Custom/CustomReportHandler.cs b/Samples/Plugin SDK/CustomReportSample/Server/ReportHandlers/Custom/CustomReportHandler.cs index ff3930a..6f39980 100644 --- a/Samples/Plugin SDK/CustomReportSample/Server/ReportHandlers/Custom/CustomReportHandler.cs +++ b/Samples/Plugin SDK/CustomReportSample/Server/ReportHandlers/Custom/CustomReportHandler.cs @@ -17,7 +17,7 @@ namespace Genetec.Dap.CodeSamples.Server.ReportHandlers.Custom; using Sdk.Entities; using Sdk.Queries; -public class CustomReportHandler(IEngine engine, Role role) : ReportHandler(engine, role) +class CustomReportHandler(IEngine engine, Role role) : ReportHandler(engine, role) { // Ensure that the custom report handler only handles the custom report with the specified identifier protected override bool IsQuerySupported(CustomQuery query) diff --git a/Samples/Plugin SDK/CustomReportSample/Server/ReportHandlers/HealthEvent.cs b/Samples/Plugin SDK/CustomReportSample/Server/ReportHandlers/HealthEvent.cs index 3b94ba6..303f1a8 100644 --- a/Samples/Plugin SDK/CustomReportSample/Server/ReportHandlers/HealthEvent.cs +++ b/Samples/Plugin SDK/CustomReportSample/Server/ReportHandlers/HealthEvent.cs @@ -9,7 +9,7 @@ namespace Genetec.Dap.CodeSamples.Server.ReportHandlers; using System; -public class HealthEvent +class HealthEvent { public int HealthEventId { get; set; } public int EventSourceTypeId { get; set; } diff --git a/Samples/Plugin SDK/CustomReportSample/Server/ReportHandlers/HealthEventsReportHandler.cs b/Samples/Plugin SDK/CustomReportSample/Server/ReportHandlers/HealthEventsReportHandler.cs index 6a204e0..cde398b 100644 --- a/Samples/Plugin SDK/CustomReportSample/Server/ReportHandlers/HealthEventsReportHandler.cs +++ b/Samples/Plugin SDK/CustomReportSample/Server/ReportHandlers/HealthEventsReportHandler.cs @@ -14,7 +14,7 @@ namespace Genetec.Dap.CodeSamples.Server.ReportHandlers; using Genetec.Sdk.Entities; using Genetec.Sdk.Queries.HealthMonitoring; -public class HealthEventsReportHandler(IEngine engine, Role role) : ReportHandler(engine, role) +class HealthEventsReportHandler(IEngine engine, Role role) : ReportHandler(engine, role) { protected override void FillDataRow(DataRow row, HealthEvent record) { diff --git a/Samples/Plugin SDK/CustomReportSample/Server/ReportHandlers/HealthStatistics.cs b/Samples/Plugin SDK/CustomReportSample/Server/ReportHandlers/HealthStatistics.cs index 779edd4..9e93ae3 100644 --- a/Samples/Plugin SDK/CustomReportSample/Server/ReportHandlers/HealthStatistics.cs +++ b/Samples/Plugin SDK/CustomReportSample/Server/ReportHandlers/HealthStatistics.cs @@ -9,7 +9,7 @@ namespace Genetec.Dap.CodeSamples.Server.ReportHandlers; using System; -public class HealthStatistics +record HealthStatistics { public int FailureCount { get; set; } public int RtpPacketLoss { get; set; } diff --git a/Samples/Plugin SDK/CustomReportSample/Server/ReportHandlers/HealthStatisticsReportHandler.cs b/Samples/Plugin SDK/CustomReportSample/Server/ReportHandlers/HealthStatisticsReportHandler.cs index 01bc54f..bcacccb 100644 --- a/Samples/Plugin SDK/CustomReportSample/Server/ReportHandlers/HealthStatisticsReportHandler.cs +++ b/Samples/Plugin SDK/CustomReportSample/Server/ReportHandlers/HealthStatisticsReportHandler.cs @@ -14,7 +14,7 @@ namespace Genetec.Dap.CodeSamples.Server.ReportHandlers; using Genetec.Sdk.Entities; using Genetec.Sdk.Queries.HealthMonitoring; -public class HealthStatisticsReportHandler(IEngine engine, Role role) : ReportHandler(engine, role) +class HealthStatisticsReportHandler(IEngine engine, Role role) : ReportHandler(engine, role) { protected override void FillDataRow(DataRow row, HealthStatistics record) { diff --git a/Samples/Plugin SDK/CustomReportSample/Server/ReportHandlers/IntrusionDetectionRecord.cs b/Samples/Plugin SDK/CustomReportSample/Server/ReportHandlers/IntrusionDetectionRecord.cs index 7cf0b88..19df709 100644 --- a/Samples/Plugin SDK/CustomReportSample/Server/ReportHandlers/IntrusionDetectionRecord.cs +++ b/Samples/Plugin SDK/CustomReportSample/Server/ReportHandlers/IntrusionDetectionRecord.cs @@ -9,7 +9,7 @@ namespace Genetec.Dap.CodeSamples.Server.ReportHandlers; using System; -public class IntrusionDetectionRecord +record class IntrusionDetectionRecord { public DateTime Timestamp { get; set; } public int EventType { get; set; } diff --git a/Samples/Plugin SDK/CustomReportSample/Server/ReportHandlers/IntrusionDetectionReportHandler.cs b/Samples/Plugin SDK/CustomReportSample/Server/ReportHandlers/IntrusionDetectionReportHandler.cs index 115255b..f6e3992 100644 --- a/Samples/Plugin SDK/CustomReportSample/Server/ReportHandlers/IntrusionDetectionReportHandler.cs +++ b/Samples/Plugin SDK/CustomReportSample/Server/ReportHandlers/IntrusionDetectionReportHandler.cs @@ -14,7 +14,7 @@ namespace Genetec.Dap.CodeSamples.Server.ReportHandlers; using Genetec.Sdk.Entities; using Genetec.Sdk.Queries.IntrusionDetection; -public class IntrusionDetectionReportHandler(IEngine engine, Role role) : ReportHandler(engine, role) +class IntrusionDetectionReportHandler(IEngine engine, Role role) : ReportHandler(engine, role) { protected override void FillDataRow(DataRow row, IntrusionDetectionRecord record) { diff --git a/Samples/Plugin SDK/CustomReportSample/Server/ReportHandlers/Video/VideoEvent.cs b/Samples/Plugin SDK/CustomReportSample/Server/ReportHandlers/Video/VideoEvent.cs index de245ab..d746a06 100644 --- a/Samples/Plugin SDK/CustomReportSample/Server/ReportHandlers/Video/VideoEvent.cs +++ b/Samples/Plugin SDK/CustomReportSample/Server/ReportHandlers/Video/VideoEvent.cs @@ -10,7 +10,7 @@ namespace Genetec.Dap.CodeSamples.Server.ReportHandlers.Video; using System; using Genetec.Sdk; -public class VideoEvent +record VideoEvent { public Guid CameraGuid { get; set; } public Guid ArchiveSourceGuid { get; set; } diff --git a/Samples/Plugin SDK/CustomReportSample/Server/ReportHandlers/Video/VideoEventReportHandler.cs b/Samples/Plugin SDK/CustomReportSample/Server/ReportHandlers/Video/VideoEventReportHandler.cs index 9eaaceb..2d19425 100644 --- a/Samples/Plugin SDK/CustomReportSample/Server/ReportHandlers/Video/VideoEventReportHandler.cs +++ b/Samples/Plugin SDK/CustomReportSample/Server/ReportHandlers/Video/VideoEventReportHandler.cs @@ -14,39 +14,39 @@ namespace Genetec.Dap.CodeSamples.Server.ReportHandlers.Video; using Genetec.Sdk.Entities; using Genetec.Sdk.Queries.Video; -public class VideoEventReportHandler(IEngine engine, Role role) : ReportHandler(engine, role) +class VideoEventReportHandler(IEngine engine, Role role) : ReportHandler(engine, role) { protected override void FillDataRow(DataRow row, VideoEvent record) { - row[VideoEventQuery.CameraGuidColumnName] = record.CameraGuid; - row[VideoEventQuery.ArchiveSourceGuidColumnName] = record.ArchiveSourceGuid; - row[VideoEventQuery.EventTimeColumnName] = record.EventTime; - row[VideoEventQuery.EventTypeColumnName] = (uint)record.EventType; - row[VideoEventQuery.ValueColumnName] = record.Value; - row[VideoEventQuery.NotesColumnName] = record.Notes; - row[VideoEventQuery.XmlDataColumnName] = record.XmlData; - row[VideoEventQuery.CapabilitiesColumnName] = record.Capabilities; - row[VideoEventQuery.TimeZoneColumnName] = record.TimeZone; - row[VideoEventQuery.ThumbnailColumnName] = record.Thumbnail; - } + row[VideoEventQuery.CameraGuidColumnName] = record.CameraGuid; + row[VideoEventQuery.ArchiveSourceGuidColumnName] = record.ArchiveSourceGuid; + row[VideoEventQuery.EventTimeColumnName] = record.EventTime; + row[VideoEventQuery.EventTypeColumnName] = (uint)record.EventType; + row[VideoEventQuery.ValueColumnName] = record.Value; + row[VideoEventQuery.NotesColumnName] = record.Notes; + row[VideoEventQuery.XmlDataColumnName] = record.XmlData; + row[VideoEventQuery.CapabilitiesColumnName] = record.Capabilities; + row[VideoEventQuery.TimeZoneColumnName] = record.TimeZone; + row[VideoEventQuery.ThumbnailColumnName] = record.Thumbnail; + } protected override async IAsyncEnumerable GetRecordsAsync(VideoEventQuery query) { - // TODO: Implement the actual data retrieval logic here. + // TODO: Implement the actual data retrieval logic here. - // This method should: - // 1. Parse the VideoEventQuery to determine the query parameters - // (e.g., time range, cameras, event types) - // 2. Use these parameters to fetch relevant records from your data source - // (e.g., database, external API) - // 3. Yield return each VideoEvent as it's retrieved, - // allowing for efficient streaming of large datasets + // This method should: + // 1. Parse the VideoEventQuery to determine the query parameters + // (e.g., time range, cameras, event types) + // 2. Use these parameters to fetch relevant records from your data source + // (e.g., database, external API) + // 3. Yield return each VideoEvent as it's retrieved, + // allowing for efficient streaming of large datasets - // Consider implementing batched database queries or paginated API calls for large datasets - // to avoid loading all data into memory at once. + // Consider implementing batched database queries or paginated API calls for large datasets + // to avoid loading all data into memory at once. - // For now, we're using placeholder code to demonstrate the structure: - await Task.Yield(); // Simulates asynchronous work (remove in actual implementation) - yield break; // No records returned in this example (remove in actual implementation) - } + // For now, we're using placeholder code to demonstrate the structure: + await Task.Yield(); // Simulates asynchronous work (remove in actual implementation) + yield break; // No records returned in this example (remove in actual implementation) + } } \ No newline at end of file diff --git a/Samples/Plugin SDK/PluginConfigurationSample/Client/CustomConfigPage.cs b/Samples/Plugin SDK/PluginConfigurationSample/Client/CustomConfigPage.cs index 779d7de..6d62d6c 100644 --- a/Samples/Plugin SDK/PluginConfigurationSample/Client/CustomConfigPage.cs +++ b/Samples/Plugin SDK/PluginConfigurationSample/Client/CustomConfigPage.cs @@ -19,7 +19,7 @@ namespace Genetec.Dap.CodeSamples.Client; /// Represents a custom configuration page for a specific role type. /// This class extends ConfigPage to provide custom configuration options for a role. /// -internal class CustomConfigPage : ConfigPage +class CustomConfigPage : ConfigPage { // Configuration object to handle serialization and deserialization private readonly RoleConfiguration m_configuration = new(); @@ -29,7 +29,7 @@ internal class CustomConfigPage : ConfigPage private int m_port; private SecureString m_password; private SecureString m_userName; - + private Role m_role; // The role entity being configured protected override EntityType EntityType => EntityType.Role; // Only show this page for roles diff --git a/Samples/Plugin SDK/PluginConfigurationSample/EntityExtensions.cs b/Samples/Plugin SDK/PluginConfigurationSample/EntityExtensions.cs index a3b6715..5322ed7 100644 --- a/Samples/Plugin SDK/PluginConfigurationSample/EntityExtensions.cs +++ b/Samples/Plugin SDK/PluginConfigurationSample/EntityExtensions.cs @@ -16,7 +16,7 @@ namespace Genetec.Dap.CodeSamples; /// /// Provides extension methods for the Entity class and its derivatives to enhance their functionality with reactive programming patterns. /// -public static class EntityExtensions +static class EntityExtensions { /// /// Creates an observable sequence from the FieldsChanged event of an entity. diff --git a/Samples/Plugin SDK/PluginConfigurationSample/PluginTypes.cs b/Samples/Plugin SDK/PluginConfigurationSample/PluginTypes.cs index 71b4959..99e7f25 100644 --- a/Samples/Plugin SDK/PluginConfigurationSample/PluginTypes.cs +++ b/Samples/Plugin SDK/PluginConfigurationSample/PluginTypes.cs @@ -10,7 +10,7 @@ namespace Genetec.Dap.CodeSamples; using System; // The PluginTypes class contains the unique identifiers for the plugin types used in the sample. -public static class PluginTypes +static class PluginTypes { // TODO: Replace with your own unique plugin type GUID public static Guid SamplePlugin { get; } = new("8E43EECB-0DCC-4A10-A365-AE278B1F35B0"); diff --git a/Samples/Plugin SDK/PluginDatabaseSample/SampleDatabaseManager.cs b/Samples/Plugin SDK/PluginDatabaseSample/SampleDatabaseManager.cs index 382e397..25c6495 100644 --- a/Samples/Plugin SDK/PluginDatabaseSample/SampleDatabaseManager.cs +++ b/Samples/Plugin SDK/PluginDatabaseSample/SampleDatabaseManager.cs @@ -19,7 +19,7 @@ namespace Genetec.Dap.CodeSamples; /// Manages database operations for the plugin, including schema creation, cleanup, and upgrades. /// Implements DatabaseManager for core functionality and IDisposable for resource management. /// -public class SampleDatabaseManager : DatabaseManager, IDisposable +class SampleDatabaseManager : DatabaseManager, IDisposable { private const string LogsCleanupThreshold = "LogThreshold"; diff --git a/Samples/Shared/SdkResolver.cs b/Samples/Shared/SdkResolver.cs index f51faea..ef83607 100644 --- a/Samples/Shared/SdkResolver.cs +++ b/Samples/Shared/SdkResolver.cs @@ -77,6 +77,7 @@ private static Assembly OnAssemblyResolve(object sender, ResolveEventArgs args) } catch { + // ignored } } diff --git a/Samples/Workspace SDK/BackgroundProcessSample/BackgroundProcessPageViewModel.cs b/Samples/Workspace SDK/BackgroundProcessSample/BackgroundProcessPageViewModel.cs index 6289262..0cfd992 100644 --- a/Samples/Workspace SDK/BackgroundProcessSample/BackgroundProcessPageViewModel.cs +++ b/Samples/Workspace SDK/BackgroundProcessSample/BackgroundProcessPageViewModel.cs @@ -15,10 +15,10 @@ namespace Genetec.Dap.CodeSamples; using Prism.Mvvm; using static System.String; -public class BackgroundProcessPageViewModel : BindableBase +class BackgroundProcessPageViewModel : BindableBase { private readonly IBackgroundProcessNotificationService m_service; - + private string m_notificationMessage; public BackgroundProcessPageViewModel(IBackgroundProcessNotificationService service) diff --git a/Samples/Workspace SDK/BadgePrinterSample/SampleBadgePrinter.cs b/Samples/Workspace SDK/BadgePrinterSample/SampleBadgePrinter.cs index 0ce15d2..91e3949 100644 --- a/Samples/Workspace SDK/BadgePrinterSample/SampleBadgePrinter.cs +++ b/Samples/Workspace SDK/BadgePrinterSample/SampleBadgePrinter.cs @@ -13,7 +13,7 @@ namespace Genetec.Dap.CodeSamples; using Genetec.Sdk.Entities; using Genetec.Sdk.Workspace.Components.BadgePrinter; -internal class SampleBadgePrinter : BadgePrinter +class SampleBadgePrinter : BadgePrinter { public override string Name => "Badge Printer Sample"; diff --git a/Samples/Workspace SDK/CardholderCredentialReaderSample/CredentialFormatComparer.cs b/Samples/Workspace SDK/CardholderCredentialReaderSample/CredentialFormatComparer.cs index 4cb2b30..2a09fb2 100644 --- a/Samples/Workspace SDK/CardholderCredentialReaderSample/CredentialFormatComparer.cs +++ b/Samples/Workspace SDK/CardholderCredentialReaderSample/CredentialFormatComparer.cs @@ -10,7 +10,7 @@ namespace Genetec.Dap.CodeSamples; using System.Collections.Generic; using Sdk.Credentials; -public class CredentialFormatComparer : IEqualityComparer +class CredentialFormatComparer : IEqualityComparer { public bool Equals(CredentialFormat x, CredentialFormat y) { diff --git a/Samples/Workspace SDK/CardholderFieldsExtractorSample/VCard.cs b/Samples/Workspace SDK/CardholderFieldsExtractorSample/VCard.cs index 43cf3ea..7c461a6 100644 --- a/Samples/Workspace SDK/CardholderFieldsExtractorSample/VCard.cs +++ b/Samples/Workspace SDK/CardholderFieldsExtractorSample/VCard.cs @@ -10,15 +10,15 @@ namespace Genetec.Dap.CodeSamples; using System.Collections.Generic; using System.Windows.Media; -public class VCard +class VCard { public string FirstName { get; set; } - + public string LastName { get; set; } - + public List Emails { get; } = []; - + public string Note { get; set; } - + public ImageSource Picture { get; set; } } \ No newline at end of file diff --git a/Samples/Workspace SDK/CardholderFieldsExtractorSample/VCardReader.cs b/Samples/Workspace SDK/CardholderFieldsExtractorSample/VCardReader.cs index e1b4201..f2c1a3f 100644 --- a/Samples/Workspace SDK/CardholderFieldsExtractorSample/VCardReader.cs +++ b/Samples/Workspace SDK/CardholderFieldsExtractorSample/VCardReader.cs @@ -15,7 +15,7 @@ namespace Genetec.Dap.CodeSamples; using System.Windows.Media; using System.Windows.Media.Imaging; -public class VCardReader +class VCardReader { public static VCard ReadVCard(string filePath) { diff --git a/Samples/Workspace SDK/ConfigPageSample/AedUnitCustomEntityType.cs b/Samples/Workspace SDK/ConfigPageSample/AedUnitCustomEntityType.cs index a6e239d..e27599b 100644 --- a/Samples/Workspace SDK/ConfigPageSample/AedUnitCustomEntityType.cs +++ b/Samples/Workspace SDK/ConfigPageSample/AedUnitCustomEntityType.cs @@ -10,7 +10,7 @@ namespace Genetec.Dap.CodeSamples; using System; // TODO: Update the GUID in this class with your own custom entity type ID -public static class AedUnitCustomEntityType +static class AedUnitCustomEntityType { public static Guid Id { get; } = new("8385D04C-F04A-4125-81E9-D1C66AFDE572"); } \ No newline at end of file diff --git a/Samples/Workspace SDK/ConfigPageSample/AedUnitCustomPrivilege.cs b/Samples/Workspace SDK/ConfigPageSample/AedUnitCustomPrivilege.cs index e60c31a..e63291a 100644 --- a/Samples/Workspace SDK/ConfigPageSample/AedUnitCustomPrivilege.cs +++ b/Samples/Workspace SDK/ConfigPageSample/AedUnitCustomPrivilege.cs @@ -11,7 +11,7 @@ namespace Genetec.Dap.CodeSamples; using Sdk; // TODO: Update the GUIDs in this class with your own SDK privilege IDs -public static class AedUnitCustomPrivilege +static class AedUnitCustomPrivilege { public static SdkPrivilege View { get; } = new(new Guid("0896B350-7225-4A53-8DDC-E8365CAE456E")); diff --git a/Samples/Workspace SDK/ConfigPageSample/AedUnitInformation.cs b/Samples/Workspace SDK/ConfigPageSample/AedUnitInformation.cs index 14093ca..5029cf3 100644 --- a/Samples/Workspace SDK/ConfigPageSample/AedUnitInformation.cs +++ b/Samples/Workspace SDK/ConfigPageSample/AedUnitInformation.cs @@ -12,21 +12,21 @@ namespace Genetec.Dap.CodeSamples; using System.Runtime.Serialization; using System.Xml; -[DataContract(Namespace = "")] +[DataContract] public class AedUnitInformation { private static readonly DataContractSerializer s_serializer = new(typeof(AedUnitInformation)); - [DataMember] + [DataMember] public DateTime LastInspectionDate { get; set; } - [DataMember] + [DataMember] public DateTime NextScheduledMaintenance { get; set; } - [DataMember] + [DataMember] public DateTime BatteryExpirationDate { get; set; } - [DataMember] + [DataMember] public DateTime PadExpirationDate { get; set; } // Deserialize the data from an XML string diff --git a/Samples/Workspace SDK/ConfigPageSample/CustomConfigPage.cs b/Samples/Workspace SDK/ConfigPageSample/CustomConfigPage.cs index a374e80..cb9081a 100644 --- a/Samples/Workspace SDK/ConfigPageSample/CustomConfigPage.cs +++ b/Samples/Workspace SDK/ConfigPageSample/CustomConfigPage.cs @@ -14,7 +14,7 @@ namespace Genetec.Dap.CodeSamples; using Sdk.Entities; using Sdk.Workspace.Pages; -internal class CustomConfigPage : ConfigPage +class CustomConfigPage : ConfigPage { private DateTime m_batteryExpirationDate; diff --git a/Samples/Workspace SDK/ControlsSample/Chart/ChartSampleViewModel.cs b/Samples/Workspace SDK/ControlsSample/Chart/ChartSampleViewModel.cs index fa61b2f..0c83adb 100644 --- a/Samples/Workspace SDK/ControlsSample/Chart/ChartSampleViewModel.cs +++ b/Samples/Workspace SDK/ControlsSample/Chart/ChartSampleViewModel.cs @@ -14,7 +14,7 @@ namespace Genetec.Dap.CodeSamples; -public class ChartSampleViewModel : BindableBase +class ChartSampleViewModel : BindableBase { private readonly Dictionary m_chartData; private readonly string[] m_labels = ["Label 1", "Label 2", "Label 3"]; diff --git a/Samples/Workspace SDK/ControlsSample/CustomTaskCategories.cs b/Samples/Workspace SDK/ControlsSample/CustomTaskCategories.cs index 9abb3a9..3c75933 100644 --- a/Samples/Workspace SDK/ControlsSample/CustomTaskCategories.cs +++ b/Samples/Workspace SDK/ControlsSample/CustomTaskCategories.cs @@ -9,7 +9,7 @@ namespace Genetec.Dap.CodeSamples; using System; -public static class CustomTaskCategories +static class CustomTaskCategories { public static Guid SdkSamples = new("4F72E1E7-DEA8-4DA3-A0C6-90A37D37F146"); } \ No newline at end of file diff --git a/Samples/Workspace SDK/EventExtenderSample/FieldName.cs b/Samples/Workspace SDK/EventExtenderSample/FieldName.cs index 3b6fc9d..ca620ae 100644 --- a/Samples/Workspace SDK/EventExtenderSample/FieldName.cs +++ b/Samples/Workspace SDK/EventExtenderSample/FieldName.cs @@ -7,7 +7,7 @@ namespace Genetec.Dap.CodeSamples; -public static class FieldName +static class FieldName { public const string Text = "Text"; public const string Numeric = "Numeric"; diff --git a/Samples/Workspace SDK/ImageExtractorSample/VCard.cs b/Samples/Workspace SDK/ImageExtractorSample/VCard.cs index 43cf3ea..7c461a6 100644 --- a/Samples/Workspace SDK/ImageExtractorSample/VCard.cs +++ b/Samples/Workspace SDK/ImageExtractorSample/VCard.cs @@ -10,15 +10,15 @@ namespace Genetec.Dap.CodeSamples; using System.Collections.Generic; using System.Windows.Media; -public class VCard +class VCard { public string FirstName { get; set; } - + public string LastName { get; set; } - + public List Emails { get; } = []; - + public string Note { get; set; } - + public ImageSource Picture { get; set; } } \ No newline at end of file diff --git a/Samples/Workspace SDK/ImageExtractorSample/VCardReader.cs b/Samples/Workspace SDK/ImageExtractorSample/VCardReader.cs index e1b4201..f2c1a3f 100644 --- a/Samples/Workspace SDK/ImageExtractorSample/VCardReader.cs +++ b/Samples/Workspace SDK/ImageExtractorSample/VCardReader.cs @@ -15,7 +15,7 @@ namespace Genetec.Dap.CodeSamples; using System.Windows.Media; using System.Windows.Media.Imaging; -public class VCardReader +class VCardReader { public static VCard ReadVCard(string filePath) { diff --git a/Samples/Workspace SDK/OptionsExtensionSample/SampleOptionsData.cs b/Samples/Workspace SDK/OptionsExtensionSample/SampleOptionsData.cs index 5f0e7ea..2ee9d66 100644 --- a/Samples/Workspace SDK/OptionsExtensionSample/SampleOptionsData.cs +++ b/Samples/Workspace SDK/OptionsExtensionSample/SampleOptionsData.cs @@ -13,7 +13,7 @@ namespace Genetec.Dap.CodeSamples; using System.Text; using System.Windows.Media; -[DataContract(Namespace = "")] +[DataContract] public class SampleOptionsData { [DataMember] @@ -30,7 +30,7 @@ public class SampleOptionsData public static SampleOptionsData Deserialize(string data) { - if (string.IsNullOrEmpty(data)) + if (string.IsNullOrEmpty(data)) return new SampleOptionsData(); using var stream = new MemoryStream(Encoding.UTF8.GetBytes(data)); diff --git a/Samples/Workspace SDK/ReportExporterSample/AggregateReportExporter.cs b/Samples/Workspace SDK/ReportExporterSample/AggregateReportExporter.cs index 061e234..fd383fc 100644 --- a/Samples/Workspace SDK/ReportExporterSample/AggregateReportExporter.cs +++ b/Samples/Workspace SDK/ReportExporterSample/AggregateReportExporter.cs @@ -12,7 +12,7 @@ namespace Genetec.Dap.CodeSamples; using System.Linq; using Genetec.Sdk.ReportExport; -public class AggregateReportExporter(params ReportExporter[] exporters) : ReportExporter +class AggregateReportExporter(params ReportExporter[] exporters) : ReportExporter { private readonly List m_exporters = exporters.ToList(); diff --git a/Samples/Workspace SDK/ReportExporterSample/CsvReportExporter.cs b/Samples/Workspace SDK/ReportExporterSample/CsvReportExporter.cs index a1ecb87..800fdd3 100644 --- a/Samples/Workspace SDK/ReportExporterSample/CsvReportExporter.cs +++ b/Samples/Workspace SDK/ReportExporterSample/CsvReportExporter.cs @@ -14,7 +14,7 @@ namespace Genetec.Dap.CodeSamples; using System.Linq; using Sdk.ReportExport; -public class CsvReportExporter(TextWriter writer) : ReportExporter +class CsvReportExporter(TextWriter writer) : ReportExporter { private bool m_headerWritten; diff --git a/Samples/Workspace SDK/ReportExporterSample/HtmlReportExporter.cs b/Samples/Workspace SDK/ReportExporterSample/HtmlReportExporter.cs index 96a1722..42c6e83 100644 --- a/Samples/Workspace SDK/ReportExporterSample/HtmlReportExporter.cs +++ b/Samples/Workspace SDK/ReportExporterSample/HtmlReportExporter.cs @@ -12,7 +12,7 @@ namespace Genetec.Dap.CodeSamples; using System.IO; using Genetec.Sdk.ReportExport; -public class HtmlReportExporter : ReportExporter +class HtmlReportExporter : ReportExporter { private readonly TextWriter m_writer; private bool m_tableStarted; diff --git a/Samples/Workspace SDK/ReportExporterSample/JsonReportExporter.cs b/Samples/Workspace SDK/ReportExporterSample/JsonReportExporter.cs index 951473b..7b81a97 100644 --- a/Samples/Workspace SDK/ReportExporterSample/JsonReportExporter.cs +++ b/Samples/Workspace SDK/ReportExporterSample/JsonReportExporter.cs @@ -12,7 +12,7 @@ namespace Genetec.Dap.CodeSamples; using Newtonsoft.Json; using Sdk.ReportExport; -public class JsonReportExporter : ReportExporter +class JsonReportExporter : ReportExporter { private readonly TextWriter m_writer; diff --git a/Samples/Workspace SDK/ReportExporterSample/MarkdownReportExporter.cs b/Samples/Workspace SDK/ReportExporterSample/MarkdownReportExporter.cs index 1d4f162..8275e58 100644 --- a/Samples/Workspace SDK/ReportExporterSample/MarkdownReportExporter.cs +++ b/Samples/Workspace SDK/ReportExporterSample/MarkdownReportExporter.cs @@ -13,7 +13,7 @@ namespace Genetec.Dap.CodeSamples; using System.Linq; using Sdk.ReportExport; -public class MarkdownReportExporter(TextWriter writer) : ReportExporter +class MarkdownReportExporter(TextWriter writer) : ReportExporter { public override QueryExportResult OnDataReady(QueryResultsBlock dataBlock) { diff --git a/Samples/Workspace SDK/ReportExporterSample/XmlReportExporter.cs b/Samples/Workspace SDK/ReportExporterSample/XmlReportExporter.cs index 0a8f653..3298798 100644 --- a/Samples/Workspace SDK/ReportExporterSample/XmlReportExporter.cs +++ b/Samples/Workspace SDK/ReportExporterSample/XmlReportExporter.cs @@ -13,7 +13,7 @@ namespace Genetec.Dap.CodeSamples; using Sdk.ReportExport; using System.Xml; -public class XmlReportExporter(TextWriter textWriter) : ReportExporter +class XmlReportExporter(TextWriter textWriter) : ReportExporter { private readonly DataTable m_dataTable = new("Results"); private readonly XmlWriter m_xmlWriter = XmlWriter.Create(textWriter, new XmlWriterSettings { Indent = true }); From e628ee7cae2a1915a9aa34a1cb65922105ea3395 Mon Sep 17 00:00:00 2001 From: Andre Lafleur Date: Sat, 21 Sep 2024 18:49:11 +0800 Subject: [PATCH 12/22] Update C# LangVersion to 12 in all .csproj files Updated the LangVersion property from 10 to 12 in multiple .csproj files. This change is applied to both Debug and Release configurations. The affected project files include: - FileCryptingManagerSample.csproj - MediaFileSample.csproj - OverlaySample.csproj - PlaybackSequenceQuerierSample.csproj - PlaybackStreamReaderSample.csproj - PtzCoordinatesManagerSample.csproj - VideoExportSample.csproj - VideoSourceFilterSample.csproj - AccessControlRawEventQuerySample.csproj - AccessControlReportQuerySample.csproj - AccessControlUnitManagerSample.csproj - AccessControlUnitSample.csproj - AccessEventMonitoringSample.csproj - AccessVerifierSample.csproj - ActivityTrailsSample.csproj - AlarmActivityQuerySample.csproj - AlarmMonitoringSample.csproj - AuditTrailsSample.csproj - CameraConfigurationSample.csproj - CameraSample.csproj - CopyConfiguratonSample.csproj - CustomEntitySample.csproj - CustomEventSample.csproj - CustomFieldSample.csproj - DiagnosticServerSample.csproj - DisplayInTileSample.csproj - CustomActionSample.csproj - CustomReportSample.csproj - PluginConfigurationSample.csproj - BackgroundProcessSample.csproj - BadgePrinterSample.csproj - CardholderCredentialReaderSample.csproj - CardholderFieldsExtractorSample.csproj - CommandManagerSample.csproj - ConfigPageSample.csproj - ControlsSample.csproj - CredentialBuilderSample.csproj - CredentialReaderSample.csproj - DashboardWidgetSample.csproj - ImageExtractorSample.csproj - OptionsExtensionSample.csproj - PageTaskSample.csproj - ReportExporterSample.csproj - TaskSample.csproj - TilePropertiesSample.csproj - TileViewSample.csproj - TileWidgetSample.csproj - TimelineProviderSample.csproj --- .../FileCryptingManagerSample.csproj | 4 ++-- Samples/Media SDK/MediaFileSample/MediaFileSample.csproj | 4 ++-- Samples/Media SDK/OverlaySample/OverlaySample.csproj | 4 ++-- .../PlaybackSequenceQuerierSample.csproj | 4 ++-- .../PlaybackStreamReaderSample.csproj | 4 ++-- .../PtzCoordinatesManagerSample.csproj | 4 ++-- Samples/Media SDK/VideoExportSample/VideoExportSample.csproj | 4 ++-- .../VideoSourceFilterSample/VideoSourceFilterSample.csproj | 4 ++-- .../AccessControlRawEventQuerySample.csproj | 4 ++-- .../AccessControlReportQuerySample.csproj | 4 ++-- .../AccessControlUnitManagerSample.csproj | 4 ++-- .../AccessControlUnitSample/AccessControlUnitSample.csproj | 4 ++-- .../AccessEventMonitoringSample.csproj | 4 ++-- .../AccessVerifierSample/AccessVerifierSample.csproj | 4 ++-- .../ActivityTrailsSample/ActivityTrailsSample.csproj | 4 ++-- .../AlarmActivityQuerySample/AlarmActivityQuerySample.csproj | 4 ++-- .../AlarmMonitoringSample/AlarmMonitoringSample.csproj | 4 ++-- .../Platform SDK/AuditTrailsSample/AuditTrailsSample.csproj | 4 ++-- .../CameraConfigurationSample.csproj | 4 ++-- Samples/Platform SDK/CameraSample/CameraSample.csproj | 4 ++-- .../CopyConfiguratonSample/CopyConfiguratonSample.csproj | 4 ++-- .../Platform SDK/CustomEntitySample/CustomEntitySample.csproj | 4 ++-- .../Platform SDK/CustomEventSample/CustomEventSample.csproj | 4 ++-- .../Platform SDK/CustomFieldSample/CustomFieldSample.csproj | 4 ++-- .../DiagnosticServerSample/DiagnosticServerSample.csproj | 4 ++-- .../DisplayInTileSample/DisplayInTileSample.csproj | 4 ++-- .../Platform SDK/EntityCacheSample/EntityCacheSample.csproj | 4 ++-- .../EntityCertificatesManagerSample.csproj | 4 ++-- .../EntityMappingSample/EntityMappingSample.csproj | 4 ++-- .../EventMonitoringSample/EventMonitoringSample.csproj | 4 ++-- .../EventToActionSample/EventToActionSample.csproj | 4 ++-- .../IncidentManagerSample/IncidentManagerSample.csproj | 4 ++-- .../LicenseManagerSample/LicenseManagerSample.csproj | 4 ++-- Samples/Platform SDK/LoggerSample/LoggerSample.csproj | 4 ++-- .../Platform SDK/LoginManagerSample/LoginManagerSample.csproj | 4 ++-- Samples/Platform SDK/MacroSample/MacroSample.csproj | 4 ++-- .../PeopleCountingSample/PeopleCountingSample.csproj | 4 ++-- Samples/Platform SDK/PlaySoundSample/PlaySoundSample.csproj | 4 ++-- Samples/Platform SDK/RaiseEventSample/RaiseEventSample.csproj | 4 ++-- .../RequestManagerSample/RequestManagerSample.csproj | 4 ++-- .../SecurityManagerSample/SecurityManagerSample.csproj | 4 ++-- .../SequenceQuerySample/SequenceQuerySample.csproj | 4 ++-- .../ThumbnailQuerySample/ThumbnailQuerySample.csproj | 4 ++-- .../TimeAttendanceSample/TimeAttendanceSample.csproj | 4 ++-- .../TransactionManagerSample/TransactionManagerSample.csproj | 4 ++-- .../Platform SDK/TriggerAlarmSample/TriggerAlarmSample.csproj | 4 ++-- .../UnusedCredentialQuerySample.csproj | 4 ++-- Samples/Platform SDK/UserTaskSample/UserTaskSample.csproj | 4 ++-- .../VideoFileQuerySample/VideoFileQuerySample.csproj | 4 ++-- Samples/Platform SDK/VideoUnitSample/VideoUnitSample.csproj | 4 ++-- .../VisitorManagerSample/VisitorManagerSample.csproj | 4 ++-- .../Plugin SDK/BasicPluginTemplate/BasicPluginTemplate.csproj | 4 ++-- .../Plugin SDK/CustomActionSample/CustomActionSample.csproj | 2 +- .../Plugin SDK/CustomReportSample/CustomReportSample.csproj | 4 ++-- .../PluginConfigurationSample.csproj | 2 +- .../BackgroundProcessSample/BackgroundProcessSample.csproj | 4 ++-- .../BadgePrinterSample/BadgePrinterSample.csproj | 4 ++-- .../CardholderCredentialReaderSample.csproj | 4 ++-- .../CardholderFieldsExtractorSample.csproj | 4 ++-- .../CommandManagerSample/CommandManagerSample.csproj | 4 ++-- .../Workspace SDK/ConfigPageSample/ConfigPageSample.csproj | 4 ++-- Samples/Workspace SDK/ControlsSample/ControlsSample.csproj | 4 ++-- .../CredentialBuilderSample/CredentialBuilderSample.csproj | 4 ++-- .../CredentialReaderSample/CredentialReaderSample.csproj | 4 ++-- .../DashboardWidgetSample/DashboardWidgetSample.csproj | 4 ++-- .../ImageExtractorSample/ImageExtractorSample.csproj | 4 ++-- .../OptionsExtensionSample/OptionsExtensionSample.csproj | 4 ++-- Samples/Workspace SDK/PageTaskSample/PageTaskSample.csproj | 4 ++-- .../ReportExporterSample/ReportExporterSample.csproj | 4 ++-- Samples/Workspace SDK/TaskSample/TaskSample.csproj | 4 ++-- .../TilePropertiesSample/TilePropertiesSample.csproj | 4 ++-- Samples/Workspace SDK/TileViewSample/TileViewSample.csproj | 4 ++-- .../Workspace SDK/TileWidgetSample/TileWidgetSample.csproj | 4 ++-- .../TimelineProviderSample/TimelineProviderSample.csproj | 4 ++-- 74 files changed, 146 insertions(+), 146 deletions(-) diff --git a/Samples/Media SDK/FileCryptingManagerSample/FileCryptingManagerSample.csproj b/Samples/Media SDK/FileCryptingManagerSample/FileCryptingManagerSample.csproj index ae4ad21..d6e1c19 100644 --- a/Samples/Media SDK/FileCryptingManagerSample/FileCryptingManagerSample.csproj +++ b/Samples/Media SDK/FileCryptingManagerSample/FileCryptingManagerSample.csproj @@ -19,7 +19,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -30,7 +30,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Media SDK/MediaFileSample/MediaFileSample.csproj b/Samples/Media SDK/MediaFileSample/MediaFileSample.csproj index 876d203..b2fe55c 100644 --- a/Samples/Media SDK/MediaFileSample/MediaFileSample.csproj +++ b/Samples/Media SDK/MediaFileSample/MediaFileSample.csproj @@ -19,7 +19,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -30,7 +30,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Media SDK/OverlaySample/OverlaySample.csproj b/Samples/Media SDK/OverlaySample/OverlaySample.csproj index 507d320..a1ab91a 100644 --- a/Samples/Media SDK/OverlaySample/OverlaySample.csproj +++ b/Samples/Media SDK/OverlaySample/OverlaySample.csproj @@ -19,7 +19,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -30,7 +30,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Media SDK/PlaybackSequenceQuerierSample/PlaybackSequenceQuerierSample.csproj b/Samples/Media SDK/PlaybackSequenceQuerierSample/PlaybackSequenceQuerierSample.csproj index 6b02866..9079118 100644 --- a/Samples/Media SDK/PlaybackSequenceQuerierSample/PlaybackSequenceQuerierSample.csproj +++ b/Samples/Media SDK/PlaybackSequenceQuerierSample/PlaybackSequenceQuerierSample.csproj @@ -19,7 +19,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -30,7 +30,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Media SDK/PlaybackStreamReaderSample/PlaybackStreamReaderSample.csproj b/Samples/Media SDK/PlaybackStreamReaderSample/PlaybackStreamReaderSample.csproj index 300b206..78cb69c 100644 --- a/Samples/Media SDK/PlaybackStreamReaderSample/PlaybackStreamReaderSample.csproj +++ b/Samples/Media SDK/PlaybackStreamReaderSample/PlaybackStreamReaderSample.csproj @@ -19,7 +19,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -30,7 +30,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Media SDK/PtzCoordinatesManagerSample/PtzCoordinatesManagerSample.csproj b/Samples/Media SDK/PtzCoordinatesManagerSample/PtzCoordinatesManagerSample.csproj index 635c23b..5a0068a 100644 --- a/Samples/Media SDK/PtzCoordinatesManagerSample/PtzCoordinatesManagerSample.csproj +++ b/Samples/Media SDK/PtzCoordinatesManagerSample/PtzCoordinatesManagerSample.csproj @@ -19,7 +19,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -30,7 +30,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Media SDK/VideoExportSample/VideoExportSample.csproj b/Samples/Media SDK/VideoExportSample/VideoExportSample.csproj index 3008f8b..39cf028 100644 --- a/Samples/Media SDK/VideoExportSample/VideoExportSample.csproj +++ b/Samples/Media SDK/VideoExportSample/VideoExportSample.csproj @@ -19,7 +19,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -30,7 +30,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Media SDK/VideoSourceFilterSample/VideoSourceFilterSample.csproj b/Samples/Media SDK/VideoSourceFilterSample/VideoSourceFilterSample.csproj index 6b2b1ed..b1aa03d 100644 --- a/Samples/Media SDK/VideoSourceFilterSample/VideoSourceFilterSample.csproj +++ b/Samples/Media SDK/VideoSourceFilterSample/VideoSourceFilterSample.csproj @@ -19,7 +19,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -30,7 +30,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Platform SDK/AccessControlRawEventQuerySample/AccessControlRawEventQuerySample.csproj b/Samples/Platform SDK/AccessControlRawEventQuerySample/AccessControlRawEventQuerySample.csproj index 81cfe4a..d55512c 100644 --- a/Samples/Platform SDK/AccessControlRawEventQuerySample/AccessControlRawEventQuerySample.csproj +++ b/Samples/Platform SDK/AccessControlRawEventQuerySample/AccessControlRawEventQuerySample.csproj @@ -19,7 +19,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -30,7 +30,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Platform SDK/AccessControlReportQuerySample/AccessControlReportQuerySample.csproj b/Samples/Platform SDK/AccessControlReportQuerySample/AccessControlReportQuerySample.csproj index 1d83870..73a9fc7 100644 --- a/Samples/Platform SDK/AccessControlReportQuerySample/AccessControlReportQuerySample.csproj +++ b/Samples/Platform SDK/AccessControlReportQuerySample/AccessControlReportQuerySample.csproj @@ -19,7 +19,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -30,7 +30,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Platform SDK/AccessControlUnitManagerSample/AccessControlUnitManagerSample.csproj b/Samples/Platform SDK/AccessControlUnitManagerSample/AccessControlUnitManagerSample.csproj index 6be2e16..dfa3c6c 100644 --- a/Samples/Platform SDK/AccessControlUnitManagerSample/AccessControlUnitManagerSample.csproj +++ b/Samples/Platform SDK/AccessControlUnitManagerSample/AccessControlUnitManagerSample.csproj @@ -19,7 +19,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -30,7 +30,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Platform SDK/AccessControlUnitSample/AccessControlUnitSample.csproj b/Samples/Platform SDK/AccessControlUnitSample/AccessControlUnitSample.csproj index a8ff7e0..f33c57c 100644 --- a/Samples/Platform SDK/AccessControlUnitSample/AccessControlUnitSample.csproj +++ b/Samples/Platform SDK/AccessControlUnitSample/AccessControlUnitSample.csproj @@ -19,7 +19,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -30,7 +30,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Platform SDK/AccessEventMonitoringSample/AccessEventMonitoringSample.csproj b/Samples/Platform SDK/AccessEventMonitoringSample/AccessEventMonitoringSample.csproj index 8dd87e5..40880d3 100644 --- a/Samples/Platform SDK/AccessEventMonitoringSample/AccessEventMonitoringSample.csproj +++ b/Samples/Platform SDK/AccessEventMonitoringSample/AccessEventMonitoringSample.csproj @@ -19,7 +19,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -30,7 +30,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Platform SDK/AccessVerifierSample/AccessVerifierSample.csproj b/Samples/Platform SDK/AccessVerifierSample/AccessVerifierSample.csproj index 3d6fd73..b191cef 100644 --- a/Samples/Platform SDK/AccessVerifierSample/AccessVerifierSample.csproj +++ b/Samples/Platform SDK/AccessVerifierSample/AccessVerifierSample.csproj @@ -19,7 +19,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -30,7 +30,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Platform SDK/ActivityTrailsSample/ActivityTrailsSample.csproj b/Samples/Platform SDK/ActivityTrailsSample/ActivityTrailsSample.csproj index d925602..a3f1188 100644 --- a/Samples/Platform SDK/ActivityTrailsSample/ActivityTrailsSample.csproj +++ b/Samples/Platform SDK/ActivityTrailsSample/ActivityTrailsSample.csproj @@ -19,7 +19,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -30,7 +30,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Platform SDK/AlarmActivityQuerySample/AlarmActivityQuerySample.csproj b/Samples/Platform SDK/AlarmActivityQuerySample/AlarmActivityQuerySample.csproj index e72a48f..35c9b64 100644 --- a/Samples/Platform SDK/AlarmActivityQuerySample/AlarmActivityQuerySample.csproj +++ b/Samples/Platform SDK/AlarmActivityQuerySample/AlarmActivityQuerySample.csproj @@ -19,7 +19,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -30,7 +30,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Platform SDK/AlarmMonitoringSample/AlarmMonitoringSample.csproj b/Samples/Platform SDK/AlarmMonitoringSample/AlarmMonitoringSample.csproj index 772ebe3..cc01773 100644 --- a/Samples/Platform SDK/AlarmMonitoringSample/AlarmMonitoringSample.csproj +++ b/Samples/Platform SDK/AlarmMonitoringSample/AlarmMonitoringSample.csproj @@ -19,7 +19,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -30,7 +30,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Platform SDK/AuditTrailsSample/AuditTrailsSample.csproj b/Samples/Platform SDK/AuditTrailsSample/AuditTrailsSample.csproj index e089f0e..e80b752 100644 --- a/Samples/Platform SDK/AuditTrailsSample/AuditTrailsSample.csproj +++ b/Samples/Platform SDK/AuditTrailsSample/AuditTrailsSample.csproj @@ -20,7 +20,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -31,7 +31,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Platform SDK/CameraConfigurationSample/CameraConfigurationSample.csproj b/Samples/Platform SDK/CameraConfigurationSample/CameraConfigurationSample.csproj index ba9b7a8..3e454e3 100644 --- a/Samples/Platform SDK/CameraConfigurationSample/CameraConfigurationSample.csproj +++ b/Samples/Platform SDK/CameraConfigurationSample/CameraConfigurationSample.csproj @@ -19,7 +19,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -30,7 +30,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Platform SDK/CameraSample/CameraSample.csproj b/Samples/Platform SDK/CameraSample/CameraSample.csproj index 156a40a..29e06c6 100644 --- a/Samples/Platform SDK/CameraSample/CameraSample.csproj +++ b/Samples/Platform SDK/CameraSample/CameraSample.csproj @@ -19,7 +19,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -30,7 +30,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Platform SDK/CopyConfiguratonSample/CopyConfiguratonSample.csproj b/Samples/Platform SDK/CopyConfiguratonSample/CopyConfiguratonSample.csproj index 9871146..a05fd96 100644 --- a/Samples/Platform SDK/CopyConfiguratonSample/CopyConfiguratonSample.csproj +++ b/Samples/Platform SDK/CopyConfiguratonSample/CopyConfiguratonSample.csproj @@ -19,7 +19,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -30,7 +30,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Platform SDK/CustomEntitySample/CustomEntitySample.csproj b/Samples/Platform SDK/CustomEntitySample/CustomEntitySample.csproj index 39047a4..c703d0d 100644 --- a/Samples/Platform SDK/CustomEntitySample/CustomEntitySample.csproj +++ b/Samples/Platform SDK/CustomEntitySample/CustomEntitySample.csproj @@ -19,7 +19,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -30,7 +30,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Platform SDK/CustomEventSample/CustomEventSample.csproj b/Samples/Platform SDK/CustomEventSample/CustomEventSample.csproj index 09e3c7f..c71dd83 100644 --- a/Samples/Platform SDK/CustomEventSample/CustomEventSample.csproj +++ b/Samples/Platform SDK/CustomEventSample/CustomEventSample.csproj @@ -19,7 +19,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -30,7 +30,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Platform SDK/CustomFieldSample/CustomFieldSample.csproj b/Samples/Platform SDK/CustomFieldSample/CustomFieldSample.csproj index 47efbc4..7aa41fe 100644 --- a/Samples/Platform SDK/CustomFieldSample/CustomFieldSample.csproj +++ b/Samples/Platform SDK/CustomFieldSample/CustomFieldSample.csproj @@ -19,7 +19,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -30,7 +30,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Platform SDK/DiagnosticServerSample/DiagnosticServerSample.csproj b/Samples/Platform SDK/DiagnosticServerSample/DiagnosticServerSample.csproj index 92462d7..63c352c 100644 --- a/Samples/Platform SDK/DiagnosticServerSample/DiagnosticServerSample.csproj +++ b/Samples/Platform SDK/DiagnosticServerSample/DiagnosticServerSample.csproj @@ -19,7 +19,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -30,7 +30,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Platform SDK/DisplayInTileSample/DisplayInTileSample.csproj b/Samples/Platform SDK/DisplayInTileSample/DisplayInTileSample.csproj index 41b7e5b..06d68a2 100644 --- a/Samples/Platform SDK/DisplayInTileSample/DisplayInTileSample.csproj +++ b/Samples/Platform SDK/DisplayInTileSample/DisplayInTileSample.csproj @@ -19,7 +19,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -30,7 +30,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Platform SDK/EntityCacheSample/EntityCacheSample.csproj b/Samples/Platform SDK/EntityCacheSample/EntityCacheSample.csproj index 0f4c38e..b604dc7 100644 --- a/Samples/Platform SDK/EntityCacheSample/EntityCacheSample.csproj +++ b/Samples/Platform SDK/EntityCacheSample/EntityCacheSample.csproj @@ -19,7 +19,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -30,7 +30,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Platform SDK/EntityCertificatesManagerSample/EntityCertificatesManagerSample.csproj b/Samples/Platform SDK/EntityCertificatesManagerSample/EntityCertificatesManagerSample.csproj index 503da6d..1a26a6f 100644 --- a/Samples/Platform SDK/EntityCertificatesManagerSample/EntityCertificatesManagerSample.csproj +++ b/Samples/Platform SDK/EntityCertificatesManagerSample/EntityCertificatesManagerSample.csproj @@ -19,7 +19,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -30,7 +30,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Platform SDK/EntityMappingSample/EntityMappingSample.csproj b/Samples/Platform SDK/EntityMappingSample/EntityMappingSample.csproj index addb0d4..5ef200c 100644 --- a/Samples/Platform SDK/EntityMappingSample/EntityMappingSample.csproj +++ b/Samples/Platform SDK/EntityMappingSample/EntityMappingSample.csproj @@ -19,7 +19,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -30,7 +30,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Platform SDK/EventMonitoringSample/EventMonitoringSample.csproj b/Samples/Platform SDK/EventMonitoringSample/EventMonitoringSample.csproj index 885894a..2e04c7e 100644 --- a/Samples/Platform SDK/EventMonitoringSample/EventMonitoringSample.csproj +++ b/Samples/Platform SDK/EventMonitoringSample/EventMonitoringSample.csproj @@ -19,7 +19,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -30,7 +30,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Platform SDK/EventToActionSample/EventToActionSample.csproj b/Samples/Platform SDK/EventToActionSample/EventToActionSample.csproj index 86d55d2..fb4ea90 100644 --- a/Samples/Platform SDK/EventToActionSample/EventToActionSample.csproj +++ b/Samples/Platform SDK/EventToActionSample/EventToActionSample.csproj @@ -19,7 +19,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -30,7 +30,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Platform SDK/IncidentManagerSample/IncidentManagerSample.csproj b/Samples/Platform SDK/IncidentManagerSample/IncidentManagerSample.csproj index 0845cef..dfb228d 100644 --- a/Samples/Platform SDK/IncidentManagerSample/IncidentManagerSample.csproj +++ b/Samples/Platform SDK/IncidentManagerSample/IncidentManagerSample.csproj @@ -19,7 +19,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -30,7 +30,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Platform SDK/LicenseManagerSample/LicenseManagerSample.csproj b/Samples/Platform SDK/LicenseManagerSample/LicenseManagerSample.csproj index 85b5b26..fffd632 100644 --- a/Samples/Platform SDK/LicenseManagerSample/LicenseManagerSample.csproj +++ b/Samples/Platform SDK/LicenseManagerSample/LicenseManagerSample.csproj @@ -19,7 +19,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -30,7 +30,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Platform SDK/LoggerSample/LoggerSample.csproj b/Samples/Platform SDK/LoggerSample/LoggerSample.csproj index 7fe3ee0..e2ced8b 100644 --- a/Samples/Platform SDK/LoggerSample/LoggerSample.csproj +++ b/Samples/Platform SDK/LoggerSample/LoggerSample.csproj @@ -19,7 +19,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -30,7 +30,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Platform SDK/LoginManagerSample/LoginManagerSample.csproj b/Samples/Platform SDK/LoginManagerSample/LoginManagerSample.csproj index e0947cc..02c95b0 100644 --- a/Samples/Platform SDK/LoginManagerSample/LoginManagerSample.csproj +++ b/Samples/Platform SDK/LoginManagerSample/LoginManagerSample.csproj @@ -27,7 +27,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -38,7 +38,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Platform SDK/MacroSample/MacroSample.csproj b/Samples/Platform SDK/MacroSample/MacroSample.csproj index 0941e04..afd00a9 100644 --- a/Samples/Platform SDK/MacroSample/MacroSample.csproj +++ b/Samples/Platform SDK/MacroSample/MacroSample.csproj @@ -19,7 +19,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -30,7 +30,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Platform SDK/PeopleCountingSample/PeopleCountingSample.csproj b/Samples/Platform SDK/PeopleCountingSample/PeopleCountingSample.csproj index 9c62fc4..f93ef98 100644 --- a/Samples/Platform SDK/PeopleCountingSample/PeopleCountingSample.csproj +++ b/Samples/Platform SDK/PeopleCountingSample/PeopleCountingSample.csproj @@ -19,7 +19,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -30,7 +30,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Platform SDK/PlaySoundSample/PlaySoundSample.csproj b/Samples/Platform SDK/PlaySoundSample/PlaySoundSample.csproj index bf3babc..c1fa567 100644 --- a/Samples/Platform SDK/PlaySoundSample/PlaySoundSample.csproj +++ b/Samples/Platform SDK/PlaySoundSample/PlaySoundSample.csproj @@ -19,7 +19,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -30,7 +30,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Platform SDK/RaiseEventSample/RaiseEventSample.csproj b/Samples/Platform SDK/RaiseEventSample/RaiseEventSample.csproj index b7303c4..c34d99c 100644 --- a/Samples/Platform SDK/RaiseEventSample/RaiseEventSample.csproj +++ b/Samples/Platform SDK/RaiseEventSample/RaiseEventSample.csproj @@ -19,7 +19,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -30,7 +30,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Platform SDK/RequestManagerSample/RequestManagerSample.csproj b/Samples/Platform SDK/RequestManagerSample/RequestManagerSample.csproj index 1747a6d..3054b81 100644 --- a/Samples/Platform SDK/RequestManagerSample/RequestManagerSample.csproj +++ b/Samples/Platform SDK/RequestManagerSample/RequestManagerSample.csproj @@ -19,7 +19,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -30,7 +30,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Platform SDK/SecurityManagerSample/SecurityManagerSample.csproj b/Samples/Platform SDK/SecurityManagerSample/SecurityManagerSample.csproj index 15e0bf6..0e53770 100644 --- a/Samples/Platform SDK/SecurityManagerSample/SecurityManagerSample.csproj +++ b/Samples/Platform SDK/SecurityManagerSample/SecurityManagerSample.csproj @@ -19,7 +19,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -30,7 +30,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Platform SDK/SequenceQuerySample/SequenceQuerySample.csproj b/Samples/Platform SDK/SequenceQuerySample/SequenceQuerySample.csproj index e669c45..994de62 100644 --- a/Samples/Platform SDK/SequenceQuerySample/SequenceQuerySample.csproj +++ b/Samples/Platform SDK/SequenceQuerySample/SequenceQuerySample.csproj @@ -19,7 +19,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -30,7 +30,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Platform SDK/ThumbnailQuerySample/ThumbnailQuerySample.csproj b/Samples/Platform SDK/ThumbnailQuerySample/ThumbnailQuerySample.csproj index 2610244..2273549 100644 --- a/Samples/Platform SDK/ThumbnailQuerySample/ThumbnailQuerySample.csproj +++ b/Samples/Platform SDK/ThumbnailQuerySample/ThumbnailQuerySample.csproj @@ -19,7 +19,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -30,7 +30,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Platform SDK/TimeAttendanceSample/TimeAttendanceSample.csproj b/Samples/Platform SDK/TimeAttendanceSample/TimeAttendanceSample.csproj index 7095597..9f42a1a 100644 --- a/Samples/Platform SDK/TimeAttendanceSample/TimeAttendanceSample.csproj +++ b/Samples/Platform SDK/TimeAttendanceSample/TimeAttendanceSample.csproj @@ -19,7 +19,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -30,7 +30,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Platform SDK/TransactionManagerSample/TransactionManagerSample.csproj b/Samples/Platform SDK/TransactionManagerSample/TransactionManagerSample.csproj index a1024e7..fabda4e 100644 --- a/Samples/Platform SDK/TransactionManagerSample/TransactionManagerSample.csproj +++ b/Samples/Platform SDK/TransactionManagerSample/TransactionManagerSample.csproj @@ -19,7 +19,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -30,7 +30,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Platform SDK/TriggerAlarmSample/TriggerAlarmSample.csproj b/Samples/Platform SDK/TriggerAlarmSample/TriggerAlarmSample.csproj index f4c5afe..1e97c97 100644 --- a/Samples/Platform SDK/TriggerAlarmSample/TriggerAlarmSample.csproj +++ b/Samples/Platform SDK/TriggerAlarmSample/TriggerAlarmSample.csproj @@ -19,7 +19,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -30,7 +30,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Platform SDK/UnusedCredentialQuerySample/UnusedCredentialQuerySample.csproj b/Samples/Platform SDK/UnusedCredentialQuerySample/UnusedCredentialQuerySample.csproj index be2d9e3..e580687 100644 --- a/Samples/Platform SDK/UnusedCredentialQuerySample/UnusedCredentialQuerySample.csproj +++ b/Samples/Platform SDK/UnusedCredentialQuerySample/UnusedCredentialQuerySample.csproj @@ -19,7 +19,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -30,7 +30,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Platform SDK/UserTaskSample/UserTaskSample.csproj b/Samples/Platform SDK/UserTaskSample/UserTaskSample.csproj index 31f1398..bdf2f49 100644 --- a/Samples/Platform SDK/UserTaskSample/UserTaskSample.csproj +++ b/Samples/Platform SDK/UserTaskSample/UserTaskSample.csproj @@ -19,7 +19,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -30,7 +30,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Platform SDK/VideoFileQuerySample/VideoFileQuerySample.csproj b/Samples/Platform SDK/VideoFileQuerySample/VideoFileQuerySample.csproj index b979275..40f1536 100644 --- a/Samples/Platform SDK/VideoFileQuerySample/VideoFileQuerySample.csproj +++ b/Samples/Platform SDK/VideoFileQuerySample/VideoFileQuerySample.csproj @@ -19,7 +19,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -30,7 +30,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Platform SDK/VideoUnitSample/VideoUnitSample.csproj b/Samples/Platform SDK/VideoUnitSample/VideoUnitSample.csproj index 5a2347e..a032071 100644 --- a/Samples/Platform SDK/VideoUnitSample/VideoUnitSample.csproj +++ b/Samples/Platform SDK/VideoUnitSample/VideoUnitSample.csproj @@ -19,7 +19,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -30,7 +30,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Platform SDK/VisitorManagerSample/VisitorManagerSample.csproj b/Samples/Platform SDK/VisitorManagerSample/VisitorManagerSample.csproj index a0b844b..04773d2 100644 --- a/Samples/Platform SDK/VisitorManagerSample/VisitorManagerSample.csproj +++ b/Samples/Platform SDK/VisitorManagerSample/VisitorManagerSample.csproj @@ -19,7 +19,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -30,7 +30,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Plugin SDK/BasicPluginTemplate/BasicPluginTemplate.csproj b/Samples/Plugin SDK/BasicPluginTemplate/BasicPluginTemplate.csproj index 43b8e40..3fa728e 100644 --- a/Samples/Plugin SDK/BasicPluginTemplate/BasicPluginTemplate.csproj +++ b/Samples/Plugin SDK/BasicPluginTemplate/BasicPluginTemplate.csproj @@ -19,7 +19,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -30,7 +30,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Plugin SDK/CustomActionSample/CustomActionSample.csproj b/Samples/Plugin SDK/CustomActionSample/CustomActionSample.csproj index 3c7754d..070c642 100644 --- a/Samples/Plugin SDK/CustomActionSample/CustomActionSample.csproj +++ b/Samples/Plugin SDK/CustomActionSample/CustomActionSample.csproj @@ -20,7 +20,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 diff --git a/Samples/Plugin SDK/CustomReportSample/CustomReportSample.csproj b/Samples/Plugin SDK/CustomReportSample/CustomReportSample.csproj index 0aec225..7036375 100644 --- a/Samples/Plugin SDK/CustomReportSample/CustomReportSample.csproj +++ b/Samples/Plugin SDK/CustomReportSample/CustomReportSample.csproj @@ -20,7 +20,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -31,7 +31,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Plugin SDK/PluginConfigurationSample/PluginConfigurationSample.csproj b/Samples/Plugin SDK/PluginConfigurationSample/PluginConfigurationSample.csproj index c0295ce..eb59c17 100644 --- a/Samples/Plugin SDK/PluginConfigurationSample/PluginConfigurationSample.csproj +++ b/Samples/Plugin SDK/PluginConfigurationSample/PluginConfigurationSample.csproj @@ -20,7 +20,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 diff --git a/Samples/Workspace SDK/BackgroundProcessSample/BackgroundProcessSample.csproj b/Samples/Workspace SDK/BackgroundProcessSample/BackgroundProcessSample.csproj index 3d19beb..26f878e 100644 --- a/Samples/Workspace SDK/BackgroundProcessSample/BackgroundProcessSample.csproj +++ b/Samples/Workspace SDK/BackgroundProcessSample/BackgroundProcessSample.csproj @@ -20,7 +20,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -31,7 +31,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Workspace SDK/BadgePrinterSample/BadgePrinterSample.csproj b/Samples/Workspace SDK/BadgePrinterSample/BadgePrinterSample.csproj index ac64f9c..ab48e2d 100644 --- a/Samples/Workspace SDK/BadgePrinterSample/BadgePrinterSample.csproj +++ b/Samples/Workspace SDK/BadgePrinterSample/BadgePrinterSample.csproj @@ -20,7 +20,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -31,7 +31,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Workspace SDK/CardholderCredentialReaderSample/CardholderCredentialReaderSample.csproj b/Samples/Workspace SDK/CardholderCredentialReaderSample/CardholderCredentialReaderSample.csproj index 2537dc3..4709418 100644 --- a/Samples/Workspace SDK/CardholderCredentialReaderSample/CardholderCredentialReaderSample.csproj +++ b/Samples/Workspace SDK/CardholderCredentialReaderSample/CardholderCredentialReaderSample.csproj @@ -20,7 +20,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -31,7 +31,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Workspace SDK/CardholderFieldsExtractorSample/CardholderFieldsExtractorSample.csproj b/Samples/Workspace SDK/CardholderFieldsExtractorSample/CardholderFieldsExtractorSample.csproj index 628d623..251f090 100644 --- a/Samples/Workspace SDK/CardholderFieldsExtractorSample/CardholderFieldsExtractorSample.csproj +++ b/Samples/Workspace SDK/CardholderFieldsExtractorSample/CardholderFieldsExtractorSample.csproj @@ -19,7 +19,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -30,7 +30,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Workspace SDK/CommandManagerSample/CommandManagerSample.csproj b/Samples/Workspace SDK/CommandManagerSample/CommandManagerSample.csproj index 90e8e18..f39299b 100644 --- a/Samples/Workspace SDK/CommandManagerSample/CommandManagerSample.csproj +++ b/Samples/Workspace SDK/CommandManagerSample/CommandManagerSample.csproj @@ -19,7 +19,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -30,7 +30,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Workspace SDK/ConfigPageSample/ConfigPageSample.csproj b/Samples/Workspace SDK/ConfigPageSample/ConfigPageSample.csproj index f39ba60..2505bc7 100644 --- a/Samples/Workspace SDK/ConfigPageSample/ConfigPageSample.csproj +++ b/Samples/Workspace SDK/ConfigPageSample/ConfigPageSample.csproj @@ -20,7 +20,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -31,7 +31,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Workspace SDK/ControlsSample/ControlsSample.csproj b/Samples/Workspace SDK/ControlsSample/ControlsSample.csproj index 470520a..9fd7c5b 100644 --- a/Samples/Workspace SDK/ControlsSample/ControlsSample.csproj +++ b/Samples/Workspace SDK/ControlsSample/ControlsSample.csproj @@ -20,7 +20,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -31,7 +31,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Workspace SDK/CredentialBuilderSample/CredentialBuilderSample.csproj b/Samples/Workspace SDK/CredentialBuilderSample/CredentialBuilderSample.csproj index 2beea64..a1f21ee 100644 --- a/Samples/Workspace SDK/CredentialBuilderSample/CredentialBuilderSample.csproj +++ b/Samples/Workspace SDK/CredentialBuilderSample/CredentialBuilderSample.csproj @@ -19,7 +19,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -30,7 +30,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Workspace SDK/CredentialReaderSample/CredentialReaderSample.csproj b/Samples/Workspace SDK/CredentialReaderSample/CredentialReaderSample.csproj index ea32493..2127f19 100644 --- a/Samples/Workspace SDK/CredentialReaderSample/CredentialReaderSample.csproj +++ b/Samples/Workspace SDK/CredentialReaderSample/CredentialReaderSample.csproj @@ -20,7 +20,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -31,7 +31,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Workspace SDK/DashboardWidgetSample/DashboardWidgetSample.csproj b/Samples/Workspace SDK/DashboardWidgetSample/DashboardWidgetSample.csproj index 4519193..a1a52e5 100644 --- a/Samples/Workspace SDK/DashboardWidgetSample/DashboardWidgetSample.csproj +++ b/Samples/Workspace SDK/DashboardWidgetSample/DashboardWidgetSample.csproj @@ -20,7 +20,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -31,7 +31,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Workspace SDK/ImageExtractorSample/ImageExtractorSample.csproj b/Samples/Workspace SDK/ImageExtractorSample/ImageExtractorSample.csproj index 738657e..ed53b29 100644 --- a/Samples/Workspace SDK/ImageExtractorSample/ImageExtractorSample.csproj +++ b/Samples/Workspace SDK/ImageExtractorSample/ImageExtractorSample.csproj @@ -19,7 +19,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -30,7 +30,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Workspace SDK/OptionsExtensionSample/OptionsExtensionSample.csproj b/Samples/Workspace SDK/OptionsExtensionSample/OptionsExtensionSample.csproj index 60c0184..9edc1cb 100644 --- a/Samples/Workspace SDK/OptionsExtensionSample/OptionsExtensionSample.csproj +++ b/Samples/Workspace SDK/OptionsExtensionSample/OptionsExtensionSample.csproj @@ -20,7 +20,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -31,7 +31,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Workspace SDK/PageTaskSample/PageTaskSample.csproj b/Samples/Workspace SDK/PageTaskSample/PageTaskSample.csproj index 348d20a..452dd54 100644 --- a/Samples/Workspace SDK/PageTaskSample/PageTaskSample.csproj +++ b/Samples/Workspace SDK/PageTaskSample/PageTaskSample.csproj @@ -20,7 +20,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -31,7 +31,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Workspace SDK/ReportExporterSample/ReportExporterSample.csproj b/Samples/Workspace SDK/ReportExporterSample/ReportExporterSample.csproj index 6024395..e2238c9 100644 --- a/Samples/Workspace SDK/ReportExporterSample/ReportExporterSample.csproj +++ b/Samples/Workspace SDK/ReportExporterSample/ReportExporterSample.csproj @@ -19,7 +19,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -30,7 +30,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Workspace SDK/TaskSample/TaskSample.csproj b/Samples/Workspace SDK/TaskSample/TaskSample.csproj index 1719148..8278d43 100644 --- a/Samples/Workspace SDK/TaskSample/TaskSample.csproj +++ b/Samples/Workspace SDK/TaskSample/TaskSample.csproj @@ -19,7 +19,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -30,7 +30,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Workspace SDK/TilePropertiesSample/TilePropertiesSample.csproj b/Samples/Workspace SDK/TilePropertiesSample/TilePropertiesSample.csproj index 744cbb8..e44092f 100644 --- a/Samples/Workspace SDK/TilePropertiesSample/TilePropertiesSample.csproj +++ b/Samples/Workspace SDK/TilePropertiesSample/TilePropertiesSample.csproj @@ -20,7 +20,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -31,7 +31,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Workspace SDK/TileViewSample/TileViewSample.csproj b/Samples/Workspace SDK/TileViewSample/TileViewSample.csproj index 0db41e4..94820e1 100644 --- a/Samples/Workspace SDK/TileViewSample/TileViewSample.csproj +++ b/Samples/Workspace SDK/TileViewSample/TileViewSample.csproj @@ -20,7 +20,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -31,7 +31,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Workspace SDK/TileWidgetSample/TileWidgetSample.csproj b/Samples/Workspace SDK/TileWidgetSample/TileWidgetSample.csproj index f439ca1..eaf4956 100644 --- a/Samples/Workspace SDK/TileWidgetSample/TileWidgetSample.csproj +++ b/Samples/Workspace SDK/TileWidgetSample/TileWidgetSample.csproj @@ -20,7 +20,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -31,7 +31,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Workspace SDK/TimelineProviderSample/TimelineProviderSample.csproj b/Samples/Workspace SDK/TimelineProviderSample/TimelineProviderSample.csproj index 38d3ecb..c66688a 100644 --- a/Samples/Workspace SDK/TimelineProviderSample/TimelineProviderSample.csproj +++ b/Samples/Workspace SDK/TimelineProviderSample/TimelineProviderSample.csproj @@ -19,7 +19,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -30,7 +30,7 @@ TRACE prompt 4 - 10 + 12 From 9852a6a7114bc2ca208c3d0632b7148191e8c6d5 Mon Sep 17 00:00:00 2001 From: Andre Lafleur Date: Sat, 21 Sep 2024 18:51:12 +0800 Subject: [PATCH 13/22] Refactor object instantiation to use shorthand syntax Simplified object instantiation for `Guid` and `Size` across multiple files: - Updated `Guid` instantiation in various files including `BouncingBallOverlay.cs`, `TimecodeOverlay.cs`, and others. - Updated `IncidentData` instantiation in `Program.cs`. - Updated `Size` instantiation in `ClockWidget.cs`. Also made minor formatting adjustments, such as removing unnecessary whitespace. --- .../Media SDK/OverlaySample/BouncingBallOverlay.cs | 2 +- Samples/Media SDK/OverlaySample/TimecodeOverlay.cs | 2 +- .../Platform SDK/IncidentManagerSample/Program.cs | 2 +- .../BasicPluginTemplate/BasicPluginDescriptor.cs | 2 +- .../PluginDatabaseSample/SamplePluginDescriptor.cs | 2 +- .../BackgroundProcessPageDescriptor.cs | 4 ++-- .../BadgePrinterSample/SampleBadgePrinter.cs | 2 +- .../SampleCardholderCredentialReader.cs | 4 ++-- .../SampleCardholderFieldsExtractor.cs | 6 +++--- .../CredentialReaderSample/SampleCredentialReader.cs | 4 ++-- .../DashboardWidgetSample/ClockWidget.cs | 12 ++++++------ .../DashboardWidgetSample/ClockWidgetBuilder.cs | 2 +- .../ImageExtractorSample/SampleImageExtractor.cs | 2 +- .../TilePropertiesSample/SampleTileProperties.cs | 2 +- .../SampleTilePropertiesBuilder.cs | 2 +- .../TileViewSample/SampleTileViewBuilder.cs | 2 +- .../TileWidgetSample/SampleTileWidget.cs | 2 +- .../TileWidgetSample/SampleTileWidgetBuilder.cs | 4 ++-- .../TimelineProviderSample/AlarmTimelineEvent.cs | 2 +- .../AlarmTimelineProviderBuilder.cs | 2 +- 20 files changed, 31 insertions(+), 31 deletions(-) diff --git a/Samples/Media SDK/OverlaySample/BouncingBallOverlay.cs b/Samples/Media SDK/OverlaySample/BouncingBallOverlay.cs index a658025..5e9c1ca 100644 --- a/Samples/Media SDK/OverlaySample/BouncingBallOverlay.cs +++ b/Samples/Media SDK/OverlaySample/BouncingBallOverlay.cs @@ -14,7 +14,7 @@ namespace Genetec.Dap.CodeSamples; class BouncingBallOverlay(Guid cameraId) { - private readonly Guid m_layerId = new Guid("69A64ACE-6DDC-4142-AD04-06690D8591B3"); + private readonly Guid m_layerId = new("69A64ACE-6DDC-4142-AD04-06690D8591B3"); private Task m_task; private CancellationTokenSource m_cancellationTokenSource; diff --git a/Samples/Media SDK/OverlaySample/TimecodeOverlay.cs b/Samples/Media SDK/OverlaySample/TimecodeOverlay.cs index 16cea95..b8a9268 100644 --- a/Samples/Media SDK/OverlaySample/TimecodeOverlay.cs +++ b/Samples/Media SDK/OverlaySample/TimecodeOverlay.cs @@ -14,7 +14,7 @@ namespace Genetec.Dap.CodeSamples; class TimecodeOverlay(Guid cameraId) { - private readonly Guid m_layerId = new Guid("69A64ACE-6DDC-4142-AD04-06690D8591B3"); + private readonly Guid m_layerId = new("69A64ACE-6DDC-4142-AD04-06690D8591B3"); private CancellationTokenSource m_cancellationTokenSource; private Task m_task; diff --git a/Samples/Platform SDK/IncidentManagerSample/Program.cs b/Samples/Platform SDK/IncidentManagerSample/Program.cs index 2c74af9..e7dbf00 100644 --- a/Samples/Platform SDK/IncidentManagerSample/Program.cs +++ b/Samples/Platform SDK/IncidentManagerSample/Program.cs @@ -98,7 +98,7 @@ static async Task Main() Console.WriteLine("\nPress any key to exit..."); Console.ReadKey(); - IncidentData CreateIncidentData(DataRow row) => new IncidentData + IncidentData CreateIncidentData(DataRow row) => new() { InstanceGuid = row.Field(IncidentSdkQuery.InstanceGuidColumnName), Latitude = row.Field(IncidentSdkQuery.LatitudeColumnName), diff --git a/Samples/Plugin SDK/BasicPluginTemplate/BasicPluginDescriptor.cs b/Samples/Plugin SDK/BasicPluginTemplate/BasicPluginDescriptor.cs index 2de3596..1a3c785 100644 --- a/Samples/Plugin SDK/BasicPluginTemplate/BasicPluginDescriptor.cs +++ b/Samples/Plugin SDK/BasicPluginTemplate/BasicPluginDescriptor.cs @@ -18,7 +18,7 @@ public class BasicPluginDescriptor : PluginDescriptor public override string Name => "Basic Plugin"; // TODO: Replace with your own unique plugin GUID - public override Guid PluginGuid => new Guid("84E87A98-8AD3-4853-85E3-05C86B9BF90C"); + public override Guid PluginGuid => new("84E87A98-8AD3-4853-85E3-05C86B9BF90C"); public override string SpecificDefaultConfig => null; diff --git a/Samples/Plugin SDK/PluginDatabaseSample/SamplePluginDescriptor.cs b/Samples/Plugin SDK/PluginDatabaseSample/SamplePluginDescriptor.cs index d03f5e9..b60740e 100644 --- a/Samples/Plugin SDK/PluginDatabaseSample/SamplePluginDescriptor.cs +++ b/Samples/Plugin SDK/PluginDatabaseSample/SamplePluginDescriptor.cs @@ -20,7 +20,7 @@ public class SamplePluginDescriptor : PluginDescriptor public override string Name => "Sample Plugin Database"; // TODO: Replace with your own unique plugin GUID - public override Guid PluginGuid => new Guid("266B2366-26AA-4538-9953-FC435D3063EE"); + public override Guid PluginGuid => new("266B2366-26AA-4538-9953-FC435D3063EE"); // This plugin does not use a configuration public override string SpecificDefaultConfig => null; diff --git a/Samples/Workspace SDK/BackgroundProcessSample/BackgroundProcessPageDescriptor.cs b/Samples/Workspace SDK/BackgroundProcessSample/BackgroundProcessPageDescriptor.cs index cde1ae5..e8920bc 100644 --- a/Samples/Workspace SDK/BackgroundProcessSample/BackgroundProcessPageDescriptor.cs +++ b/Samples/Workspace SDK/BackgroundProcessSample/BackgroundProcessPageDescriptor.cs @@ -13,13 +13,13 @@ namespace Genetec.Dap.CodeSamples; public class BackgroundProcessPageDescriptor : PageDescriptor { - public override Guid CategoryId { get; } = new Guid(TaskCategories.Operation); + public override Guid CategoryId { get; } = new(TaskCategories.Operation); public override string Description => "Demonstrate the IBackgroundProcessNotificationService"; public override string Name => "Background Process Service"; - public override Guid Type { get; } = new Guid("B94C35AA-D324-4381-A05E-B3A5F24FF487"); // TODO: Replace with a new GUID + public override Guid Type { get; } = new("B94C35AA-D324-4381-A05E-B3A5F24FF487"); // TODO: Replace with a new GUID public override bool AllowOfflineExecution => false; } \ No newline at end of file diff --git a/Samples/Workspace SDK/BadgePrinterSample/SampleBadgePrinter.cs b/Samples/Workspace SDK/BadgePrinterSample/SampleBadgePrinter.cs index 91e3949..a3d43b8 100644 --- a/Samples/Workspace SDK/BadgePrinterSample/SampleBadgePrinter.cs +++ b/Samples/Workspace SDK/BadgePrinterSample/SampleBadgePrinter.cs @@ -19,7 +19,7 @@ class SampleBadgePrinter : BadgePrinter public override int Priority => 0; - public override Guid UniqueId { get; } = new Guid("9D4B5E78-9DE7-40EA-86C2-E70078DDC8D1"); // Replace with your own unique ID + public override Guid UniqueId { get; } = new("9D4B5E78-9DE7-40EA-86C2-E70078DDC8D1"); // Replace with your own unique ID public override bool SupportsDecoding => false; diff --git a/Samples/Workspace SDK/CardholderCredentialReaderSample/SampleCardholderCredentialReader.cs b/Samples/Workspace SDK/CardholderCredentialReaderSample/SampleCardholderCredentialReader.cs index 77f2da7..67e30ad 100644 --- a/Samples/Workspace SDK/CardholderCredentialReaderSample/SampleCardholderCredentialReader.cs +++ b/Samples/Workspace SDK/CardholderCredentialReaderSample/SampleCardholderCredentialReader.cs @@ -59,7 +59,7 @@ await Workspace.Sdk.TransactionManager.ExecuteTransactionAsync(() => { foreach (WiegandStandardCredentialFormat format in missing) { - + Dispatcher.Invoke(() => OnCredentialRetrieved(new CredentialRetrievedEventArgs(format))); } }); @@ -68,7 +68,7 @@ await Workspace.Sdk.TransactionManager.ExecuteTransactionAsync(() => public override string Name => nameof(SampleCardholderCredentialReader); - public override Guid UniqueId { get; } = new Guid("9B28081F-206B-41D4-AC26-B358DD9573EF"); + public override Guid UniqueId { get; } = new("9B28081F-206B-41D4-AC26-B358DD9573EF"); public override bool IsValid => true; diff --git a/Samples/Workspace SDK/CardholderFieldsExtractorSample/SampleCardholderFieldsExtractor.cs b/Samples/Workspace SDK/CardholderFieldsExtractorSample/SampleCardholderFieldsExtractor.cs index 90d30ad..1b58cc1 100644 --- a/Samples/Workspace SDK/CardholderFieldsExtractorSample/SampleCardholderFieldsExtractor.cs +++ b/Samples/Workspace SDK/CardholderFieldsExtractorSample/SampleCardholderFieldsExtractor.cs @@ -16,7 +16,7 @@ public class SampleCardholderFieldsExtractor : CardholderFieldsExtractor { public override string Name => "Read vCard..."; - public override Guid UniqueId { get; } = new Guid("88F33E43-1E51-4504-95BF-ADD2FBCBA8AD"); + public override Guid UniqueId { get; } = new("88F33E43-1E51-4504-95BF-ADD2FBCBA8AD"); public override CardholderFields GetFields(CardholderFieldsExtractorData data) { @@ -35,8 +35,8 @@ public override CardholderFields GetFields(CardholderFieldsExtractorData data) { FirstName = vCardInfo.FirstName, LastName = vCardInfo.LastName, - Email = vCardInfo.Emails.FirstOrDefault(), - Picture = vCardInfo.Picture, + Email = vCardInfo.Emails.FirstOrDefault(), + Picture = vCardInfo.Picture, Description = vCardInfo.Note }; } diff --git a/Samples/Workspace SDK/CredentialReaderSample/SampleCredentialReader.cs b/Samples/Workspace SDK/CredentialReaderSample/SampleCredentialReader.cs index 70b5e33..00499af 100644 --- a/Samples/Workspace SDK/CredentialReaderSample/SampleCredentialReader.cs +++ b/Samples/Workspace SDK/CredentialReaderSample/SampleCredentialReader.cs @@ -59,7 +59,7 @@ await Workspace.Sdk.TransactionManager.ExecuteTransactionAsync(() => { foreach (WiegandStandardCredentialFormat format in missing) { - + Dispatcher.Invoke(() => OnCredentialRetrieved(new CredentialRetrievedEventArgs(format))); } }); @@ -68,7 +68,7 @@ await Workspace.Sdk.TransactionManager.ExecuteTransactionAsync(() => public override string Name => nameof(SampleCredentialReader); - public override Guid UniqueId { get; } = new Guid("76104935-7793-4529-83D2-061BE6FB072F"); + public override Guid UniqueId { get; } = new("76104935-7793-4529-83D2-061BE6FB072F"); public override bool IsValid => true; diff --git a/Samples/Workspace SDK/DashboardWidgetSample/ClockWidget.cs b/Samples/Workspace SDK/DashboardWidgetSample/ClockWidget.cs index 295a9e8..7ce36ad 100644 --- a/Samples/Workspace SDK/DashboardWidgetSample/ClockWidget.cs +++ b/Samples/Workspace SDK/DashboardWidgetSample/ClockWidget.cs @@ -41,9 +41,9 @@ public class ClockWidget : DashboardWidget, INotifyPropertyChanged public override bool IsResizableVertically => false; - public override Size MaxWidgetSize { get; } = new Size(10, 10); + public override Size MaxWidgetSize { get; } = new(10, 10); - public override Size MinWidgetSize { get; } = new Size(3, 3); + public override Size MinWidgetSize { get; } = new(3, 3); public bool ShowDigitalTime { @@ -56,12 +56,12 @@ public string Time get => m_time; set => SetProperty(ref m_time, value); } - + public ICommand ViewDigitalTimeCommand { get; } public override string WidgetName => "Custom Clock Widget"; - public override Size WidgetSize { get; set; } = new Size(8, 8); + public override Size WidgetSize { get; set; } = new(8, 8); public override Guid WidgetTypeId => ClockWidgetBuilder.ClockWidgetTypeId; @@ -93,7 +93,7 @@ public override UIElement CreateView() { return m_view; } - + public override void Deserialize(string value) { ShowDigitalTime = ClockWidgetConfiguration.Deserialize(value).ShowDigitalTime; @@ -136,5 +136,5 @@ private void DigitalTimeCommand() Refresh(); } - + } \ No newline at end of file diff --git a/Samples/Workspace SDK/DashboardWidgetSample/ClockWidgetBuilder.cs b/Samples/Workspace SDK/DashboardWidgetSample/ClockWidgetBuilder.cs index 2bacdc4..4736890 100644 --- a/Samples/Workspace SDK/DashboardWidgetSample/ClockWidgetBuilder.cs +++ b/Samples/Workspace SDK/DashboardWidgetSample/ClockWidgetBuilder.cs @@ -17,7 +17,7 @@ namespace Genetec.Dap.CodeSamples; public sealed class ClockWidgetBuilder : DashboardWidgetBuilder { - public static Guid ClockWidgetTypeId = new Guid("3E27799F-2FE1-44B6-B131-0695D98503DE"); + public static Guid ClockWidgetTypeId = new("3E27799F-2FE1-44B6-B131-0695D98503DE"); public override string Description => "Simple clock"; diff --git a/Samples/Workspace SDK/ImageExtractorSample/SampleImageExtractor.cs b/Samples/Workspace SDK/ImageExtractorSample/SampleImageExtractor.cs index 878f816..e34808b 100644 --- a/Samples/Workspace SDK/ImageExtractorSample/SampleImageExtractor.cs +++ b/Samples/Workspace SDK/ImageExtractorSample/SampleImageExtractor.cs @@ -19,7 +19,7 @@ public sealed class SampleImageExtractor : ImageExtractor public override string Name => "Load from vCard..."; - public override Guid UniqueId { get; } = new Guid("5EDBB0B6-8253-433E-99A1-9021E498437A"); + public override Guid UniqueId { get; } = new("5EDBB0B6-8253-433E-99A1-9021E498437A"); public override ImageSource GetImage() diff --git a/Samples/Workspace SDK/TilePropertiesSample/SampleTileProperties.cs b/Samples/Workspace SDK/TilePropertiesSample/SampleTileProperties.cs index 99bb633..61515aa 100644 --- a/Samples/Workspace SDK/TilePropertiesSample/SampleTileProperties.cs +++ b/Samples/Workspace SDK/TilePropertiesSample/SampleTileProperties.cs @@ -12,7 +12,7 @@ namespace Genetec.Dap.CodeSamples; public class SampleTileProperties : TileProperties { - private readonly SampleTilePropertiesView m_view = new SampleTilePropertiesView(); + private readonly SampleTilePropertiesView m_view = new(); public override UIElement View => m_view; } \ No newline at end of file diff --git a/Samples/Workspace SDK/TilePropertiesSample/SampleTilePropertiesBuilder.cs b/Samples/Workspace SDK/TilePropertiesSample/SampleTilePropertiesBuilder.cs index 37dac5a..1026a9c 100644 --- a/Samples/Workspace SDK/TilePropertiesSample/SampleTilePropertiesBuilder.cs +++ b/Samples/Workspace SDK/TilePropertiesSample/SampleTilePropertiesBuilder.cs @@ -16,7 +16,7 @@ public class SampleTilePropertiesBuilder : TilePropertiesBuilder { public override string Name => nameof(SampleTilePropertiesBuilder); - public override Guid UniqueId { get; } = new Guid("25DD268E-A7AA-41DF-89FF-FAB6C0A74D57"); + public override Guid UniqueId { get; } = new("25DD268E-A7AA-41DF-89FF-FAB6C0A74D57"); public override TileProperties CreateView() { diff --git a/Samples/Workspace SDK/TileViewSample/SampleTileViewBuilder.cs b/Samples/Workspace SDK/TileViewSample/SampleTileViewBuilder.cs index 489915a..7c7e0e7 100644 --- a/Samples/Workspace SDK/TileViewSample/SampleTileViewBuilder.cs +++ b/Samples/Workspace SDK/TileViewSample/SampleTileViewBuilder.cs @@ -16,7 +16,7 @@ public class SampleTileViewBuilder : TileViewBuilder { public override string Name => nameof(SampleTileViewBuilder); - public override Guid UniqueId { get; } = new Guid("BA77CE7D-51D5-4274-B75F-0BCEEC392F03"); + public override Guid UniqueId { get; } = new("BA77CE7D-51D5-4274-B75F-0BCEEC392F03"); public override TileView CreateView() { diff --git a/Samples/Workspace SDK/TileWidgetSample/SampleTileWidget.cs b/Samples/Workspace SDK/TileWidgetSample/SampleTileWidget.cs index 8a8e6b9..afa4741 100644 --- a/Samples/Workspace SDK/TileWidgetSample/SampleTileWidget.cs +++ b/Samples/Workspace SDK/TileWidgetSample/SampleTileWidget.cs @@ -12,7 +12,7 @@ namespace Genetec.Dap.CodeSamples; public class SampleTileWidget : TileWidget { - private readonly SampleTileWidgetView m_view = new SampleTileWidgetView(); + private readonly SampleTileWidgetView m_view = new(); public override UIElement View => m_view; diff --git a/Samples/Workspace SDK/TileWidgetSample/SampleTileWidgetBuilder.cs b/Samples/Workspace SDK/TileWidgetSample/SampleTileWidgetBuilder.cs index a953340..c2ade0f 100644 --- a/Samples/Workspace SDK/TileWidgetSample/SampleTileWidgetBuilder.cs +++ b/Samples/Workspace SDK/TileWidgetSample/SampleTileWidgetBuilder.cs @@ -16,7 +16,7 @@ public class SampleTileWidgetBuilder : TileWidgetBuilder { public override string Name => nameof(SampleTileWidgetBuilder); - public override Guid UniqueId { get; } = new Guid("AAF2CC2A-A731-4882-98C1-87DF91AC6734"); + public override Guid UniqueId { get; } = new("AAF2CC2A-A731-4882-98C1-87DF91AC6734"); public override TileWidget CreateView() { @@ -28,5 +28,5 @@ public override bool IsSupported(TilePluginContext context) return context.Content is EntityContent || context.ContentGroup is EntityContentGroup; } - public override string Title => "Sample Tile Widget"; + public override string Title => "Sample Tile Widget"; } \ No newline at end of file diff --git a/Samples/Workspace SDK/TimelineProviderSample/AlarmTimelineEvent.cs b/Samples/Workspace SDK/TimelineProviderSample/AlarmTimelineEvent.cs index bb35376..520faaa 100644 --- a/Samples/Workspace SDK/TimelineProviderSample/AlarmTimelineEvent.cs +++ b/Samples/Workspace SDK/TimelineProviderSample/AlarmTimelineEvent.cs @@ -16,7 +16,7 @@ namespace Genetec.Dap.CodeSamples; public class AlarmTimelineEvent(Guid alarmGuid, int instanceId, DateTime dateTime) : TimelineEvent(dateTime) { - private static readonly Size s_size = new Size(16, 16); + private static readonly Size s_size = new(16, 16); private static readonly BitmapImage s_image; diff --git a/Samples/Workspace SDK/TimelineProviderSample/AlarmTimelineProviderBuilder.cs b/Samples/Workspace SDK/TimelineProviderSample/AlarmTimelineProviderBuilder.cs index 5823c6f..6224376 100644 --- a/Samples/Workspace SDK/TimelineProviderSample/AlarmTimelineProviderBuilder.cs +++ b/Samples/Workspace SDK/TimelineProviderSample/AlarmTimelineProviderBuilder.cs @@ -16,7 +16,7 @@ public class AlarmTimelineProviderBuilder : TimelineProviderBuilder public override string Title => "Active Alarms"; - public override Guid UniqueId { get; } = new Guid("4765D714-2BD6-42A8-99E3-0A0767C76321"); + public override Guid UniqueId { get; } = new("4765D714-2BD6-42A8-99E3-0A0767C76321"); public override TimelineProvider CreateProvider() { From 6e1857eead0eedd923402089a2aa88500a4c736c Mon Sep 17 00:00:00 2001 From: Andre Lafleur Date: Sun, 22 Sep 2024 02:59:49 +0800 Subject: [PATCH 14/22] Refactor classes to records for immutability Converted the following classes to records for better immutability and concise syntax: - `TimeAttendance` in `Program.cs` - `VideoFileInfo` in `Program.cs` - `ArchivedVisitorData` in `ArchivedVisitorData.cs` - `AccessControlReportRecord` in `AccessControlReportRecord.cs` - `ZoneActivityRecord` in `ZoneActivityRecord.cs` - `HealthEvent` in `HealthEvent.cs` - `IntrusionDetectionRecord` in `IntrusionDetectionRecord.cs` --- Samples/Platform SDK/TimeAttendanceSample/Program.cs | 2 +- Samples/Platform SDK/VideoFileQuerySample/Program.cs | 2 +- .../Platform SDK/VisitorManagerSample/ArchivedVisitorData.cs | 2 +- .../ReportHandlers/AccessControl/AccessControlReportRecord.cs | 2 +- .../Server/ReportHandlers/AccessControl/ZoneActivityRecord.cs | 2 +- .../CustomReportSample/Server/ReportHandlers/HealthEvent.cs | 2 +- .../Server/ReportHandlers/IntrusionDetectionRecord.cs | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Samples/Platform SDK/TimeAttendanceSample/Program.cs b/Samples/Platform SDK/TimeAttendanceSample/Program.cs index 4381be2..706d9f1 100644 --- a/Samples/Platform SDK/TimeAttendanceSample/Program.cs +++ b/Samples/Platform SDK/TimeAttendanceSample/Program.cs @@ -100,7 +100,7 @@ void DisplayToConsole(Engine engine, TimeAttendance timeAttendance) string GetEntityName(Guid entityGuid) => engine.GetEntity(entityGuid)?.Name ?? "Unknown"; } -class TimeAttendance +record TimeAttendance { public DateTime Date { get; set; } public Guid CardholderGuid { get; set; } diff --git a/Samples/Platform SDK/VideoFileQuerySample/Program.cs b/Samples/Platform SDK/VideoFileQuerySample/Program.cs index 99793f6..a996aba 100644 --- a/Samples/Platform SDK/VideoFileQuerySample/Program.cs +++ b/Samples/Platform SDK/VideoFileQuerySample/Program.cs @@ -108,7 +108,7 @@ void DisplayToConsole(VideoFileInfo info) Console.WriteLine(new string('-', 60)); } -class VideoFileInfo +record VideoFileInfo { public Guid CameraGuid { get; set; } public Guid ArchiveSourceGuid { get; set; } diff --git a/Samples/Platform SDK/VisitorManagerSample/ArchivedVisitorData.cs b/Samples/Platform SDK/VisitorManagerSample/ArchivedVisitorData.cs index fb9519b..c08a953 100644 --- a/Samples/Platform SDK/VisitorManagerSample/ArchivedVisitorData.cs +++ b/Samples/Platform SDK/VisitorManagerSample/ArchivedVisitorData.cs @@ -11,7 +11,7 @@ namespace Genetec.Dap.CodeSamples; using Sdk.Entities.CustomFields; using Sdk.Queries; -class ArchivedVisitorData +record ArchivedVisitorData { public Guid Guid { get; set; } public string FirstName { get; set; } diff --git a/Samples/Plugin SDK/CustomReportSample/Server/ReportHandlers/AccessControl/AccessControlReportRecord.cs b/Samples/Plugin SDK/CustomReportSample/Server/ReportHandlers/AccessControl/AccessControlReportRecord.cs index c1fb12c..457ff80 100644 --- a/Samples/Plugin SDK/CustomReportSample/Server/ReportHandlers/AccessControl/AccessControlReportRecord.cs +++ b/Samples/Plugin SDK/CustomReportSample/Server/ReportHandlers/AccessControl/AccessControlReportRecord.cs @@ -10,7 +10,7 @@ namespace Genetec.Dap.CodeSamples.Server.ReportHandlers.AccessControl; using System; using Genetec.Sdk; -class AccessControlReportRecord +record AccessControlReportRecord { public DateTime Timestamp { get; set; } public EventType EventType { get; set; } diff --git a/Samples/Plugin SDK/CustomReportSample/Server/ReportHandlers/AccessControl/ZoneActivityRecord.cs b/Samples/Plugin SDK/CustomReportSample/Server/ReportHandlers/AccessControl/ZoneActivityRecord.cs index 6f5024a..a35827d 100644 --- a/Samples/Plugin SDK/CustomReportSample/Server/ReportHandlers/AccessControl/ZoneActivityRecord.cs +++ b/Samples/Plugin SDK/CustomReportSample/Server/ReportHandlers/AccessControl/ZoneActivityRecord.cs @@ -9,7 +9,7 @@ namespace Genetec.Dap.CodeSamples.Server.ReportHandlers.AccessControl; using System; -class ZoneActivityRecord +record ZoneActivityRecord { public DateTime Timestamp { get; set; } public int EventType { get; set; } diff --git a/Samples/Plugin SDK/CustomReportSample/Server/ReportHandlers/HealthEvent.cs b/Samples/Plugin SDK/CustomReportSample/Server/ReportHandlers/HealthEvent.cs index 303f1a8..64fedf7 100644 --- a/Samples/Plugin SDK/CustomReportSample/Server/ReportHandlers/HealthEvent.cs +++ b/Samples/Plugin SDK/CustomReportSample/Server/ReportHandlers/HealthEvent.cs @@ -9,7 +9,7 @@ namespace Genetec.Dap.CodeSamples.Server.ReportHandlers; using System; -class HealthEvent +record HealthEvent { public int HealthEventId { get; set; } public int EventSourceTypeId { get; set; } diff --git a/Samples/Plugin SDK/CustomReportSample/Server/ReportHandlers/IntrusionDetectionRecord.cs b/Samples/Plugin SDK/CustomReportSample/Server/ReportHandlers/IntrusionDetectionRecord.cs index 19df709..9dcbdc4 100644 --- a/Samples/Plugin SDK/CustomReportSample/Server/ReportHandlers/IntrusionDetectionRecord.cs +++ b/Samples/Plugin SDK/CustomReportSample/Server/ReportHandlers/IntrusionDetectionRecord.cs @@ -9,7 +9,7 @@ namespace Genetec.Dap.CodeSamples.Server.ReportHandlers; using System; -record class IntrusionDetectionRecord +record IntrusionDetectionRecord { public DateTime Timestamp { get; set; } public int EventType { get; set; } From d73f789b2d816586765f2df561e309b0c9ff25e2 Mon Sep 17 00:00:00 2001 From: Andre Lafleur Date: Fri, 27 Sep 2024 22:41:00 +0800 Subject: [PATCH 15/22] Refactor main logic into async RunSample method Encapsulated main logic within an async RunSample method. Moved connection details and Engine initialization inside RunSample. Relocated LogOnAsync call and subsequent logic to RunSample. Added connection state check and entity processing in RunSample. Called LoadAreas and LoadFiles within RunSample to cache entities. Handled retrieval and processing of Area and File entities in RunSample. Moved console output for login failure and exit prompt to RunSample. Added await RunSample() to main program flow. --- .../CameraConfigurationSample/Program.cs | 53 ++++++++++--------- .../PeopleCountingSample/Program.cs | 47 ++++++++-------- .../Platform SDK/PlaySoundSample/Program.cs | 51 ++++++++++-------- 3 files changed, 83 insertions(+), 68 deletions(-) diff --git a/Samples/Platform SDK/CameraConfigurationSample/Program.cs b/Samples/Platform SDK/CameraConfigurationSample/Program.cs index 7af3b03..c46eb0d 100644 --- a/Samples/Platform SDK/CameraConfigurationSample/Program.cs +++ b/Samples/Platform SDK/CameraConfigurationSample/Program.cs @@ -14,35 +14,40 @@ SdkResolver.Initialize(); -using var engine = new Engine(); +await RunSample(); -ConnectionStateCode state = await engine.LogOnAsync(server, username, password); - -if (state == ConnectionStateCode.Success) +async Task RunSample() { - // Load cameras into the entity cache - await LoadCamerasIntoCache(); - - // Retrieve cameras from the entity cache - List cameras = engine.GetEntities(EntityType.Camera).OfType().ToList(); - Console.WriteLine($"{cameras.Count} cameras loaded"); - - // Retrieve camera configurations for all cameras - IList configurations = await GetCameraConfigurations(cameras); - - // Display camera configurations - foreach (CameraConfiguration configuration in configurations) + using var engine = new Engine(); + + ConnectionStateCode state = await engine.LogOnAsync(server, username, password); + + if (state == ConnectionStateCode.Success) + { + // Load cameras into the entity cache + await LoadCamerasIntoCache(); + + // Retrieve cameras from the entity cache + List cameras = engine.GetEntities(EntityType.Camera).OfType().ToList(); + Console.WriteLine($"{cameras.Count} cameras loaded"); + + // Retrieve camera configurations for all cameras + IList configurations = await GetCameraConfigurations(cameras); + + // Display camera configurations + foreach (CameraConfiguration configuration in configurations) + { + DisplayToConsole(configuration); + } + } + else { - DisplayToConsole(configuration); + Console.WriteLine($"Login failed: {state}"); } -} -else -{ - Console.WriteLine($"Login failed: {state}"); -} -Console.WriteLine("Press any key to exit..."); -Console.ReadKey(); + Console.WriteLine("Press any key to exit..."); + Console.ReadKey(); +} async Task LoadCamerasIntoCache() { diff --git a/Samples/Platform SDK/PeopleCountingSample/Program.cs b/Samples/Platform SDK/PeopleCountingSample/Program.cs index c3b756a..55949e5 100644 --- a/Samples/Platform SDK/PeopleCountingSample/Program.cs +++ b/Samples/Platform SDK/PeopleCountingSample/Program.cs @@ -14,36 +14,41 @@ using Genetec.Sdk; using Genetec.Sdk.Queries; -const string server = "localhost"; -const string username = "admin"; -const string password = ""; - SdkResolver.Initialize(); -using var engine = new Engine(); - -ConnectionStateCode state = await engine.LogOnAsync(server, username, password); +await RunSample(); -if (state == ConnectionStateCode.Success) +async Task RunSample() { - // Load areas into the entity cache - await LoadAreas(); + const string server = "localhost"; + const string username = "admin"; + const string password = ""; - // Retrieve areas from the entity cache - IEnumerable areas = engine.GetEntities(EntityType.Area).OfType(); + using var engine = new Engine(); - foreach (var area in areas) + ConnectionStateCode state = await engine.LogOnAsync(server, username, password); + + if (state == ConnectionStateCode.Success) { - DisplayToConsole(area); + // Load areas into the entity cache + await LoadAreas(); + + // Retrieve areas from the entity cache + IEnumerable areas = engine.GetEntities(EntityType.Area).OfType(); + + foreach (var area in areas) + { + DisplayToConsole(area); + } + } + else + { + Console.WriteLine($"Logon failed: {state}"); } -} -else -{ - Console.WriteLine($"Logon failed: {state}"); -} -Console.WriteLine("Press any key to exit..."); -Console.ReadKey(); + Console.WriteLine("Press any key to exit..."); + Console.ReadKey(); +} async Task LoadAreas() { diff --git a/Samples/Platform SDK/PlaySoundSample/Program.cs b/Samples/Platform SDK/PlaySoundSample/Program.cs index 366db20..302cf79 100644 --- a/Samples/Platform SDK/PlaySoundSample/Program.cs +++ b/Samples/Platform SDK/PlaySoundSample/Program.cs @@ -14,40 +14,45 @@ using Genetec.Sdk; using Genetec.Sdk.Entities; -const string server = "localhost"; -const string username = "admin"; -const string password = ""; - SdkResolver.Initialize(); -using var engine = new Engine(); - -ConnectionStateCode loginState = await engine.LogOnAsync(server, username, password); +await RunSample(); -if (loginState == ConnectionStateCode.Success) +async Task RunSample() { - // Load files into the entity cache - await LoadFiles(); + const string server = "localhost"; + const string username = "admin"; + const string password = ""; + + using var engine = new Engine(); - // Get audio files from the entity cache - IEnumerable audioFiles = engine.GetEntities(EntityType.File).OfType().Where(file => file.FileType == FileType.Audio); + ConnectionStateCode loginState = await engine.LogOnAsync(server, username, password); - foreach (File file in audioFiles) + if (loginState == ConnectionStateCode.Success) { - Console.WriteLine($"Playing sound file: {file.Name}"); + // Load files into the entity cache + await LoadFiles(); - engine.ActionManager.PlaySound(UserGroup.AdministratorsUserGroupGuid, file.Guid); + // Get audio files from the entity cache + IEnumerable audioFiles = engine.GetEntities(EntityType.File).OfType().Where(file => file.FileType == FileType.Audio); - await Task.Delay(2000); // Wait 2 seconds between each sound + foreach (File file in audioFiles) + { + Console.WriteLine($"Playing sound file: {file.Name}"); + + engine.ActionManager.PlaySound(UserGroup.AdministratorsUserGroupGuid, file.Guid); + + await Task.Delay(2000); // Wait 2 seconds between each sound + } + } + else + { + Console.WriteLine($"Login failed: {loginState}"); } -} -else -{ - Console.WriteLine($"Login failed: {loginState}"); -} -Console.WriteLine("Press any key to exit..."); -Console.ReadKey(); + Console.WriteLine("Press any key to exit..."); + Console.ReadKey(); +} async Task LoadFiles() { From 6f78fba9222b13e712720c48736bac8666329722 Mon Sep 17 00:00:00 2001 From: Andre Lafleur Date: Fri, 27 Sep 2024 22:52:58 +0800 Subject: [PATCH 16/22] Refactor methods to include Engine parameter Refactored several methods in `Program.cs` to include an `Engine` parameter, ensuring explicit dependency injection. Updated `RunSample` to initialize and pass the `Engine` instance to `LoadCamerasIntoCache`, `GetCameraConfigurations`, `LoadAreas`, and `LoadFiles`. Modified `DisplayToConsole` methods for `CameraConfiguration` and `Area` to use the `Engine` parameter. These changes enhance code modularity, readability, and maintainability. --- .../CameraConfigurationSample/Program.cs | 20 +++++++++---------- .../PeopleCountingSample/Program.cs | 8 ++++---- .../Platform SDK/PlaySoundSample/Program.cs | 4 ++-- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/Samples/Platform SDK/CameraConfigurationSample/Program.cs b/Samples/Platform SDK/CameraConfigurationSample/Program.cs index c46eb0d..a283ede 100644 --- a/Samples/Platform SDK/CameraConfigurationSample/Program.cs +++ b/Samples/Platform SDK/CameraConfigurationSample/Program.cs @@ -8,16 +8,16 @@ using Genetec.Sdk.Entities; using System.Linq; -const string server = "localhost"; -const string username = "admin"; -const string password = ""; - SdkResolver.Initialize(); await RunSample(); async Task RunSample() { + const string server = "localhost"; + const string username = "admin"; + const string password = ""; + using var engine = new Engine(); ConnectionStateCode state = await engine.LogOnAsync(server, username, password); @@ -25,19 +25,19 @@ async Task RunSample() if (state == ConnectionStateCode.Success) { // Load cameras into the entity cache - await LoadCamerasIntoCache(); + await LoadCamerasIntoCache(engine); // Retrieve cameras from the entity cache List cameras = engine.GetEntities(EntityType.Camera).OfType().ToList(); Console.WriteLine($"{cameras.Count} cameras loaded"); // Retrieve camera configurations for all cameras - IList configurations = await GetCameraConfigurations(cameras); + IList configurations = await GetCameraConfigurations(engine, cameras); // Display camera configurations foreach (CameraConfiguration configuration in configurations) { - DisplayToConsole(configuration); + DisplayToConsole(engine, configuration); } } else @@ -49,7 +49,7 @@ async Task RunSample() Console.ReadKey(); } -async Task LoadCamerasIntoCache() +async Task LoadCamerasIntoCache(Engine engine) { Console.WriteLine("Loading cameras..."); @@ -58,7 +58,7 @@ async Task LoadCamerasIntoCache() await Task.Factory.FromAsync(query.BeginQuery, query.EndQuery, null); } -async Task> GetCameraConfigurations(IEnumerable cameras) +async Task> GetCameraConfigurations(Engine engine, IEnumerable cameras) { Console.WriteLine("Retrieving camera configurations..."); @@ -94,7 +94,7 @@ async Task> GetCameraConfigurations(IEnumerable areas = engine.GetEntities(EntityType.Area).OfType(); foreach (var area in areas) { - DisplayToConsole(area); + DisplayToConsole(engine, area); } } else @@ -50,7 +50,7 @@ async Task RunSample() Console.ReadKey(); } -async Task LoadAreas() +async Task LoadAreas(Engine engine) { Console.WriteLine("Loading areas..."); @@ -68,7 +68,7 @@ async Task LoadAreas() } while (args.Data.Rows.Count > query.PageSize); } -void DisplayToConsole(Area area) +void DisplayToConsole(Engine engine, Area area) { Console.WriteLine($"\n{area.Name}"); Console.WriteLine($"People Count: {area.PeopleCount.Count}"); diff --git a/Samples/Platform SDK/PlaySoundSample/Program.cs b/Samples/Platform SDK/PlaySoundSample/Program.cs index 302cf79..adbc311 100644 --- a/Samples/Platform SDK/PlaySoundSample/Program.cs +++ b/Samples/Platform SDK/PlaySoundSample/Program.cs @@ -31,7 +31,7 @@ async Task RunSample() if (loginState == ConnectionStateCode.Success) { // Load files into the entity cache - await LoadFiles(); + await LoadFiles(engine); // Get audio files from the entity cache IEnumerable audioFiles = engine.GetEntities(EntityType.File).OfType().Where(file => file.FileType == FileType.Audio); @@ -54,7 +54,7 @@ async Task RunSample() Console.ReadKey(); } -async Task LoadFiles() +async Task LoadFiles(Engine engine) { Console.WriteLine("Loading files..."); From 273b2c23628e3a5816299e5b565a7cad9efe48a6 Mon Sep 17 00:00:00 2001 From: Andre Lafleur Date: Fri, 27 Sep 2024 23:16:33 +0800 Subject: [PATCH 17/22] Refactor main logic into async RunSample method Encapsulated main logic into an async RunSample method called at the start of Main. Moved connection details, Engine initialization, and LogOnAsync handling inside RunSample. Nested PTZ camera operations within RunSample, ensuring execution only on successful logon. Scoped FindPtzCamera and LoadNetworks methods within RunSample. Added checks for camera presets and appropriate messages for various failure states. Included IsPtzCamera predicate within FindPtzCamera. Final exit message moved inside RunSample. --- .../PtzCoordinatesManagerSample/Program.cs | 189 +++++++++--------- 1 file changed, 97 insertions(+), 92 deletions(-) diff --git a/Samples/Media SDK/PtzCoordinatesManagerSample/Program.cs b/Samples/Media SDK/PtzCoordinatesManagerSample/Program.cs index 1f582a7..19aa9d2 100644 --- a/Samples/Media SDK/PtzCoordinatesManagerSample/Program.cs +++ b/Samples/Media SDK/PtzCoordinatesManagerSample/Program.cs @@ -16,137 +16,142 @@ using Genetec.Sdk.Media.Ptz; using Genetec.Sdk.Queries; -const string server = "localhost"; -const string username = "admin"; -const string password = ""; - SdkResolver.Initialize(); -using var engine = new Engine(); - -ConnectionStateCode state = await engine.LogOnAsync(server: server, username: username, password: password); +await RunSample(); -if (state == ConnectionStateCode.Success) +async Task RunSample() { - // Find the first PTZ camera that is running - Camera camera = await FindPtzCamera(); + const string server = "localhost"; + const string username = "admin"; + const string password = ""; + + using var engine = new Engine(); + + ConnectionStateCode state = await engine.LogOnAsync(server: server, username: username, password: password); - if (camera is not null) + if (state == ConnectionStateCode.Success) { - // Load all networks entities into the entity cache - await LoadNetworks(); + // Find the first PTZ camera that is running + Camera camera = await FindPtzCamera(); - // Retrieve all the networks from the entity cache - IEnumerable networks = engine.GetEntities(EntityType.Network).OfType(); + if (camera is not null) + { + // Load all networks entities into the entity cache + await LoadNetworks(); - // The client subnet, for route resolving purpose - // In this sample, we use the first network found, but you can use any network that is connected to the camera - Network network = networks.First(); + // Retrieve all the networks from the entity cache + IEnumerable networks = engine.GetEntities(EntityType.Network).OfType(); - using var manager = new PtzCoordinatesManager(); - manager.PtzStarted += (sender, e) => Console.WriteLine($"PTZ started. Coordinates: {e.Coordinates}\n"); - manager.PtzStopped += (sender, e) => Console.WriteLine($"PTZ stopped. Coordinates: {e.Coordinates}\n"); - manager.CoordinatesReceived += (sender, e) => Console.WriteLine($"Coordinates received. Coordinates: {e.Coordinates}\n"); + // The client subnet, for route resolving purpose + // In this sample, we use the first network found, but you can use any network that is connected to the camera + Network network = networks.First(); - Console.WriteLine($"Initializing PTZ control for camera '{camera.Name}' using network '{network.Name}'.\n"); - manager.Initialize(sdkEngine: engine, cameraGuid: camera.Guid, clientSubnet: network.Guid); + using var manager = new PtzCoordinatesManager(); + manager.PtzStarted += (sender, e) => Console.WriteLine($"PTZ started. Coordinates: {e.Coordinates}\n"); + manager.PtzStopped += (sender, e) => Console.WriteLine($"PTZ stopped. Coordinates: {e.Coordinates}\n"); + manager.CoordinatesReceived += (sender, e) => Console.WriteLine($"Coordinates received. Coordinates: {e.Coordinates}\n"); - // Get the presets of the camera - List presets = Enumerable.Range(camera.PtzCapabilities.PresetBase, camera.PtzCapabilities.NumberOfPresets).ToList(); + Console.WriteLine($"Initializing PTZ control for camera '{camera.Name}' using network '{network.Name}'.\n"); + manager.Initialize(sdkEngine: engine, cameraGuid: camera.Guid, clientSubnet: network.Guid); - if (presets.Any()) - { - // Move the camera to each preset - foreach (int preset in presets) - { - // Get the name of the preset - string presetName = camera.GetPtzPresetName(preset); + // Get the presets of the camera + List presets = Enumerable.Range(camera.PtzCapabilities.PresetBase, camera.PtzCapabilities.NumberOfPresets).ToList(); - // If the preset has no name, use the preset number - if (string.IsNullOrEmpty(presetName)) + if (presets.Any()) + { + // Move the camera to each preset + foreach (int preset in presets) { - presetName = $"Preset {preset}"; - } + // Get the name of the preset + string presetName = camera.GetPtzPresetName(preset); - Console.WriteLine($"Moving to {presetName}... (Preset number: {preset})"); - manager.ControlPtz(PtzCommandType.GoToPreset, preset, 0); // Move the camera to the preset + // If the preset has no name, use the preset number + if (string.IsNullOrEmpty(presetName)) + { + presetName = $"Preset {preset}"; + } - Console.WriteLine("Pausing for 2 seconds before next movement.\n"); - await Task.Delay(2000); // Wait for 2 seconds before moving to the next preset - } + Console.WriteLine($"Moving to {presetName}... (Preset number: {preset})"); + manager.ControlPtz(PtzCommandType.GoToPreset, preset, 0); // Move the camera to the preset - Console.WriteLine($"Completed moving through {presets.Count} presets.\n"); + Console.WriteLine("Pausing for 2 seconds before next movement.\n"); + await Task.Delay(2000); // Wait for 2 seconds before moving to the next preset + } + + Console.WriteLine($"Completed moving through {presets.Count} presets.\n"); + } + else + { + Console.WriteLine($"No presets found for camera '{camera.Name}'.\n"); + } } else { - Console.WriteLine($"No presets found for camera '{camera.Name}'.\n"); + Console.WriteLine("No suitable PTZ camera found. Ensure a PTZ camera is running and supports the GoToPreset command.\n"); } } else { - Console.WriteLine("No suitable PTZ camera found. Ensure a PTZ camera is running and supports the GoToPreset command.\n"); + Console.WriteLine($"Logon failed: {state}"); } -} -else -{ - Console.WriteLine($"Logon failed: {state}"); -} -Console.WriteLine(value: "Press any key to exit..."); -Console.ReadKey(); + Console.WriteLine(value: "Press any key to exit..."); + Console.ReadKey(); -// Find the first PTZ camera that is running and supports the GoToPreset command -async Task FindPtzCamera() -{ - Console.WriteLine("Loading cameras...\n"); + // Find the first PTZ camera that is running and supports the GoToPreset command + async Task FindPtzCamera() + { + Console.WriteLine("Loading cameras...\n"); - var query = (EntityConfigurationQuery)engine.ReportManager.CreateReportQuery(ReportType.EntityConfiguration); + var query = (EntityConfigurationQuery)engine.ReportManager.CreateReportQuery(ReportType.EntityConfiguration); - query.EntityTypeFilter.Add(EntityType.Camera); // Only fetch cameras - query.Page = 1; // Start at page 1 - query.PageSize = 100; // Fetch 100 cameras at a time + query.EntityTypeFilter.Add(EntityType.Camera); // Only fetch cameras + query.Page = 1; // Start at page 1 + query.PageSize = 100; // Fetch 100 cameras at a time - QueryCompletedEventArgs args; + QueryCompletedEventArgs args; - do - { - // Fetch the current page of cameras - QueryCompletedEventArgs result = args = await Task.Factory.FromAsync(query.BeginQuery, query.EndQuery, null); + do + { + // Fetch the current page of cameras + QueryCompletedEventArgs result = args = await Task.Factory.FromAsync(query.BeginQuery, query.EndQuery, null); - // Find the first PTZ camera that is running and supports the GoToPreset command - Camera camera = result.Data.AsEnumerable() - .Select(row => engine.GetEntity(row.Field(nameof(Guid)))) - .OfType() - .FirstOrDefault(IsPtzCamera); + // Find the first PTZ camera that is running and supports the GoToPreset command + Camera camera = result.Data.AsEnumerable() + .Select(row => engine.GetEntity(row.Field(nameof(Guid)))) + .OfType() + .FirstOrDefault(IsPtzCamera); - // If we found a camera, return it - if (camera != null) - { - return camera; - } + // If we found a camera, return it + if (camera != null) + { + return camera; + } - // If we didn't find a camera, move to the next page - query.Page++; + // If we didn't find a camera, move to the next page + query.Page++; - // If there are more rows than the page size, we need to fetch them - } while (args.Data.Rows.Count > query.PageSize); + // If there are more rows than the page size, we need to fetch them + } while (args.Data.Rows.Count > query.PageSize); - return null; + return null; - // Predicate to check if a camera is a PTZ camera that is running and supports the GoToPreset command - bool IsPtzCamera(Camera camera) - => camera.IsPtz && camera.PtzCapabilities.IsSupportedCommand(PtzCommandType.GoToPreset) && camera.RunningState == State.Running; -} + // Predicate to check if a camera is a PTZ camera that is running and supports the GoToPreset command + bool IsPtzCamera(Camera camera) + => camera.IsPtz && camera.PtzCapabilities.IsSupportedCommand(PtzCommandType.GoToPreset) && camera.RunningState == State.Running; + } -// Load all networks entities into the entity cache -async Task LoadNetworks() -{ - Console.WriteLine("Loading networks...\n"); + // Load all networks entities into the entity cache + async Task LoadNetworks() + { + Console.WriteLine("Loading networks...\n"); - var query = (EntityConfigurationQuery)engine.ReportManager.CreateReportQuery(ReportType.EntityConfiguration); + var query = (EntityConfigurationQuery)engine.ReportManager.CreateReportQuery(ReportType.EntityConfiguration); - query.EntityTypeFilter.Add(EntityType.Network); // Only fetch networks + query.EntityTypeFilter.Add(EntityType.Network); // Only fetch networks - // Fetch the networks - await Task.Factory.FromAsync(query.BeginQuery, query.EndQuery, null); + // Fetch the networks + await Task.Factory.FromAsync(query.BeginQuery, query.EndQuery, null); + } } \ No newline at end of file From de1627988ceabe3835c3b35e9a2086b1b86404b2 Mon Sep 17 00:00:00 2001 From: Andre Lafleur Date: Sat, 28 Sep 2024 08:20:29 +0800 Subject: [PATCH 18/22] Update package and ensure config file is copied Updated Microsoft.Windows.Compatibility package to version 8.0.8 for latest features and bug fixes. Added LoggerSample.exe.gconfig to always copy to output directory during build for runtime configuration. --- Samples/Platform SDK/LoggerSample/LoggerSample.csproj | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Samples/Platform SDK/LoggerSample/LoggerSample.csproj b/Samples/Platform SDK/LoggerSample/LoggerSample.csproj index 7fe3ee0..0444c04 100644 --- a/Samples/Platform SDK/LoggerSample/LoggerSample.csproj +++ b/Samples/Platform SDK/LoggerSample/LoggerSample.csproj @@ -45,7 +45,7 @@ $(GSC_SDK_CORE)\Genetec.Sdk.dll False - + @@ -53,6 +53,12 @@ + + + Always + + + From bdffb9d4b5ca92be14d2898e040cac52df03e2e9 Mon Sep 17 00:00:00 2001 From: Andre Lafleur Date: Sat, 28 Sep 2024 10:12:46 +0800 Subject: [PATCH 19/22] Update .csproj files for .NET 8.0 and WPF support Updated project references and package dependencies across multiple .csproj files to support .NET 8.0 for Windows. Key changes include: - Updated `Microsoft.Windows.Compatibility` package from `8.0.6` to `8.0.8`. - Added `FrameworkReference` to `Microsoft.WindowsDesktop.App.WPF` for WPF applications. - Added and removed references to essential .NET assemblies (`System`, `System.Core`, `PresentationCore`, `PresentationFramework`, `WindowsBase`, `System.Drawing`, `System.Data.DataSetExtensions`). - Added `Microsoft.Bcl.AsyncInterfaces` package reference to some projects. - Removed `DebugType` property for `net481` configurations in `VisitorManagerSample.csproj`. - Added a `Target` named `CopyCertificates` to copy certificates post-build. These changes ensure compatibility with .NET 8.0, streamline project files, and improve maintainability. --- .../BasicMediaPlayer/BasicMediaPlayer.csproj | 20 +++++++------- .../FileCryptingManagerSample.csproj | 17 +++++------- .../MediaFileSample/MediaFileSample.csproj | 17 +++++------- .../OverlaySample/OverlaySample.csproj | 18 ++++++------- .../PlaybackSequenceQuerierSample.csproj | 10 +++---- .../PlaybackStreamReaderSample.csproj | 10 +++---- .../PtzCoordinatesManagerSample.csproj | 12 ++++----- .../VideoExportSample.csproj | 10 +++---- .../VideoSourceFilterSample.csproj | 10 +++---- .../AccessControlRawEventQuerySample.csproj | 12 ++++----- .../AccessControlReportQuerySample.csproj | 13 +++++----- .../AccessControlUnitManagerSample.csproj | 10 +++---- .../AccessControlUnitSample.csproj | 12 ++++----- .../AccessEventMonitoringSample.csproj | 10 +++---- .../AccessVerifierSample.csproj | 10 +++---- .../ActivityTrailsSample.csproj | 12 ++++----- .../AlarmActivityQuerySample.csproj | 12 ++++----- .../AlarmMonitoringSample.csproj | 10 +++---- .../AuditTrailsSample.csproj | 12 ++++----- .../CameraConfigurationSample.csproj | 12 ++++----- .../CameraSample/CameraSample.csproj | 12 ++++----- .../CopyConfiguratonSample.csproj | 12 ++++----- .../CustomEntitySample.csproj | 20 +++++++------- .../CustomEventSample.csproj | 12 ++++----- .../CustomFieldSample.csproj | 14 +++++----- .../CustomIconSample/CustomIconSample.csproj | 13 +++++----- .../DiagnosticServerSample.csproj | 10 +++---- .../DisplayInTileSample.csproj | 10 +++---- .../EntityCacheSample.csproj | 10 +++---- .../EntityCertificatesManagerSample.csproj | 10 +++---- .../EntityMappingSample.csproj | 10 +++---- .../EventMonitoringSample.csproj | 10 +++---- .../EventToActionSample.csproj | 10 +++---- .../IncidentManagerSample.csproj | 15 ++++------- .../LicenseManagerSample.csproj | 10 +++---- .../LoggerSample/LoggerSample.csproj | 8 +++--- .../LoginManagerSample.csproj | 18 +++---------- .../MacroSample/MacroSample.csproj | 12 ++++----- .../PeopleCountingSample.csproj | 10 +++---- .../PlaySoundSample/PlaySoundSample.csproj | 10 +++---- .../RaiseEventSample/RaiseEventSample.csproj | 10 +++---- .../RequestManagerSample.csproj | 12 ++++----- .../SecurityManagerSample.csproj | 10 +++---- .../SequenceQuerySample.csproj | 12 ++++----- .../ThumbnailQuerySample.csproj | 12 ++++----- .../TimeAttendanceSample.csproj | 12 ++++----- .../TransactionManagerSample.csproj | 14 +++------- .../TriggerAlarmSample.csproj | 14 +++------- .../UnusedCredentialQuerySample.csproj | 12 ++++----- .../UserTaskSample/UserTaskSample.csproj | 12 ++++----- .../VideoFileQuerySample.csproj | 12 ++++----- .../VideoUnitSample/VideoUnitSample.csproj | 12 ++++----- .../VisitorManagerSample.csproj | 20 ++++---------- .../BasicPluginTemplate.csproj | 12 ++++----- .../CustomActionSample.csproj | 24 +++++------------ .../CustomReportSample.csproj | 21 ++++++--------- .../PluginConfigurationSample.csproj | 18 ++++++------- .../PluginDatabaseSample.csproj | 12 ++++----- .../BackgroundProcessSample.csproj | 13 +++++----- .../BadgePrinterSample.csproj | 19 +++++++------- .../CardholderCredentialReaderSample.csproj | 15 ++++++----- .../CardholderFieldsExtractorSample.csproj | 16 +++++------- .../CommandManagerSample.csproj | 16 +++++------- .../ConfigPageSample/ConfigPageSample.csproj | 16 +++++------- .../ControlsSample/ControlsSample.csproj | 17 ++++++------ .../CredentialBuilderSample.csproj | 12 ++++----- .../CredentialReaderSample.csproj | 15 ++++++----- .../DashboardWidgetSample.csproj | 26 +++++++++---------- .../EventExtenderSample.csproj | 22 +++++----------- .../ImageExtractorSample.csproj | 16 +++++------- .../OptionsExtensionSample.csproj | 20 +++++--------- .../PageTaskSample/PageTaskSample.csproj | 16 +++++------- .../ReportExporterSample.csproj | 7 ++--- .../TaskSample/TaskSample.csproj | 23 +++++----------- .../TilePropertiesSample.csproj | 16 +++++------- .../TileViewSample/TileViewSample.csproj | 16 +++++------- .../TileWidgetSample/TileWidgetSample.csproj | 18 ++++++------- .../TimelineProviderSample.csproj | 20 +++++++------- 78 files changed, 441 insertions(+), 634 deletions(-) diff --git a/Samples/Media SDK/BasicMediaPlayer/BasicMediaPlayer.csproj b/Samples/Media SDK/BasicMediaPlayer/BasicMediaPlayer.csproj index e4a48d3..485bb47 100644 --- a/Samples/Media SDK/BasicMediaPlayer/BasicMediaPlayer.csproj +++ b/Samples/Media SDK/BasicMediaPlayer/BasicMediaPlayer.csproj @@ -42,6 +42,13 @@ $(GSC_SDK)\Genetec.Sdk.Media.dll False + + + + + + + @@ -53,17 +60,8 @@ $(GSC_SDK_CORE)\Genetec.Sdk.Media.dll False - - - - - - - - - - - + + diff --git a/Samples/Media SDK/FileCryptingManagerSample/FileCryptingManagerSample.csproj b/Samples/Media SDK/FileCryptingManagerSample/FileCryptingManagerSample.csproj index ae4ad21..019415e 100644 --- a/Samples/Media SDK/FileCryptingManagerSample/FileCryptingManagerSample.csproj +++ b/Samples/Media SDK/FileCryptingManagerSample/FileCryptingManagerSample.csproj @@ -42,6 +42,12 @@ $(GSC_SDK)\Genetec.Sdk.Media.dll False + + + + + + @@ -53,16 +59,7 @@ $(GSC_SDK_CORE)\Genetec.Sdk.Media.dll False - - - - - - - - - - + diff --git a/Samples/Media SDK/MediaFileSample/MediaFileSample.csproj b/Samples/Media SDK/MediaFileSample/MediaFileSample.csproj index 876d203..220c3ea 100644 --- a/Samples/Media SDK/MediaFileSample/MediaFileSample.csproj +++ b/Samples/Media SDK/MediaFileSample/MediaFileSample.csproj @@ -42,6 +42,12 @@ $(GSC_SDK)\Genetec.Sdk.Media.dll False + + + + + + @@ -53,16 +59,7 @@ $(GSC_SDK_CORE)\Genetec.Sdk.Media.dll False - - - - - - - - - - + diff --git a/Samples/Media SDK/OverlaySample/OverlaySample.csproj b/Samples/Media SDK/OverlaySample/OverlaySample.csproj index 507d320..b218c2f 100644 --- a/Samples/Media SDK/OverlaySample/OverlaySample.csproj +++ b/Samples/Media SDK/OverlaySample/OverlaySample.csproj @@ -42,6 +42,12 @@ $(GSC_SDK)\Genetec.Sdk.Media.dll False + + + + + + @@ -53,16 +59,8 @@ $(GSC_SDK_CORE)\Genetec.Sdk.Media.dll False - - - - - - - - - - + + diff --git a/Samples/Media SDK/PlaybackSequenceQuerierSample/PlaybackSequenceQuerierSample.csproj b/Samples/Media SDK/PlaybackSequenceQuerierSample/PlaybackSequenceQuerierSample.csproj index 6b02866..6125862 100644 --- a/Samples/Media SDK/PlaybackSequenceQuerierSample/PlaybackSequenceQuerierSample.csproj +++ b/Samples/Media SDK/PlaybackSequenceQuerierSample/PlaybackSequenceQuerierSample.csproj @@ -42,6 +42,8 @@ $(GSC_SDK)\Genetec.Sdk.Media.dll False + + @@ -53,12 +55,8 @@ $(GSC_SDK_CORE)\Genetec.Sdk.Media.dll False - - - - - - + + diff --git a/Samples/Media SDK/PlaybackStreamReaderSample/PlaybackStreamReaderSample.csproj b/Samples/Media SDK/PlaybackStreamReaderSample/PlaybackStreamReaderSample.csproj index 300b206..1e9acad 100644 --- a/Samples/Media SDK/PlaybackStreamReaderSample/PlaybackStreamReaderSample.csproj +++ b/Samples/Media SDK/PlaybackStreamReaderSample/PlaybackStreamReaderSample.csproj @@ -42,6 +42,8 @@ $(GSC_SDK)\Genetec.Sdk.Media.dll False + + @@ -53,12 +55,8 @@ $(GSC_SDK_CORE)\Genetec.Sdk.Media.dll False - - - - - - + + diff --git a/Samples/Media SDK/PtzCoordinatesManagerSample/PtzCoordinatesManagerSample.csproj b/Samples/Media SDK/PtzCoordinatesManagerSample/PtzCoordinatesManagerSample.csproj index 635c23b..1d5a26b 100644 --- a/Samples/Media SDK/PtzCoordinatesManagerSample/PtzCoordinatesManagerSample.csproj +++ b/Samples/Media SDK/PtzCoordinatesManagerSample/PtzCoordinatesManagerSample.csproj @@ -42,6 +42,9 @@ $(GSC_SDK)\Genetec.Sdk.Media.dll False + + + @@ -53,13 +56,8 @@ $(GSC_SDK_CORE)\Genetec.Sdk.Media.dll False - - - - - - - + + diff --git a/Samples/Media SDK/VideoExportSample/VideoExportSample.csproj b/Samples/Media SDK/VideoExportSample/VideoExportSample.csproj index 3008f8b..3aae6a8 100644 --- a/Samples/Media SDK/VideoExportSample/VideoExportSample.csproj +++ b/Samples/Media SDK/VideoExportSample/VideoExportSample.csproj @@ -42,6 +42,8 @@ $(GSC_SDK)\Genetec.Sdk.Media.dll False + + @@ -53,12 +55,8 @@ $(GSC_SDK_CORE)\Genetec.Sdk.Media.dll False - - - - - - + + diff --git a/Samples/Media SDK/VideoSourceFilterSample/VideoSourceFilterSample.csproj b/Samples/Media SDK/VideoSourceFilterSample/VideoSourceFilterSample.csproj index 6b2b1ed..1133d23 100644 --- a/Samples/Media SDK/VideoSourceFilterSample/VideoSourceFilterSample.csproj +++ b/Samples/Media SDK/VideoSourceFilterSample/VideoSourceFilterSample.csproj @@ -42,6 +42,8 @@ $(GSC_SDK)\Genetec.Sdk.Media.dll False + + @@ -53,12 +55,8 @@ $(GSC_SDK_CORE)\Genetec.Sdk.Media.dll False - - - - - - + + diff --git a/Samples/Platform SDK/AccessControlRawEventQuerySample/AccessControlRawEventQuerySample.csproj b/Samples/Platform SDK/AccessControlRawEventQuerySample/AccessControlRawEventQuerySample.csproj index 81cfe4a..59e96d0 100644 --- a/Samples/Platform SDK/AccessControlRawEventQuerySample/AccessControlRawEventQuerySample.csproj +++ b/Samples/Platform SDK/AccessControlRawEventQuerySample/AccessControlRawEventQuerySample.csproj @@ -38,6 +38,9 @@ $(GSC_SDK)\Genetec.Sdk.dll False + + + @@ -45,13 +48,8 @@ $(GSC_SDK_CORE)\Genetec.Sdk.dll False - - - - - - - + + diff --git a/Samples/Platform SDK/AccessControlReportQuerySample/AccessControlReportQuerySample.csproj b/Samples/Platform SDK/AccessControlReportQuerySample/AccessControlReportQuerySample.csproj index 1d83870..2c4aca1 100644 --- a/Samples/Platform SDK/AccessControlReportQuerySample/AccessControlReportQuerySample.csproj +++ b/Samples/Platform SDK/AccessControlReportQuerySample/AccessControlReportQuerySample.csproj @@ -38,6 +38,10 @@ $(GSC_SDK)\Genetec.Sdk.dll False + + + + @@ -45,13 +49,8 @@ $(GSC_SDK_CORE)\Genetec.Sdk.dll False - - - - - - - + + diff --git a/Samples/Platform SDK/AccessControlUnitManagerSample/AccessControlUnitManagerSample.csproj b/Samples/Platform SDK/AccessControlUnitManagerSample/AccessControlUnitManagerSample.csproj index 6be2e16..91b2c09 100644 --- a/Samples/Platform SDK/AccessControlUnitManagerSample/AccessControlUnitManagerSample.csproj +++ b/Samples/Platform SDK/AccessControlUnitManagerSample/AccessControlUnitManagerSample.csproj @@ -38,6 +38,8 @@ $(GSC_SDK)\Genetec.Sdk.dll False + + @@ -45,12 +47,8 @@ $(GSC_SDK_CORE)\Genetec.Sdk.dll False - - - - - - + + diff --git a/Samples/Platform SDK/AccessControlUnitSample/AccessControlUnitSample.csproj b/Samples/Platform SDK/AccessControlUnitSample/AccessControlUnitSample.csproj index a8ff7e0..b41e96c 100644 --- a/Samples/Platform SDK/AccessControlUnitSample/AccessControlUnitSample.csproj +++ b/Samples/Platform SDK/AccessControlUnitSample/AccessControlUnitSample.csproj @@ -38,6 +38,8 @@ $(GSC_SDK)\Genetec.Sdk.dll False + + @@ -45,14 +47,10 @@ $(GSC_SDK_CORE)\Genetec.Sdk.dll False - - - - - - + + - + $(OutputPath)Certificates diff --git a/Samples/Platform SDK/AccessEventMonitoringSample/AccessEventMonitoringSample.csproj b/Samples/Platform SDK/AccessEventMonitoringSample/AccessEventMonitoringSample.csproj index 8dd87e5..ef65121 100644 --- a/Samples/Platform SDK/AccessEventMonitoringSample/AccessEventMonitoringSample.csproj +++ b/Samples/Platform SDK/AccessEventMonitoringSample/AccessEventMonitoringSample.csproj @@ -38,6 +38,8 @@ $(GSC_SDK)\Genetec.Sdk.dll False + + @@ -45,12 +47,8 @@ $(GSC_SDK_CORE)\Genetec.Sdk.dll False - - - - - - + + diff --git a/Samples/Platform SDK/AccessVerifierSample/AccessVerifierSample.csproj b/Samples/Platform SDK/AccessVerifierSample/AccessVerifierSample.csproj index 3d6fd73..c21efc6 100644 --- a/Samples/Platform SDK/AccessVerifierSample/AccessVerifierSample.csproj +++ b/Samples/Platform SDK/AccessVerifierSample/AccessVerifierSample.csproj @@ -38,6 +38,8 @@ $(GSC_SDK)\Genetec.Sdk.dll False + + @@ -45,12 +47,8 @@ $(GSC_SDK_CORE)\Genetec.Sdk.dll False - - - - - - + + diff --git a/Samples/Platform SDK/ActivityTrailsSample/ActivityTrailsSample.csproj b/Samples/Platform SDK/ActivityTrailsSample/ActivityTrailsSample.csproj index d925602..e6beb6d 100644 --- a/Samples/Platform SDK/ActivityTrailsSample/ActivityTrailsSample.csproj +++ b/Samples/Platform SDK/ActivityTrailsSample/ActivityTrailsSample.csproj @@ -38,6 +38,9 @@ $(GSC_SDK)\Genetec.Sdk.dll False + + + @@ -45,14 +48,11 @@ $(GSC_SDK_CORE)\Genetec.Sdk.dll False - + + - - - - - + diff --git a/Samples/Platform SDK/AlarmActivityQuerySample/AlarmActivityQuerySample.csproj b/Samples/Platform SDK/AlarmActivityQuerySample/AlarmActivityQuerySample.csproj index e72a48f..83b05db 100644 --- a/Samples/Platform SDK/AlarmActivityQuerySample/AlarmActivityQuerySample.csproj +++ b/Samples/Platform SDK/AlarmActivityQuerySample/AlarmActivityQuerySample.csproj @@ -38,6 +38,9 @@ $(GSC_SDK)\Genetec.Sdk.dll False + + + @@ -45,13 +48,8 @@ $(GSC_SDK_CORE)\Genetec.Sdk.dll False - - - - - - - + + diff --git a/Samples/Platform SDK/AlarmMonitoringSample/AlarmMonitoringSample.csproj b/Samples/Platform SDK/AlarmMonitoringSample/AlarmMonitoringSample.csproj index 772ebe3..2821c68 100644 --- a/Samples/Platform SDK/AlarmMonitoringSample/AlarmMonitoringSample.csproj +++ b/Samples/Platform SDK/AlarmMonitoringSample/AlarmMonitoringSample.csproj @@ -38,6 +38,8 @@ $(GSC_SDK)\Genetec.Sdk.dll False + + @@ -45,12 +47,8 @@ $(GSC_SDK_CORE)\Genetec.Sdk.dll False - - - - - - + + diff --git a/Samples/Platform SDK/AuditTrailsSample/AuditTrailsSample.csproj b/Samples/Platform SDK/AuditTrailsSample/AuditTrailsSample.csproj index e089f0e..14265d3 100644 --- a/Samples/Platform SDK/AuditTrailsSample/AuditTrailsSample.csproj +++ b/Samples/Platform SDK/AuditTrailsSample/AuditTrailsSample.csproj @@ -39,6 +39,9 @@ $(GSC_SDK)\Genetec.Sdk.dll False + + + @@ -46,13 +49,8 @@ $(GSC_SDK_CORE)\Genetec.Sdk.dll False - - - - - - - + + diff --git a/Samples/Platform SDK/CameraConfigurationSample/CameraConfigurationSample.csproj b/Samples/Platform SDK/CameraConfigurationSample/CameraConfigurationSample.csproj index ba9b7a8..d9a8ff4 100644 --- a/Samples/Platform SDK/CameraConfigurationSample/CameraConfigurationSample.csproj +++ b/Samples/Platform SDK/CameraConfigurationSample/CameraConfigurationSample.csproj @@ -38,6 +38,9 @@ $(GSC_SDK)\Genetec.Sdk.dll False + + + @@ -45,13 +48,8 @@ $(GSC_SDK_CORE)\Genetec.Sdk.dll False - - - - - - - + + diff --git a/Samples/Platform SDK/CameraSample/CameraSample.csproj b/Samples/Platform SDK/CameraSample/CameraSample.csproj index 156a40a..f39cdba 100644 --- a/Samples/Platform SDK/CameraSample/CameraSample.csproj +++ b/Samples/Platform SDK/CameraSample/CameraSample.csproj @@ -38,6 +38,9 @@ $(GSC_SDK)\Genetec.Sdk.dll False + + + @@ -45,13 +48,8 @@ $(GSC_SDK_CORE)\Genetec.Sdk.dll False - - - - - - - + + diff --git a/Samples/Platform SDK/CopyConfiguratonSample/CopyConfiguratonSample.csproj b/Samples/Platform SDK/CopyConfiguratonSample/CopyConfiguratonSample.csproj index 9871146..cfdab36 100644 --- a/Samples/Platform SDK/CopyConfiguratonSample/CopyConfiguratonSample.csproj +++ b/Samples/Platform SDK/CopyConfiguratonSample/CopyConfiguratonSample.csproj @@ -38,6 +38,9 @@ $(GSC_SDK)\Genetec.Sdk.dll False + + + @@ -45,13 +48,8 @@ $(GSC_SDK_CORE)\Genetec.Sdk.dll False - - - - - - - + + diff --git a/Samples/Platform SDK/CustomEntitySample/CustomEntitySample.csproj b/Samples/Platform SDK/CustomEntitySample/CustomEntitySample.csproj index 39047a4..dc320ed 100644 --- a/Samples/Platform SDK/CustomEntitySample/CustomEntitySample.csproj +++ b/Samples/Platform SDK/CustomEntitySample/CustomEntitySample.csproj @@ -38,17 +38,6 @@ $(GSC_SDK)\Genetec.Sdk.dll False - - - - - $(GSC_SDK_CORE)\Genetec.Sdk.dll - False - - - - - @@ -58,6 +47,15 @@ + + + $(GSC_SDK_CORE)\Genetec.Sdk.dll + False + + + + + $(OutputPath)Certificates diff --git a/Samples/Platform SDK/CustomEventSample/CustomEventSample.csproj b/Samples/Platform SDK/CustomEventSample/CustomEventSample.csproj index 09e3c7f..c287d9b 100644 --- a/Samples/Platform SDK/CustomEventSample/CustomEventSample.csproj +++ b/Samples/Platform SDK/CustomEventSample/CustomEventSample.csproj @@ -38,6 +38,9 @@ $(GSC_SDK)\Genetec.Sdk.dll False + + + @@ -45,13 +48,8 @@ $(GSC_SDK_CORE)\Genetec.Sdk.dll False - - - - - - - + + diff --git a/Samples/Platform SDK/CustomFieldSample/CustomFieldSample.csproj b/Samples/Platform SDK/CustomFieldSample/CustomFieldSample.csproj index 47efbc4..b1f3e10 100644 --- a/Samples/Platform SDK/CustomFieldSample/CustomFieldSample.csproj +++ b/Samples/Platform SDK/CustomFieldSample/CustomFieldSample.csproj @@ -38,6 +38,10 @@ $(GSC_SDK)\Genetec.Sdk.dll False + + + + @@ -45,14 +49,8 @@ $(GSC_SDK_CORE)\Genetec.Sdk.dll False - - - - - - - - + + diff --git a/Samples/Platform SDK/CustomIconSample/CustomIconSample.csproj b/Samples/Platform SDK/CustomIconSample/CustomIconSample.csproj index 00ef21e..c67627b 100644 --- a/Samples/Platform SDK/CustomIconSample/CustomIconSample.csproj +++ b/Samples/Platform SDK/CustomIconSample/CustomIconSample.csproj @@ -38,6 +38,8 @@ $(GSC_SDK)\Genetec.Sdk.dll False + + @@ -45,14 +47,11 @@ $(GSC_SDK_CORE)\Genetec.Sdk.dll False - - - - - - + + + - + True diff --git a/Samples/Platform SDK/DiagnosticServerSample/DiagnosticServerSample.csproj b/Samples/Platform SDK/DiagnosticServerSample/DiagnosticServerSample.csproj index 92462d7..a17ceb5 100644 --- a/Samples/Platform SDK/DiagnosticServerSample/DiagnosticServerSample.csproj +++ b/Samples/Platform SDK/DiagnosticServerSample/DiagnosticServerSample.csproj @@ -38,6 +38,8 @@ $(GSC_SDK)\Genetec.Sdk.dll False + + @@ -45,12 +47,8 @@ $(GSC_SDK_CORE)\Genetec.Sdk.dll False - - - - - - + + diff --git a/Samples/Platform SDK/DisplayInTileSample/DisplayInTileSample.csproj b/Samples/Platform SDK/DisplayInTileSample/DisplayInTileSample.csproj index 41b7e5b..4f8840e 100644 --- a/Samples/Platform SDK/DisplayInTileSample/DisplayInTileSample.csproj +++ b/Samples/Platform SDK/DisplayInTileSample/DisplayInTileSample.csproj @@ -38,6 +38,8 @@ $(GSC_SDK)\Genetec.Sdk.dll False + + @@ -45,12 +47,8 @@ $(GSC_SDK_CORE)\Genetec.Sdk.dll False - - - - - - + + diff --git a/Samples/Platform SDK/EntityCacheSample/EntityCacheSample.csproj b/Samples/Platform SDK/EntityCacheSample/EntityCacheSample.csproj index 0f4c38e..940e10f 100644 --- a/Samples/Platform SDK/EntityCacheSample/EntityCacheSample.csproj +++ b/Samples/Platform SDK/EntityCacheSample/EntityCacheSample.csproj @@ -38,6 +38,8 @@ $(GSC_SDK)\Genetec.Sdk.dll False + + @@ -45,12 +47,8 @@ $(GSC_SDK_CORE)\Genetec.Sdk.dll False - - - - - - + + diff --git a/Samples/Platform SDK/EntityCertificatesManagerSample/EntityCertificatesManagerSample.csproj b/Samples/Platform SDK/EntityCertificatesManagerSample/EntityCertificatesManagerSample.csproj index 503da6d..79f611a 100644 --- a/Samples/Platform SDK/EntityCertificatesManagerSample/EntityCertificatesManagerSample.csproj +++ b/Samples/Platform SDK/EntityCertificatesManagerSample/EntityCertificatesManagerSample.csproj @@ -38,6 +38,8 @@ $(GSC_SDK)\Genetec.Sdk.dll False + + @@ -45,12 +47,8 @@ $(GSC_SDK_CORE)\Genetec.Sdk.dll False - - - - - - + + diff --git a/Samples/Platform SDK/EntityMappingSample/EntityMappingSample.csproj b/Samples/Platform SDK/EntityMappingSample/EntityMappingSample.csproj index addb0d4..f58d621 100644 --- a/Samples/Platform SDK/EntityMappingSample/EntityMappingSample.csproj +++ b/Samples/Platform SDK/EntityMappingSample/EntityMappingSample.csproj @@ -38,6 +38,8 @@ $(GSC_SDK)\Genetec.Sdk.dll False + + @@ -45,12 +47,8 @@ $(GSC_SDK_CORE)\Genetec.Sdk.dll False - - - - - - + + diff --git a/Samples/Platform SDK/EventMonitoringSample/EventMonitoringSample.csproj b/Samples/Platform SDK/EventMonitoringSample/EventMonitoringSample.csproj index 885894a..5caaad8 100644 --- a/Samples/Platform SDK/EventMonitoringSample/EventMonitoringSample.csproj +++ b/Samples/Platform SDK/EventMonitoringSample/EventMonitoringSample.csproj @@ -38,6 +38,8 @@ $(GSC_SDK)\Genetec.Sdk.dll False + + @@ -45,12 +47,8 @@ $(GSC_SDK_CORE)\Genetec.Sdk.dll False - - - - - - + + diff --git a/Samples/Platform SDK/EventToActionSample/EventToActionSample.csproj b/Samples/Platform SDK/EventToActionSample/EventToActionSample.csproj index 86d55d2..6734d96 100644 --- a/Samples/Platform SDK/EventToActionSample/EventToActionSample.csproj +++ b/Samples/Platform SDK/EventToActionSample/EventToActionSample.csproj @@ -38,6 +38,8 @@ $(GSC_SDK)\Genetec.Sdk.dll False + + @@ -45,12 +47,8 @@ $(GSC_SDK_CORE)\Genetec.Sdk.dll False - - - - - - + + diff --git a/Samples/Platform SDK/IncidentManagerSample/IncidentManagerSample.csproj b/Samples/Platform SDK/IncidentManagerSample/IncidentManagerSample.csproj index 0845cef..551a7f8 100644 --- a/Samples/Platform SDK/IncidentManagerSample/IncidentManagerSample.csproj +++ b/Samples/Platform SDK/IncidentManagerSample/IncidentManagerSample.csproj @@ -38,6 +38,9 @@ $(GSC_SDK)\Genetec.Sdk.dll False + + + @@ -45,16 +48,8 @@ $(GSC_SDK_CORE)\Genetec.Sdk.dll False - - - - - - - - - - + + diff --git a/Samples/Platform SDK/LicenseManagerSample/LicenseManagerSample.csproj b/Samples/Platform SDK/LicenseManagerSample/LicenseManagerSample.csproj index 85b5b26..879c87b 100644 --- a/Samples/Platform SDK/LicenseManagerSample/LicenseManagerSample.csproj +++ b/Samples/Platform SDK/LicenseManagerSample/LicenseManagerSample.csproj @@ -38,6 +38,8 @@ $(GSC_SDK)\Genetec.Sdk.dll False + + @@ -45,12 +47,8 @@ $(GSC_SDK_CORE)\Genetec.Sdk.dll False - - - - - - + + diff --git a/Samples/Platform SDK/LoggerSample/LoggerSample.csproj b/Samples/Platform SDK/LoggerSample/LoggerSample.csproj index 0444c04..c10fabb 100644 --- a/Samples/Platform SDK/LoggerSample/LoggerSample.csproj +++ b/Samples/Platform SDK/LoggerSample/LoggerSample.csproj @@ -38,6 +38,8 @@ $(GSC_SDK)\Genetec.Sdk.dll False + + @@ -46,11 +48,7 @@ False - - - - - + diff --git a/Samples/Platform SDK/LoginManagerSample/LoginManagerSample.csproj b/Samples/Platform SDK/LoginManagerSample/LoginManagerSample.csproj index e0947cc..475277f 100644 --- a/Samples/Platform SDK/LoginManagerSample/LoginManagerSample.csproj +++ b/Samples/Platform SDK/LoginManagerSample/LoginManagerSample.csproj @@ -10,14 +10,6 @@ Exe - - NETFRAMEWORK_481 - - - - NET8_0_WINDOWS - - AnyCPU true @@ -46,6 +38,8 @@ $(GSC_SDK)\Genetec.Sdk.dll False + + @@ -53,12 +47,8 @@ $(GSC_SDK_CORE)\Genetec.Sdk.dll False - - - - - - + + diff --git a/Samples/Platform SDK/MacroSample/MacroSample.csproj b/Samples/Platform SDK/MacroSample/MacroSample.csproj index 0941e04..dc72889 100644 --- a/Samples/Platform SDK/MacroSample/MacroSample.csproj +++ b/Samples/Platform SDK/MacroSample/MacroSample.csproj @@ -46,6 +46,9 @@ $(GSC_SDK)\Genetec.Sdk.Scripting.Interfaces.dll False + + + @@ -61,13 +64,8 @@ $(GSC_SDK_CORE)\Genetec.Sdk.Scripting.Interfaces.dll False - - - - - - - + + diff --git a/Samples/Platform SDK/PeopleCountingSample/PeopleCountingSample.csproj b/Samples/Platform SDK/PeopleCountingSample/PeopleCountingSample.csproj index 9c62fc4..6da6b00 100644 --- a/Samples/Platform SDK/PeopleCountingSample/PeopleCountingSample.csproj +++ b/Samples/Platform SDK/PeopleCountingSample/PeopleCountingSample.csproj @@ -38,6 +38,8 @@ $(GSC_SDK)\Genetec.Sdk.dll False + + @@ -45,12 +47,8 @@ $(GSC_SDK_CORE)\Genetec.Sdk.dll False - - - - - - + + diff --git a/Samples/Platform SDK/PlaySoundSample/PlaySoundSample.csproj b/Samples/Platform SDK/PlaySoundSample/PlaySoundSample.csproj index bf3babc..fde518f 100644 --- a/Samples/Platform SDK/PlaySoundSample/PlaySoundSample.csproj +++ b/Samples/Platform SDK/PlaySoundSample/PlaySoundSample.csproj @@ -38,6 +38,8 @@ $(GSC_SDK)\Genetec.Sdk.dll False + + @@ -45,12 +47,8 @@ $(GSC_SDK_CORE)\Genetec.Sdk.dll False - - - - - - + + diff --git a/Samples/Platform SDK/RaiseEventSample/RaiseEventSample.csproj b/Samples/Platform SDK/RaiseEventSample/RaiseEventSample.csproj index b7303c4..b417ec5 100644 --- a/Samples/Platform SDK/RaiseEventSample/RaiseEventSample.csproj +++ b/Samples/Platform SDK/RaiseEventSample/RaiseEventSample.csproj @@ -38,6 +38,8 @@ $(GSC_SDK)\Genetec.Sdk.dll False + + @@ -45,12 +47,8 @@ $(GSC_SDK_CORE)\Genetec.Sdk.dll False - - - - - - + + diff --git a/Samples/Platform SDK/RequestManagerSample/RequestManagerSample.csproj b/Samples/Platform SDK/RequestManagerSample/RequestManagerSample.csproj index 1747a6d..91efe4d 100644 --- a/Samples/Platform SDK/RequestManagerSample/RequestManagerSample.csproj +++ b/Samples/Platform SDK/RequestManagerSample/RequestManagerSample.csproj @@ -38,6 +38,8 @@ $(GSC_SDK)\Genetec.Sdk.dll False + + @@ -45,14 +47,10 @@ $(GSC_SDK_CORE)\Genetec.Sdk.dll False - + + - - - - - - + $(OutputPath)Certificates diff --git a/Samples/Platform SDK/SecurityManagerSample/SecurityManagerSample.csproj b/Samples/Platform SDK/SecurityManagerSample/SecurityManagerSample.csproj index 15e0bf6..f3d966e 100644 --- a/Samples/Platform SDK/SecurityManagerSample/SecurityManagerSample.csproj +++ b/Samples/Platform SDK/SecurityManagerSample/SecurityManagerSample.csproj @@ -38,6 +38,8 @@ $(GSC_SDK)\Genetec.Sdk.dll False + + @@ -45,12 +47,8 @@ $(GSC_SDK_CORE)\Genetec.Sdk.dll False - - - - - - + + diff --git a/Samples/Platform SDK/SequenceQuerySample/SequenceQuerySample.csproj b/Samples/Platform SDK/SequenceQuerySample/SequenceQuerySample.csproj index e669c45..fa5b755 100644 --- a/Samples/Platform SDK/SequenceQuerySample/SequenceQuerySample.csproj +++ b/Samples/Platform SDK/SequenceQuerySample/SequenceQuerySample.csproj @@ -38,6 +38,9 @@ $(GSC_SDK)\Genetec.Sdk.dll False + + + @@ -45,13 +48,8 @@ $(GSC_SDK_CORE)\Genetec.Sdk.dll False - - - - - - - + + diff --git a/Samples/Platform SDK/ThumbnailQuerySample/ThumbnailQuerySample.csproj b/Samples/Platform SDK/ThumbnailQuerySample/ThumbnailQuerySample.csproj index 2610244..b0b4838 100644 --- a/Samples/Platform SDK/ThumbnailQuerySample/ThumbnailQuerySample.csproj +++ b/Samples/Platform SDK/ThumbnailQuerySample/ThumbnailQuerySample.csproj @@ -38,6 +38,9 @@ $(GSC_SDK)\Genetec.Sdk.dll False + + + @@ -45,13 +48,8 @@ $(GSC_SDK_CORE)\Genetec.Sdk.dll False - - - - - - - + + diff --git a/Samples/Platform SDK/TimeAttendanceSample/TimeAttendanceSample.csproj b/Samples/Platform SDK/TimeAttendanceSample/TimeAttendanceSample.csproj index 7095597..7ad60b6 100644 --- a/Samples/Platform SDK/TimeAttendanceSample/TimeAttendanceSample.csproj +++ b/Samples/Platform SDK/TimeAttendanceSample/TimeAttendanceSample.csproj @@ -38,6 +38,9 @@ $(GSC_SDK)\Genetec.Sdk.dll False + + + @@ -45,13 +48,8 @@ $(GSC_SDK_CORE)\Genetec.Sdk.dll False - - - - - - - + + diff --git a/Samples/Platform SDK/TransactionManagerSample/TransactionManagerSample.csproj b/Samples/Platform SDK/TransactionManagerSample/TransactionManagerSample.csproj index a1024e7..c8eae1b 100644 --- a/Samples/Platform SDK/TransactionManagerSample/TransactionManagerSample.csproj +++ b/Samples/Platform SDK/TransactionManagerSample/TransactionManagerSample.csproj @@ -38,6 +38,8 @@ $(GSC_SDK)\Genetec.Sdk.dll False + + @@ -45,16 +47,8 @@ $(GSC_SDK_CORE)\Genetec.Sdk.dll False - - - - - - - - - - + + diff --git a/Samples/Platform SDK/TriggerAlarmSample/TriggerAlarmSample.csproj b/Samples/Platform SDK/TriggerAlarmSample/TriggerAlarmSample.csproj index f4c5afe..a835f26 100644 --- a/Samples/Platform SDK/TriggerAlarmSample/TriggerAlarmSample.csproj +++ b/Samples/Platform SDK/TriggerAlarmSample/TriggerAlarmSample.csproj @@ -38,6 +38,8 @@ $(GSC_SDK)\Genetec.Sdk.dll False + + @@ -45,16 +47,8 @@ $(GSC_SDK_CORE)\Genetec.Sdk.dll False - - - - - - - - - - + + diff --git a/Samples/Platform SDK/UnusedCredentialQuerySample/UnusedCredentialQuerySample.csproj b/Samples/Platform SDK/UnusedCredentialQuerySample/UnusedCredentialQuerySample.csproj index be2d9e3..ba61b23 100644 --- a/Samples/Platform SDK/UnusedCredentialQuerySample/UnusedCredentialQuerySample.csproj +++ b/Samples/Platform SDK/UnusedCredentialQuerySample/UnusedCredentialQuerySample.csproj @@ -38,6 +38,9 @@ $(GSC_SDK)\Genetec.Sdk.dll False + + + @@ -45,13 +48,8 @@ $(GSC_SDK_CORE)\Genetec.Sdk.dll False - - - - - - - + + diff --git a/Samples/Platform SDK/UserTaskSample/UserTaskSample.csproj b/Samples/Platform SDK/UserTaskSample/UserTaskSample.csproj index 31f1398..8357969 100644 --- a/Samples/Platform SDK/UserTaskSample/UserTaskSample.csproj +++ b/Samples/Platform SDK/UserTaskSample/UserTaskSample.csproj @@ -38,6 +38,9 @@ $(GSC_SDK)\Genetec.Sdk.dll False + + + @@ -45,13 +48,8 @@ $(GSC_SDK_CORE)\Genetec.Sdk.dll False - - - - - - - + + diff --git a/Samples/Platform SDK/VideoFileQuerySample/VideoFileQuerySample.csproj b/Samples/Platform SDK/VideoFileQuerySample/VideoFileQuerySample.csproj index b979275..f37a5df 100644 --- a/Samples/Platform SDK/VideoFileQuerySample/VideoFileQuerySample.csproj +++ b/Samples/Platform SDK/VideoFileQuerySample/VideoFileQuerySample.csproj @@ -38,6 +38,9 @@ $(GSC_SDK)\Genetec.Sdk.dll False + + + @@ -45,13 +48,8 @@ $(GSC_SDK_CORE)\Genetec.Sdk.dll False - - - - - - - + + diff --git a/Samples/Platform SDK/VideoUnitSample/VideoUnitSample.csproj b/Samples/Platform SDK/VideoUnitSample/VideoUnitSample.csproj index 5a2347e..2d7f245 100644 --- a/Samples/Platform SDK/VideoUnitSample/VideoUnitSample.csproj +++ b/Samples/Platform SDK/VideoUnitSample/VideoUnitSample.csproj @@ -38,6 +38,9 @@ $(GSC_SDK)\Genetec.Sdk.dll False + + + @@ -45,13 +48,8 @@ $(GSC_SDK_CORE)\Genetec.Sdk.dll False - - - - - - - + + diff --git a/Samples/Platform SDK/VisitorManagerSample/VisitorManagerSample.csproj b/Samples/Platform SDK/VisitorManagerSample/VisitorManagerSample.csproj index a0b844b..2e43e41 100644 --- a/Samples/Platform SDK/VisitorManagerSample/VisitorManagerSample.csproj +++ b/Samples/Platform SDK/VisitorManagerSample/VisitorManagerSample.csproj @@ -33,19 +33,14 @@ 10 - - full - - - - full - - $(GSC_SDK)\Genetec.Sdk.dll False + + + @@ -53,13 +48,8 @@ $(GSC_SDK_CORE)\Genetec.Sdk.dll False - - - - - - - + + diff --git a/Samples/Plugin SDK/BasicPluginTemplate/BasicPluginTemplate.csproj b/Samples/Plugin SDK/BasicPluginTemplate/BasicPluginTemplate.csproj index 43b8e40..92efc09 100644 --- a/Samples/Plugin SDK/BasicPluginTemplate/BasicPluginTemplate.csproj +++ b/Samples/Plugin SDK/BasicPluginTemplate/BasicPluginTemplate.csproj @@ -42,6 +42,9 @@ $(GSC_SDK)\Genetec.Sdk.Plugin.dll False + + + @@ -53,13 +56,8 @@ $(GSC_SDK_CORE)\Genetec.Sdk.Plugin.dll False - - - - - - - + + diff --git a/Samples/Plugin SDK/CustomActionSample/CustomActionSample.csproj b/Samples/Plugin SDK/CustomActionSample/CustomActionSample.csproj index 3c7754d..f0526b8 100644 --- a/Samples/Plugin SDK/CustomActionSample/CustomActionSample.csproj +++ b/Samples/Plugin SDK/CustomActionSample/CustomActionSample.csproj @@ -51,6 +51,11 @@ $(GSC_SDK)\Genetec.Sdk.Controls.dll False + + + + + @@ -70,29 +75,14 @@ $(GSC_SDK_CORE)\Genetec.Sdk.Controls.dll False - - - - - + + - - - - - - - - - - - - True diff --git a/Samples/Plugin SDK/CustomReportSample/CustomReportSample.csproj b/Samples/Plugin SDK/CustomReportSample/CustomReportSample.csproj index 0aec225..fdc6c22 100644 --- a/Samples/Plugin SDK/CustomReportSample/CustomReportSample.csproj +++ b/Samples/Plugin SDK/CustomReportSample/CustomReportSample.csproj @@ -51,6 +51,12 @@ $(GSC_SDK)\Genetec.Sdk.Controls.dll False + + + + + + @@ -70,19 +76,8 @@ $(GSC_SDK_CORE)\Genetec.Sdk.Controls.dll False - - - - - - - - - - - - - + + diff --git a/Samples/Plugin SDK/PluginConfigurationSample/PluginConfigurationSample.csproj b/Samples/Plugin SDK/PluginConfigurationSample/PluginConfigurationSample.csproj index c0295ce..5d99a65 100644 --- a/Samples/Plugin SDK/PluginConfigurationSample/PluginConfigurationSample.csproj +++ b/Samples/Plugin SDK/PluginConfigurationSample/PluginConfigurationSample.csproj @@ -51,6 +51,12 @@ $(GSC_SDK)\Genetec.Sdk.Controls.dll False + + + + + + @@ -70,23 +76,15 @@ $(GSC_SDK_CORE)\Genetec.Sdk.Controls.dll False - + + - - - - - - - - - PreserveNewest diff --git a/Samples/Plugin SDK/PluginDatabaseSample/PluginDatabaseSample.csproj b/Samples/Plugin SDK/PluginDatabaseSample/PluginDatabaseSample.csproj index 4c385ce..ee1aee8 100644 --- a/Samples/Plugin SDK/PluginDatabaseSample/PluginDatabaseSample.csproj +++ b/Samples/Plugin SDK/PluginDatabaseSample/PluginDatabaseSample.csproj @@ -42,6 +42,9 @@ $(GSC_SDK)\Genetec.Sdk.Plugin.dll False + + + @@ -53,19 +56,14 @@ $(GSC_SDK_CORE)\Genetec.Sdk.Plugin.dll False - + + - - - - - - $(OutputPath)Certificates diff --git a/Samples/Workspace SDK/BackgroundProcessSample/BackgroundProcessSample.csproj b/Samples/Workspace SDK/BackgroundProcessSample/BackgroundProcessSample.csproj index 3d19beb..26b9318 100644 --- a/Samples/Workspace SDK/BackgroundProcessSample/BackgroundProcessSample.csproj +++ b/Samples/Workspace SDK/BackgroundProcessSample/BackgroundProcessSample.csproj @@ -47,6 +47,11 @@ $(GSC_SDK)\Genetec.Sdk.Controls.dll False + + + + + @@ -62,15 +67,11 @@ $(GSC_SDK_CORE)\Genetec.Sdk.Controls.dll False - + + - - - - - diff --git a/Samples/Workspace SDK/BadgePrinterSample/BadgePrinterSample.csproj b/Samples/Workspace SDK/BadgePrinterSample/BadgePrinterSample.csproj index ac64f9c..d0c2912 100644 --- a/Samples/Workspace SDK/BadgePrinterSample/BadgePrinterSample.csproj +++ b/Samples/Workspace SDK/BadgePrinterSample/BadgePrinterSample.csproj @@ -47,6 +47,14 @@ $(GSC_SDK)\Genetec.Sdk.Controls.dll False + + + + + + + + @@ -62,18 +70,11 @@ $(GSC_SDK_CORE)\Genetec.Sdk.Controls.dll False - + + - - - - - - - - diff --git a/Samples/Workspace SDK/CardholderCredentialReaderSample/CardholderCredentialReaderSample.csproj b/Samples/Workspace SDK/CardholderCredentialReaderSample/CardholderCredentialReaderSample.csproj index 2537dc3..a1cbc4a 100644 --- a/Samples/Workspace SDK/CardholderCredentialReaderSample/CardholderCredentialReaderSample.csproj +++ b/Samples/Workspace SDK/CardholderCredentialReaderSample/CardholderCredentialReaderSample.csproj @@ -47,6 +47,12 @@ $(GSC_SDK)\Genetec.Sdk.Controls.dll False + + + + + + @@ -62,16 +68,11 @@ $(GSC_SDK_CORE)\Genetec.Sdk.Controls.dll False - + + - - - - - - diff --git a/Samples/Workspace SDK/CardholderFieldsExtractorSample/CardholderFieldsExtractorSample.csproj b/Samples/Workspace SDK/CardholderFieldsExtractorSample/CardholderFieldsExtractorSample.csproj index 628d623..f241e43 100644 --- a/Samples/Workspace SDK/CardholderFieldsExtractorSample/CardholderFieldsExtractorSample.csproj +++ b/Samples/Workspace SDK/CardholderFieldsExtractorSample/CardholderFieldsExtractorSample.csproj @@ -42,6 +42,11 @@ $(GSC_SDK)\Genetec.Sdk.Workspace.dll False + + + + + @@ -53,15 +58,8 @@ $(GSC_SDK_CORE)\Genetec.Sdk.Workspace.dll False - - - - - - - - - + + diff --git a/Samples/Workspace SDK/CommandManagerSample/CommandManagerSample.csproj b/Samples/Workspace SDK/CommandManagerSample/CommandManagerSample.csproj index 90e8e18..c01a971 100644 --- a/Samples/Workspace SDK/CommandManagerSample/CommandManagerSample.csproj +++ b/Samples/Workspace SDK/CommandManagerSample/CommandManagerSample.csproj @@ -42,6 +42,11 @@ $(GSC_SDK)\Genetec.Sdk.Workspace.dll False + + + + + @@ -53,15 +58,8 @@ $(GSC_SDK_CORE)\Genetec.Sdk.Workspace.dll False - - - - - - - - - + + diff --git a/Samples/Workspace SDK/ConfigPageSample/ConfigPageSample.csproj b/Samples/Workspace SDK/ConfigPageSample/ConfigPageSample.csproj index f39ba60..eeb515f 100644 --- a/Samples/Workspace SDK/ConfigPageSample/ConfigPageSample.csproj +++ b/Samples/Workspace SDK/ConfigPageSample/ConfigPageSample.csproj @@ -47,6 +47,11 @@ $(GSC_SDK)\Genetec.Sdk.Controls.dll False + + + + + @@ -62,15 +67,8 @@ $(GSC_SDK_CORE)\Genetec.Sdk.Controls.dll False - - - - - - - - - + + diff --git a/Samples/Workspace SDK/ControlsSample/ControlsSample.csproj b/Samples/Workspace SDK/ControlsSample/ControlsSample.csproj index 470520a..2561545 100644 --- a/Samples/Workspace SDK/ControlsSample/ControlsSample.csproj +++ b/Samples/Workspace SDK/ControlsSample/ControlsSample.csproj @@ -47,6 +47,12 @@ $(GSC_SDK)\Genetec.Sdk.Controls.dll False + + + + + + @@ -62,20 +68,13 @@ $(GSC_SDK_CORE)\Genetec.Sdk.Controls.dll False - + + - - - - - - - - diff --git a/Samples/Workspace SDK/CredentialBuilderSample/CredentialBuilderSample.csproj b/Samples/Workspace SDK/CredentialBuilderSample/CredentialBuilderSample.csproj index 2beea64..fe5897c 100644 --- a/Samples/Workspace SDK/CredentialBuilderSample/CredentialBuilderSample.csproj +++ b/Samples/Workspace SDK/CredentialBuilderSample/CredentialBuilderSample.csproj @@ -38,6 +38,9 @@ $(GSC_SDK)\Genetec.Sdk.dll False + + + @@ -45,13 +48,8 @@ $(GSC_SDK_CORE)\Genetec.Sdk.dll False - - - - - - - + + diff --git a/Samples/Workspace SDK/CredentialReaderSample/CredentialReaderSample.csproj b/Samples/Workspace SDK/CredentialReaderSample/CredentialReaderSample.csproj index ea32493..9450091 100644 --- a/Samples/Workspace SDK/CredentialReaderSample/CredentialReaderSample.csproj +++ b/Samples/Workspace SDK/CredentialReaderSample/CredentialReaderSample.csproj @@ -47,6 +47,12 @@ $(GSC_SDK)\Genetec.Sdk.Controls.dll False + + + + + + @@ -62,16 +68,11 @@ $(GSC_SDK_CORE)\Genetec.Sdk.Controls.dll False - + + - - - - - - diff --git a/Samples/Workspace SDK/DashboardWidgetSample/DashboardWidgetSample.csproj b/Samples/Workspace SDK/DashboardWidgetSample/DashboardWidgetSample.csproj index 4519193..112473b 100644 --- a/Samples/Workspace SDK/DashboardWidgetSample/DashboardWidgetSample.csproj +++ b/Samples/Workspace SDK/DashboardWidgetSample/DashboardWidgetSample.csproj @@ -43,6 +43,16 @@ $(GSC_SDK)\Genetec.Sdk.Workspace.dll False + + + + + + + + + + @@ -54,20 +64,8 @@ $(GSC_SDK_CORE)\Genetec.Sdk.Workspace.dll False - - - - - - - - - - - - - - + + diff --git a/Samples/Workspace SDK/EventExtenderSample/EventExtenderSample.csproj b/Samples/Workspace SDK/EventExtenderSample/EventExtenderSample.csproj index 343572b..e7e05b0 100644 --- a/Samples/Workspace SDK/EventExtenderSample/EventExtenderSample.csproj +++ b/Samples/Workspace SDK/EventExtenderSample/EventExtenderSample.csproj @@ -42,6 +42,11 @@ $(GSC_SDK)\Genetec.Sdk.Workspace.dll False + + + + + @@ -53,21 +58,8 @@ $(GSC_SDK_CORE)\Genetec.Sdk.Workspace.dll False - - - - - - - - - - - - - - - + + diff --git a/Samples/Workspace SDK/ImageExtractorSample/ImageExtractorSample.csproj b/Samples/Workspace SDK/ImageExtractorSample/ImageExtractorSample.csproj index 738657e..4d491f8 100644 --- a/Samples/Workspace SDK/ImageExtractorSample/ImageExtractorSample.csproj +++ b/Samples/Workspace SDK/ImageExtractorSample/ImageExtractorSample.csproj @@ -42,6 +42,11 @@ $(GSC_SDK)\Genetec.Sdk.Workspace.dll False + + + + + @@ -53,21 +58,14 @@ $(GSC_SDK_CORE)\Genetec.Sdk.Workspace.dll False - + + - - - - - - - - $(OutputPath)Certificates diff --git a/Samples/Workspace SDK/OptionsExtensionSample/OptionsExtensionSample.csproj b/Samples/Workspace SDK/OptionsExtensionSample/OptionsExtensionSample.csproj index 60c0184..7ce1322 100644 --- a/Samples/Workspace SDK/OptionsExtensionSample/OptionsExtensionSample.csproj +++ b/Samples/Workspace SDK/OptionsExtensionSample/OptionsExtensionSample.csproj @@ -47,6 +47,11 @@ $(GSC_SDK)\Genetec.Sdk.Controls.dll False + + + + + @@ -62,25 +67,14 @@ $(GSC_SDK_CORE)\Genetec.Sdk.Controls.dll False - + + - - - - - - - - - - - - diff --git a/Samples/Workspace SDK/PageTaskSample/PageTaskSample.csproj b/Samples/Workspace SDK/PageTaskSample/PageTaskSample.csproj index 348d20a..08c27e6 100644 --- a/Samples/Workspace SDK/PageTaskSample/PageTaskSample.csproj +++ b/Samples/Workspace SDK/PageTaskSample/PageTaskSample.csproj @@ -47,6 +47,11 @@ $(GSC_SDK)\Genetec.Sdk.Controls.dll False + + + + + @@ -62,15 +67,8 @@ $(GSC_SDK_CORE)\Genetec.Sdk.Controls.dll False - - - - - - - - - + + diff --git a/Samples/Workspace SDK/ReportExporterSample/ReportExporterSample.csproj b/Samples/Workspace SDK/ReportExporterSample/ReportExporterSample.csproj index 6024395..e5cba1b 100644 --- a/Samples/Workspace SDK/ReportExporterSample/ReportExporterSample.csproj +++ b/Samples/Workspace SDK/ReportExporterSample/ReportExporterSample.csproj @@ -38,6 +38,8 @@ $(GSC_SDK)\Genetec.Sdk.dll False + + @@ -45,12 +47,11 @@ $(GSC_SDK_CORE)\Genetec.Sdk.dll False - + + - - diff --git a/Samples/Workspace SDK/TaskSample/TaskSample.csproj b/Samples/Workspace SDK/TaskSample/TaskSample.csproj index 1719148..1fa0fdf 100644 --- a/Samples/Workspace SDK/TaskSample/TaskSample.csproj +++ b/Samples/Workspace SDK/TaskSample/TaskSample.csproj @@ -42,6 +42,11 @@ $(GSC_SDK)\Genetec.Sdk.Workspace.dll False + + + + + @@ -53,22 +58,8 @@ $(GSC_SDK_CORE)\Genetec.Sdk.Workspace.dll False - - - - - - - - - - - - - - - - + + diff --git a/Samples/Workspace SDK/TilePropertiesSample/TilePropertiesSample.csproj b/Samples/Workspace SDK/TilePropertiesSample/TilePropertiesSample.csproj index 744cbb8..dfe792f 100644 --- a/Samples/Workspace SDK/TilePropertiesSample/TilePropertiesSample.csproj +++ b/Samples/Workspace SDK/TilePropertiesSample/TilePropertiesSample.csproj @@ -47,6 +47,11 @@ $(GSC_SDK)\Genetec.Sdk.Controls.dll False + + + + + @@ -62,15 +67,8 @@ $(GSC_SDK_CORE)\Genetec.Sdk.Controls.dll False - - - - - - - - - + + diff --git a/Samples/Workspace SDK/TileViewSample/TileViewSample.csproj b/Samples/Workspace SDK/TileViewSample/TileViewSample.csproj index 0db41e4..4e90a71 100644 --- a/Samples/Workspace SDK/TileViewSample/TileViewSample.csproj +++ b/Samples/Workspace SDK/TileViewSample/TileViewSample.csproj @@ -47,6 +47,11 @@ $(GSC_SDK)\Genetec.Sdk.Controls.dll False + + + + + @@ -62,15 +67,8 @@ $(GSC_SDK_CORE)\Genetec.Sdk.Controls.dll False - - - - - - - - - + + diff --git a/Samples/Workspace SDK/TileWidgetSample/TileWidgetSample.csproj b/Samples/Workspace SDK/TileWidgetSample/TileWidgetSample.csproj index f439ca1..524a969 100644 --- a/Samples/Workspace SDK/TileWidgetSample/TileWidgetSample.csproj +++ b/Samples/Workspace SDK/TileWidgetSample/TileWidgetSample.csproj @@ -47,6 +47,12 @@ $(GSC_SDK)\Genetec.Sdk.Controls.dll False + + + + + + @@ -62,16 +68,8 @@ $(GSC_SDK_CORE)\Genetec.Sdk.Controls.dll False - - - - - - - - - - + + diff --git a/Samples/Workspace SDK/TimelineProviderSample/TimelineProviderSample.csproj b/Samples/Workspace SDK/TimelineProviderSample/TimelineProviderSample.csproj index 38d3ecb..3f02d57 100644 --- a/Samples/Workspace SDK/TimelineProviderSample/TimelineProviderSample.csproj +++ b/Samples/Workspace SDK/TimelineProviderSample/TimelineProviderSample.csproj @@ -42,6 +42,12 @@ $(GSC_SDK)\Genetec.Sdk.Workspace.dll False + + + + + + @@ -53,18 +59,10 @@ $(GSC_SDK_CORE)\Genetec.Sdk.Workspace.dll False - - - - - - - - - - + + - + $(OutputPath)Certificates From 8bf535e15b67c1a89dd4070731f54521d651d892 Mon Sep 17 00:00:00 2001 From: Andre Lafleur Date: Sat, 28 Sep 2024 10:17:07 +0800 Subject: [PATCH 20/22] Updated the C# language version to 12 --- .../FileCryptingManagerSample.csproj | 4 ++-- Samples/Media SDK/MediaFileSample/MediaFileSample.csproj | 4 ++-- Samples/Media SDK/OverlaySample/OverlaySample.csproj | 4 ++-- .../PlaybackSequenceQuerierSample.csproj | 4 ++-- .../PlaybackStreamReaderSample.csproj | 4 ++-- .../PtzCoordinatesManagerSample.csproj | 4 ++-- Samples/Media SDK/VideoExportSample/VideoExportSample.csproj | 4 ++-- .../VideoSourceFilterSample/VideoSourceFilterSample.csproj | 4 ++-- .../AccessControlRawEventQuerySample.csproj | 4 ++-- .../AccessControlReportQuerySample.csproj | 4 ++-- .../AccessControlUnitManagerSample.csproj | 4 ++-- .../AccessControlUnitSample/AccessControlUnitSample.csproj | 4 ++-- .../AccessEventMonitoringSample.csproj | 4 ++-- .../AccessVerifierSample/AccessVerifierSample.csproj | 4 ++-- .../ActivityTrailsSample/ActivityTrailsSample.csproj | 4 ++-- .../AlarmActivityQuerySample/AlarmActivityQuerySample.csproj | 4 ++-- .../AlarmMonitoringSample/AlarmMonitoringSample.csproj | 4 ++-- .../Platform SDK/AuditTrailsSample/AuditTrailsSample.csproj | 4 ++-- .../CameraConfigurationSample.csproj | 4 ++-- Samples/Platform SDK/CameraSample/CameraSample.csproj | 4 ++-- .../CopyConfiguratonSample/CopyConfiguratonSample.csproj | 4 ++-- .../Platform SDK/CustomEntitySample/CustomEntitySample.csproj | 4 ++-- .../Platform SDK/CustomEventSample/CustomEventSample.csproj | 4 ++-- .../Platform SDK/CustomFieldSample/CustomFieldSample.csproj | 4 ++-- Samples/Platform SDK/CustomIconSample/CustomIconSample.csproj | 4 ++-- .../DiagnosticServerSample/DiagnosticServerSample.csproj | 4 ++-- .../DisplayInTileSample/DisplayInTileSample.csproj | 4 ++-- .../Platform SDK/EntityCacheSample/EntityCacheSample.csproj | 4 ++-- .../EntityCertificatesManagerSample.csproj | 4 ++-- .../EntityMappingSample/EntityMappingSample.csproj | 4 ++-- .../EventMonitoringSample/EventMonitoringSample.csproj | 4 ++-- .../EventToActionSample/EventToActionSample.csproj | 4 ++-- .../IncidentManagerSample/IncidentManagerSample.csproj | 4 ++-- .../LicenseManagerSample/LicenseManagerSample.csproj | 4 ++-- Samples/Platform SDK/LoggerSample/LoggerSample.csproj | 4 ++-- .../Platform SDK/LoginManagerSample/LoginManagerSample.csproj | 4 ++-- Samples/Platform SDK/MacroSample/MacroSample.csproj | 4 ++-- .../PeopleCountingSample/PeopleCountingSample.csproj | 4 ++-- Samples/Platform SDK/PlaySoundSample/PlaySoundSample.csproj | 4 ++-- Samples/Platform SDK/RaiseEventSample/RaiseEventSample.csproj | 4 ++-- .../RequestManagerSample/RequestManagerSample.csproj | 4 ++-- .../SecurityManagerSample/SecurityManagerSample.csproj | 4 ++-- .../SequenceQuerySample/SequenceQuerySample.csproj | 4 ++-- .../ThumbnailQuerySample/ThumbnailQuerySample.csproj | 4 ++-- .../TimeAttendanceSample/TimeAttendanceSample.csproj | 4 ++-- .../TransactionManagerSample/TransactionManagerSample.csproj | 4 ++-- .../Platform SDK/TriggerAlarmSample/TriggerAlarmSample.csproj | 4 ++-- .../UnusedCredentialQuerySample.csproj | 4 ++-- Samples/Platform SDK/UserTaskSample/UserTaskSample.csproj | 4 ++-- .../VideoFileQuerySample/VideoFileQuerySample.csproj | 4 ++-- Samples/Platform SDK/VideoUnitSample/VideoUnitSample.csproj | 4 ++-- .../VisitorManagerSample/VisitorManagerSample.csproj | 4 ++-- .../Plugin SDK/BasicPluginTemplate/BasicPluginTemplate.csproj | 4 ++-- .../Plugin SDK/CustomActionSample/CustomActionSample.csproj | 4 ++-- .../Plugin SDK/CustomReportSample/CustomReportSample.csproj | 4 ++-- .../PluginConfigurationSample.csproj | 4 ++-- .../BackgroundProcessSample/BackgroundProcessSample.csproj | 4 ++-- .../BadgePrinterSample/BadgePrinterSample.csproj | 4 ++-- .../CardholderCredentialReaderSample.csproj | 4 ++-- .../CardholderFieldsExtractorSample.csproj | 4 ++-- .../CommandManagerSample/CommandManagerSample.csproj | 4 ++-- .../Workspace SDK/ConfigPageSample/ConfigPageSample.csproj | 4 ++-- Samples/Workspace SDK/ControlsSample/ControlsSample.csproj | 4 ++-- .../CredentialBuilderSample/CredentialBuilderSample.csproj | 4 ++-- .../CredentialReaderSample/CredentialReaderSample.csproj | 4 ++-- .../DashboardWidgetSample/DashboardWidgetSample.csproj | 4 ++-- .../ImageExtractorSample/ImageExtractorSample.csproj | 4 ++-- .../OptionsExtensionSample/OptionsExtensionSample.csproj | 4 ++-- Samples/Workspace SDK/PageTaskSample/PageTaskSample.csproj | 4 ++-- .../ReportExporterSample/ReportExporterSample.csproj | 4 ++-- Samples/Workspace SDK/TaskSample/TaskSample.csproj | 4 ++-- .../TilePropertiesSample/TilePropertiesSample.csproj | 4 ++-- Samples/Workspace SDK/TileViewSample/TileViewSample.csproj | 4 ++-- .../Workspace SDK/TileWidgetSample/TileWidgetSample.csproj | 4 ++-- .../TimelineProviderSample/TimelineProviderSample.csproj | 4 ++-- 75 files changed, 150 insertions(+), 150 deletions(-) diff --git a/Samples/Media SDK/FileCryptingManagerSample/FileCryptingManagerSample.csproj b/Samples/Media SDK/FileCryptingManagerSample/FileCryptingManagerSample.csproj index 019415e..4cfc757 100644 --- a/Samples/Media SDK/FileCryptingManagerSample/FileCryptingManagerSample.csproj +++ b/Samples/Media SDK/FileCryptingManagerSample/FileCryptingManagerSample.csproj @@ -19,7 +19,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -30,7 +30,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Media SDK/MediaFileSample/MediaFileSample.csproj b/Samples/Media SDK/MediaFileSample/MediaFileSample.csproj index 220c3ea..1422c67 100644 --- a/Samples/Media SDK/MediaFileSample/MediaFileSample.csproj +++ b/Samples/Media SDK/MediaFileSample/MediaFileSample.csproj @@ -19,7 +19,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -30,7 +30,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Media SDK/OverlaySample/OverlaySample.csproj b/Samples/Media SDK/OverlaySample/OverlaySample.csproj index b218c2f..1cbd1ad 100644 --- a/Samples/Media SDK/OverlaySample/OverlaySample.csproj +++ b/Samples/Media SDK/OverlaySample/OverlaySample.csproj @@ -19,7 +19,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -30,7 +30,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Media SDK/PlaybackSequenceQuerierSample/PlaybackSequenceQuerierSample.csproj b/Samples/Media SDK/PlaybackSequenceQuerierSample/PlaybackSequenceQuerierSample.csproj index 6125862..b281439 100644 --- a/Samples/Media SDK/PlaybackSequenceQuerierSample/PlaybackSequenceQuerierSample.csproj +++ b/Samples/Media SDK/PlaybackSequenceQuerierSample/PlaybackSequenceQuerierSample.csproj @@ -19,7 +19,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -30,7 +30,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Media SDK/PlaybackStreamReaderSample/PlaybackStreamReaderSample.csproj b/Samples/Media SDK/PlaybackStreamReaderSample/PlaybackStreamReaderSample.csproj index 1e9acad..1d365a8 100644 --- a/Samples/Media SDK/PlaybackStreamReaderSample/PlaybackStreamReaderSample.csproj +++ b/Samples/Media SDK/PlaybackStreamReaderSample/PlaybackStreamReaderSample.csproj @@ -19,7 +19,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -30,7 +30,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Media SDK/PtzCoordinatesManagerSample/PtzCoordinatesManagerSample.csproj b/Samples/Media SDK/PtzCoordinatesManagerSample/PtzCoordinatesManagerSample.csproj index 1d5a26b..bfdb726 100644 --- a/Samples/Media SDK/PtzCoordinatesManagerSample/PtzCoordinatesManagerSample.csproj +++ b/Samples/Media SDK/PtzCoordinatesManagerSample/PtzCoordinatesManagerSample.csproj @@ -19,7 +19,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -30,7 +30,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Media SDK/VideoExportSample/VideoExportSample.csproj b/Samples/Media SDK/VideoExportSample/VideoExportSample.csproj index 3aae6a8..3d4ae01 100644 --- a/Samples/Media SDK/VideoExportSample/VideoExportSample.csproj +++ b/Samples/Media SDK/VideoExportSample/VideoExportSample.csproj @@ -19,7 +19,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -30,7 +30,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Media SDK/VideoSourceFilterSample/VideoSourceFilterSample.csproj b/Samples/Media SDK/VideoSourceFilterSample/VideoSourceFilterSample.csproj index 1133d23..3aa41e2 100644 --- a/Samples/Media SDK/VideoSourceFilterSample/VideoSourceFilterSample.csproj +++ b/Samples/Media SDK/VideoSourceFilterSample/VideoSourceFilterSample.csproj @@ -19,7 +19,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -30,7 +30,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Platform SDK/AccessControlRawEventQuerySample/AccessControlRawEventQuerySample.csproj b/Samples/Platform SDK/AccessControlRawEventQuerySample/AccessControlRawEventQuerySample.csproj index 59e96d0..4d6b00f 100644 --- a/Samples/Platform SDK/AccessControlRawEventQuerySample/AccessControlRawEventQuerySample.csproj +++ b/Samples/Platform SDK/AccessControlRawEventQuerySample/AccessControlRawEventQuerySample.csproj @@ -19,7 +19,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -30,7 +30,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Platform SDK/AccessControlReportQuerySample/AccessControlReportQuerySample.csproj b/Samples/Platform SDK/AccessControlReportQuerySample/AccessControlReportQuerySample.csproj index 2c4aca1..70d93c9 100644 --- a/Samples/Platform SDK/AccessControlReportQuerySample/AccessControlReportQuerySample.csproj +++ b/Samples/Platform SDK/AccessControlReportQuerySample/AccessControlReportQuerySample.csproj @@ -19,7 +19,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -30,7 +30,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Platform SDK/AccessControlUnitManagerSample/AccessControlUnitManagerSample.csproj b/Samples/Platform SDK/AccessControlUnitManagerSample/AccessControlUnitManagerSample.csproj index 91b2c09..35824cd 100644 --- a/Samples/Platform SDK/AccessControlUnitManagerSample/AccessControlUnitManagerSample.csproj +++ b/Samples/Platform SDK/AccessControlUnitManagerSample/AccessControlUnitManagerSample.csproj @@ -19,7 +19,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -30,7 +30,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Platform SDK/AccessControlUnitSample/AccessControlUnitSample.csproj b/Samples/Platform SDK/AccessControlUnitSample/AccessControlUnitSample.csproj index b41e96c..81c1edd 100644 --- a/Samples/Platform SDK/AccessControlUnitSample/AccessControlUnitSample.csproj +++ b/Samples/Platform SDK/AccessControlUnitSample/AccessControlUnitSample.csproj @@ -19,7 +19,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -30,7 +30,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Platform SDK/AccessEventMonitoringSample/AccessEventMonitoringSample.csproj b/Samples/Platform SDK/AccessEventMonitoringSample/AccessEventMonitoringSample.csproj index ef65121..610d514 100644 --- a/Samples/Platform SDK/AccessEventMonitoringSample/AccessEventMonitoringSample.csproj +++ b/Samples/Platform SDK/AccessEventMonitoringSample/AccessEventMonitoringSample.csproj @@ -19,7 +19,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -30,7 +30,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Platform SDK/AccessVerifierSample/AccessVerifierSample.csproj b/Samples/Platform SDK/AccessVerifierSample/AccessVerifierSample.csproj index c21efc6..6421cbb 100644 --- a/Samples/Platform SDK/AccessVerifierSample/AccessVerifierSample.csproj +++ b/Samples/Platform SDK/AccessVerifierSample/AccessVerifierSample.csproj @@ -19,7 +19,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -30,7 +30,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Platform SDK/ActivityTrailsSample/ActivityTrailsSample.csproj b/Samples/Platform SDK/ActivityTrailsSample/ActivityTrailsSample.csproj index e6beb6d..2749cd5 100644 --- a/Samples/Platform SDK/ActivityTrailsSample/ActivityTrailsSample.csproj +++ b/Samples/Platform SDK/ActivityTrailsSample/ActivityTrailsSample.csproj @@ -19,7 +19,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -30,7 +30,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Platform SDK/AlarmActivityQuerySample/AlarmActivityQuerySample.csproj b/Samples/Platform SDK/AlarmActivityQuerySample/AlarmActivityQuerySample.csproj index 83b05db..d1a3f9a 100644 --- a/Samples/Platform SDK/AlarmActivityQuerySample/AlarmActivityQuerySample.csproj +++ b/Samples/Platform SDK/AlarmActivityQuerySample/AlarmActivityQuerySample.csproj @@ -19,7 +19,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -30,7 +30,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Platform SDK/AlarmMonitoringSample/AlarmMonitoringSample.csproj b/Samples/Platform SDK/AlarmMonitoringSample/AlarmMonitoringSample.csproj index 2821c68..2be7438 100644 --- a/Samples/Platform SDK/AlarmMonitoringSample/AlarmMonitoringSample.csproj +++ b/Samples/Platform SDK/AlarmMonitoringSample/AlarmMonitoringSample.csproj @@ -19,7 +19,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -30,7 +30,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Platform SDK/AuditTrailsSample/AuditTrailsSample.csproj b/Samples/Platform SDK/AuditTrailsSample/AuditTrailsSample.csproj index 14265d3..60a910c 100644 --- a/Samples/Platform SDK/AuditTrailsSample/AuditTrailsSample.csproj +++ b/Samples/Platform SDK/AuditTrailsSample/AuditTrailsSample.csproj @@ -20,7 +20,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -31,7 +31,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Platform SDK/CameraConfigurationSample/CameraConfigurationSample.csproj b/Samples/Platform SDK/CameraConfigurationSample/CameraConfigurationSample.csproj index d9a8ff4..e57582d 100644 --- a/Samples/Platform SDK/CameraConfigurationSample/CameraConfigurationSample.csproj +++ b/Samples/Platform SDK/CameraConfigurationSample/CameraConfigurationSample.csproj @@ -19,7 +19,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -30,7 +30,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Platform SDK/CameraSample/CameraSample.csproj b/Samples/Platform SDK/CameraSample/CameraSample.csproj index f39cdba..72f6b70 100644 --- a/Samples/Platform SDK/CameraSample/CameraSample.csproj +++ b/Samples/Platform SDK/CameraSample/CameraSample.csproj @@ -19,7 +19,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -30,7 +30,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Platform SDK/CopyConfiguratonSample/CopyConfiguratonSample.csproj b/Samples/Platform SDK/CopyConfiguratonSample/CopyConfiguratonSample.csproj index cfdab36..aec16dd 100644 --- a/Samples/Platform SDK/CopyConfiguratonSample/CopyConfiguratonSample.csproj +++ b/Samples/Platform SDK/CopyConfiguratonSample/CopyConfiguratonSample.csproj @@ -19,7 +19,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -30,7 +30,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Platform SDK/CustomEntitySample/CustomEntitySample.csproj b/Samples/Platform SDK/CustomEntitySample/CustomEntitySample.csproj index dc320ed..be9cd70 100644 --- a/Samples/Platform SDK/CustomEntitySample/CustomEntitySample.csproj +++ b/Samples/Platform SDK/CustomEntitySample/CustomEntitySample.csproj @@ -19,7 +19,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -30,7 +30,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Platform SDK/CustomEventSample/CustomEventSample.csproj b/Samples/Platform SDK/CustomEventSample/CustomEventSample.csproj index c287d9b..de9e90f 100644 --- a/Samples/Platform SDK/CustomEventSample/CustomEventSample.csproj +++ b/Samples/Platform SDK/CustomEventSample/CustomEventSample.csproj @@ -19,7 +19,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -30,7 +30,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Platform SDK/CustomFieldSample/CustomFieldSample.csproj b/Samples/Platform SDK/CustomFieldSample/CustomFieldSample.csproj index b1f3e10..7ffeff8 100644 --- a/Samples/Platform SDK/CustomFieldSample/CustomFieldSample.csproj +++ b/Samples/Platform SDK/CustomFieldSample/CustomFieldSample.csproj @@ -19,7 +19,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -30,7 +30,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Platform SDK/CustomIconSample/CustomIconSample.csproj b/Samples/Platform SDK/CustomIconSample/CustomIconSample.csproj index c67627b..c796bb1 100644 --- a/Samples/Platform SDK/CustomIconSample/CustomIconSample.csproj +++ b/Samples/Platform SDK/CustomIconSample/CustomIconSample.csproj @@ -19,7 +19,7 @@ DEBUG;TRACE prompt 4 - 9 + 12 @@ -30,7 +30,7 @@ TRACE prompt 4 - 9 + 12 diff --git a/Samples/Platform SDK/DiagnosticServerSample/DiagnosticServerSample.csproj b/Samples/Platform SDK/DiagnosticServerSample/DiagnosticServerSample.csproj index a17ceb5..ed2f1ca 100644 --- a/Samples/Platform SDK/DiagnosticServerSample/DiagnosticServerSample.csproj +++ b/Samples/Platform SDK/DiagnosticServerSample/DiagnosticServerSample.csproj @@ -19,7 +19,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -30,7 +30,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Platform SDK/DisplayInTileSample/DisplayInTileSample.csproj b/Samples/Platform SDK/DisplayInTileSample/DisplayInTileSample.csproj index 4f8840e..cd6ae59 100644 --- a/Samples/Platform SDK/DisplayInTileSample/DisplayInTileSample.csproj +++ b/Samples/Platform SDK/DisplayInTileSample/DisplayInTileSample.csproj @@ -19,7 +19,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -30,7 +30,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Platform SDK/EntityCacheSample/EntityCacheSample.csproj b/Samples/Platform SDK/EntityCacheSample/EntityCacheSample.csproj index 940e10f..e9a071f 100644 --- a/Samples/Platform SDK/EntityCacheSample/EntityCacheSample.csproj +++ b/Samples/Platform SDK/EntityCacheSample/EntityCacheSample.csproj @@ -19,7 +19,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -30,7 +30,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Platform SDK/EntityCertificatesManagerSample/EntityCertificatesManagerSample.csproj b/Samples/Platform SDK/EntityCertificatesManagerSample/EntityCertificatesManagerSample.csproj index 79f611a..b7ed173 100644 --- a/Samples/Platform SDK/EntityCertificatesManagerSample/EntityCertificatesManagerSample.csproj +++ b/Samples/Platform SDK/EntityCertificatesManagerSample/EntityCertificatesManagerSample.csproj @@ -19,7 +19,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -30,7 +30,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Platform SDK/EntityMappingSample/EntityMappingSample.csproj b/Samples/Platform SDK/EntityMappingSample/EntityMappingSample.csproj index f58d621..60d47e3 100644 --- a/Samples/Platform SDK/EntityMappingSample/EntityMappingSample.csproj +++ b/Samples/Platform SDK/EntityMappingSample/EntityMappingSample.csproj @@ -19,7 +19,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -30,7 +30,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Platform SDK/EventMonitoringSample/EventMonitoringSample.csproj b/Samples/Platform SDK/EventMonitoringSample/EventMonitoringSample.csproj index 5caaad8..dacf9c4 100644 --- a/Samples/Platform SDK/EventMonitoringSample/EventMonitoringSample.csproj +++ b/Samples/Platform SDK/EventMonitoringSample/EventMonitoringSample.csproj @@ -19,7 +19,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -30,7 +30,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Platform SDK/EventToActionSample/EventToActionSample.csproj b/Samples/Platform SDK/EventToActionSample/EventToActionSample.csproj index 6734d96..a8484a2 100644 --- a/Samples/Platform SDK/EventToActionSample/EventToActionSample.csproj +++ b/Samples/Platform SDK/EventToActionSample/EventToActionSample.csproj @@ -19,7 +19,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -30,7 +30,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Platform SDK/IncidentManagerSample/IncidentManagerSample.csproj b/Samples/Platform SDK/IncidentManagerSample/IncidentManagerSample.csproj index 551a7f8..790f1c2 100644 --- a/Samples/Platform SDK/IncidentManagerSample/IncidentManagerSample.csproj +++ b/Samples/Platform SDK/IncidentManagerSample/IncidentManagerSample.csproj @@ -19,7 +19,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -30,7 +30,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Platform SDK/LicenseManagerSample/LicenseManagerSample.csproj b/Samples/Platform SDK/LicenseManagerSample/LicenseManagerSample.csproj index 879c87b..fcdebe8 100644 --- a/Samples/Platform SDK/LicenseManagerSample/LicenseManagerSample.csproj +++ b/Samples/Platform SDK/LicenseManagerSample/LicenseManagerSample.csproj @@ -19,7 +19,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -30,7 +30,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Platform SDK/LoggerSample/LoggerSample.csproj b/Samples/Platform SDK/LoggerSample/LoggerSample.csproj index c10fabb..4663220 100644 --- a/Samples/Platform SDK/LoggerSample/LoggerSample.csproj +++ b/Samples/Platform SDK/LoggerSample/LoggerSample.csproj @@ -19,7 +19,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -30,7 +30,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Platform SDK/LoginManagerSample/LoginManagerSample.csproj b/Samples/Platform SDK/LoginManagerSample/LoginManagerSample.csproj index 475277f..a9db385 100644 --- a/Samples/Platform SDK/LoginManagerSample/LoginManagerSample.csproj +++ b/Samples/Platform SDK/LoginManagerSample/LoginManagerSample.csproj @@ -19,7 +19,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -30,7 +30,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Platform SDK/MacroSample/MacroSample.csproj b/Samples/Platform SDK/MacroSample/MacroSample.csproj index dc72889..1bbf010 100644 --- a/Samples/Platform SDK/MacroSample/MacroSample.csproj +++ b/Samples/Platform SDK/MacroSample/MacroSample.csproj @@ -19,7 +19,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -30,7 +30,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Platform SDK/PeopleCountingSample/PeopleCountingSample.csproj b/Samples/Platform SDK/PeopleCountingSample/PeopleCountingSample.csproj index 6da6b00..5f314a2 100644 --- a/Samples/Platform SDK/PeopleCountingSample/PeopleCountingSample.csproj +++ b/Samples/Platform SDK/PeopleCountingSample/PeopleCountingSample.csproj @@ -19,7 +19,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -30,7 +30,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Platform SDK/PlaySoundSample/PlaySoundSample.csproj b/Samples/Platform SDK/PlaySoundSample/PlaySoundSample.csproj index fde518f..8a8a1cd 100644 --- a/Samples/Platform SDK/PlaySoundSample/PlaySoundSample.csproj +++ b/Samples/Platform SDK/PlaySoundSample/PlaySoundSample.csproj @@ -19,7 +19,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -30,7 +30,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Platform SDK/RaiseEventSample/RaiseEventSample.csproj b/Samples/Platform SDK/RaiseEventSample/RaiseEventSample.csproj index b417ec5..1191b42 100644 --- a/Samples/Platform SDK/RaiseEventSample/RaiseEventSample.csproj +++ b/Samples/Platform SDK/RaiseEventSample/RaiseEventSample.csproj @@ -19,7 +19,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -30,7 +30,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Platform SDK/RequestManagerSample/RequestManagerSample.csproj b/Samples/Platform SDK/RequestManagerSample/RequestManagerSample.csproj index 91efe4d..89c9c40 100644 --- a/Samples/Platform SDK/RequestManagerSample/RequestManagerSample.csproj +++ b/Samples/Platform SDK/RequestManagerSample/RequestManagerSample.csproj @@ -19,7 +19,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -30,7 +30,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Platform SDK/SecurityManagerSample/SecurityManagerSample.csproj b/Samples/Platform SDK/SecurityManagerSample/SecurityManagerSample.csproj index f3d966e..7763ffd 100644 --- a/Samples/Platform SDK/SecurityManagerSample/SecurityManagerSample.csproj +++ b/Samples/Platform SDK/SecurityManagerSample/SecurityManagerSample.csproj @@ -19,7 +19,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -30,7 +30,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Platform SDK/SequenceQuerySample/SequenceQuerySample.csproj b/Samples/Platform SDK/SequenceQuerySample/SequenceQuerySample.csproj index fa5b755..76e066e 100644 --- a/Samples/Platform SDK/SequenceQuerySample/SequenceQuerySample.csproj +++ b/Samples/Platform SDK/SequenceQuerySample/SequenceQuerySample.csproj @@ -19,7 +19,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -30,7 +30,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Platform SDK/ThumbnailQuerySample/ThumbnailQuerySample.csproj b/Samples/Platform SDK/ThumbnailQuerySample/ThumbnailQuerySample.csproj index b0b4838..7afe1fb 100644 --- a/Samples/Platform SDK/ThumbnailQuerySample/ThumbnailQuerySample.csproj +++ b/Samples/Platform SDK/ThumbnailQuerySample/ThumbnailQuerySample.csproj @@ -19,7 +19,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -30,7 +30,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Platform SDK/TimeAttendanceSample/TimeAttendanceSample.csproj b/Samples/Platform SDK/TimeAttendanceSample/TimeAttendanceSample.csproj index 7ad60b6..1a6e4bd 100644 --- a/Samples/Platform SDK/TimeAttendanceSample/TimeAttendanceSample.csproj +++ b/Samples/Platform SDK/TimeAttendanceSample/TimeAttendanceSample.csproj @@ -19,7 +19,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -30,7 +30,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Platform SDK/TransactionManagerSample/TransactionManagerSample.csproj b/Samples/Platform SDK/TransactionManagerSample/TransactionManagerSample.csproj index c8eae1b..186fc5c 100644 --- a/Samples/Platform SDK/TransactionManagerSample/TransactionManagerSample.csproj +++ b/Samples/Platform SDK/TransactionManagerSample/TransactionManagerSample.csproj @@ -19,7 +19,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -30,7 +30,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Platform SDK/TriggerAlarmSample/TriggerAlarmSample.csproj b/Samples/Platform SDK/TriggerAlarmSample/TriggerAlarmSample.csproj index a835f26..9aae99c 100644 --- a/Samples/Platform SDK/TriggerAlarmSample/TriggerAlarmSample.csproj +++ b/Samples/Platform SDK/TriggerAlarmSample/TriggerAlarmSample.csproj @@ -19,7 +19,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -30,7 +30,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Platform SDK/UnusedCredentialQuerySample/UnusedCredentialQuerySample.csproj b/Samples/Platform SDK/UnusedCredentialQuerySample/UnusedCredentialQuerySample.csproj index ba61b23..a8421eb 100644 --- a/Samples/Platform SDK/UnusedCredentialQuerySample/UnusedCredentialQuerySample.csproj +++ b/Samples/Platform SDK/UnusedCredentialQuerySample/UnusedCredentialQuerySample.csproj @@ -19,7 +19,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -30,7 +30,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Platform SDK/UserTaskSample/UserTaskSample.csproj b/Samples/Platform SDK/UserTaskSample/UserTaskSample.csproj index 8357969..ef0ae29 100644 --- a/Samples/Platform SDK/UserTaskSample/UserTaskSample.csproj +++ b/Samples/Platform SDK/UserTaskSample/UserTaskSample.csproj @@ -19,7 +19,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -30,7 +30,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Platform SDK/VideoFileQuerySample/VideoFileQuerySample.csproj b/Samples/Platform SDK/VideoFileQuerySample/VideoFileQuerySample.csproj index f37a5df..2e273c9 100644 --- a/Samples/Platform SDK/VideoFileQuerySample/VideoFileQuerySample.csproj +++ b/Samples/Platform SDK/VideoFileQuerySample/VideoFileQuerySample.csproj @@ -19,7 +19,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -30,7 +30,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Platform SDK/VideoUnitSample/VideoUnitSample.csproj b/Samples/Platform SDK/VideoUnitSample/VideoUnitSample.csproj index 2d7f245..e97353d 100644 --- a/Samples/Platform SDK/VideoUnitSample/VideoUnitSample.csproj +++ b/Samples/Platform SDK/VideoUnitSample/VideoUnitSample.csproj @@ -19,7 +19,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -30,7 +30,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Platform SDK/VisitorManagerSample/VisitorManagerSample.csproj b/Samples/Platform SDK/VisitorManagerSample/VisitorManagerSample.csproj index 2e43e41..4f3b6c6 100644 --- a/Samples/Platform SDK/VisitorManagerSample/VisitorManagerSample.csproj +++ b/Samples/Platform SDK/VisitorManagerSample/VisitorManagerSample.csproj @@ -19,7 +19,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -30,7 +30,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Plugin SDK/BasicPluginTemplate/BasicPluginTemplate.csproj b/Samples/Plugin SDK/BasicPluginTemplate/BasicPluginTemplate.csproj index 92efc09..bc847e0 100644 --- a/Samples/Plugin SDK/BasicPluginTemplate/BasicPluginTemplate.csproj +++ b/Samples/Plugin SDK/BasicPluginTemplate/BasicPluginTemplate.csproj @@ -19,7 +19,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -30,7 +30,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Plugin SDK/CustomActionSample/CustomActionSample.csproj b/Samples/Plugin SDK/CustomActionSample/CustomActionSample.csproj index f0526b8..95b3e0a 100644 --- a/Samples/Plugin SDK/CustomActionSample/CustomActionSample.csproj +++ b/Samples/Plugin SDK/CustomActionSample/CustomActionSample.csproj @@ -20,7 +20,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -31,7 +31,7 @@ TRACE prompt 4 - 9 + 12 diff --git a/Samples/Plugin SDK/CustomReportSample/CustomReportSample.csproj b/Samples/Plugin SDK/CustomReportSample/CustomReportSample.csproj index fdc6c22..189a463 100644 --- a/Samples/Plugin SDK/CustomReportSample/CustomReportSample.csproj +++ b/Samples/Plugin SDK/CustomReportSample/CustomReportSample.csproj @@ -20,7 +20,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -31,7 +31,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Plugin SDK/PluginConfigurationSample/PluginConfigurationSample.csproj b/Samples/Plugin SDK/PluginConfigurationSample/PluginConfigurationSample.csproj index 5d99a65..b0f9571 100644 --- a/Samples/Plugin SDK/PluginConfigurationSample/PluginConfigurationSample.csproj +++ b/Samples/Plugin SDK/PluginConfigurationSample/PluginConfigurationSample.csproj @@ -20,7 +20,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -31,7 +31,7 @@ TRACE prompt 4 - 9 + 12 diff --git a/Samples/Workspace SDK/BackgroundProcessSample/BackgroundProcessSample.csproj b/Samples/Workspace SDK/BackgroundProcessSample/BackgroundProcessSample.csproj index 26b9318..4d43b3e 100644 --- a/Samples/Workspace SDK/BackgroundProcessSample/BackgroundProcessSample.csproj +++ b/Samples/Workspace SDK/BackgroundProcessSample/BackgroundProcessSample.csproj @@ -20,7 +20,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -31,7 +31,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Workspace SDK/BadgePrinterSample/BadgePrinterSample.csproj b/Samples/Workspace SDK/BadgePrinterSample/BadgePrinterSample.csproj index d0c2912..90ceee7 100644 --- a/Samples/Workspace SDK/BadgePrinterSample/BadgePrinterSample.csproj +++ b/Samples/Workspace SDK/BadgePrinterSample/BadgePrinterSample.csproj @@ -20,7 +20,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -31,7 +31,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Workspace SDK/CardholderCredentialReaderSample/CardholderCredentialReaderSample.csproj b/Samples/Workspace SDK/CardholderCredentialReaderSample/CardholderCredentialReaderSample.csproj index a1cbc4a..3a6db35 100644 --- a/Samples/Workspace SDK/CardholderCredentialReaderSample/CardholderCredentialReaderSample.csproj +++ b/Samples/Workspace SDK/CardholderCredentialReaderSample/CardholderCredentialReaderSample.csproj @@ -20,7 +20,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -31,7 +31,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Workspace SDK/CardholderFieldsExtractorSample/CardholderFieldsExtractorSample.csproj b/Samples/Workspace SDK/CardholderFieldsExtractorSample/CardholderFieldsExtractorSample.csproj index f241e43..82c10b3 100644 --- a/Samples/Workspace SDK/CardholderFieldsExtractorSample/CardholderFieldsExtractorSample.csproj +++ b/Samples/Workspace SDK/CardholderFieldsExtractorSample/CardholderFieldsExtractorSample.csproj @@ -19,7 +19,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -30,7 +30,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Workspace SDK/CommandManagerSample/CommandManagerSample.csproj b/Samples/Workspace SDK/CommandManagerSample/CommandManagerSample.csproj index c01a971..2dcae90 100644 --- a/Samples/Workspace SDK/CommandManagerSample/CommandManagerSample.csproj +++ b/Samples/Workspace SDK/CommandManagerSample/CommandManagerSample.csproj @@ -19,7 +19,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -30,7 +30,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Workspace SDK/ConfigPageSample/ConfigPageSample.csproj b/Samples/Workspace SDK/ConfigPageSample/ConfigPageSample.csproj index eeb515f..eb730d2 100644 --- a/Samples/Workspace SDK/ConfigPageSample/ConfigPageSample.csproj +++ b/Samples/Workspace SDK/ConfigPageSample/ConfigPageSample.csproj @@ -20,7 +20,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -31,7 +31,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Workspace SDK/ControlsSample/ControlsSample.csproj b/Samples/Workspace SDK/ControlsSample/ControlsSample.csproj index 2561545..2c5f211 100644 --- a/Samples/Workspace SDK/ControlsSample/ControlsSample.csproj +++ b/Samples/Workspace SDK/ControlsSample/ControlsSample.csproj @@ -20,7 +20,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -31,7 +31,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Workspace SDK/CredentialBuilderSample/CredentialBuilderSample.csproj b/Samples/Workspace SDK/CredentialBuilderSample/CredentialBuilderSample.csproj index fe5897c..e904fa1 100644 --- a/Samples/Workspace SDK/CredentialBuilderSample/CredentialBuilderSample.csproj +++ b/Samples/Workspace SDK/CredentialBuilderSample/CredentialBuilderSample.csproj @@ -19,7 +19,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -30,7 +30,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Workspace SDK/CredentialReaderSample/CredentialReaderSample.csproj b/Samples/Workspace SDK/CredentialReaderSample/CredentialReaderSample.csproj index 9450091..d96cd2c 100644 --- a/Samples/Workspace SDK/CredentialReaderSample/CredentialReaderSample.csproj +++ b/Samples/Workspace SDK/CredentialReaderSample/CredentialReaderSample.csproj @@ -20,7 +20,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -31,7 +31,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Workspace SDK/DashboardWidgetSample/DashboardWidgetSample.csproj b/Samples/Workspace SDK/DashboardWidgetSample/DashboardWidgetSample.csproj index 112473b..28b0641 100644 --- a/Samples/Workspace SDK/DashboardWidgetSample/DashboardWidgetSample.csproj +++ b/Samples/Workspace SDK/DashboardWidgetSample/DashboardWidgetSample.csproj @@ -20,7 +20,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -31,7 +31,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Workspace SDK/ImageExtractorSample/ImageExtractorSample.csproj b/Samples/Workspace SDK/ImageExtractorSample/ImageExtractorSample.csproj index 4d491f8..6f9ab3d 100644 --- a/Samples/Workspace SDK/ImageExtractorSample/ImageExtractorSample.csproj +++ b/Samples/Workspace SDK/ImageExtractorSample/ImageExtractorSample.csproj @@ -19,7 +19,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -30,7 +30,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Workspace SDK/OptionsExtensionSample/OptionsExtensionSample.csproj b/Samples/Workspace SDK/OptionsExtensionSample/OptionsExtensionSample.csproj index 7ce1322..d631002 100644 --- a/Samples/Workspace SDK/OptionsExtensionSample/OptionsExtensionSample.csproj +++ b/Samples/Workspace SDK/OptionsExtensionSample/OptionsExtensionSample.csproj @@ -20,7 +20,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -31,7 +31,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Workspace SDK/PageTaskSample/PageTaskSample.csproj b/Samples/Workspace SDK/PageTaskSample/PageTaskSample.csproj index 08c27e6..70c7b90 100644 --- a/Samples/Workspace SDK/PageTaskSample/PageTaskSample.csproj +++ b/Samples/Workspace SDK/PageTaskSample/PageTaskSample.csproj @@ -20,7 +20,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -31,7 +31,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Workspace SDK/ReportExporterSample/ReportExporterSample.csproj b/Samples/Workspace SDK/ReportExporterSample/ReportExporterSample.csproj index e5cba1b..db5beec 100644 --- a/Samples/Workspace SDK/ReportExporterSample/ReportExporterSample.csproj +++ b/Samples/Workspace SDK/ReportExporterSample/ReportExporterSample.csproj @@ -19,7 +19,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -30,7 +30,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Workspace SDK/TaskSample/TaskSample.csproj b/Samples/Workspace SDK/TaskSample/TaskSample.csproj index 1fa0fdf..7ee617c 100644 --- a/Samples/Workspace SDK/TaskSample/TaskSample.csproj +++ b/Samples/Workspace SDK/TaskSample/TaskSample.csproj @@ -19,7 +19,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -30,7 +30,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Workspace SDK/TilePropertiesSample/TilePropertiesSample.csproj b/Samples/Workspace SDK/TilePropertiesSample/TilePropertiesSample.csproj index dfe792f..e29f7e1 100644 --- a/Samples/Workspace SDK/TilePropertiesSample/TilePropertiesSample.csproj +++ b/Samples/Workspace SDK/TilePropertiesSample/TilePropertiesSample.csproj @@ -20,7 +20,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -31,7 +31,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Workspace SDK/TileViewSample/TileViewSample.csproj b/Samples/Workspace SDK/TileViewSample/TileViewSample.csproj index 4e90a71..10e2f3d 100644 --- a/Samples/Workspace SDK/TileViewSample/TileViewSample.csproj +++ b/Samples/Workspace SDK/TileViewSample/TileViewSample.csproj @@ -20,7 +20,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -31,7 +31,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Workspace SDK/TileWidgetSample/TileWidgetSample.csproj b/Samples/Workspace SDK/TileWidgetSample/TileWidgetSample.csproj index 524a969..2333378 100644 --- a/Samples/Workspace SDK/TileWidgetSample/TileWidgetSample.csproj +++ b/Samples/Workspace SDK/TileWidgetSample/TileWidgetSample.csproj @@ -20,7 +20,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -31,7 +31,7 @@ TRACE prompt 4 - 10 + 12 diff --git a/Samples/Workspace SDK/TimelineProviderSample/TimelineProviderSample.csproj b/Samples/Workspace SDK/TimelineProviderSample/TimelineProviderSample.csproj index 3f02d57..0d4c74a 100644 --- a/Samples/Workspace SDK/TimelineProviderSample/TimelineProviderSample.csproj +++ b/Samples/Workspace SDK/TimelineProviderSample/TimelineProviderSample.csproj @@ -19,7 +19,7 @@ DEBUG;TRACE prompt 4 - 10 + 12 @@ -30,7 +30,7 @@ TRACE prompt 4 - 10 + 12 From 0ea57a5a930c72335f65a42628e47225a9c97d30 Mon Sep 17 00:00:00 2001 From: Andre Lafleur Date: Sat, 28 Sep 2024 11:34:14 +0800 Subject: [PATCH 21/22] Refactor to introduce MediaPlayerApp class Introduced the `MediaPlayerApp` class in `MediaPlayerApp.cs` to encapsulate media player functionality, including initialization, event handling, and user interactions. Refactored `Program.cs` to utilize this new class, simplifying the main method and delegating media player and window management responsibilities. Retained `DisplayControls` and `ReadFilePath` methods in `Program.cs` for user input and control instructions. Improved code organization and readability with the new class structure. --- .../BasicMediaPlayer/MediaPlayerApp.cs | 131 +++++++++++++ Samples/Media SDK/BasicMediaPlayer/Program.cs | 180 ++++-------------- 2 files changed, 165 insertions(+), 146 deletions(-) create mode 100644 Samples/Media SDK/BasicMediaPlayer/MediaPlayerApp.cs diff --git a/Samples/Media SDK/BasicMediaPlayer/MediaPlayerApp.cs b/Samples/Media SDK/BasicMediaPlayer/MediaPlayerApp.cs new file mode 100644 index 0000000..96a5339 --- /dev/null +++ b/Samples/Media SDK/BasicMediaPlayer/MediaPlayerApp.cs @@ -0,0 +1,131 @@ +// Copyright 2024 Genetec Inc. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. + +namespace Genetec.Dap.CodeSamples; + +using System; +using System.Windows; +using System.Windows.Input; +using System.Windows.Media; +using Sdk.Media; +using MediaPlayer = Sdk.Media.MediaPlayer; + +public class MediaPlayerApp(string filePath) +{ + private MediaPlayer m_player; + private Window m_window; + + public void Run() + { + m_player = new MediaPlayer(); + m_player.OpenFile(filePath); + + m_window = new Window + { + Width = 800, + Height = 600, + Background = Brushes.Black, + Content = m_player + }; + m_window.Loaded += (sender, arg) => m_player.PlayFile(); + m_window.KeyDown += OnKeyDown; + + m_player.PlayerStateChanged += (sender, arg) => UpdateTitle(); + m_player.PlaySpeedChanged += (sender, arg) => UpdateTitle(); + + var application = new Application(); + application.Run(m_window); + m_player.Dispose(); + } + + private void UpdateTitle() + { + m_window.Title = $"MediaPlayer - {filePath} - {m_player.State}" + + $"{(m_player.PlaySpeed != PlaySpeed.Speed1X ? $" ({m_player.PlaySpeed})" : "")}"; + } + + private void OnKeyDown(object sender, KeyEventArgs e) + { + switch (e.Key) + { + case Key.Space: + TogglePlayPause(); + break; + case Key.Left: + SeekBackward(); + break; + case Key.Right: + SeekForward(); + break; + case Key.Up: + IncreasePlaySpeed(); + break; + case Key.Down: + DecreasePlaySpeed(); + break; + case Key.R: + m_player.Rewind(); + break; + case Key.I: + m_player.ShowSpecialOverlay(OverlayType.Statistics); + break; + case Key.M: + m_player.IsAudioEnabled = !m_player.IsAudioEnabled; + break; + } + } + + private void TogglePlayPause() + { + switch (m_player.State) + { + case PlayerState.Playing: + m_player.Pause(); + break; + case PlayerState.Paused: + m_player.ResumePlaying(); + break; + default: + m_player.PlayFile(); + break; + } + } + + private void SeekBackward() + { + if (m_player.LastRenderedFrameTime != DateTime.MinValue) + { + m_player.Seek(m_player.LastRenderedFrameTime.AddSeconds(-10)); + } + } + + private void SeekForward() + { + if (m_player.LastRenderedFrameTime != DateTime.MinValue) + { + m_player.Seek(m_player.LastRenderedFrameTime.AddSeconds(10)); + } + } + + private void IncreasePlaySpeed() + { + int currentIndex = Array.IndexOf(Enum.GetValues(typeof(PlaySpeed)), m_player.PlaySpeed); + if (currentIndex < Enum.GetValues(typeof(PlaySpeed)).Length - 1) + { + m_player.PlaySpeed = (PlaySpeed)Enum.GetValues(typeof(PlaySpeed)).GetValue(currentIndex + 1); + } + } + + private void DecreasePlaySpeed() + { + int currentIndex = Array.IndexOf(Enum.GetValues(typeof(PlaySpeed)), m_player.PlaySpeed); + if (currentIndex > 0) + { + m_player.PlaySpeed = (PlaySpeed)Enum.GetValues(typeof(PlaySpeed)).GetValue(currentIndex - 1); + } + } +} \ No newline at end of file diff --git a/Samples/Media SDK/BasicMediaPlayer/Program.cs b/Samples/Media SDK/BasicMediaPlayer/Program.cs index a8ae20d..62d03e2 100644 --- a/Samples/Media SDK/BasicMediaPlayer/Program.cs +++ b/Samples/Media SDK/BasicMediaPlayer/Program.cs @@ -6,165 +6,53 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. using System; -using System.IO; -using System.Windows; -using System.Windows.Input; -using System.Windows.Media; -using Genetec.Sdk.Media; -namespace Genetec.Dap.CodeSamples; - -using MediaPlayer = Sdk.Media.MediaPlayer; - -class Program +namespace Genetec.Dap.CodeSamples { - static Program() => SdkResolver.Initialize(); - - [STAThread] - static void Main() + class Program { - DisplayControls(); - - string filePath = ReadFilePath(); - - var player = new MediaPlayer(); - player.OpenFile(filePath); - - var window = new Window - { - Width = 800, - Height = 600, - Background = Brushes.Black, - Content = player - }; - window.Loaded += (sender, arg) => player.PlayFile(); - window.KeyDown += OnKeyDown; - - player.PlayerStateChanged += (sender, arg) => UpdateTitle(); - player.PlaySpeedChanged += (sender, arg) => UpdateTitle(); - - var application = new Application(); - application.Run(window); - player.Dispose(); - - void UpdateTitle() - { - window.Title = $"MediaPlayer - {filePath} - {player.State}" + - $"{(player.PlaySpeed != PlaySpeed.Speed1X ? $" ({player.PlaySpeed})" : "")}"; - } + static Program() => SdkResolver.Initialize(); - void OnKeyDown(object sender, KeyEventArgs e) + [STAThread] + static void Main() { - switch (e.Key) - { - case Key.Space: - TogglePlayPause(); - break; - case Key.Left: - SeekBackward(); - break; - case Key.Right: - SeekForward(); - break; - case Key.Up: - IncreasePlaySpeed(); - break; - case Key.Down: - DecreasePlaySpeed(); - break; - case Key.R: - player.Rewind(); - break; - case Key.I: - player.ShowSpecialOverlay(OverlayType.Statistics); - break; - case Key.M: - player.IsAudioEnabled = !player.IsAudioEnabled; - break; - } + DisplayControls(); + string filePath = ReadFilePath(); + var app = new MediaPlayerApp(filePath); + app.Run(); } - void TogglePlayPause() + private static void DisplayControls() { - switch (player.State) - { - case PlayerState.Playing: - player.Pause(); - break; - case PlayerState.Paused: - player.ResumePlaying(); - break; - default: - player.PlayFile(); - break; - } + Console.WriteLine("Basic MediaPlayer sample"); + Console.WriteLine("Space: Play/Pause"); + Console.WriteLine("Left Arrow: Seek backward by 10 seconds"); + Console.WriteLine("Right Arrow: Seek forward by 10 seconds"); + Console.WriteLine("Up Arrow: Increase playback speed"); + Console.WriteLine("Down Arrow: Decrease playback speed"); + Console.WriteLine("R: Rewind to the beginning"); + Console.WriteLine("I: Toggle statistics overlay"); + Console.WriteLine("M: Toggle audio mute"); } - void SeekBackward() + private static string ReadFilePath() { - if (player.LastRenderedFrameTime != DateTime.MinValue) + while (true) { - player.Seek(player.LastRenderedFrameTime.AddSeconds(-10)); + Console.Write("Please enter the path to a .g64, .g64x, or .mp4 file: "); + string filePath = Console.ReadLine()?.Trim(); + if (string.IsNullOrEmpty(filePath)) + { + Console.WriteLine("File path cannot be empty. Please try again."); + continue; + } + if (!System.IO.File.Exists(filePath)) + { + Console.WriteLine($"The file {filePath} does not exist. Please try again."); + continue; + } + return filePath; } } - - void SeekForward() - { - if (player.LastRenderedFrameTime != DateTime.MinValue) - { - player.Seek(player.LastRenderedFrameTime.AddSeconds(10)); - } - } - - void IncreasePlaySpeed() - { - int currentIndex = Array.IndexOf(Enum.GetValues(typeof(PlaySpeed)), player.PlaySpeed); - if (currentIndex < Enum.GetValues(typeof(PlaySpeed)).Length - 1) - { - player.PlaySpeed = (PlaySpeed)Enum.GetValues(typeof(PlaySpeed)).GetValue(currentIndex + 1); - } - } - - void DecreasePlaySpeed() - { - int currentIndex = Array.IndexOf(Enum.GetValues(typeof(PlaySpeed)), player.PlaySpeed); - if (currentIndex > 0) - { - player.PlaySpeed = (PlaySpeed)Enum.GetValues(typeof(PlaySpeed)).GetValue(currentIndex - 1); - } - } - } - - static string ReadFilePath() - { - while (true) - { - Console.Write("Please enter the path to a .g64, .g64x, or .mp4 file: "); - string filePath = Console.ReadLine()?.Trim(); - if (string.IsNullOrEmpty(filePath)) - { - Console.WriteLine("File path cannot be empty. Please try again."); - continue; - } - if (!File.Exists(filePath)) - { - Console.WriteLine($"The file {filePath} does not exist. Please try again."); - continue; - } - return filePath; - } - } - - static void DisplayControls() - { - Console.WriteLine("Basic MediaPlayer sample"); - Console.WriteLine("Space: Play/Pause"); - Console.WriteLine("Left Arrow: Seek backward by 10 seconds"); - Console.WriteLine("Right Arrow: Seek forward by 10 seconds"); - Console.WriteLine("Up Arrow: Increase playback speed"); - Console.WriteLine("Down Arrow: Decrease playback speed"); - Console.WriteLine("R: Rewind to the beginning"); - Console.WriteLine("I: Toggle statistics overlay"); - Console.WriteLine("M: Toggle audio mute"); } } \ No newline at end of file From 430439278e084f9ad7f6887ff437fd697c4e292d Mon Sep 17 00:00:00 2001 From: Andre Lafleur Date: Sat, 28 Sep 2024 11:38:31 +0800 Subject: [PATCH 22/22] Refactor and reformat Program class for readability - Moved namespace declaration to the top of the file. - Moved `using System;` directive below the namespace. --- Samples/Media SDK/BasicMediaPlayer/Program.cs | 77 +++++++++---------- 1 file changed, 38 insertions(+), 39 deletions(-) diff --git a/Samples/Media SDK/BasicMediaPlayer/Program.cs b/Samples/Media SDK/BasicMediaPlayer/Program.cs index 62d03e2..46a6dc0 100644 --- a/Samples/Media SDK/BasicMediaPlayer/Program.cs +++ b/Samples/Media SDK/BasicMediaPlayer/Program.cs @@ -5,54 +5,53 @@ // Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. +namespace Genetec.Dap.CodeSamples; + using System; -namespace Genetec.Dap.CodeSamples +class Program { - class Program - { - static Program() => SdkResolver.Initialize(); + static Program() => SdkResolver.Initialize(); - [STAThread] - static void Main() - { - DisplayControls(); - string filePath = ReadFilePath(); - var app = new MediaPlayerApp(filePath); - app.Run(); - } + [STAThread] + static void Main() + { + DisplayControls(); + string filePath = ReadFilePath(); + var app = new MediaPlayerApp(filePath); + app.Run(); + } - private static void DisplayControls() - { - Console.WriteLine("Basic MediaPlayer sample"); - Console.WriteLine("Space: Play/Pause"); - Console.WriteLine("Left Arrow: Seek backward by 10 seconds"); - Console.WriteLine("Right Arrow: Seek forward by 10 seconds"); - Console.WriteLine("Up Arrow: Increase playback speed"); - Console.WriteLine("Down Arrow: Decrease playback speed"); - Console.WriteLine("R: Rewind to the beginning"); - Console.WriteLine("I: Toggle statistics overlay"); - Console.WriteLine("M: Toggle audio mute"); - } + private static void DisplayControls() + { + Console.WriteLine("Basic MediaPlayer sample"); + Console.WriteLine("Space: Play/Pause"); + Console.WriteLine("Left Arrow: Seek backward by 10 seconds"); + Console.WriteLine("Right Arrow: Seek forward by 10 seconds"); + Console.WriteLine("Up Arrow: Increase playback speed"); + Console.WriteLine("Down Arrow: Decrease playback speed"); + Console.WriteLine("R: Rewind to the beginning"); + Console.WriteLine("I: Toggle statistics overlay"); + Console.WriteLine("M: Toggle audio mute"); + } - private static string ReadFilePath() + private static string ReadFilePath() + { + while (true) { - while (true) + Console.Write("Please enter the path to a .g64, .g64x, or .mp4 file: "); + string filePath = Console.ReadLine()?.Trim(); + if (string.IsNullOrEmpty(filePath)) + { + Console.WriteLine("File path cannot be empty. Please try again."); + continue; + } + if (!System.IO.File.Exists(filePath)) { - Console.Write("Please enter the path to a .g64, .g64x, or .mp4 file: "); - string filePath = Console.ReadLine()?.Trim(); - if (string.IsNullOrEmpty(filePath)) - { - Console.WriteLine("File path cannot be empty. Please try again."); - continue; - } - if (!System.IO.File.Exists(filePath)) - { - Console.WriteLine($"The file {filePath} does not exist. Please try again."); - continue; - } - return filePath; + Console.WriteLine($"The file {filePath} does not exist. Please try again."); + continue; } + return filePath; } } } \ No newline at end of file