Skip to content

Commit 61bf89d

Browse files
committed
Add class from Extensions
1 parent 4f4e093 commit 61bf89d

3 files changed

Lines changed: 98 additions & 0 deletions

File tree

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// <copyright file="AdbServerFeatures.cs" company="The Android Open Source Project, Ryan Conrad, Quamotion, yungd1plomat, wherewhere">
2+
// Copyright (c) The Android Open Source Project, Ryan Conrad, Quamotion, yungd1plomat, wherewhere. All rights reserved.
3+
// </copyright>
4+
5+
namespace AdvancedSharpAdbClient.WinRT
6+
{
7+
/// <summary>
8+
/// Lists features which an Android Debug Bridge can support.
9+
/// </summary>
10+
public static class AdbServerFeatures
11+
{
12+
/// <summary>
13+
/// The server supports the shell protocol.
14+
/// </summary>
15+
public static string Shell2 { get; } = AdvancedSharpAdbClient.AdbServerFeatures.Shell2;
16+
17+
/// <summary>
18+
/// The server supports the <c>cmd</c> command.
19+
/// </summary>
20+
public static string Cmd { get; } = AdvancedSharpAdbClient.AdbServerFeatures.Cmd;
21+
22+
/// <summary>
23+
/// The server supports the stat2 protocol.
24+
/// </summary>
25+
public static string Stat2 { get; } = AdvancedSharpAdbClient.AdbServerFeatures.Stat2;
26+
27+
/// <summary>
28+
/// The server supports libusb.
29+
/// </summary>
30+
public static string LibUsb { get; } = AdvancedSharpAdbClient.AdbServerFeatures.LibUsb;
31+
32+
/// <summary>
33+
/// The server supports <c>push --sync</c>.
34+
/// </summary>
35+
public static string PushSync { get; } = AdvancedSharpAdbClient.AdbServerFeatures.PushSync;
36+
}
37+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// <copyright file="DateTimeHelper.cs" company="The Android Open Source Project, Ryan Conrad, Quamotion, yungd1plomat, wherewhere">
2+
// Copyright (c) The Android Open Source Project, Ryan Conrad, Quamotion, yungd1plomat, wherewhere. All rights reserved.
3+
// </copyright>
4+
5+
using System;
6+
7+
namespace AdvancedSharpAdbClient.WinRT
8+
{
9+
/// <summary>
10+
/// Provides helper methods for working with Unix-based date formats.
11+
/// </summary>
12+
public static class DateTimeHelper
13+
{
14+
/// <summary>
15+
/// Gets EPOCH time.
16+
/// </summary>
17+
public static DateTimeOffset Epoch { get; } = AdvancedSharpAdbClient.DateTimeHelper.Epoch;
18+
19+
/// <summary>
20+
/// Converts a <see cref="DateTimeOffset"/> to the Unix equivalent.
21+
/// </summary>
22+
/// <param name="date">The date to convert to the Unix format.</param>
23+
/// <returns>A <see cref="long"/> that represents the date, in Unix format.</returns>
24+
public static long ToUnixEpoch(this DateTimeOffset date) => AdvancedSharpAdbClient.DateTimeHelper.ToUnixEpoch(date.DateTime);
25+
26+
/// <summary>
27+
/// Converts a Unix equivalent to the <see cref="DateTimeOffset"/>.
28+
/// </summary>
29+
/// <param name="time">The Unix equivalent to convert to the date.</param>
30+
/// <returns>A <see cref="DateTimeOffset"/> that represents the date.</returns>
31+
public static DateTimeOffset ToDateTime(this long time) => AdvancedSharpAdbClient.DateTimeHelper.ToDateTime(time);
32+
}
33+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// <copyright file="SyncCommandConverter.cs" company="The Android Open Source Project, Ryan Conrad, Quamotion, yungd1plomat, wherewhere">
2+
// Copyright (c) The Android Open Source Project, Ryan Conrad, Quamotion, yungd1plomat, wherewhere. All rights reserved.
3+
// </copyright>
4+
5+
using System.Runtime.InteropServices.WindowsRuntime;
6+
7+
namespace AdvancedSharpAdbClient.WinRT
8+
{
9+
/// <summary>
10+
/// Converts <see cref="SyncCommand"/> values to their binary representation and vice versa.
11+
/// </summary>
12+
public static class SyncCommandConverter
13+
{
14+
/// <summary>
15+
/// Gets the byte array that represents the <see cref="SyncCommand"/>.
16+
/// </summary>
17+
/// <param name="command">The <see cref="SyncCommand"/> to convert.</param>
18+
/// <returns>A byte array that represents the <see cref="SyncCommand"/>.</returns>
19+
public static byte[] GetBytes(SyncCommand command) => AdvancedSharpAdbClient.SyncCommandConverter.GetBytes((AdvancedSharpAdbClient.SyncCommand)command);
20+
21+
/// <summary>
22+
/// Determines which <see cref="SyncCommand"/> is represented by this byte array.
23+
/// </summary>
24+
/// <param name="_value">A byte array that represents a <see cref="SyncCommand"/>.</param>
25+
/// <returns>The corresponding <see cref="SyncCommand"/>.</returns>
26+
public static SyncCommand GetCommand([ReadOnlyArray] byte[] _value) => (SyncCommand)AdvancedSharpAdbClient.SyncCommandConverter.GetCommand(_value);
27+
}
28+
}

0 commit comments

Comments
 (0)