public void WriteTrain(string filename, Train train, BaseFormater formater) { Stream fs = new FileStream(filename, FileMode.Create); foreach (IFilter filter in filters) fs = filter.Apply(fs, FilterMode.Write); formater.WriteTrain(train, fs); fs.Close(); }
public Train ReadTrain(string filename, BaseFormater formater) { Stream fs = new FileStream(filename, FileMode.Open); foreach (IFilter filter in filters) fs = filter.Apply(fs, FilterMode.Read); Train train = formater.ReadTrain(fs); fs.Close(); return train; }