// Where registryPath like "Software\\DTN\\IQFeed\\Startup" public static MyRegistryKey OpenSubKey(string registryPath, bool createIfNotExist = false) { string filename = string.Format("REGISTRY.LocalMachine.{0}.json", registryPath.Replace('\\', '.')); string json = GFile.ReadTextFile(Folders.misc_path(filename), createIfNotExist); if (json == null) { return(null); } var dict = JsonConvert.DeserializeObject <Dictionary <string, string> >(json); return(new MyRegistryKey(dict)); }
// Read the ApiKey/ApiSecret credentials from the 'pathname' file public void ReadCredentials() { string json = GFile.ReadTextFile(Filename); ApiKeys.Clear(); if (json == null) { return; } var res = JsonConvert.DeserializeObject <Dictionary <string, string[]> >(json); foreach (var exch in res.Keys) { var li = res[exch]; ApiKeys.Add(exch, li[0], li[1]); } }