コード例 #1
0
 internal void WriteText(PlainTextString plainText)
 {
     m_htmlTextWriter.WriteEncodedText(plainText);
 }
コード例 #2
0
 /// <summary>
 /// Convert a PlainTextString to Html.
 /// </summary>
 /// <param name="plainText">Text string.</param>
 /// <remarks>
 /// HtmlEncodes the <paramref name="plainText"/>
 /// </remarks>
 internal HtmlString(PlainTextString plainText)
 {
     m_html = HttpUtility.HtmlEncode(plainText);
 }
コード例 #3
0
 internal void AddAttribute(string name, PlainTextString plainText)
 {
     m_htmlTextWriter.AddAttribute(name, plainText);
 }
コード例 #4
0
 internal void AddAttribute(HtmlTextWriterAttribute key,
                            PlainTextString plainText)
 {
     m_htmlTextWriter.AddAttribute(key, plainText);
 }
コード例 #5
0
ファイル: Encoding.cs プロジェクト: supermuk/iudico
 internal void WriteText(PlainTextString plainText)
 {
     m_htmlTextWriter.WriteEncodedText(plainText);
 }
コード例 #6
0
ファイル: Encoding.cs プロジェクト: supermuk/iudico
 /// <summary>
 /// Convert a PlainTextString to Html.
 /// </summary>
 /// <param name="plainText">Text string.</param>
 /// <remarks>
 /// HtmlEncodes the <paramref name="plainText"/>
 /// </remarks>
 internal HtmlString(PlainTextString plainText)
 {
     m_html = HttpUtility.HtmlEncode(plainText);
 }
コード例 #7
0
ファイル: Encoding.cs プロジェクト: supermuk/iudico
 internal void AddAttribute(HtmlTextWriterAttribute key,
     PlainTextString plainText)
 {
     m_htmlTextWriter.AddAttribute(key, plainText);
 }
コード例 #8
0
ファイル: Encoding.cs プロジェクト: supermuk/iudico
 internal void AddAttribute(string name, PlainTextString plainText)
 {
     m_htmlTextWriter.AddAttribute(name, plainText);
 }
コード例 #9
0
ファイル: HtmlTextReader.cs プロジェクト: supermuk/iudico
 /// <summary>
 /// Gets the value of the requested attribute name from the case-sensitively named Element or Identifier node.  
 /// </summary>
 /// <param name="name"></param>
 /// <returns>The attribute value of the requested attribute name, or String.Empty if it doesn't exist.</returns>
 /// <remarks>
 /// If the node isn’t Element or Identifier throws InvalidOperationException.  
 /// If the name doesn’t exist as an attribute returns String.Empty. 
 /// This method does not move the reader unless attributes haven’t been parsed yet.
 /// <p>If there is more than one attribute with the same name, only retrieves 
 /// the first.</p>
 /// </remarks>
 /// <exception cref="InvalidOperationException">If <c>NodeType</c> is not
 /// <c>HtmlNodeType.Element</c> or <c>HtmlNodeType.Identifier</c>.</exception>
 internal PlainTextString GetAttributeValue(PlainTextString name)
 {
     CheckDispose();
     // calling the following can throw
     return GetAttributeValue(name, false);
 }
コード例 #10
0
ファイル: HtmlTextReader.cs プロジェクト: supermuk/iudico
  /// <summary>
  /// Gets the value of the requested attribute name from the named Element or Identifier node.  
  /// </summary>
  /// <param name="name"></param>
  /// <param name="ignoreCase"></param>
  /// <returns>The attribute value of the requested attribute name, or String.Empty if it doesn't exist.</returns>
  /// <remarks>
  /// If the node isn’t Element or Identifier, throws InvalidOperationException.  
  /// This method does not move the reader unless attributes haven’t been parsed yet.
  /// <p>If there is more than one attribute with the same name, only retrieves 
  /// the first.</p>
  /// </remarks>
  /// <exception cref="InvalidOperationException">If <c>NodeType</c> is not
  /// <c>HtmlNodeType.Element</c> or <c>HtmlNodeType.Identifier</c>.</exception>
  internal PlainTextString GetAttributeValue(PlainTextString name, bool ignoreCase)
  {
      CheckDispose();
      if (NodeType != HtmlNodeType.Element && NodeType != HtmlNodeType.Identifier)
          throw new InvalidOperationException();
      for (int i = 0; i < m_htmlNodeParser.Attributes.Count; i++ )
      {
          if (0 == String.Compare(name, m_htmlNodeParser.Attributes[i].Name, 
              ignoreCase ? StringComparison.OrdinalIgnoreCase : StringComparison.Ordinal))
              return m_htmlNodeParser.Attributes[i].Value;
      }
      return String.Empty;
 }
コード例 #11
0
ファイル: AIRenderer.cs プロジェクト: supermuk/iudico
        /// <summary>
        /// Returns the review HTML depending on the correctness of the learner response and whether
        /// ShowCorrectAnswers is true.
        /// </summary>
        private string GetReviewHtml(int ordinal)
        {
            AIResources.Culture = LocalizationManager.GetCurrentCulture();
            // RandomAccess view is identical to Review view.
            string ordinalString = ordinal.ToString(CultureInfo.InvariantCulture);
            StringBuilder bld = new StringBuilder(200);
            string learnerAnswer = LearnerAnswer(ordinal);
            string learnerAnswerHtml;
            string imageSrc;
            string altText;

            if (LearnerAnswerCorrect(ordinalString))
            {
                learnerAnswerHtml = new PlainTextString(learnerAnswer).ToHtmlString();
                imageSrc = ImageFileName.Correct;
                altText = AIResources.CorrectAnswerHtml;
            }
            else
            {
                // if answer is incorrect, learner answer is surrounded by <STRIKE></STRIKE> unless unanswered.
                if (String.IsNullOrEmpty(learnerAnswer))
                {
                    learnerAnswerHtml = new PlainTextString(AIResources.Unanswered).ToHtmlString();
                }
                else
                {
                    learnerAnswerHtml = "<STRIKE>" + new PlainTextString(learnerAnswer).ToHtmlString() + "</STRIKE>";
                }
                imageSrc = ImageFileName.Incorrect;
                altText = AIResources.IncorrectAnswerHtml;
            }
            bld.AppendLine(String.Format(CultureInfo.InvariantCulture, m_reviewHtml,
                learnerAnswerHtml, ImageFileName.GetFullPath(RenderContext.EmbeddedUIResourcePath, imageSrc), altText));
            if (!LearnerAnswerCorrect(ordinalString))
            {
                if (RenderContext.ShowCorrectAnswers)
                {
                    bld.AppendLine(String.Format(CultureInfo.InvariantCulture, m_correctAnswerHtml,
                        AIResources.CorrectAnswerColonHtml, CorrectAnswer(ordinalString)));
                }
            }
            return bld.ToString();
        }