private void AddRuleToFile(Rule rule) { if (!TestFile.Exists) { using (StreamWriter streamWriter = TestFile.AppendText()) { streamWriter.WriteLine("if/" + rule.IfText + "/then/" + rule.ThenText); } } }
private void AddRulesData(string line, List<Rule> rules) { string[] splitingText = line.Split('/'); Rule rule = new Rule(splitingText[1], splitingText[3], type); rules.Add(rule); }
public void AddRule(Rule rule) { if (rules == null) { rules = new List<Rule>(); if (!TestFile.Exists) { using (StreamWriter streamWriter = TestFile.AppendText()) { streamWriter.WriteLine("Rules:"); } } } rules.Add(rule); AddRuleToFile(rule); }