/// <summary> /// Copy file and take local path into consideration /// </summary> /// <param name="file"></param> /// <param name="target"></param> private void CopyEmbeddedFile(string file, string target) { string fileName = HoUtil.GetFilePath("Linked File", file); if (IsFileToProcess(fileName)) { DirFiles.FileCopy(fileName, target); } }
/// <summary> /// Export all jobs of the current list number with the respectively defined settings. Only changed tagged values are exported/updated. /// </summary> /// <param name="listNumber"></param> /// <returns></returns> public bool RoundtripBySetting(int listNumber) { bool result = true; _level = -1; _count = 0; _countAll = 0; _countPkg = 0; _countItems = 0; foreach (FileImportSettingsItem item in _importSettings) { if (Convert.ToInt32(item.ListNo) == listNumber) { // Copy input file to export file if (!DirFiles.FileCopy(item.InputFile, item.ExportFile)) { return(false); } _importModuleFile = item.ExportFile; if (!System.IO.File.Exists(_importModuleFile)) { MessageBox.Show($@"File: '{_importModuleFile}'", @"Import files doesn't exists, break"); return(false); } // check if there are columns to update if (item.WriteAttrNameList.Count == 0) { var attributesToVisualize = String.Join(", ", item.WriteAttrNameList.ToArray()); MessageBox.Show($@"Roundtrip needs Attributes to write in Settings ('WriteAttrNameList' is empty): File: '{_importModuleFile}' Attributes to write ('{nameof(item.WriteAttrNameList)}'): '{attributesToVisualize}' ", @"No Attributes to write in 'Setting.json' defined"); return(false); } // handle more than one package // handle zip files like foreach (var itemGuidList in item.PackageGuidList) { string guid = itemGuidList.Guid; _pkg = _rep.GetPackageByGuid(guid); if (_pkg == null) { MessageBox.Show( $@"Package of export list {listNumber} with GUID='{guid}' not available. {item.Description} {item.Name} Check Import settings in Settings.Json.", @"Package to import into isn't available, break!"); return(false); } switch (item.ImportType) { case FileImportSettingsItem.ImportTypes.DoorsReqIf: case FileImportSettingsItem.ImportTypes.ReqIf: var reqIfRoundtrip = new ReqIfs.ReqIfRoundtrip(_rep, _pkg, _importModuleFile, item); result = result && reqIfRoundtrip.RoundtripForFile(); //await Task.Run(() => // doorsReqIf.ImportForFile(eaObjectType, eaStereotype, eaStatusNew, eaStatusChanged)); break; } } } } return(true); }