Hi,
Based on this answer http://stackoverflow.com/questions/288810/get-the-subdomain-from-a-url, I am trying to use code.google.com/p/domainname-parser/ that will use Public Suffix List from publicsuffix.org to get subdomain and domain for managing my cookie collection.
In the current moment, Domainname-parser is the only .NET code I found in the internet that implement list from publicsuffix.org.
In order to use Domainname-parser I want to make a changes to the source code so that it would be able to:
- Use in .NET 2.0
- Accept Uri object to parse the Host into subdomain, domain and TLD.
- Will auto download the latest list from the publicsuffix.org by using WebRequest and WebResponse if LastModified is changed.
So it will become more usable and always updated. (2) and (3) would not be a problem but (1) is my focus now.
The current Domainname-parser is v1.0, build to use .NET 3.5 that using Linq in the code. To make it compatible to .NET 2.0, I need to convert the Linq codes to non-Linq and it makes me to understand the Public Suffix List rules. That is Normal, Wildcard and Exception rule. However I don't have knowledge about Linq and how it can be converted back to the normal way.
Converter tools might be useful but the better is I review and modify it line by line.
Now my question is how can I convert it? Eg codes from FindMatchingTLDRule method in DomainNames class:
// Try to match an wildcard rule:
var wildcardresults = from test in TLDRulesCache.Instance.TLDRuleList
where
test.Name.Equals(checkAgainst, StringComparison.InvariantCultureIgnoreCase)
&&
test.Type == TLDRule.RuleType.Wildcard
select
test;
and also this:
var results = from match in ruleMatches
orderby match.Name.Length descending
select match;
What is the simple guide line to follow? or any free tools to convert this one sentence above to the normal C# codes in .NET 2.0.?
I believe that no database involved, just in the way they deals with collections.
I also trying to contact the domainname-parser owner to improve the codes and help me to solve this.
Thanks
CallMeLaNN