Ejemplo n.º 1
0
        public static TestScript Load(string filename)
        {
            TestScript retValue = null;

            XmlSerializer serializer = new XmlSerializer(typeof(TestScript));

            using (var reader = new StreamReader(filename))
            {
                retValue = (TestScript)serializer.Deserialize(reader);
            }

            return(retValue);
        }
Ejemplo n.º 2
0
        private void scriptButton_Click(object sender, EventArgs e)
        {
            var dialog = new OpenFileDialog()
            {
                AddExtension = true,
                DefaultExt   = "xml",
                Filter       = "Script Files (*.xml)|*.xml"
            };

            if (dialog.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    script = TestScript.Load(dialog.FileName);
                    script.Start();
                    scriptTimer.Enabled = true;
                }
                catch
                {
                }
            }
        }