This repository has been archived by the owner on Dec 26, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
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
8481cb6
commit bfa49b5
Showing
9 changed files
with
166 additions
and
47 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
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
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,36 @@ | ||
namespace FSMosquitoClient.Helpers | ||
{ | ||
using Newtonsoft.Json; | ||
using Newtonsoft.Json.Linq; | ||
using System; | ||
using System.IO; | ||
|
||
public static class SettingsHelpers | ||
{ | ||
public static bool AddOrUpdateAppSetting<T>(string sectionPathKey, T value) | ||
{ | ||
try | ||
{ | ||
var filePath = Path.Combine(AppContext.BaseDirectory, "appsettings.json"); | ||
var json = File.ReadAllText(filePath); | ||
var obj = JObject.Parse(json); | ||
|
||
var token = obj.SelectToken(sectionPathKey); | ||
if (token == null) | ||
{ | ||
return false; | ||
} | ||
token.Replace(JToken.FromObject(value)); | ||
|
||
var output = obj.ToString(Formatting.Indented); | ||
File.WriteAllText(filePath, output); | ||
return true; | ||
} | ||
catch (Exception ex) | ||
{ | ||
Console.WriteLine("Error writing app settings | {0}", ex.Message); | ||
} | ||
return false; | ||
} | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
namespace FSMosquitoClient | ||
{ | ||
using Newtonsoft.Json; | ||
|
||
class SetSimConnectVarRequest | ||
{ | ||
[JsonProperty("objectId")] | ||
public uint? ObjectId | ||
{ | ||
get; | ||
set; | ||
} | ||
|
||
[JsonProperty("value")] | ||
public object Value | ||
{ | ||
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