public static MatchingSheet FromFile(string FileName) { StreamReader file; try { file = File.OpenText(FileName); } catch (FileNotFoundException) { return(null); } MatchingSheet sheet = FromFile(file, FileName); file.Close(); return(sheet); }
public static MatchingSheet Validate(MatchingSheet sheet) { StringWriter writer = new StringWriter(); bool b = sheet.Save(writer); writer.Close(); if (!b) { return(sheet); } StringReader reader = new StringReader(writer.GetStringBuilder().ToString()); MatchingSheet result = FromFile(reader); reader.Close(); return(result); }
public static string Normalize(string text) { StringReader reader = new StringReader(text); MatchingSheet sheet = FromFile(reader); reader.Close(); StringWriter writer = new StringWriter(); writer.NewLine = GetNewLine(text, writer.NewLine); bool b = sheet.Save(writer); writer.Close(); if (!b) { return(""); } return(writer.GetStringBuilder().ToString()); }