ToObject() 공개 정적인 메소드

public static ToObject ( string json ) : JsonData
json string
리턴 JsonData
 public JsonPlayerLoader(Uri uri)
 {
     JsonMapper jsonMapper = new JsonMapper();
     jsonMapper.RegisterImporter<JsonReader, KeyControl>(deserializeKeyControl);
     Stream jsonStream = Application.GetContentStream(uri).Stream;
     string jsonStr = new StreamReader(jsonStream, Encoding.UTF8).ReadToEnd();
     this.dummyPlayer = jsonMapper.ToObject<DummyPlayer>(jsonStr);
 }
 public JsonKeyControlLoader(JsonReader reader)
 {
     dummyKeyControl = new DummyKeyControl();
     JsonMapper jsonMapper = new JsonMapper();
     while (reader.Read())
     {
         if (reader.Token == JsonToken.ObjectEnd)
         {
             break;
         }
         if (reader.Token == JsonToken.PropertyName)
         {
             switch (reader.Value as string)
             {
                 case "walkKeyBinding":
                     dummyKeyControl.walkKeyBinding = jsonMapper.ToObject<Dictionary<string, string>>(reader);
                     break;
                 case "layBombKey":
                     dummyKeyControl.layBombKey = jsonMapper.ToObject<string>(reader);
                     break;
             }
         }
     }
 }
예제 #3
0
파일: Chat.cs 프로젝트: huokele/shadow-gun
    internal void ReceiveMessage(string channel, string json)
    {
        try
        {
            Chat.Message message = JsonMapper.ToObject <Chat.Message>(json);
            message.Text = SwearWords.Filter(message.Text, true);

            ForwardMessage(channel, channel, message);
            ForwardMessage(CHANNEL_ALL, channel, message);
        }
        catch
        {
            if (Debug.isDebugBuild == true)
            {
                Debug.LogWarning("Chat.ReceiveMessage() :: json of invalid format received!");
                Debug.LogWarning("  channel = " + channel);
                Debug.LogWarning("  json = " + json);
            }
        }
    }
 public TileMap parse()
 {
     JsonMapper jsonMapper = new JsonMapper();
     Stream jsonStream = Application.GetContentStream(uri).Stream;
     string jsonStr = new StreamReader(jsonStream, Encoding.UTF8).ReadToEnd();
     return jsonMapper.ToObject<TileMap>(jsonStr);
 }
예제 #5
0
    public List<newNote> getNotesJson(string MusicName){
        JsonMapper JsonMapper = new JsonMapper();
        path = Application.persistentDataPath + "/Notes/" ;
        outjson = new OutJson();
        fi = new FileInfo(path +MusicName + ".json");
        try {
			using (StreamReader sr = new StreamReader(fi.OpenRead(), Encoding.UTF8)){
				jsontext = sr.ReadToEnd();
			}
		} catch (Exception e){
			Debug.Log("NotFound Notes-Json File");
            Debug.Log("Error:"+e);
		}
        notes = JsonMapper.ToObject<List<newNote>>(jsontext);
        return notes; 
    }
예제 #6
0
 public static T Deserialize <T>(Stream stream)
 {
     using (var s = new StreamReader(stream))
         return(JsonMapper.ToObject <T>(s.ReadToEnd()));
 }