forked from thebookisclosed/ViVe
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9c921e2
commit 7f8bed0
Showing
5 changed files
with
122 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
using System.Collections.Generic; | ||
using System.Management.Automation; | ||
using Albacore.ViVe; | ||
using Albacore.ViVe.NativeStructs; | ||
using Albacore.ViVe.NativeEnums; | ||
using PsViveTool.Types; | ||
|
||
namespace PsViveTool.Commands | ||
{ | ||
[Cmdlet(VerbsCommon.Get, "ViveFeature")] | ||
[OutputType(typeof(ViveFeature))] | ||
public sealed class GetViveFeatureCommand : Cmdlet | ||
{ | ||
[Parameter()] | ||
public uint[] FeatureId { get; set; } | ||
|
||
[Parameter()] | ||
public RTL_FEATURE_CONFIGURATION_TYPE ConfigType { get; set; } = RTL_FEATURE_CONFIGURATION_TYPE.Runtime; | ||
|
||
protected override void EndProcessing() | ||
{ | ||
IList<RTL_FEATURE_CONFIGURATION> featuresToOutput; | ||
if (FeatureId.Length == 0) | ||
{ | ||
featuresToOutput = FeatureManager.QueryAllFeatureConfigurations(ConfigType); | ||
} | ||
else | ||
{ | ||
featuresToOutput = new List<RTL_FEATURE_CONFIGURATION>(FeatureId.Length); | ||
foreach (var id in FeatureId) | ||
{ | ||
var foundFeature = FeatureManager.QueryFeatureConfiguration(id, ConfigType); | ||
if (foundFeature != null) | ||
{ | ||
featuresToOutput.Add((RTL_FEATURE_CONFIGURATION)foundFeature); | ||
} | ||
} | ||
} | ||
|
||
foreach (var feature in featuresToOutput) | ||
{ | ||
WriteObject(new ViveFeature(feature)); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
using System.Collections.Generic; | ||
using System.Management.Automation; | ||
using Albacore.ViVe; | ||
using Albacore.ViVe.NativeStructs; | ||
using Albacore.ViVe.NativeEnums; | ||
using PsViveTool.Types; | ||
|
||
namespace PsViveTool.Commands | ||
{ | ||
[Cmdlet(VerbsCommon.Set, "ViveFeature")] | ||
public sealed class SetViveFeatureCommand : Cmdlet | ||
{ | ||
[Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, ParameterSetName = "SetByFeatureId")] | ||
public uint[] FeatureId { get; set; } | ||
|
||
[Parameter(Mandatory = true, ParameterSetName = "SetByFeatureName")] | ||
public string[] FeatureName { get; set; } | ||
|
||
[Parameter(Mandatory = true)] | ||
public RTL_FEATURE_ENABLED_STATE FeatureState { get; set; } | ||
|
||
protected override void EndProcessing() | ||
{ | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>netstandard2.0</TargetFramework> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="PowerShellStandard.Library" Version="5.1.1" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\ViVe\ViVe.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
using Albacore.ViVe.NativeEnums; | ||
using Albacore.ViVe.NativeStructs; | ||
|
||
namespace PsViveTool.Types | ||
{ | ||
internal class ViveFeature | ||
{ | ||
public ViveFeature(RTL_FEATURE_CONFIGURATION featureStruct) | ||
{ | ||
FeatureName = ""; | ||
FeatureId = featureStruct.FeatureId; | ||
Priority = featureStruct.Priority; | ||
State = featureStruct.EnabledState; | ||
Variant = featureStruct.Variant; | ||
PayloadKind = featureStruct.VariantPayloadKind; | ||
Payload = featureStruct.VariantPayload; | ||
} | ||
|
||
public string FeatureName { get; set; } | ||
public uint FeatureId { get; set; } | ||
public RTL_FEATURE_CONFIGURATION_PRIORITY Priority { get; set; } | ||
public RTL_FEATURE_ENABLED_STATE State { get; set; } | ||
public uint Variant { get; set; } | ||
public RTL_FEATURE_VARIANT_PAYLOAD_KIND PayloadKind { get; set; } | ||
public uint Payload { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters