public string ApplyPattern(ZhouyiHexagram.Line line) { if (line.LineIndex == 0) { return(string.Format(line.YinYang == Core.YinYang.Yang ? this.patterns.ApplyNines : this.patterns.ApplySixes, Environment.NewLine, line.LineText)); } var pattern = line.YinYang.IsYang ? this.patterns.YangLines : this.patterns.YinLines; return(string.Format(pattern[line.LineIndex - 1], Environment.NewLine, line.LineText)); }
/// <summary> /// 获取一爻的象辞。 /// Get the text in Xiangzhuan of a line. /// </summary> /// <param name="line"> /// 爻。 /// The line. /// </param> /// <returns> /// 象辞。 /// The text in Xiangzhuan. /// </returns> /// <exception cref="ArgumentNullException"> /// <paramref name="line"/> 为 <c>null</c> 。 /// <paramref name="line"/> is <c>null</c>. /// </exception> public string this[ZhouyiHexagram.Line line] { get { if (line is null) { throw new ArgumentNullException(nameof(line)); } if (line.LineIndex is 0) { return(line.YinYang.IsYang ? this.translation.XiangOfApplyNines : this.translation.XiangOfApplySixes); } return(this.translation.XiangTexts[line.From.Index - 1].Lines[line.LineIndex - 1]); } }