public static Dictionary <string, string> dnr(string path) { var json = Filer.readAllText(path); //Dictionary<string, string> rv = JsonConvert.SerializeObject() return(Newtonsoft.Json.JsonConvert.DeserializeObject <Dictionary <string, string> >(json)); }
//strings inside double quotes don't get parsed in this function public static List <string[]> csv2ListStringArray(string path) { string[] file = Filer.readAllLines(path); var l = new List <string[]>(); int i = 0; string line2; string[] line2arr; foreach (string line in file) { if (line.IndexOf("\"") == -1) { l.Add(line.Split(',')); } else { line2 = Stringer.removeCharFromInterval(line, ',', '^'); line2arr = line2.Split(','); for (i = 0; i < line2arr.Length; i++) { line2arr[i] = Stringer.removeCharFromInterval(line2arr[i], '^', ','); } l.Add(line2arr); } } return(l); }
// you have to use the same stretch of text // and if you want something else, just make a new class public XMLParty(string targetPath) { string s = Filer.readAllText(targetPath); XML = s; doc = new XmlDocument(); doc.LoadXml(XML); }