本文整理汇总了C#中JsonReader.Deserialize方法的典型用法代码示例。如果您正苦于以下问题:C# JsonReader.Deserialize方法的具体用法?C# JsonReader.Deserialize怎么用?C# JsonReader.Deserialize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JsonReader
的用法示例。
在下文中一共展示了JsonReader.Deserialize方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ping
public void ping(string input)
{
JsonReader reader = new JsonReader(input);
ping_class info = reader.Deserialize<ping_class>();
if(info.maintenance_mode) {
mainenance_mode();
return;
}
Client.form_Login.last_ping_time = DateTime.Now;
}
示例2: DeserializeMeta
private GraphMeta DeserializeMeta(ZipEntry entry)
{
string s = GetString (entry);
JsonReader reader = new JsonReader(s,readerSettings);
return (GraphMeta)reader.Deserialize(typeof(GraphMeta));
//JsonConvert.DeserializeObject<GraphMeta>(s,settings);
}
示例3: DeserializeUserConnections
/** Deserializes manually created connections.
* Connections are created in the A* inspector.
* \note Stored in a file named "connections.json".
*/
public UserConnection[] DeserializeUserConnections()
{
ZipEntry entry = zip["connections"+jsonExt];
if (entry == null) return new UserConnection[0];
string entryText = GetString (entry);
JsonReader reader = new JsonReader(entryText,readerSettings);
UserConnection[] conns = (UserConnection[])reader.Deserialize(typeof(UserConnection[]));
return conns;
}
示例4: DeserializeMeta
private GraphMeta DeserializeMeta (ZipEntry entry) {
if ( entry == null ) throw new Exception ("No metadata found in serialized data.");
#if !ASTAR_NO_JSON
string s = GetString (entry);
var reader = new JsonReader(s,readerSettings);
return (GraphMeta)reader.Deserialize(typeof(GraphMeta));
#else
var meta = new GraphMeta();
var mem = new System.IO.MemoryStream();
entry.Extract (mem);
mem.Position = 0;
var reader = new System.IO.BinaryReader(mem);
if ( reader.ReadString() != "A*" ) throw new System.Exception ("Invalid magic number in saved data");
int major = reader.ReadInt32 ();
int minor = reader.ReadInt32 ();
int build = reader.ReadInt32 ();
int revision = reader.ReadInt32 ();
// Required because when saving a version with a field not set, it will save it as -1
// and then the Version constructor will throw an exception (which we do not want)
if ( major < 0 ) meta.version = new Version (0, 0);
else if ( minor < 0 ) meta.version = new Version (major, 0);
else if ( build < 0 ) meta.version = new Version (major, minor);
else if ( revision < 0 ) meta.version = new Version (major, minor, build);
else meta.version = new Version (major, minor, build, revision);
meta.graphs = reader.ReadInt32 ();
meta.guids = new string[reader.ReadInt32()];
for ( int i = 0; i < meta.guids.Length; i++ ) meta.guids[i] = reader.ReadString();
meta.typeNames = new string[reader.ReadInt32()];
for ( int i = 0; i < meta.typeNames.Length; i++ ) meta.typeNames[i] = reader.ReadString();
meta.nodeCounts = new int[reader.ReadInt32()];
for ( int i = 0; i < meta.nodeCounts.Length; i++ ) meta.nodeCounts[i] = reader.ReadInt32();
return meta;
#endif
}
示例5: DeserializeMeta
private GraphMeta DeserializeMeta (ZipEntry entry) {
if ( entry == null ) throw new System.Exception ("No metadata found in serialized data.");
string s = GetString (entry);
JsonReader reader = new JsonReader(s,readerSettings);
return (GraphMeta)reader.Deserialize(typeof(GraphMeta));
//JsonConvert.DeserializeObject<GraphMeta>(s,settings);
}
示例6: DeserializeUserConnections
/** Deserializes manually created connections.
* Connections are created in the A* inspector.
* \note Stored in a file named "connections.json".
*/
public UserConnection[] DeserializeUserConnections () {
#if !ASTAR_NO_JSON
var entry = zip["connections"+jsonExt];
if (entry == null) return new UserConnection[0];
var entryText = GetString (entry);
var reader = new JsonReader(entryText,readerSettings);
var conns = (UserConnection[])reader.Deserialize(typeof(UserConnection[]));
return conns;
#else
return new UserConnection[0];
#endif
}
示例7: upload_successful
private void upload_successful()
{
_lblStatus.Visible = false;
_barProgress.Visible = false;
_picPreview.BackgroundImage = Properties.Resources.icon_24_em_check;
file_info.status = DC_FileInformationStatus.Uploaded;
JsonReader jr = new JsonReader(upload_response.body);
DC_FileInformation info = jr.Deserialize<DC_FileInformation>();
file_info.url_id = info.url_id;
file_info.url = connector.server_info.upload_base_url + info.url_id;
// Automatically copy the URL to clipboard if the user so desires.
if(Client.config.get<bool>("frmquickupload.copy_upload_clipboard")) {
Clipboard.SetText(file_info.url, TextDataFormat.UnicodeText);
}
}
示例8: DeserializeMeta
private GraphMeta DeserializeMeta (ZipEntry entry) {
if ( entry == null ) throw new System.Exception ("No metadata found in serialized data.");
#if !ASTAR_NO_JSON
string s = GetString (entry);
JsonReader reader = new JsonReader(s,readerSettings);
return (GraphMeta)reader.Deserialize(typeof(GraphMeta));
//JsonConvert.DeserializeObject<GraphMeta>(s,settings);
#else
var meta = new GraphMeta();
var mem = new System.IO.MemoryStream();
entry.Extract (mem);
mem.Position = 0;
var reader = new System.IO.BinaryReader(mem);
if ( reader.ReadString() != "A*" ) throw new System.Exception ("Invalid magic number in saved data");
meta.version = new Version (reader.ReadInt32 (),reader.ReadInt32 (),reader.ReadInt32 (),reader.ReadInt32 ());
meta.graphs = reader.ReadInt32 ();
meta.guids = new string[reader.ReadInt32()];
for ( int i = 0; i < meta.guids.Length; i++ ) meta.guids[i] = reader.ReadString();
meta.typeNames = new string[reader.ReadInt32()];
for ( int i = 0; i < meta.typeNames.Length; i++ ) meta.typeNames[i] = reader.ReadString();
meta.nodeCounts = new int[reader.ReadInt32()];
for ( int i = 0; i < meta.nodeCounts.Length; i++ ) meta.nodeCounts[i] = reader.ReadInt32();
return meta;
#endif
}