Changeset 588 for apps/outlook/branches/1.5/DotTelSystem/DNS/Records/DNSUnlinkedTelnameNaptrResourceRecord.cs
- Timestamp:
- 11/27/09 09:51:15 (4 months ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
apps/outlook/branches/1.5/DotTelSystem/DNS/Records/DNSUnlinkedTelnameNaptrResourceRecord.cs
r580 r588 84 84 this.serviceType = naptr.ServiceType; 85 85 this.catagories = naptr.Catagories; 86 Logger.Log(Logger.Section.Lookups,"URI Path: " + naptr.UriPath); 86 87 this.uriPath = naptr.UriPath; 88 Logger.Log(Logger.Section.Lookups, "URI Scheme: " + naptr.UriScheme); 87 89 this.uriScheme = naptr.UriScheme; 88 90 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")) 90 108 { 91 109 System.Text.UTF8Encoding encoder = new System.Text.UTF8Encoding(); 92 110 System.Text.Decoder utf8Decode = encoder.GetDecoder(); 93 111 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 } 100 129 } 101 130 else 102 131 { 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; 107 133 } 108 if (UriHandler.getInstance().Displayable(this.serviceType, this.uriScheme) || !UriHandler.getInstance().KnownService(this.serviceType))109 this.display = true;110 else111 this.display = false;112 134 113 135 }








