-
Notifications
You must be signed in to change notification settings - Fork 143
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17 from 2gis/feature/status-command
Add status command implementation
- Loading branch information
Showing
4 changed files
with
112 additions
and
0 deletions.
There are no files selected for viewing
24 changes: 24 additions & 0 deletions
24
src/Winium.Desktop.Driver/CommandExecutors/StatusExecutor.cs
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,24 @@ | ||
namespace Winium.Desktop.Driver.CommandExecutors | ||
{ | ||
#region using | ||
|
||
using System.Collections.Generic; | ||
|
||
using Winium.Desktop.Driver.CommandHelpers; | ||
using Winium.StoreApps.Common; | ||
|
||
#endregion | ||
|
||
internal class StatusExecutor : CommandExecutorBase | ||
{ | ||
#region Methods | ||
|
||
protected override string DoImpl() | ||
{ | ||
var response = new Dictionary<string, object> { { "build", new BuildInfo() }, { "os", new OSInfo() } }; | ||
return this.JsonResponse(ResponseStatus.Success, response); | ||
} | ||
|
||
#endregion | ||
} | ||
} |
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,32 @@ | ||
namespace Winium.Desktop.Driver.CommandHelpers | ||
{ | ||
#region using | ||
|
||
using System.Reflection; | ||
|
||
using Newtonsoft.Json; | ||
|
||
#endregion | ||
|
||
public class BuildInfo | ||
{ | ||
#region Static Fields | ||
|
||
private static string version; | ||
|
||
#endregion | ||
|
||
#region Public Properties | ||
|
||
[JsonProperty("version")] | ||
public string Version | ||
{ | ||
get | ||
{ | ||
return version ?? (version = Assembly.GetExecutingAssembly().GetName().Version.ToString()); | ||
} | ||
} | ||
|
||
#endregion | ||
} | ||
} |
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,53 @@ | ||
namespace Winium.Desktop.Driver.CommandHelpers | ||
{ | ||
#region using | ||
|
||
using System; | ||
|
||
using Newtonsoft.Json; | ||
|
||
#endregion | ||
|
||
// ReSharper disable once InconsistentNaming | ||
public class OSInfo | ||
{ | ||
#region Static Fields | ||
|
||
private static string architecture; | ||
|
||
private static string version; | ||
|
||
#endregion | ||
|
||
#region Public Properties | ||
|
||
[JsonProperty("arch")] | ||
public string Architecture | ||
{ | ||
get | ||
{ | ||
return architecture ?? (architecture = Environment.Is64BitOperatingSystem ? "x64" : "x86"); | ||
} | ||
} | ||
|
||
[JsonProperty("name")] | ||
public string Name | ||
{ | ||
get | ||
{ | ||
return "windows"; | ||
} | ||
} | ||
|
||
[JsonProperty("version")] | ||
public string Version | ||
{ | ||
get | ||
{ | ||
return version ?? (version = Environment.OSVersion.VersionString); | ||
} | ||
} | ||
|
||
#endregion | ||
} | ||
} |
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