public override ITreeViewItem AddSubFolder(Type typeOfFolder, string newFolderName, string newFolderPath) { try { RepositoryFolderBase repoFolder = (RepositoryFolderBase)(((ITreeViewItem)this).NodeObject()); repoFolder.AddSubFolder(newFolderName); return(null); } catch (Exception ex) { Reporter.ToLog(eLogLevel.ERROR, $"Method - {MethodBase.GetCurrentMethod().Name}, Error - {ex.Message}", ex); return(null); } }
public override ITreeViewItem AddSubFolder(Type typeOfFolder, string newFolderName, string newFolderPath) { try { object folderItem; RepositoryFolderBase repoFolder = (RepositoryFolderBase)(((ITreeViewItem)this).NodeObject()); object newFolder = repoFolder.AddSubFolder(newFolderName); //FIXME not good approuch try { folderItem = Activator.CreateInstance(this.GetType(), newFolder); } catch (Exception ex) { folderItem = Activator.CreateInstance(this.GetType(), BindingFlags.CreateInstance | BindingFlags.Public | BindingFlags.Instance | BindingFlags.OptionalParamBinding, null, new object[] { repoFolder }, CultureInfo.CurrentCulture); Reporter.ToLog(eLogLevel.ERROR, $"Method - {MethodBase.GetCurrentMethod().Name}, Error - {ex.Message}"); } if (folderItem == null) { return(null); } return((ITreeViewItem)folderItem); } catch (Exception ex) { Reporter.ToLog(eLogLevel.ERROR, $"Method - {MethodBase.GetCurrentMethod().Name}, Error - {ex.Message}"); return(null); } }
void AddRepositoryItem(GlobalSolutionItem itemToImport, RepositoryItemBase repoItemToImport, string targetFile) { //Get subdirectory path string path = Path.GetDirectoryName(targetFile); RepositoryFolderBase repoFolder = WorkSpace.Instance.SolutionRepository.GetRepositoryFolderByPath(path); if (repoFolder != null) { repoFolder.AddRepositoryItem(repoItemToImport); return; } string folderPath = string.Empty; RepositoryFolderBase rootFolder = null; RepositoryFolderBase subFolder = null; switch (itemToImport.ItemType) { case GlobalSolution.eImportItemType.Environments: rootFolder = WorkSpace.Instance.SolutionRepository.GetRepositoryItemRootFolder <ProjEnvironment>(); break; case GlobalSolution.eImportItemType.DataSources: rootFolder = WorkSpace.Instance.SolutionRepository.GetRepositoryItemRootFolder <DataSourceBase>(); break; case GlobalSolution.eImportItemType.BusinessFlows: rootFolder = WorkSpace.Instance.SolutionRepository.GetRepositoryItemRootFolder <BusinessFlow>(); break; case GlobalSolution.eImportItemType.SharedRepositoryActivities: rootFolder = WorkSpace.Instance.SolutionRepository.GetRepositoryItemRootFolder <Activity>(); break; case GlobalSolution.eImportItemType.SharedRepositoryActivitiesGroup: rootFolder = WorkSpace.Instance.SolutionRepository.GetRepositoryItemRootFolder <ActivitiesGroup>(); break; case GlobalSolution.eImportItemType.SharedRepositoryActions: rootFolder = WorkSpace.Instance.SolutionRepository.GetRepositoryItemRootFolder <Act>(); break; case GlobalSolution.eImportItemType.SharedRepositoryVariables: rootFolder = WorkSpace.Instance.SolutionRepository.GetRepositoryItemRootFolder <VariableBase>(); break; case GlobalSolution.eImportItemType.APIModels: rootFolder = WorkSpace.Instance.SolutionRepository.GetRepositoryItemRootFolder <ApplicationAPIModel>(); break; case GlobalSolution.eImportItemType.POMModels: rootFolder = WorkSpace.Instance.SolutionRepository.GetRepositoryItemRootFolder <ApplicationPOMModel>(); break; case GlobalSolution.eImportItemType.Agents: rootFolder = WorkSpace.Instance.SolutionRepository.GetRepositoryItemRootFolder <Agent>(); break; default: break; } folderPath = path.Replace(rootFolder.FolderFullPath + "\\", ""); subFolder = rootFolder.AddSubFolder(folderPath); subFolder.FolderRelativePath = rootFolder.FolderRelativePath + "\\" + folderPath; subFolder.AddRepositoryItem(repoItemToImport); }