private static IEnumerable <KeyValuePair <string, string> > GetKvStoreValues() { List <KeyValuePair <string, string> > list = new List <KeyValuePair <string, string> >(); using (RegistryKey registryKey = BaseMixpanelEvent.GetRegistryKey("KVStore")) { if (registryKey != null) { string[] valueNames = registryKey.GetValueNames(); for (int i = 0; i < valueNames.Length; i++) { string text = valueNames[i]; string text2 = registryKey.GetValue(text).ToString(); KvStoreData kvStoreData = new KvStoreData(); if (kvStoreData.DeserializeObject(text2)) { if (kvStoreData.GetExpires() > DateTime.UtcNow) { list.Add(new KeyValuePair <string, string>(text, kvStoreData.get_value())); } } else { list.Add(new KeyValuePair <string, string>(text, text2)); } } } } return(list); }
public static string GetKvStoreAsJson() { ExpandoObject expandoObject = new ExpandoObject(); using (RegistryKey registryKey = BaseMixpanelEvent.GetRegistryKey("KVStore")) { if (registryKey != null) { string[] valueNames = registryKey.GetValueNames(); for (int i = 0; i < valueNames.Length; i++) { string text = valueNames[i]; string text2 = registryKey.GetValue(text).ToString(); KvStoreData kvStoreData = new KvStoreData(); if (kvStoreData.DeserializeObject(text2)) { if (kvStoreData.GetExpires() > DateTime.UtcNow) { ExpandoObject expandoObject2 = new ExpandoObject(); ExpandoExtensions.AddProperty(expandoObject2, "value", kvStoreData.get_value()); ExpandoExtensions.AddProperty(expandoObject2, "days", Convert.ToInt32((kvStoreData.GetExpires() - DateTime.UtcNow).TotalDays)); ExpandoExtensions.AddProperty(expandoObject, text, expandoObject2); } } else { ExpandoObject expandoObject3 = new ExpandoObject(); ExpandoExtensions.AddProperty(expandoObject3, "value", text2); ExpandoExtensions.AddProperty(expandoObject, text, expandoObject3); } } } } ExpandoObject expr_F1 = new ExpandoObject(); ExpandoExtensions.AddProperty(expr_F1, "superproperties", expandoObject); return(JsonConvert.SerializeObject(expr_F1)); }