public void LogValidationOperationResultMessages(ValidationOperationResult validationOperationResult, int errorLine)
        {
            string        errorLineString        = $"Line {errorLine}";
            List <string> errorMessages          = validationOperationResult.Messages;
            List <string> errorMessagesWithLines = errorMessages.AppendToEachString(errorLineString);

            string separatorHeader = DateTime.Now.ToLongTimeString();

            errorMessagesWithLines.Insert(0, separatorHeader);

            string pathToFile = AppDomain.CurrentDomain.BaseDirectory + @"\ValidationLog.txt";

            _fileOperations.AppendLinesToFile(pathToFile, errorMessagesWithLines);
        }
예제 #2
0
        public string LogInferenceResult(Dictionary <int, ImplicationRule> implicationRules, ExpertOpinion expertOpinion, string userName)
        {
            var destinationPath = AppDomain.CurrentDomain.BaseDirectory + $@"\Results\{userName}\InferenceLog-{DateTime.Now:yyyy-MM-dd_HH-mm-ss-fff}.txt";

            Directory.CreateDirectory(Path.GetDirectoryName(destinationPath));

            var rules = implicationRules.Select(rule => $"Implication rule {rule.Key} : {rule.Value}").ToList();

            _fileOperations.AppendLinesToFile(destinationPath, rules);

            if (expertOpinion.IsSuccess)
            {
                var results = expertOpinion.Result.Select(result => $"Node {result.NodeName} ({result.DefuzzifiedValue}) was enabled with confidence factor {result.ConfidenceFactor}").ToList();
                _fileOperations.AppendLinesToFile(destinationPath, results);
            }
            else
            {
                _fileOperations.AppendLinesToFile(destinationPath, expertOpinion.ErrorMessages);
            }

            return(destinationPath);
        }