Assembly References

I've added the ability to add assembly references when compiling with Code Blog.  Something that threw me is the strong name key used to sign the 'System' and 'System.Web' assemblies are different!  To make life easy for you I'm now using LoadWithPartialName.  To reference the correct version of 'System.Web' you can just do "System.Web, Version=1.0.5000.0".

I've updated the challenge (another easy one).  If you fancy a go, subscribe to the feed and post a submission.  I'm looking for more ideas for challenges.  If you have any ideas, please send them (along with NUnit tests and a stub implementation) here.

2 Comments

  • Actually, there seem to be a problem with one of the unit test, since "\u8220" is not a "\"" at all (but a curved quote).



    And my (contrived) example fails (I know I should have coded the simplest thing that possibly worked. Oh, well)



    using System;

    using System.Collections;

    using System.Diagnostics;

    using System.Text.RegularExpressions;

    public class HtmlEscape : IEscape

    {

    public static Regex rex = new Regex(@"&(#)?([A-Za-z\d]+);"); private Hashtable escMap; public HtmlEscape()

    {

    escMap = new Hashtable(new CaseInsensitiveHashCodeProvider(),new CaseInsensitiveComparer());

    escMap.Add("amp","&");

    escMap.Add("gt",">");

    escMap.Add("lt","<");

    escMap.Add("quot","\"");

    escMap.Add("nbsp"," ");

    }

    public string ToPlain(string escaped)

    {

    return rex.Replace(escaped,new MatchEvaluator(this.EscEval));

    }

    public string EscEval(Match m)

    {

    if (m.Groups[1].Value != "")

    return Convert.ToChar(Int64.Parse(m.Groups[2].Value)).ToString();

    else

    return escMap[m.Groups[2].Value] as string;

    }

    }



  • Hi Yann,



    I've tweaked the unit tests and removed the check for "\u8220". It was in there because the HTML editor control I'm using was converting regular quotes to them for some reason. It was a hack.



    Your code should have a better chance of working now. I look forward to your post. :)



    Thanks, Jamie.

Comments have been disabled for this content.