-
Notifications
You must be signed in to change notification settings - Fork 630
C# Record and Playback APIs #822
base: develop
Are you sure you want to change the base?
Changes from 1 commit
176e9e2
3f2241e
6d1a588
7209221
310287a
ad6f6b6
c169698
f876d18
1797758
c6025bb
3768533
972324a
594d672
0d50feb
09a6cf3
2b49c26
05265bf
5999e19
3a3a059
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| <Project Sdk="Microsoft.NET.Sdk"> | ||
|
|
||
| <PropertyGroup> | ||
| <OutputType>Exe</OutputType> | ||
| <TargetFramework>netcoreapp2.2</TargetFramework> | ||
| <AssemblyName>dotnetrecording</AssemblyName> | ||
| </PropertyGroup> | ||
|
|
||
| <ItemGroup> | ||
| <ProjectReference Include="..\..\Record\Microsoft.Azure.Kinect.Sensor.Record.csproj" /> | ||
| <ProjectReference Include="..\..\SDK\Microsoft.Azure.Kinect.Sensor.csproj" /> | ||
| </ItemGroup> | ||
|
|
||
| </Project> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| using System; | ||
| using Microsoft.Azure.Kinect.Sensor; | ||
| using Microsoft.Azure.Kinect.Sensor.Record; | ||
|
|
||
| namespace Recording | ||
| { | ||
| class Program | ||
| { | ||
| static void Main(string[] args) | ||
| { | ||
| int frame = 0; | ||
|
|
||
| Console.WriteLine("Recording from device."); | ||
|
|
||
| DeviceConfiguration configuration = new DeviceConfiguration() | ||
| { | ||
| CameraFPS = FPS.FPS30, | ||
| ColorFormat = ImageFormat.ColorMJPG, | ||
| ColorResolution = ColorResolution.R720p, | ||
| DepthMode = DepthMode.NFOV_2x2Binned | ||
| }; | ||
|
|
||
| using (Device device = Device.Open()) | ||
| using (Record recording = Record.Create(@"output.mkv", device, configuration)) | ||
| { | ||
| device.StartCameras(configuration); | ||
|
|
||
| recording.WriteHeader(); | ||
|
|
||
| for (frame = 0; frame < 100; frame++) | ||
| { | ||
| using (Capture capture = device.GetCapture()) | ||
| { | ||
| recording.WriteCapture(capture); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| Console.WriteLine($"Wrote {frame} frames to output.mkv"); | ||
| } | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -40,86 +40,146 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Examples", "Examples", "{D9 | |
| EndProject | ||
| Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Extensions", "Extensions", "{94E07BE5-5E5C-488B-A5CD-0D7D9EBCC725}" | ||
| EndProject | ||
| Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Azure.Kinect.Sensor.Examples.Recording", "Examples\Recording\Microsoft.Azure.Kinect.Sensor.Examples.Recording.csproj", "{568BBB67-4EE0-4A0D-AD69-5D10386E2D40}" | ||
| EndProject | ||
| Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.Azure.Kinect.Sensor.Record", "Record\Microsoft.Azure.Kinect.Sensor.Record.csproj", "{71EAC57F-4023-4B45-8F9E-4A7C05A6BDB3}" | ||
| EndProject | ||
| Global | ||
| GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
| Debug|Any CPU = Debug|Any CPU | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure the best way to deal with this. The "Any CPU" in the solution can get confusing, but Visual Studio really likes adding it back in. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure here either. Not supporting Any CPU in the nuget package is also pretty rough since downstream projects tend to have it by default. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I thought we did have an issue tracking Any CPU support but I can't find it at this moment. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. .NET Core can actually do AnyCPU here. It's able to handle multiple native libraries with different architectures by deploying the native libs in the |
||
| Debug|x64 = Debug|x64 | ||
| Debug|x86 = Debug|x86 | ||
| Release|Any CPU = Release|Any CPU | ||
| Release|x64 = Release|x64 | ||
| Release|x86 = Release|x86 | ||
| EndGlobalSection | ||
| GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
| {847B31D5-C253-4766-BF81-032F4670589D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
| {847B31D5-C253-4766-BF81-032F4670589D}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
| {847B31D5-C253-4766-BF81-032F4670589D}.Debug|x64.ActiveCfg = Debug|Any CPU | ||
| {847B31D5-C253-4766-BF81-032F4670589D}.Debug|x64.Build.0 = Debug|Any CPU | ||
| {847B31D5-C253-4766-BF81-032F4670589D}.Debug|x86.ActiveCfg = Debug|Any CPU | ||
| {847B31D5-C253-4766-BF81-032F4670589D}.Debug|x86.Build.0 = Debug|Any CPU | ||
| {847B31D5-C253-4766-BF81-032F4670589D}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
| {847B31D5-C253-4766-BF81-032F4670589D}.Release|Any CPU.Build.0 = Release|Any CPU | ||
| {847B31D5-C253-4766-BF81-032F4670589D}.Release|x64.ActiveCfg = Release|Any CPU | ||
| {847B31D5-C253-4766-BF81-032F4670589D}.Release|x64.Build.0 = Release|Any CPU | ||
| {847B31D5-C253-4766-BF81-032F4670589D}.Release|x86.ActiveCfg = Release|Any CPU | ||
| {847B31D5-C253-4766-BF81-032F4670589D}.Release|x86.Build.0 = Release|Any CPU | ||
| {4762DD42-3CF3-4742-9AEA-5D39781FD2A6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
| {4762DD42-3CF3-4742-9AEA-5D39781FD2A6}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
| {4762DD42-3CF3-4742-9AEA-5D39781FD2A6}.Debug|x64.ActiveCfg = Debug|Any CPU | ||
| {4762DD42-3CF3-4742-9AEA-5D39781FD2A6}.Debug|x64.Build.0 = Debug|Any CPU | ||
| {4762DD42-3CF3-4742-9AEA-5D39781FD2A6}.Debug|x86.ActiveCfg = Debug|Any CPU | ||
| {4762DD42-3CF3-4742-9AEA-5D39781FD2A6}.Debug|x86.Build.0 = Debug|Any CPU | ||
| {4762DD42-3CF3-4742-9AEA-5D39781FD2A6}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
| {4762DD42-3CF3-4742-9AEA-5D39781FD2A6}.Release|Any CPU.Build.0 = Release|Any CPU | ||
| {4762DD42-3CF3-4742-9AEA-5D39781FD2A6}.Release|x64.ActiveCfg = Release|Any CPU | ||
| {4762DD42-3CF3-4742-9AEA-5D39781FD2A6}.Release|x64.Build.0 = Release|Any CPU | ||
| {4762DD42-3CF3-4742-9AEA-5D39781FD2A6}.Release|x86.ActiveCfg = Release|Any CPU | ||
| {4762DD42-3CF3-4742-9AEA-5D39781FD2A6}.Release|x86.Build.0 = Release|Any CPU | ||
| {618E28C5-0624-463F-9ADB-040BA5DAED68}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
| {618E28C5-0624-463F-9ADB-040BA5DAED68}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
| {618E28C5-0624-463F-9ADB-040BA5DAED68}.Debug|x64.ActiveCfg = Debug|Any CPU | ||
| {618E28C5-0624-463F-9ADB-040BA5DAED68}.Debug|x64.Build.0 = Debug|Any CPU | ||
| {618E28C5-0624-463F-9ADB-040BA5DAED68}.Debug|x86.ActiveCfg = Debug|Any CPU | ||
| {618E28C5-0624-463F-9ADB-040BA5DAED68}.Debug|x86.Build.0 = Debug|Any CPU | ||
| {618E28C5-0624-463F-9ADB-040BA5DAED68}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
| {618E28C5-0624-463F-9ADB-040BA5DAED68}.Release|Any CPU.Build.0 = Release|Any CPU | ||
| {618E28C5-0624-463F-9ADB-040BA5DAED68}.Release|x64.ActiveCfg = Release|Any CPU | ||
| {618E28C5-0624-463F-9ADB-040BA5DAED68}.Release|x64.Build.0 = Release|Any CPU | ||
| {618E28C5-0624-463F-9ADB-040BA5DAED68}.Release|x86.ActiveCfg = Release|Any CPU | ||
| {618E28C5-0624-463F-9ADB-040BA5DAED68}.Release|x86.Build.0 = Release|Any CPU | ||
| {CCD99E9D-1EE2-41F5-AD3F-4110A466A9A4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
| {CCD99E9D-1EE2-41F5-AD3F-4110A466A9A4}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
| {CCD99E9D-1EE2-41F5-AD3F-4110A466A9A4}.Debug|x64.ActiveCfg = Debug|x64 | ||
| {CCD99E9D-1EE2-41F5-AD3F-4110A466A9A4}.Debug|x64.Build.0 = Debug|x64 | ||
| {CCD99E9D-1EE2-41F5-AD3F-4110A466A9A4}.Debug|x86.ActiveCfg = Debug|x86 | ||
| {CCD99E9D-1EE2-41F5-AD3F-4110A466A9A4}.Debug|x86.Build.0 = Debug|x86 | ||
| {CCD99E9D-1EE2-41F5-AD3F-4110A466A9A4}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
| {CCD99E9D-1EE2-41F5-AD3F-4110A466A9A4}.Release|Any CPU.Build.0 = Release|Any CPU | ||
| {CCD99E9D-1EE2-41F5-AD3F-4110A466A9A4}.Release|x64.ActiveCfg = Release|x64 | ||
| {CCD99E9D-1EE2-41F5-AD3F-4110A466A9A4}.Release|x64.Build.0 = Release|x64 | ||
| {CCD99E9D-1EE2-41F5-AD3F-4110A466A9A4}.Release|x86.ActiveCfg = Release|x86 | ||
| {CCD99E9D-1EE2-41F5-AD3F-4110A466A9A4}.Release|x86.Build.0 = Release|x86 | ||
| {8A14FB66-07CD-4E4C-A533-89DE0AFF4FCB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
| {8A14FB66-07CD-4E4C-A533-89DE0AFF4FCB}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
| {8A14FB66-07CD-4E4C-A533-89DE0AFF4FCB}.Debug|x64.ActiveCfg = Debug|x64 | ||
| {8A14FB66-07CD-4E4C-A533-89DE0AFF4FCB}.Debug|x64.Build.0 = Debug|x64 | ||
| {8A14FB66-07CD-4E4C-A533-89DE0AFF4FCB}.Debug|x86.ActiveCfg = Debug|x86 | ||
| {8A14FB66-07CD-4E4C-A533-89DE0AFF4FCB}.Debug|x86.Build.0 = Debug|x86 | ||
| {8A14FB66-07CD-4E4C-A533-89DE0AFF4FCB}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
| {8A14FB66-07CD-4E4C-A533-89DE0AFF4FCB}.Release|Any CPU.Build.0 = Release|Any CPU | ||
| {8A14FB66-07CD-4E4C-A533-89DE0AFF4FCB}.Release|x64.ActiveCfg = Release|x64 | ||
| {8A14FB66-07CD-4E4C-A533-89DE0AFF4FCB}.Release|x64.Build.0 = Release|x64 | ||
| {8A14FB66-07CD-4E4C-A533-89DE0AFF4FCB}.Release|x86.ActiveCfg = Release|x86 | ||
| {8A14FB66-07CD-4E4C-A533-89DE0AFF4FCB}.Release|x86.Build.0 = Release|x86 | ||
| {6D4EC05A-3A81-4B92-8881-96F499F5986B}.Debug|Any CPU.ActiveCfg = Debug|x86 | ||
| {6D4EC05A-3A81-4B92-8881-96F499F5986B}.Debug|x64.ActiveCfg = Debug|x64 | ||
| {6D4EC05A-3A81-4B92-8881-96F499F5986B}.Debug|x64.Build.0 = Debug|x64 | ||
| {6D4EC05A-3A81-4B92-8881-96F499F5986B}.Debug|x86.ActiveCfg = Debug|x86 | ||
| {6D4EC05A-3A81-4B92-8881-96F499F5986B}.Debug|x86.Build.0 = Debug|x86 | ||
| {6D4EC05A-3A81-4B92-8881-96F499F5986B}.Release|Any CPU.ActiveCfg = Release|x86 | ||
| {6D4EC05A-3A81-4B92-8881-96F499F5986B}.Release|x64.ActiveCfg = Release|x64 | ||
| {6D4EC05A-3A81-4B92-8881-96F499F5986B}.Release|x64.Build.0 = Release|x64 | ||
| {6D4EC05A-3A81-4B92-8881-96F499F5986B}.Release|x86.ActiveCfg = Release|x86 | ||
| {6D4EC05A-3A81-4B92-8881-96F499F5986B}.Release|x86.Build.0 = Release|x86 | ||
| {41510BD0-7F25-470B-A1DC-12E1DB1AB3B7}.Debug|Any CPU.ActiveCfg = Debug|x86 | ||
| {41510BD0-7F25-470B-A1DC-12E1DB1AB3B7}.Debug|x64.ActiveCfg = Debug|x64 | ||
| {41510BD0-7F25-470B-A1DC-12E1DB1AB3B7}.Debug|x64.Build.0 = Debug|x64 | ||
| {41510BD0-7F25-470B-A1DC-12E1DB1AB3B7}.Debug|x86.ActiveCfg = Debug|x86 | ||
| {41510BD0-7F25-470B-A1DC-12E1DB1AB3B7}.Debug|x86.Build.0 = Debug|x86 | ||
| {41510BD0-7F25-470B-A1DC-12E1DB1AB3B7}.Release|Any CPU.ActiveCfg = Release|x86 | ||
| {41510BD0-7F25-470B-A1DC-12E1DB1AB3B7}.Release|x64.ActiveCfg = Release|x64 | ||
| {41510BD0-7F25-470B-A1DC-12E1DB1AB3B7}.Release|x64.Build.0 = Release|x64 | ||
| {41510BD0-7F25-470B-A1DC-12E1DB1AB3B7}.Release|x86.ActiveCfg = Release|x86 | ||
| {41510BD0-7F25-470B-A1DC-12E1DB1AB3B7}.Release|x86.Build.0 = Release|x86 | ||
| {FCD1E629-1E96-4BDD-A247-35B50F31137A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
| {FCD1E629-1E96-4BDD-A247-35B50F31137A}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
| {FCD1E629-1E96-4BDD-A247-35B50F31137A}.Debug|x64.ActiveCfg = Debug|Any CPU | ||
| {FCD1E629-1E96-4BDD-A247-35B50F31137A}.Debug|x64.Build.0 = Debug|Any CPU | ||
| {FCD1E629-1E96-4BDD-A247-35B50F31137A}.Debug|x86.ActiveCfg = Debug|Any CPU | ||
| {FCD1E629-1E96-4BDD-A247-35B50F31137A}.Debug|x86.Build.0 = Debug|Any CPU | ||
| {FCD1E629-1E96-4BDD-A247-35B50F31137A}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
| {FCD1E629-1E96-4BDD-A247-35B50F31137A}.Release|Any CPU.Build.0 = Release|Any CPU | ||
| {FCD1E629-1E96-4BDD-A247-35B50F31137A}.Release|x64.ActiveCfg = Release|Any CPU | ||
| {FCD1E629-1E96-4BDD-A247-35B50F31137A}.Release|x64.Build.0 = Release|Any CPU | ||
| {FCD1E629-1E96-4BDD-A247-35B50F31137A}.Release|x86.ActiveCfg = Release|Any CPU | ||
| {FCD1E629-1E96-4BDD-A247-35B50F31137A}.Release|x86.Build.0 = Release|Any CPU | ||
| {E1B3CC41-BC1C-47B7-A6A6-AA50E6994C05}.Debug|Any CPU.ActiveCfg = Debug|x86 | ||
| {E1B3CC41-BC1C-47B7-A6A6-AA50E6994C05}.Debug|x64.ActiveCfg = Debug|x64 | ||
| {E1B3CC41-BC1C-47B7-A6A6-AA50E6994C05}.Debug|x64.Build.0 = Debug|x64 | ||
| {E1B3CC41-BC1C-47B7-A6A6-AA50E6994C05}.Debug|x86.ActiveCfg = Debug|x86 | ||
| {E1B3CC41-BC1C-47B7-A6A6-AA50E6994C05}.Debug|x86.Build.0 = Debug|x86 | ||
| {E1B3CC41-BC1C-47B7-A6A6-AA50E6994C05}.Release|Any CPU.ActiveCfg = Release|x86 | ||
| {E1B3CC41-BC1C-47B7-A6A6-AA50E6994C05}.Release|x64.ActiveCfg = Release|x64 | ||
| {E1B3CC41-BC1C-47B7-A6A6-AA50E6994C05}.Release|x64.Build.0 = Release|x64 | ||
| {E1B3CC41-BC1C-47B7-A6A6-AA50E6994C05}.Release|x86.ActiveCfg = Release|x86 | ||
| {E1B3CC41-BC1C-47B7-A6A6-AA50E6994C05}.Release|x86.Build.0 = Release|x86 | ||
| {568BBB67-4EE0-4A0D-AD69-5D10386E2D40}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
| {568BBB67-4EE0-4A0D-AD69-5D10386E2D40}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
| {568BBB67-4EE0-4A0D-AD69-5D10386E2D40}.Debug|x64.ActiveCfg = Debug|Any CPU | ||
| {568BBB67-4EE0-4A0D-AD69-5D10386E2D40}.Debug|x64.Build.0 = Debug|Any CPU | ||
| {568BBB67-4EE0-4A0D-AD69-5D10386E2D40}.Debug|x86.ActiveCfg = Debug|Any CPU | ||
| {568BBB67-4EE0-4A0D-AD69-5D10386E2D40}.Debug|x86.Build.0 = Debug|Any CPU | ||
| {568BBB67-4EE0-4A0D-AD69-5D10386E2D40}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
| {568BBB67-4EE0-4A0D-AD69-5D10386E2D40}.Release|Any CPU.Build.0 = Release|Any CPU | ||
| {568BBB67-4EE0-4A0D-AD69-5D10386E2D40}.Release|x64.ActiveCfg = Release|Any CPU | ||
| {568BBB67-4EE0-4A0D-AD69-5D10386E2D40}.Release|x64.Build.0 = Release|Any CPU | ||
| {568BBB67-4EE0-4A0D-AD69-5D10386E2D40}.Release|x86.ActiveCfg = Release|Any CPU | ||
| {568BBB67-4EE0-4A0D-AD69-5D10386E2D40}.Release|x86.Build.0 = Release|Any CPU | ||
| {71EAC57F-4023-4B45-8F9E-4A7C05A6BDB3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
| {71EAC57F-4023-4B45-8F9E-4A7C05A6BDB3}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
| {71EAC57F-4023-4B45-8F9E-4A7C05A6BDB3}.Debug|x64.ActiveCfg = Debug|Any CPU | ||
| {71EAC57F-4023-4B45-8F9E-4A7C05A6BDB3}.Debug|x64.Build.0 = Debug|Any CPU | ||
| {71EAC57F-4023-4B45-8F9E-4A7C05A6BDB3}.Debug|x86.ActiveCfg = Debug|Any CPU | ||
| {71EAC57F-4023-4B45-8F9E-4A7C05A6BDB3}.Debug|x86.Build.0 = Debug|Any CPU | ||
| {71EAC57F-4023-4B45-8F9E-4A7C05A6BDB3}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
| {71EAC57F-4023-4B45-8F9E-4A7C05A6BDB3}.Release|Any CPU.Build.0 = Release|Any CPU | ||
| {71EAC57F-4023-4B45-8F9E-4A7C05A6BDB3}.Release|x64.ActiveCfg = Release|Any CPU | ||
| {71EAC57F-4023-4B45-8F9E-4A7C05A6BDB3}.Release|x64.Build.0 = Release|Any CPU | ||
| {71EAC57F-4023-4B45-8F9E-4A7C05A6BDB3}.Release|x86.ActiveCfg = Release|Any CPU | ||
| {71EAC57F-4023-4B45-8F9E-4A7C05A6BDB3}.Release|x86.Build.0 = Release|Any CPU | ||
| EndGlobalSection | ||
| GlobalSection(SolutionProperties) = preSolution | ||
| HideSolutionNode = FALSE | ||
|
|
@@ -134,6 +194,7 @@ Global | |
| {5C3A9F92-56B4-4A7B-86EC-BACBE07C5AAE} = {21E41070-E020-49B0-9976-54F92B2251DD} | ||
| {FCD1E629-1E96-4BDD-A247-35B50F31137A} = {5C3A9F92-56B4-4A7B-86EC-BACBE07C5AAE} | ||
| {E1B3CC41-BC1C-47B7-A6A6-AA50E6994C05} = {5C3A9F92-56B4-4A7B-86EC-BACBE07C5AAE} | ||
| {568BBB67-4EE0-4A0D-AD69-5D10386E2D40} = {D946946D-56B5-4F64-B4FC-5C79F15295C4} | ||
| EndGlobalSection | ||
| GlobalSection(ExtensibilityGlobals) = postSolution | ||
| SolutionGuid = {9BC05C93-252F-4030-ACA6-41B4B54F9C86} | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,118 @@ | ||
| //------------------------------------------------------------------------------ | ||
| // <copyright file="AzureKinectAddTagException.cs" company="Microsoft"> | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. | ||
| // </copyright> | ||
| //------------------------------------------------------------------------------ | ||
| using System; | ||
| using System.Collections.Generic; | ||
| using System.Runtime.Serialization; | ||
| using Microsoft.Azure.Kinect.Sensor.Record.Exceptions; | ||
|
|
||
| namespace Microsoft.Azure.Kinect.Sensor | ||
| { | ||
| /// <summary> | ||
| /// Represents errors that occur when adding a tag to a recording | ||
| /// </summary> | ||
| [Serializable] | ||
| public class AzureKinectAddTagException : AzureKinectRecordException | ||
| { | ||
| /// <summary> | ||
| /// Initializes a new instance of the <see cref="AzureKinectAddTagException"/> class. | ||
| /// </summary> | ||
| public AzureKinectAddTagException() | ||
| { | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Initializes a new instance of the <see cref="AzureKinectAddTagException"/> class | ||
| /// with a specified error message. | ||
| /// </summary> | ||
| /// <param name="message">The message that describes the error.</param> | ||
| public AzureKinectAddTagException(string message) | ||
| : base(message) | ||
| { | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Initializes a new instance of the <see cref="AzureKinectAddTagException"/> class | ||
| /// with a specified error message and a reference to the inner exception that is the | ||
| /// cause of this exception. | ||
| /// </summary> | ||
| /// <param name="message"> | ||
| /// The error message that explains the reason for the exception. | ||
| /// </param> | ||
| /// <param name="innerException"> | ||
| /// The exception that is the cause of the current exception, or a null reference | ||
| /// (Nothing in Visual Basic) if no inner exception is specified. | ||
| /// </param> | ||
| public AzureKinectAddTagException(string message, Exception innerException) | ||
| : base(message, innerException) | ||
| { | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Initializes a new instance of the <see cref="AzureKinectAddTagException"/> class | ||
| /// with serialized data. | ||
| /// </summary> | ||
| /// <param name="info"> | ||
| /// The <see cref="SerializationInfo"/> that holds the serialized object data about the | ||
| /// exception being thrown.</param> | ||
| /// <param name="context"> | ||
| /// The <see cref="StreamingContext"/>System.Runtime.Serialization.StreamingContext that | ||
| /// contains contextual information about the source or destination. | ||
| /// </param> | ||
| protected AzureKinectAddTagException(SerializationInfo info, StreamingContext context) | ||
| : base(info, context) | ||
| { | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Initializes a new instance of the <see cref="AzureKinectAddTagException"/> class | ||
| /// with a specified error message. | ||
| /// </summary> | ||
| /// <param name="message">The message that describes the error.</param> | ||
| /// <param name="logMessages"> | ||
| /// The log messages that happened during the function call that generated this error. | ||
| /// </param> | ||
| protected AzureKinectAddTagException(string message, ICollection<LogMessage> logMessages) | ||
| : base(message, logMessages) | ||
| { | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Throws an <see cref="AzureKinectAddTagException"/> if the result of the function | ||
| /// is not a success. | ||
| /// </summary> | ||
| /// <param name="function">The native function to call.</param> | ||
| /// <typeparam name="T">The type of result to expect from the function call.</typeparam> | ||
| internal static void ThrowIfNotSuccess<T>(Func<T> function) | ||
| where T : System.Enum | ||
| { | ||
| using (LoggingTracer tracer = new LoggingTracer()) | ||
| { | ||
| T result = function(); | ||
| if (!AzureKinectRecordException.IsSuccess(result)) | ||
| { | ||
| throw new AzureKinectAddTagException($"result = {result}", tracer.LogMessages); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Throws an <see cref="AzureKinectAddTagException"/> if the result of the function | ||
| /// is not a success. | ||
| /// </summary> | ||
| /// <param name="tracer">The tracer is that is capturing logging messages.</param> | ||
| /// <param name="result">The result native function to call.</param> | ||
| /// <typeparam name="T">The type of result to expect from the function call.</typeparam> | ||
| internal static void ThrowIfNotSuccess<T>(LoggingTracer tracer, T result) | ||
| where T : System.Enum | ||
| { | ||
| if (!AzureKinectRecordException.IsSuccess(result)) | ||
| { | ||
| throw new AzureKinectAddTagException($"result = {result}", tracer.LogMessages); | ||
| } | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copyright header.