Skip to content
This repository was archived by the owner on Aug 22, 2024. It is now read-only.

Commit 2b49c26

Browse files
committed
Style cleanup
1 parent 09a6cf3 commit 2b49c26

38 files changed

+584
-382
lines changed

src/csharp/Examples/Recording/Program.cs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,22 +31,21 @@ static void Main(string[] args)
3131
DepthMode = DepthMode.NFOV_2x2Binned,
3232
SynchronizedImagesOnly = true
3333
};
34-
3534
using (Device device = Device.Open())
36-
using (Record recording = Record.Create(path, device, configuration))
35+
using (Recorder recorder = Recorder.Create(path, device, configuration))
3736
{
3837

3938
device.StartCameras(configuration);
4039
device.StartImu();
4140

42-
recording.AddImuTrack();
43-
recording.WriteHeader();
41+
recorder.AddImuTrack();
42+
recorder.WriteHeader();
4443

4544
for (frame = 0; frame < 100; frame++)
4645
{
4746
using (Capture capture = device.GetCapture())
4847
{
49-
recording.WriteCapture(capture);
48+
recorder.WriteCapture(capture);
5049
Console.WriteLine($"Wrote capture ({capture.Color.DeviceTimestamp})");
5150
try
5251
{
@@ -55,7 +54,7 @@ static void Main(string[] args)
5554
// Throws TimeoutException when Imu sample is not available
5655
ImuSample sample = device.GetImuSample(TimeSpan.Zero);
5756

58-
recording.WriteImuSample(sample);
57+
recorder.WriteImuSample(sample);
5958
Console.WriteLine($"Wrote imu ({sample.AccelerometerTimestamp})");
6059
}
6160
}

src/csharp/Record/DataBlock.cs

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Globalization;
1+
//------------------------------------------------------------------------------
2+
// <copyright file="DataBlock.cs" company="Microsoft">
3+
// Copyright (c) Microsoft Corporation. All rights reserved.
4+
// Licensed under the MIT License.
5+
// </copyright>
6+
//------------------------------------------------------------------------------
7+
using System;
8+
using System.Buffers;
49
using System.Runtime.InteropServices;
5-
using System.Text;
610

711
namespace Microsoft.Azure.Kinect.Sensor.Record
812
{
9-
public class DataBlock : IDisposable
13+
/// <summary>
14+
/// Represents a block of data from a custom recording track.
15+
/// </summary>
16+
public class DataBlock : IDisposable, IMemoryOwner<byte>
1017
{
1118
// The native handle for this data block.
1219
private readonly NativeMethods.k4a_playback_data_block_t handle;
@@ -16,12 +23,19 @@ public class DataBlock : IDisposable
1623

1724
private byte[] buffer = null;
1825

26+
/// <summary>
27+
/// Initializes a new instance of the <see cref="DataBlock"/> class.
28+
/// </summary>
29+
/// <param name="handle">Native handle to the data block.</param>
1930
internal DataBlock(NativeMethods.k4a_playback_data_block_t handle)
2031
{
2132
this.handle = handle;
2233
}
2334

24-
public byte[] Buffer
35+
/// <summary>
36+
/// Gets the memory with the custom data.
37+
/// </summary>
38+
public Memory<byte> Memory
2539
{
2640
get
2741
{
@@ -37,7 +51,7 @@ public byte[] Buffer
3751
ulong bufferSize = NativeMethods.k4a_playback_data_block_get_buffer_size(this.handle);
3852

3953
this.buffer = new byte[bufferSize];
40-
54+
4155
IntPtr bufferPtr = NativeMethods.k4a_playback_data_block_get_buffer(this.handle);
4256

4357
if (bufferPtr != IntPtr.Zero)
@@ -55,6 +69,9 @@ public byte[] Buffer
5569
}
5670
}
5771

72+
/// <summary>
73+
/// Gets the device timestamp associated with the data.
74+
/// </summary>
5875
public TimeSpan DeviceTimestamp
5976
{
6077
get
@@ -73,7 +90,6 @@ public TimeSpan DeviceTimestamp
7390
}
7491
}
7592

76-
7793
/// <inheritdoc/>
7894
public void Dispose()
7995
{

src/csharp/Record/Exceptions/AzureKinectAddAttachmentException.cs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
1-
using System;
1+
//------------------------------------------------------------------------------
2+
// <copyright file="AzureKinectAddAttachmentException.cs" company="Microsoft">
3+
// Copyright (c) Microsoft Corporation. All rights reserved.
4+
// Licensed under the MIT License.
5+
// </copyright>
6+
//------------------------------------------------------------------------------
7+
using System;
28
using System.Collections.Generic;
39
using System.Runtime.Serialization;
4-
using System.Text;
510

611
namespace Microsoft.Azure.Kinect.Sensor.Record.Exceptions
712
{
8-
913
/// <summary>
10-
/// Represents errors that occur when adding an attachment to a recording
14+
/// Represents errors that occur when adding an attachment to a recording.
1115
/// </summary>
1216
[Serializable]
1317
public class AzureKinectAddAttachmentException : AzureKinectRecordException

src/csharp/Record/Exceptions/AzureKinectAddCustomSubtitleTrackException.cs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
1-
using System;
1+
//------------------------------------------------------------------------------
2+
// <copyright file="AzureKinectAddCustomSubtitleTrackException.cs" company="Microsoft">
3+
// Copyright (c) Microsoft Corporation. All rights reserved.
4+
// Licensed under the MIT License.
5+
// </copyright>
6+
//------------------------------------------------------------------------------
7+
using System;
28
using System.Collections.Generic;
39
using System.Runtime.Serialization;
4-
using System.Text;
510

611
namespace Microsoft.Azure.Kinect.Sensor.Record.Exceptions
712
{
8-
913
/// <summary>
10-
/// Represents errors that occur when adding a custom subtitle track
14+
/// Represents errors that occur when adding a custom subtitle track.
1115
/// </summary>
1216
[Serializable]
1317
public class AzureKinectAddCustomSubtitleTrackException : AzureKinectRecordException

src/csharp/Record/Exceptions/AzureKinectAddCustomVideoTrackException.cs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
1-
using System;
1+
//------------------------------------------------------------------------------
2+
// <copyright file="AzureKinectAddCustomVideoTrackException.cs" company="Microsoft">
3+
// Copyright (c) Microsoft Corporation. All rights reserved.
4+
// Licensed under the MIT License.
5+
// </copyright>
6+
//------------------------------------------------------------------------------
7+
using System;
28
using System.Collections.Generic;
39
using System.Runtime.Serialization;
4-
using System.Text;
510

611
namespace Microsoft.Azure.Kinect.Sensor.Record.Exceptions
712
{
8-
913
/// <summary>
10-
/// Represents errors that occur when adding a custom video track
14+
/// Represents errors that occur when adding a custom video track.
1115
/// </summary>
1216
[Serializable]
1317
public class AzureKinectAddCustomVideoTrackException : AzureKinectRecordException

src/csharp/Record/Exceptions/AzureKinectAddImuTrackException.cs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
1-
using System;
1+
//------------------------------------------------------------------------------
2+
// <copyright file="AzureKinectAddImuTrackException.cs" company="Microsoft">
3+
// Copyright (c) Microsoft Corporation. All rights reserved.
4+
// Licensed under the MIT License.
5+
// </copyright>
6+
//------------------------------------------------------------------------------
7+
using System;
28
using System.Collections.Generic;
39
using System.Runtime.Serialization;
4-
using System.Text;
510

611
namespace Microsoft.Azure.Kinect.Sensor.Record.Exceptions
712
{
8-
913
/// <summary>
1014
/// Represents errors that occur when adding an IMU track to a recording.
1115
/// </summary>

src/csharp/Record/Exceptions/AzureKinectAddTagException.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
namespace Microsoft.Azure.Kinect.Sensor.Record.Exceptions
1212
{
1313
/// <summary>
14-
/// Represents errors that occur when adding a tag to a recording
14+
/// Represents errors that occur when adding a tag to a recording.
1515
/// </summary>
1616
[Serializable]
1717
public class AzureKinectAddTagException : AzureKinectRecordException

src/csharp/Record/Exceptions/AzureKinectCreateRecordingException.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
using System;
88
using System.Collections.Generic;
99
using System.Runtime.Serialization;
10-
using Microsoft.Azure.Kinect.Sensor.Record;
1110

1211
namespace Microsoft.Azure.Kinect.Sensor.Record.Exceptions
1312
{
@@ -84,13 +83,12 @@ protected AzureKinectCreateRecordingException(string message, ICollection<LogMes
8483
/// Throws an <see cref="AzureKinectCreateRecordingException"/> if the result of the function
8584
/// is not a success.
8685
/// </summary>
87-
/// <param name="fileName">File name of the create</param>
86+
/// <param name="fileName">File name of the create.</param>
8887
/// <param name="function">The native function to call.</param>
8988
/// <typeparam name="T">The type of result to expect from the function call.</typeparam>
9089
internal static void ThrowIfNotSuccess<T>(string fileName, Func<T> function)
9190
where T : System.Enum
9291
{
93-
9492
using (LoggingTracer tracer = new LoggingTracer(LogLevel.Warning, Logger.LogProvider, RecordLogger.LogProvider))
9593
{
9694
T result = function();
@@ -105,7 +103,7 @@ internal static void ThrowIfNotSuccess<T>(string fileName, Func<T> function)
105103
/// Throws an <see cref="AzureKinectCreateRecordingException"/> if the result of the function
106104
/// is not a success.
107105
/// </summary>
108-
/// <param name="fileName">File name of the create</param>
106+
/// <param name="fileName">File name of the create.</param>
109107
/// <param name="tracer">The tracer is that is capturing logging messages.</param>
110108
/// <param name="result">The result native function to call.</param>
111109
/// <typeparam name="T">The type of result to expect from the function call.</typeparam>

src/csharp/Record/Exceptions/AzureKinectFlushException.cs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
1-
using System;
1+
//------------------------------------------------------------------------------
2+
// <copyright file="AzureKinectFlushException.cs" company="Microsoft">
3+
// Copyright (c) Microsoft Corporation. All rights reserved.
4+
// Licensed under the MIT License.
5+
// </copyright>
6+
//------------------------------------------------------------------------------
7+
using System;
28
using System.Collections.Generic;
39
using System.Runtime.Serialization;
4-
using System.Text;
510

611
namespace Microsoft.Azure.Kinect.Sensor.Record.Exceptions
712
{
8-
913
/// <summary>
10-
/// Represents errors that occur when an error occurs during flushing
14+
/// Represents errors that occur when an error occurs during flushing.
1115
/// </summary>
1216
[Serializable]
1317
public class AzureKinectFlushException : AzureKinectRecordException

src/csharp/Record/Exceptions/AzureKinectGetCalibrationException.cs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
1-
using System;
1+
//------------------------------------------------------------------------------
2+
// <copyright file="AzureKinectGetCalibrationException.cs" company="Microsoft">
3+
// Copyright (c) Microsoft Corporation. All rights reserved.
4+
// Licensed under the MIT License.
5+
// </copyright>
6+
//------------------------------------------------------------------------------
7+
using System;
28
using System.Collections.Generic;
39
using System.Runtime.Serialization;
4-
using System.Text;
510

611
namespace Microsoft.Azure.Kinect.Sensor.Record.Exceptions
712
{
8-
913
/// <summary>
1014
/// Represents errors that occur when getting calibration from a recording.
1115
/// </summary>

src/csharp/Record/Exceptions/AzureKinectGetCaptureException.cs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
1-
using System;
1+
//------------------------------------------------------------------------------
2+
// <copyright file="AzureKinectGetCaptureException.cs" company="Microsoft">
3+
// Copyright (c) Microsoft Corporation. All rights reserved.
4+
// Licensed under the MIT License.
5+
// </copyright>
6+
//------------------------------------------------------------------------------
7+
using System;
28
using System.Collections.Generic;
39
using System.Runtime.Serialization;
4-
using System.Text;
510

611
namespace Microsoft.Azure.Kinect.Sensor.Record.Exceptions
712
{
8-
913
/// <summary>
1014
/// Represents errors that occur when getting the next or previous capture.
1115
/// </summary>

src/csharp/Record/Exceptions/AzureKinectGetDataBlockException.cs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
1-
using System;
1+
//------------------------------------------------------------------------------
2+
// <copyright file="AzureKinectGetDataBlockException.cs" company="Microsoft">
3+
// Copyright (c) Microsoft Corporation. All rights reserved.
4+
// Licensed under the MIT License.
5+
// </copyright>
6+
//------------------------------------------------------------------------------
7+
using System;
28
using System.Collections.Generic;
39
using System.Runtime.Serialization;
4-
using System.Text;
510

611
namespace Microsoft.Azure.Kinect.Sensor.Record.Exceptions
712
{
8-
913
/// <summary>
1014
/// Represents errors that occur when getting a data block.
1115
/// </summary>

src/csharp/Record/Exceptions/AzureKinectGetImuSampleException.cs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
1-
using System;
1+
//------------------------------------------------------------------------------
2+
// <copyright file="AzureKinectGetImuSampleException.cs" company="Microsoft">
3+
// Copyright (c) Microsoft Corporation. All rights reserved.
4+
// Licensed under the MIT License.
5+
// </copyright>
6+
//------------------------------------------------------------------------------
7+
using System;
28
using System.Collections.Generic;
39
using System.Runtime.Serialization;
4-
using System.Text;
510

611
namespace Microsoft.Azure.Kinect.Sensor.Record.Exceptions
712
{
8-
913
/// <summary>
1014
/// Represents errors that occur when reading an IMU sample.
1115
/// </summary>

src/csharp/Record/Exceptions/AzureKinectGetRawCalibrationException.cs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
1-
using System;
1+
//------------------------------------------------------------------------------
2+
// <copyright file="AzureKinectGetRawCalibrationException.cs" company="Microsoft">
3+
// Copyright (c) Microsoft Corporation. All rights reserved.
4+
// Licensed under the MIT License.
5+
// </copyright>
6+
//------------------------------------------------------------------------------
7+
using System;
28
using System.Collections.Generic;
39
using System.Runtime.Serialization;
4-
using System.Text;
510

611
namespace Microsoft.Azure.Kinect.Sensor.Record.Exceptions
712
{
8-
913
/// <summary>
1014
/// Represents errors that occur when getting raw calibration from a recording.
1115
/// </summary>

src/csharp/Record/Exceptions/AzureKinectGetTagException.cs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
1-
using System;
1+
//------------------------------------------------------------------------------
2+
// <copyright file="AzureKinectGetTagException.cs" company="Microsoft">
3+
// Copyright (c) Microsoft Corporation. All rights reserved.
4+
// Licensed under the MIT License.
5+
// </copyright>
6+
//------------------------------------------------------------------------------
7+
using System;
28
using System.Collections.Generic;
39
using System.Runtime.Serialization;
4-
using System.Text;
510

611
namespace Microsoft.Azure.Kinect.Sensor.Record.Exceptions
712
{
8-
913
/// <summary>
10-
/// Represents errors that occur when getting a tag value
14+
/// Represents errors that occur when getting a tag value.
1115
/// </summary>
1216
[Serializable]
1317
public class AzureKinectGetTagException : AzureKinectRecordException

src/csharp/Record/Exceptions/AzureKinectGetTrackCodecContextException.cs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
1-
using System;
1+
//------------------------------------------------------------------------------
2+
// <copyright file="AzureKinectGetTrackCodecContextException.cs" company="Microsoft">
3+
// Copyright (c) Microsoft Corporation. All rights reserved.
4+
// Licensed under the MIT License.
5+
// </copyright>
6+
//------------------------------------------------------------------------------
7+
using System;
28
using System.Collections.Generic;
39
using System.Runtime.Serialization;
4-
using System.Text;
510

611
namespace Microsoft.Azure.Kinect.Sensor.Record.Exceptions
712
{
8-
913
/// <summary>
10-
/// Represents errors that occur when getting a codec context from a track
14+
/// Represents errors that occur when getting a codec context from a track.
1115
/// </summary>
1216
[Serializable]
1317
public class AzureKinectGetTrackCodecContextException : AzureKinectRecordException

0 commit comments

Comments
 (0)