/// <summary> /// Reads the content from the files and calls SetEntityContent to save the values. /// </summary> /// <param name="directoryOfFoldersList">List with the path to the folders</param> private void ReadFileContent(IEnumerable <string> directoryOfFoldersList) { var prefix = _resEdit.GetPrefix(); foreach (var filepath in directoryOfFoldersList) { //Analyzes the Filepath and checks if it contains the prefix selected in the Settings //Prepare the path to the files if (filepath.Substring(_workingDirectory.Length, prefix.Length) != prefix) { continue; } var projIniHandler = new IniHandler($@"{filepath}\project.ini"); var configIniHandler = new IniHandler($@"{filepath}\Config\config.ini"); //Get content from project.ini _tempProjectName = projIniHandler.IniReadValue("GENERAL", "PROJECTNAME"); _tempProjectId = projIniHandler.IniReadValue("GENERAL", "PROJECTID"); _tempProjectGuid = projIniHandler.IniReadValue("GENERAL", "PROJECTGUID"); _tempPwProject = projIniHandler.IniReadValue("ProjectWise", "PWProject"); _tempPwProjectGuid = projIniHandler.IniReadValue("ProjectWise", "PWProjectGUID"); //get content from config.ini _tempRootSpecsDir = configIniHandler.IniReadValue("System", "Root_Specs_Dir"); _tempRootModulesDir = configIniHandler.IniReadValue("System", "Root_Modules_Dir"); _tempModulesIniFile = configIniHandler.IniReadValue("System", "Modules_Ini_File"); //Search for wrong values and set the if (_tempRootSpecsDir != _correctRootSpecsDir || _tempRootModulesDir != _correctRootModulesDir || _tempModulesIniFile != _correctModulesIniFile) //MODULES INI FILE { _tempIsChecked = true; _incorrectFiles.Add($@"{filepath}\Config\config.ini"); //TODO check onenote for infos (Buhler AG → iniTool) } else { _tempIsChecked = false; } //Add content to _entityContent SetEntityContents(filepath, _tempIsChecked, _tempProjectName, _tempProjectId, _tempProjectGuid, _tempPwProject, _tempPwProjectGuid, _tempRootSpecsDir, _tempRootModulesDir, _tempModulesIniFile); } }
private void SetCorrectFiles(IEnumerable <string> fileArray, string dir) { var prefix = _resEdit.GetPrefix(); foreach (var filepath in fileArray) { if (filepath.Substring(dir.Length, prefix.Length) != prefix) { continue; } var projIniHandler = new IniHandler($@"{filepath}\project.ini"); var configIniHandler = new IniHandler($@"{filepath}\Config\config.ini"); //get content form project.ini _tempProjectName = projIniHandler.IniReadValue("GENERAL", "PROJECTNAME"); _tempProjectId = projIniHandler.IniReadValue("GENERAL", "PROJECTID"); _tempProjectGuid = projIniHandler.IniReadValue("GENERAL", "PROJECTGUID"); _tempPwProject = projIniHandler.IniReadValue("ProjectWise", "PWProject"); _tempPwProjectGuid = projIniHandler.IniReadValue("ProjectWise", "PWProjectGUID"); //get content from config.ini _tempRootSpecsDir = configIniHandler.IniReadValue("System", "Root_Specs_Dir"); _tempRootModulesDir = configIniHandler.IniReadValue("System", "Root_Modules_Dir"); _tempModulesIniFile = configIniHandler.IniReadValue("System", "Modules_Ini_File"); //Search for files if (_tempRootSpecsDir != _correctRootSpecsDir || _tempRootModulesDir != _correctRootModulesDir || _tempModulesIniFile != _correctModulesIniFile) //MODULES INI FILE { _tempIsChecked = true; _incorrectFiles.Add($@"{filepath}\Config\config.ini"); //TODO was here } else { _tempIsChecked = false; } //Add content to contentList SetContentList(filepath, _tempIsChecked, _tempProjectName, _tempProjectId, _tempProjectGuid, _tempPwProject, _tempPwProjectGuid, _tempRootSpecsDir, _tempRootModulesDir, _tempModulesIniFile); } }