public bool UpdateDataBank() { isExceptionUnhandled = false; int filesCounter = 0; if (isInputCsvFileAvailable()) { while (isInputCsvFileAvailable()) { if (TryUpdateSavedXml(PathToFilesUtil.GetNameInputCsvFile())) { PathToFilesUtil.MoveFileToArxiv(); filesCounter++; } } } else { PathToFilesUtil.CreateSskaFolderAndFile(); } if (filesCounter > 0) { MessageBox.Show("Update is completed. It was processed " + filesCounter + (filesCounter == 1 ? " file." : " files."), Config.AppName, MessageBoxButton.OK, MessageBoxImage.Information); } else { MessageBox.Show("File(s) to update not found.", Config.AppName); } return(filesCounter > 0); }
public CsvToXmlSSKA() { PathToStorageXmlFile = Config.PathToXmlStorageFolder + @"\" + Settings.Default.StorageFileName; try { if (File.Exists(PathToStorageXmlFile)) { DataSource = XElement.Load(PathToStorageXmlFile); } else { DataSource = XElement.Load(PathToFilesUtil.CreateSskaFolderAndFile()); MessageBox.Show("The data bank file is empty.", Config.AppName, MessageBoxButton.OK, MessageBoxImage.Information); } } catch (Exception e) { MessageBox.Show(e.Message, Config.AppName + ": Xml Storage File was not load!", MessageBoxButton.OK, MessageBoxImage.Error); } //finally //{ // DataSource = null; //} }