private void GetFile(String filename) { if (filename != null) { if (filename == "favicon.ico") { byte[] content = Resource1.fi; String mime = this.GetMIME(filename.ToLower()); byte[] header = this.BuildHeader(mime, content.Length, false); this.data_out.Add(header); if (this.current_item.RequestType != HttpRequestType.Head) { this.data_out.Add(content); } } else if (filename == "sb0t.js") { byte[] content = Resource1.sb0t; content = Zip.GCompress(content); String mime = this.GetMIME(filename.ToLower()); byte[] header = this.BuildHeader(mime, content.Length, true); this.data_out.Add(header); if (this.current_item.RequestType != HttpRequestType.Head) { this.data_out.Add(content); } } else if (filename == "font.htm") // ajax callback from default sbot template { this.ParseFont(); byte[] content = new byte[] { 79, 75 }; content = Zip.GCompress(content); String mime = this.GetMIME(filename.ToLower()); byte[] header = this.BuildHeader(mime, content.Length, true); this.data_out.Add(header); if (this.current_item.RequestType != HttpRequestType.Head) { this.data_out.Add(content); } } else if (File.Exists(Settings.WebPath + filename) && !this.IsBadName(filename)) { try { byte[] content = File.ReadAllBytes(Settings.WebPath + filename); if (filename == "template.htm") { String html = Encoding.UTF8.GetString(content).Replace("\"sb0t.js\"", "\"sb0t.js?r=" + Helpers.UnixTime + "\""); int index = html.ToUpper().IndexOf("<HEAD>"); if (index > -1) { StringBuilder sb = new StringBuilder(); sb.AppendLine(); sb.AppendLine("<script>"); sb.AppendLine("<!--"); sb.AppendLine(" var my_username = \"" + this.UserName + "\";"); sb.AppendLine("-->"); sb.Append("</script>"); content = Encoding.UTF8.GetBytes(html.Insert((index + 6), sb.ToString())); } } bool compress = this.ShouldCompress(filename); if (compress) { content = Zip.GCompress(content); } String mime = this.GetMIME(filename.ToLower()); byte[] header = this.BuildHeader(mime, content.Length, compress); this.data_out.Add(header); if (this.current_item.RequestType != HttpRequestType.Head) { this.data_out.Add(content); } } catch { this.data_out.Add(this.Build404()); } } else { this.data_out.Add(this.Build404()); } } }