private static string GetDecisionByNumber(string adrRepositoryPath, int targetDecisionNum) { var adrFiles = Directory.GetFiles(adrRepositoryPath, "*.md"); var adrFile = AdrNameHelper.FindByNumber(adrFiles, targetDecisionNum); return(adrFile); }
private static void ChangeStatusToRejected(string decisionFileName, int causeDecisionNum, string adrRepositoryPath) { var content = File.ReadAllText(decisionFileName); var fileContentLines = content.Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries); var status = fileContentLines[2].Trim(); var adrFiles = Directory.GetFiles(adrRepositoryPath, "*.md"); var causeDecisionFile = AdrNameHelper.FindByNumber(adrFiles, causeDecisionNum); var fileInfo = new FileInfo(causeDecisionFile); var causeDecisionFileTitle = fileInfo.Name; content = content.Replace(status, $"Отменено (причина: [{causeDecisionFileTitle}]({causeDecisionFileTitle}))"); File.WriteAllText(decisionFileName, content); }