private static void UpdateRegistry(string CacheId, DateTime Timestamp, int Size, string WalletName) { DataNode root; if (File.Exists(FilePath)) { root = DataFormats.LoadFromFile(FilePath); } else { root = DataNode.CreateObject(); } DataNode caches; if (root.HasNode("caches")) { caches = root.GetNode("caches"); } else { caches = root.AddNode(DataNode.CreateObject("caches")); } DataNode cacheNode; if (caches.HasNode(CacheId)) { cacheNode = caches.GetNode(CacheId); } else { cacheNode = caches.AddNode(DataNode.CreateObject(CacheId)); } if (cacheNode.HasNode("timestamp")) { cacheNode.GetNode("timestamp").Value = Timestamp.ToString(); } else { cacheNode.AddField("timestamp", Timestamp.ToString()); } if (cacheNode.HasNode("size")) { cacheNode.GetNode("size").Value = Size.ToString(); } else { cacheNode.AddField("size", Size.ToString()); } if (cacheNode.HasNode("wallet-name")) { cacheNode.GetNode("wallet-name").Value = WalletName; } else { if (!String.IsNullOrEmpty(WalletName)) { cacheNode.AddField("wallet-name", WalletName); } } DataFormats.SaveToFile(FilePath, root); }