Exemplo n.º 1
0
 public void Save(string path)
 {
     this.path = path;
     if (Directory.Exists(path))
     {
         string    filename = path + @"\" + this.station + ".xml";
         XDocument doc;
         try
         {
             doc = new XDocument(
                 new XDeclaration("1.0", "utf-8", "yes"),
                 new XElement(informationTag,
                              new XElement(ipTag, GetIP()),
                              new XElement(computerNameTag, this.station),
                              new XElement(lastUpdate, DateTime.Now),
                              new XElement(versionTag, GetVersion()),
                              new XElement(typeTag, GetType()),
                              new XElement(serialNumberTag, Agilent.GetSN())
                              )
                 );
             doc.Save(filename);
         }
         catch
         {
             Console.Write("Error");
         }
     }
 }