コード例 #1
0
 public IDictionary <string, object> getDocument()
 {
     if (inner != null && parser.Parse(inner.getContents()))
     {
         return(parser.AsDictionary());
     }
     return(null);
 }
コード例 #2
0
 private void loadPinsetConfiguration(string name, IJSONParser parser)
 {
     content     = Resources.Load(name) as TextAsset;
     pinningInfo = new Dictionary <string, IList <IPinningInfo> >();
     hostInfo    = new Dictionary <string, IHostInfo>();
     try
     {
         if (!parser.Parse(content.text))
         {
             return;
         }
         IDictionary <string, object> dictionary  = parser.AsDictionary();
         IDictionary <string, object> dictionary2 = (IDictionary <string, object>)dictionary["pinset"];
         if (dictionary2 != null)
         {
             foreach (KeyValuePair <string, object> item in dictionary2)
             {
                 string key = item.Key;
                 IList <IPinningInfo> list = new List <IPinningInfo>();
                 pinningInfo[key] = list;
                 IEnumerable enumerable = (IEnumerable)item.Value;
                 foreach (object item2 in enumerable)
                 {
                     list.Add(new PinningInfo((IDictionary <string, object>)item2));
                     Debug.Log("Added " + key + " : " + item2.ToString() + " to pinset");
                 }
             }
         }
         IDictionary <string, object> dictionary3 = (IDictionary <string, object>)dictionary["hosts"];
         if (dictionary3 == null)
         {
             return;
         }
         foreach (KeyValuePair <string, object> item3 in dictionary3)
         {
             string key = item3.Key;
             hostInfo[key] = new HostInfo((IDictionary <string, object>)item3.Value);
         }
     }
     catch (Exception ex)
     {
         Debug.LogError("Unable to parse pinset." + ex.Message);
         Debug.LogException(ex);
     }
 }