-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding installation path as part of parsing process (#15)
- Loading branch information
Showing
4 changed files
with
49 additions
and
22 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,15 @@ | ||
using System; | ||
|
||
namespace OculusLibrary | ||
{ | ||
[Serializable] | ||
public class ManifestParseException : Exception | ||
{ | ||
public ManifestParseException() { } | ||
public ManifestParseException(string message) : base(message) { } | ||
public ManifestParseException(string message, Exception inner) : base(message, inner) { } | ||
protected ManifestParseException( | ||
System.Runtime.Serialization.SerializationInfo info, | ||
System.Runtime.Serialization.StreamingContext context) : base(info, context) { } | ||
} | ||
} |
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
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
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 |
---|---|---|
@@ -1,10 +1,32 @@ | ||
namespace OculusLibrary | ||
using Newtonsoft.Json; | ||
using System; | ||
|
||
namespace OculusLibrary | ||
{ | ||
internal class OculusManifest | ||
{ | ||
public string AppId { get; set; } | ||
public string LaunchFile { get; set; } | ||
public string LaunchParameters { get; set; } | ||
public string CanonicalName { get; set; } | ||
|
||
public static OculusManifest Parse(string json) | ||
{ | ||
if (string.IsNullOrWhiteSpace(json)) | ||
{ | ||
throw new ArgumentException("JSON string cannot be null and empty"); | ||
} | ||
|
||
var manifest = JsonConvert.DeserializeObject<OculusManifest>(json); | ||
|
||
if (manifest == null) | ||
{ | ||
throw new ManifestParseException("Could not deserialise json"); | ||
} | ||
|
||
manifest.LaunchFile = manifest?.LaunchFile?.Replace("/", @"\"); | ||
|
||
return manifest; | ||
} | ||
} | ||
} |