private void readCombos() { string[] lines = new string[0] { }; this.discoverylist.Clear(); try { string path = Settings.Instance.path; lines = System.IO.File.ReadAllLines(path + "_discovery.txt"); } catch { Helpfunctions.Instance.ErrorLog("cant find _discovery.txt (if you didn't create your own discovery file, ignore this message)"); return; } Helpfunctions.Instance.ErrorLog("read _discovery.txt..."); foreach (string line in lines) { string shortline = line.Replace(" ", ""); if (shortline.StartsWith("//")) continue; if (shortline.Length == 0) continue; try { discoveryitem d = new discoveryitem(line); this.discoverylist.Add(d); } catch { Helpfunctions.Instance.ErrorLog("discoverymaker cant read: " + line); } } Helpfunctions.Instance.ErrorLog(discoverylist.Count + " discovery rules found"); }
private void readCombos() { string[] lines = new string[] { }; this.discoverylist.Clear(); string path = Settings.Instance.path; string cleanpath = "Silverfish" + System.IO.Path.DirectorySeparatorChar; string datapath = path + "Data" + System.IO.Path.DirectorySeparatorChar; string cleandatapath = cleanpath + "Data" + System.IO.Path.DirectorySeparatorChar; string classpath = datapath + ownClass + System.IO.Path.DirectorySeparatorChar; string cleanclasspath = cleandatapath + ownClass + System.IO.Path.DirectorySeparatorChar; string deckpath = classpath + deckName + System.IO.Path.DirectorySeparatorChar; string cleandeckpath = cleanclasspath + deckName + System.IO.Path.DirectorySeparatorChar; const string filestring = "_discovery.txt"; if (deckName != "" && System.IO.File.Exists(deckpath + filestring)) { path = deckpath; cleanPath = cleandeckpath + filestring; } else if (deckName != "" && System.IO.File.Exists(classpath + filestring)) { path = classpath; cleanPath = cleanclasspath + filestring; } else if (deckName != "" && System.IO.File.Exists(datapath + filestring)) { path = datapath; cleanPath = cleandatapath + filestring; } else if (System.IO.File.Exists(path + filestring)) { cleanPath = cleanpath + filestring; } else { Helpfunctions.Instance.ErrorLog("[Discovery] cant find base _discovery.txt, consider creating one"); return; } Helpfunctions.Instance.ErrorLog("[Discovery] read " + cleanPath); try { lines = System.IO.File.ReadAllLines(path + "_discovery.txt"); } catch { Helpfunctions.Instance.ErrorLog("_discovery.txt read error. Continuing without user-defined rules."); return; } foreach (string line in lines) { string shortline = line.Replace(" ", ""); if (shortline.StartsWith("//")) { continue; } if (shortline.Length == 0) { continue; } try { discoveryitem d = new discoveryitem(line); this.discoverylist.Add(d); } catch { Helpfunctions.Instance.ErrorLog("[Discovery] cant read line: " + line); } } Helpfunctions.Instance.ErrorLog("[Discovery] " + discoverylist.Count + " rules found"); }