Exemple #1
0
 /// <summary>
 /// Raw() - read elements from Raw.xml or re-write it, if necessary 
 ///<para>
 ///re-write reasons could be: Raw.xml not exists, or error found in ModelINFO
 ///</para>
 /// </summary>
 /// <returns>updated list of elements in file and in memory</returns>
 public List<Elm> Raw(Mod mod)
 {
     const string me = "SavedReport__Raw_";
     Log.set("SR.Raw(" + mod.name + ")");
     model = mod;
     List<Elm> elms = new List<Elm>();
     if (!FileOp.isDirExist(model.dir)) Msg.F(me + "No model dir", model.dir);
     string file = Path.Combine(model.dir, Decl.RAWXML);
     if(FileOp.isFileExist(file))
     {                               // Read Raw.xml
         elms = rwXML.XML.ReadFromXmlFile<List<Elm>>(file);
         model.date = File.GetLastWriteTime(file);
     }
     else
     {                               // get from CAD and Write or re-Write Raw.xml 
         Msg.AskFOK(me + "CAD Read");
         model.Read();
         rwXML.XML.WriteToXmlFile(file, model.elements);
         elms = model.elements;
     }
     model.MD5 = model.getMD5(elms);
     log.Info("Raw.xml: { elmCount, MD5} ==" + elms.Count + ", " + model.MD5);
     Log.exit();
     return elms;
 }
 private void OnTeklaRead_button_click(object sender, RoutedEventArgs e)
 {
     MessageBox.Show("Читать?", "TSmatch", MessageBoxButton.OK);
     model.Read();
     model.isChanged = true;
 }