Skip to content

Commit 7eff848

Browse files
committed
Merge pull request #17 from 2gis/feature/status-command
Add status command implementation
2 parents 5250c69 + c60b14f commit 7eff848

File tree

4 files changed

+112
-0
lines changed

4 files changed

+112
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
namespace Winium.Desktop.Driver.CommandExecutors
2+
{
3+
#region using
4+
5+
using System.Collections.Generic;
6+
7+
using Winium.Desktop.Driver.CommandHelpers;
8+
using Winium.StoreApps.Common;
9+
10+
#endregion
11+
12+
internal class StatusExecutor : CommandExecutorBase
13+
{
14+
#region Methods
15+
16+
protected override string DoImpl()
17+
{
18+
var response = new Dictionary<string, object> { { "build", new BuildInfo() }, { "os", new OSInfo() } };
19+
return this.JsonResponse(ResponseStatus.Success, response);
20+
}
21+
22+
#endregion
23+
}
24+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
namespace Winium.Desktop.Driver.CommandHelpers
2+
{
3+
#region using
4+
5+
using System.Reflection;
6+
7+
using Newtonsoft.Json;
8+
9+
#endregion
10+
11+
public class BuildInfo
12+
{
13+
#region Static Fields
14+
15+
private static string version;
16+
17+
#endregion
18+
19+
#region Public Properties
20+
21+
[JsonProperty("version")]
22+
public string Version
23+
{
24+
get
25+
{
26+
return version ?? (version = Assembly.GetExecutingAssembly().GetName().Version.ToString());
27+
}
28+
}
29+
30+
#endregion
31+
}
32+
}
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
namespace Winium.Desktop.Driver.CommandHelpers
2+
{
3+
#region using
4+
5+
using System;
6+
7+
using Newtonsoft.Json;
8+
9+
#endregion
10+
11+
// ReSharper disable once InconsistentNaming
12+
public class OSInfo
13+
{
14+
#region Static Fields
15+
16+
private static string architecture;
17+
18+
private static string version;
19+
20+
#endregion
21+
22+
#region Public Properties
23+
24+
[JsonProperty("arch")]
25+
public string Architecture
26+
{
27+
get
28+
{
29+
return architecture ?? (architecture = Environment.Is64BitOperatingSystem ? "x64" : "x86");
30+
}
31+
}
32+
33+
[JsonProperty("name")]
34+
public string Name
35+
{
36+
get
37+
{
38+
return "windows";
39+
}
40+
}
41+
42+
[JsonProperty("version")]
43+
public string Version
44+
{
45+
get
46+
{
47+
return version ?? (version = Environment.OSVersion.VersionString);
48+
}
49+
}
50+
51+
#endregion
52+
}
53+
}

‎src/Winium.Desktop.Driver/Winium.Desktop.Driver.csproj‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@
6464
<ItemGroup>
6565
<Compile Include="Automator\Automator.cs" />
6666
<Compile Include="Automator\Capabilities.cs" />
67+
<Compile Include="CommandExecutors\StatusExecutor.cs" />
6768
<Compile Include="CommandExecutors\SubmitElementExecutor.cs" />
6869
<Compile Include="CommandExecutors\ExecuteScriptExecutor.cs" />
6970
<Compile Include="CommandExecutors\ElementEqualsExecutor.cs" />
@@ -103,6 +104,8 @@
103104
<Compile Include="Program.cs" />
104105
<Compile Include="Properties\AssemblyInfo.cs" />
105106
<Compile Include="Requester.cs" />
107+
<Compile Include="CommandHelpers\OSInfo.cs" />
108+
<Compile Include="CommandHelpers\BuildInfo.cs" />
106109
<Compile Include="UriDispatchTables.cs" />
107110
</ItemGroup>
108111
<ItemGroup>

0 commit comments

Comments
 (0)