示例#1
0
        public void Deserialize()
        {
            // Test that each sample XML file can be deserialized.

            foreach (string filename in XmlFiles)
            {
                Waveform wave = Waveform.FromXMLFile(filename);
                Assert.IsNotNull(wave);
                Assert.IsNotNull(wave.Profile);
                Assert.IsNotNull(wave.Point);
                Assert.IsTrue(wave.Point.Length > 1);
            }
        }
示例#2
0
        /// <summary>Open a file.</summary>
        /// <param name="sender">The event sender.</param>
        /// <param name="e">The event arguments.</param>
        private void OpenFile_Click(object sender, EventArgs e)
        {
            OpenFileDialog dialog = new OpenFileDialog();

            dialog.DefaultExt = "xml";
            dialog.Filter     =
                "DSO Nano XML files (*.xml)|*.xml|All files (*.*)|*.*";
            dialog.Multiselect = true;
            if (dialog.ShowDialog() == DialogResult.OK)
            {
                foreach (string filename in dialog.FileNames)
                {
                    Waveform       newwave = Waveform.FromXMLFile(filename);
                    WaveformWindow ww      = new WaveformWindow(this, newwave);
                    ww.Show();
                }
            }
        }
示例#3
0
        /// <summary>
        /// The thread procedure to parallelize a serialization test on each
        /// sample XML file.
        /// </summary>
        /// <param name="parameter">The input XML file name.</param>
        public void SerializeThreadProc(object parameter)
        {
            string   filein = (string)parameter;
            FileInfo ininfo = new FileInfo(filein);
            Waveform wave   = Waveform.FromXMLFile(filein);

            foreach (WaveformFormat format in WaveformFormat.Formats)
            {
                if (format is RenderedFormat)
                {
                    continue;
                }
                string fileout = Path.Combine(
                    serializedDir, ininfo.Name + ".test." + format.Extension);
                format.Save(wave, fileout);
                Assert.IsTrue(File.Exists(fileout));
                FileInfo fileoutinfo = new FileInfo(fileout);
                Assert.IsTrue(fileoutinfo.Length > 0);
            }
        }