示例#1
0
 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();
 }
示例#2
0
 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;
 }