Skip to content

Commit 6cf5b1e

Browse files
committed
Adds support for querying metaverse by object class only (#10)
1 parent 521b108 commit 6cf5b1e

File tree

2 files changed

+1083
-95
lines changed

2 files changed

+1083
-95
lines changed

src/Lithnet.Miiserver.Automation/Get-MVObject.cs

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,15 @@
77

88
namespace Lithnet.Miiserver.Automation
99
{
10-
[Cmdlet(VerbsCommon.Get, "MVObject", DefaultParameterSetName = "SearchByKey")]
10+
[Cmdlet(VerbsCommon.Get, "MVObject", DefaultParameterSetName = "SearchByObjectType")]
1111
public class GetMVObject : PSCmdlet
1212
{
1313
[ValidateNotNullOrEmpty]
1414
[Parameter(ValueFromPipeline = true, ParameterSetName = "Guid", Mandatory = true, Position = 1)]
1515
public Guid ID { get; set; }
1616

1717
[ValidateNotNullOrEmpty]
18+
[Parameter(ValueFromPipeline = false, ParameterSetName = "SearchByObjectType", Mandatory = true, Position = 1)]
1819
[Parameter(ValueFromPipeline = false, ParameterSetName = "SearchByQuery", Mandatory = false, Position = 1)]
1920
[Parameter(ValueFromPipeline = false, ParameterSetName = "SearchByKey", Mandatory = true, Position = 1)]
2021
public string ObjectType { get; set; }
@@ -45,6 +46,10 @@ protected override void EndProcessing()
4546
{
4647
this.GetByPipeLineQuery();
4748
}
49+
else if (this.ParameterSetName == "SearchByObjectType")
50+
{
51+
this.GetByObjectType();
52+
}
4853
}
4954

5055
protected override void ProcessRecord()
@@ -53,6 +58,10 @@ protected override void ProcessRecord()
5358
{
5459
this.GetByGuid();
5560
}
61+
else if (this.ParameterSetName == "SearchByObjectType")
62+
{
63+
this.GetByObjectType();
64+
}
5665
else if (this.ParameterSetName == "SearchByQuery")
5766
{
5867
if (this.Queries != null)
@@ -102,6 +111,14 @@ private void GetByKey()
102111
this.WriteObject(SyncServer.GetMVObjects(q), true);
103112
}
104113

114+
private void GetByObjectType()
115+
{
116+
MVQuery q = new MVQuery();
117+
q.ObjectType = this.GetObjectType();
118+
119+
this.WriteObject(SyncServer.GetMVObjects(q), true);
120+
}
121+
105122
private DsmlObjectClass GetObjectType()
106123
{
107124
if (this.ObjectType == null)

0 commit comments

Comments
 (0)