Exemple #1
0
        public static void Main(string[] args)
        {
            XmlSerializer x = new XmlSerializer(typeof(Configuration));

              Configuration Cf;
              string xmlfile;
              string shefile;
              if (args.Length == 2)
              {
            if (Path.GetExtension(args[0]).ToLower() == ".xml")
            {
              xmlfile = args[0];
              shefile = args[1];
            }
            else
            {
              xmlfile = args[1];
              shefile = args[0];
            }

            using (FileStream fs = new FileStream(xmlfile, System.IO.FileMode.Open))
              Cf = (Configuration)x.Deserialize(fs);

            Cf.SheFile = shefile;
              }
              else
            Cf = (Configuration)x.Deserialize(new FileStream(args[0], System.IO.FileMode.Open));

              Controller C = new Controller(Cf);
              C.Run();
        }
        public void RunTest()
        {
            XmlSerializer x = new XmlSerializer(typeof(Configuration));

              string xmlFileName = @"..\..\..\TestData\IrrigationConfiguration.xml";
              Configuration Cf;
            using (FileStream fs =new System.IO.FileStream(xmlFileName, System.IO.FileMode.Open))
              Cf = (Configuration)x.Deserialize(fs);

              Controller C = new Controller(Cf);

              C.Run();
        }