Developer Area

Show
Ignore:
Timestamp:
11/27/09 09:51:15 (4 months ago)
Author:
jonmaycock
Message:
 
Files:
1 modified

Legend:

Unmodified
Added
Removed
  • apps/outlook/branches/1.5/DotTelSystem/DNS/Records/DNSUnlinkedTelnameNaptrResourceRecord.cs

    r580 r588  
    8484            this.serviceType = naptr.ServiceType; 
    8585            this.catagories = naptr.Catagories; 
     86            Logger.Log(Logger.Section.Lookups,"URI Path: " + naptr.UriPath); 
    8687            this.uriPath = naptr.UriPath; 
     88            Logger.Log(Logger.Section.Lookups, "URI Scheme: " + naptr.UriScheme); 
    8789            this.uriScheme = naptr.UriScheme; 
    8890            this.labels = naptr.Labels; 
    89             if (this.uriPath.StartsWith(";base64")) 
     91            string[] split = this.uriPath.Split(new char[] { ',' }, 2); 
     92            string stuff = split[0]; 
     93            string txtStr = ""; 
     94            if (split.Length > 1) 
     95            { 
     96                txtStr = split[1]; 
     97            } 
     98            else 
     99            { 
     100                txtStr = split[0]; 
     101            } 
     102            if (stuff == "" || split.Length <= 1 || this.uriScheme != "data:") 
     103            { 
     104                this.text = System.Uri.UnescapeDataString(txtStr); 
     105                this.display = true; 
     106            } 
     107            else if (stuff.StartsWith(";base64")) 
    90108            { 
    91109                System.Text.UTF8Encoding encoder = new System.Text.UTF8Encoding(); 
    92110                System.Text.Decoder utf8Decode = encoder.GetDecoder(); 
    93111 
    94                 byte[] todecode_byte = Convert.FromBase64String(this.uriPath.Substring(8, this.uriPath.Length-8)); 
    95                 int charCount = utf8Decode.GetCharCount(todecode_byte, 0, todecode_byte.Length); 
    96                 char[] decoded_char = new char[charCount]; 
    97                 utf8Decode.GetChars(todecode_byte, 0, todecode_byte.Length, decoded_char, 0); 
    98                 this.text = new string(decoded_char); 
    99  
     112                Logger.Log(Logger.Section.Lookups, "Base 64 String to decode: " + txtStr); 
     113                try 
     114                { 
     115                    byte[] todecode_byte = Convert.FromBase64String(txtStr); 
     116                    int charCount = utf8Decode.GetCharCount(todecode_byte, 0, todecode_byte.Length); 
     117                    char[] decoded_char = new char[charCount]; 
     118                    utf8Decode.GetChars(todecode_byte, 0, todecode_byte.Length, decoded_char, 0); 
     119                    this.text = new string(decoded_char); 
     120                    if (UriHandler.getInstance().Displayable(this.serviceType, this.uriScheme) || !UriHandler.getInstance().KnownService(this.serviceType)) 
     121                        this.display = true; 
     122                    else 
     123                        this.display = false; 
     124                } 
     125                catch (FormatException e) 
     126                { 
     127                    this.text = txtStr; 
     128                } 
    100129            } 
    101130            else 
    102131            { 
    103                 if (this.uriScheme.StartsWith("data:")) 
    104                     this.text = this.uriPath.Substring(1, this.uriPath.Length - 1); 
    105                 else 
    106                     this.text = this.uriPath; 
     132                this.display = false; 
    107133            } 
    108             if (UriHandler.getInstance().Displayable(this.serviceType, this.uriScheme) || !UriHandler.getInstance().KnownService(this.serviceType)) 
    109                 this.display = true; 
    110             else 
    111                 this.display = false; 
    112134 
    113135        } 
Telnic
Search This Site
Partners
Neustar
ICANN
Main site | WHOIS | Sell .tel | FAQ | Archived Site | About Telnic | Contact Us