//public static SortedDictionary<string, SortedSet<string>> rtp=null; public static void DumpAppFile(string fil) { string s = SaveAndLoad.LoadText("..\\bin\\data\\" + fil); SaveAndLoad.SaveText(fil, s); }
public static Maps GetDoc(string inp, bool user = true) { Maps data = new Maps(); data.clear(); //var fileService = DependencyService.Get<ISaveAndLoad>(); if (!SaveAndLoad.FileExists(inp + ".txt")) { return(data); } string st = SaveAndLoad.LoadText(inp + ".txt"); if (user && SaveAndLoad.FileExists(inp + "_user.txt")) { st += "\n" + SaveAndLoad.LoadText(inp + "_user.txt"); } byte[] byteArray = Encoding.UTF8.GetBytes(st); //byte[] byteArray = Encoding.ASCII.GetBytes(contents); MemoryStream stream = new MemoryStream(byteArray); StreamReader str = new StreamReader(stream); string s; while (true) { s = str.ReadLine(); if (s == null) { break; } List <string> a = new List <string> { "" }; string b = "", d = ""; int l = s.Length; bool tag = false, star = false, dis = false; for (int i = 0; i < l; i++) { if (tag) { b += s[i]; } else if (s[i] == '$') { dis = true; } else if (s[i] == '*') { star = true; } else if (star && s[i] == ' ') { d += ' '; } else if (s[i] == ',') { tag = true; } else if (s[i] == '/') { a.Add(""); } else { a[a.Count - 1] += s[i]; d += s[i]; } } foreach (var c in a) { if (c.Trim() == "") { continue; } if (dis) { data.remove(c); continue; } data.add(c, b); if (star) { data.add_ok(c, d); } } } if (user) { data.file_name = inp + "_user.txt"; } else { data.file_name = inp + ".txt"; } return(data); }
//public static SortedDictionary<string, SortedSet<string>> rtp=null; public static void DumpAppFile(string fil) { string s = SaveAndLoad.LoadText(fil); SaveAndLoad.SaveText(fil, s); }