Beispiel #1
0
        private void Parse(string json)
        {
            container = Json.Deserialize <SaveItemsContainer>(json);

            linkedItems = new Dictionary <string, Dictionary <string, object> >();

            foreach (var linked in container.items)
            {
                if (linked == null || string.IsNullOrEmpty(linked.link) || linked.item == null)
                {
                    continue;
                }
                if (linkedItems.TryGetValue(linked.link, out Dictionary <string, object> dict) == false)
                {
                    dict = new Dictionary <string, object>();
                    linkedItems.Add(linked.link, dict);
                }
                string itemKey = linked.item.GetType().FullName;
                if (dict.ContainsKey(itemKey) == false)
                {
                    dict.Add(itemKey, linked.item);
                }
            }

            if (linkedItems.ContainsKey(NOT_LINKED) == false)
            {
                linkedItems.Add(NOT_LINKED, new Dictionary <string, object>());
            }

            notLinkedItems = linkedItems[NOT_LINKED];

            OnAfterLoad();
        }
Beispiel #2
0
 public long GetSaveTimestamp(string rawSave)
 {
     try
     {
         SaveItemsContainer c = Json.Deserialize <SaveItemsContainer>(Json.Decompress(rawSave));
         return(c.timestamp);
     }
     catch
     {
         return(0);
     }
 }