Exemplo n.º 1
0
    public override void WriteHtml(System.Web.UI.HtmlTextWriter w)
    {
      /*
      //set code language
      if (Language == CompiledQuestion.LANGUAGE.CPP)
      {
        LanguageToHighlight = HtmlHighlightedCode.LANGUAGE.Cpp;
      }
      else if (Language == CompiledQuestion.LANGUAGE.CS)
      {
        LanguageToHighlight = HtmlHighlightedCode.LANGUAGE.Cpp;
      }
      else if (Language == CompiledQuestion.LANGUAGE.Delphi)
      {
        LanguageToHighlight = HtmlHighlightedCode.LANGUAGE.Delphi;
      }
      else if (Language == CompiledQuestion.LANGUAGE.Java)
      {
        LanguageToHighlight = HtmlHighlightedCode.LANGUAGE.Java;
      }
       * */

      //<div>
      w.AddAttribute(HtmlAttribute.Id, Name);
      w.AddAttribute(HtmlAttribute.Name, "advancedCompiledTest");
      w.AddStyleAttribute(HtmlStyleAttribute.Position, "absolute");
      HtmlSerializeHelper<HtmlCompiledTest>.WriteRootElementAttributes(w, this);
      w.RenderBeginTag(HtmlTag.Div);

      //var ls = LanguageToHighlight.ToString().ToLower();

      //<span name="BeforeCode">//there will be lector code
      w.AddAttribute(HtmlAttribute.Id, "TextBoxBefore");
      w.AddStyleAttribute(HtmlStyleAttribute.Overflow, "scroll");
      w.AddStyleAttribute(HtmlStyleAttribute.Height, (Control as AdvancedCompiledTest).TextBoxBefore.Height.ToString());
      w.AddStyleAttribute(HtmlStyleAttribute.Width, (Control as AdvancedCompiledTest).TextBoxBefore.Width.ToString());
      w.RenderBeginTag(HtmlTag.Span);
      //w.AddAttribute(HtmlAttribute.Class, ls);
      //w.WriteFullBeginTag(string.Concat("pre><code class=\"", ls, "\""));
      w.WriteFullBeginTag(string.Concat("pre><code"));
      w.Write((Control as AdvancedCompiledTest).TextBoxBefore.Text.HttpEncode());
      w.WriteFullBeginTag("/code></pre");
      w.RenderEndTag();
      //</span>

      //<textarea>//there will be user code
      w.AddAttribute(HtmlAttribute.Id, "TextBoxUserCode");
      w.AddStyleAttribute(HtmlStyleAttribute.Width, (Control as AdvancedCompiledTest).TextBoxUserCode.Width.ToString());
      w.AddStyleAttribute(HtmlStyleAttribute.Height, (Control as AdvancedCompiledTest).TextBoxUserCode.Height.ToString());
      w.RenderBeginTag(HtmlTextWriterTag.Textarea);
      w.RenderEndTag();
      //</textarea>

      //<span name="AfterCode">//there will be lector code
      w.AddAttribute(HtmlAttribute.Id, "TextBoxAfter");
      w.AddStyleAttribute(HtmlStyleAttribute.Overflow, "scroll");
      w.AddStyleAttribute(HtmlStyleAttribute.Height, (Control as AdvancedCompiledTest).TextBoxAfter.Height.ToString());
      w.AddStyleAttribute(HtmlStyleAttribute.Width, (Control as AdvancedCompiledTest).TextBoxAfter.Width.ToString());
      w.RenderBeginTag(HtmlTag.Span);
      //w.AddAttribute(HtmlAttribute.Class, ls);
      //w.WriteFullBeginTag(string.Concat("pre><code class=\"", ls, "\""));
      w.WriteFullBeginTag(string.Concat("pre><code"));
      w.Write((Control as AdvancedCompiledTest).TextBoxAfter.Text.HttpEncode());
      w.WriteFullBeginTag("/code></pre");
      w.RenderEndTag();
      //</span>

      w.RenderEndTag();
      //</div>
    }
Exemplo n.º 2
0
		public static void CopyStream(System.IO.Stream input, System.IO.Stream output)
		{
			var buffer = new byte[8 * 1024];
			int length;
			while ((length = input.Read(buffer, 0, buffer.Length)) > 0)
			{
				output.Write(buffer, 0, length);
			}
			output.Close();
		}
Exemplo n.º 3
0
 void Write(System.IO.BinaryWriter writer, DateTime dateTime)
 {
     // The resulting file time would represent a date and time before 12:00 midnight January 1, 1601 C.E. UTC.
     writer.Write(dateTime.ToFileTimeUtc());
 }
Exemplo n.º 4
0
 void WriteSafe(System.IO.BinaryWriter writer, string mssage)
 {
     writer.Write(mssage != null ? mssage : string.Empty);
 }
Exemplo n.º 5
0
 public void Store(System.IO.BinaryWriter writer)
 {
     writer.Write((byte)this.Type);
     Write(writer, this.DateTime);
     WriteSafe(writer, this.Message);
 }