I'm collecting scoreboard stats into a datafile using nested data (see below) so I can throw it into our leaderboard database on an external website, I'll admit my C# is a little rusty, but is there a way I can convert the whole DynamicConfigFile into a string to be used as part of the POST web request? do I have to loop through the datafile to recreate?
Thanks For Reading.
Datafile:
{
"steamID": {
"heavyscientist": 1,
"scientist": 4
}
}
GetDatafile to string for POST
just grabbed the file via http://ftp.. probably easier on the server if the website is doing all of the pull and processing.
DynamicConfigFile.ReadObject<string>() legend, thanks..
Merged post
oh.. I can't get that to work at all.
Merged post
string storedData = Interface.Oxide.DataFileSystem.ReadObject<string>("TPTVLB");
gives
(JsonReaderException: Unexpected character encountered while parsing value: {. Path '', line 1, position 1.)
at Newtonsoft.Json.JsonTextReader.ReadStringValue (Newtonsoft.Json.ReadType readType) [0x00366] in <2ae3f091decd4989b3c4d466e6eb5985>:0
at Newtonsoft.Json.JsonTextReader.ReadAsString () [0x00000] in <2ae3f091decd4989b3c4d466e6eb5985>:0
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.ReadForType (Newtonsoft.Json.JsonReader reader, Newtonsoft.Json.Serialization.JsonContract contract, System.Boolean hasConverter) [0x00077] in <2ae3f091decd4989b3c4d466e6eb5985>:0
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize (Newtonsoft.Json.JsonReader reader, System.Type objectType, System.Boolean checkAdditionalContent) [0x000d9] in <2ae3f091decd4989b3c4d466e6eb5985>:0
at Newtonsoft.Json.JsonSerializer.DeserializeInternal (Newtonsoft.Json.JsonReader reader, System.Type objectType) [0x00053] in <2ae3f091decd4989b3c4d466e6eb5985>:0
at Newtonsoft.Json.JsonSerializer.Deserialize (Newtonsoft.Json.JsonReader reader, System.Type objectType) [0x00000] in <2ae3f091decd4989b3c4d466e6eb5985>:0
at Newtonsoft.Json.JsonConvert.DeserializeObject (System.String value, System.Type type, Newtonsoft.Json.JsonSerializerSettings settings) [0x0002d] in <2ae3f091decd4989b3c4d466e6eb5985>:0
at Newtonsoft.Json.JsonConvert.DeserializeObject[T] (System.String value, Newtonsoft.Json.JsonSerializerSettings settings) [0x00000] in <2ae3f091decd4989b3c4d466e6eb5985>:0
at Oxide.Core.Configuration.DynamicConfigFile.ReadObject[T] (System.String filename) [0x00028] in <9882f28dc2204b4dba514a9ad18f5042>:0
at Oxide.Core.DataFileSystem.ReadObject[T] (System.String name) [0x00021] in <9882f28dc2204b4dba514a9ad18f5042>:0
at Oxide.Plugins.TPTVScoreboard.sendStatsCommand () [0x00016] in <4954eb14cabe441e81e387f20cec9553>:0
at Oxide.Plugins.TPTVScoreboard.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x0027a] in <4954eb14cabe441e81e387f20cec9553>:0
at Oxide.Plugins.CSharpPlugin.InvokeMethod (Oxide.Core.Plugins.HookMethod method, System.Object[] args) [0x00079] in <60c318df79ed41688ea59335e48d61ad>:0
at Oxide.Core.Plugins.CSPlugin.OnCallHook (System.String name, System.Object[] args) [0x000d8] in <9882f28dc2204b4dba514a9ad18f5042>:0
at Oxide.Core.Plugins.Plugin.CallHook (System.String hook, System.Object[] args) [0x00060] in <9882f28dc2204b4dba514a9ad18f5042>:0
Merged post
string storedData = scoreboardFile.ReadObject<string>("TPTVLB");
gives
[Oxide] 10:14 [Error] Failed to call hook 'sendStatsCommand' on plugin 'TPTVScoreboard v0.5.0' (Exception: Only access to oxide directory!
Path: C:\TCAFiles\Users\xyz\17778\TPTVLB)
at Oxide.Core.Configuration.DynamicConfigFile.CheckPath (System.String filename) [0x00029] in <9882f28dc2204b4dba514a9ad18f5042>:0
at Oxide.Core.Configuration.DynamicConfigFile.ReadObject[T] (System.String filename) [0x0000c] in <9882f28dc2204b4dba514a9ad18f5042>:0
at Oxide.Plugins.TPTVScoreboard.sendStatsCommand () [0x0000c] in <a4b3f0df74884a4e82fb67554f1d7214>:0
at Oxide.Plugins.TPTVScoreboard.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x0027a] in <a4b3f0df74884a4e82fb67554f1d7214>:0
at Oxide.Plugins.CSharpPlugin.InvokeMethod (Oxide.Core.Plugins.HookMethod method, System.Object[] args) [0x00079] in <60c318df79ed41688ea59335e48d61ad>:0
at Oxide.Core.Plugins.CSPlugin.OnCallHook (System.String name, System.Object[] args) [0x000d8] in <9882f28dc2204b4dba514a9ad18f5042>:0
at Oxide.Core.Plugins.Plugin.CallHook (System.String hook, System.Object[] args) [0x00060] in <9882f28dc2204b4dba514a9ad18f5042>:0