示例#1
0
        private void ReadRecords(RecordInfo[] info, Stream stream)
        {
            StdfFileReader reader = null;

            try
            {
                reader = new StdfFileReader(stream);
                foreach (RecordInfo stdfInfo in info)
                {
                    reader.RegisterDelegate(stdfInfo.Type, stdfInfo.Subtype, delegate(object o, RecordReadEventArgs e)
                    {
                        StdfRecord record = e.Record;
                        Assert.AreEqual(stdfInfo.Type, record.Type);
                        Assert.AreEqual(stdfInfo.Subtype, record.Subtype);
                    });
                }
                reader.Read();
            }
            catch (StdfException e)
            {
                Console.WriteLine(e.StackTrace);
                Assert.Fail(e.Message);
            }
            finally
            {
                if (reader != null)
                {
                    reader.Dispose();
                }
            }
        }
示例#2
0
        private void ReadRecords(List <Type> records, Stream stream)
        {
            StdfFileReader reader = null;

            try
            {
                reader = new StdfFileReader(stream);
                foreach (Type recordType in records)
                {
                    StdfRecord record = reader.ReadRecord();
                    Assert.IsInstanceOf(recordType, record);
                }
            }
            catch (StdfException e)
            {
                Console.WriteLine(e.StackTrace);
                Assert.Fail(e.Message);
            }
            finally
            {
                if (reader != null)
                {
                    reader.Dispose();
                }
            }
        }
示例#3
0
 public void OpenFileSeveralTimesDisposingReader()
 {
     for (int i = 0; i < 100; i++)
     {
         StdfFileReader reader = file.OpenForRead();
         reader.Dispose();
     }
 }
示例#4
0
 public void Finish()
 {
     if (reader != null)
     {
         reader.Close();
         reader.Dispose();
     }
     if (writer != null)
     {
         writer.Close();
         writer.Dispose();
     }
     file = null;
 }