Exemplo n.º 1
0
        private static void Heading(HtmlTagWriter container)
        {
            using (var table = container.Tag("table"))
            {
                Action <string, string> Line = (name, value) =>
                {
                    using (var tr = table.Tag("tr"))
                    {
                        tr.EchoTag("td", name, new { @class = "e" });
                        tr.EchoTag("td", value, new { @class = "v" });
                    }
                };

                Line("System", $"{GetOsName()} {Environment.MachineName} {RuntimeInformation.OSDescription} {RuntimeInformation.OSArchitecture}");
                Line("Architecture", RuntimeInformation.ProcessArchitecture.ToString());
                Line("Debug build",
#if DEBUG
                     true
#else
                     false
#endif
                    ? "yes":"no");
                Line("IPv6 Support", System.Net.Sockets.Socket.OSSupportsIPv6 ? "yes" : "no");
            }
        }
Exemplo n.º 2
0
 private static void PageTitle(HtmlTagWriter container)
 {
     using (var table = container.Tag("table"))
         using (var tr = table.Tag("tr", new { @class = "h" }))
             using (var td = tr.Tag("td"))
             {
                 using (var a = td.Tag("a", new { href = Resource.LogoHref, target = "_blank" }))
                 {
                     a.EchoTagSelf("img", new { border = "0", src = Resource.LogoSrc, alt = Resource.LogoAlt });
                 }
                 using (var title = td.Tag("h1", new { @class = "p" }))
                 {
                     title.EchoEscaped("PeachPie Version " + typeof(Context).GetTypeInfo().Assembly.GetName().Version);
                 }
             }
 }
Exemplo n.º 3
0
        private static void Variables(HtmlTagWriter container)
        {
            container.EchoTag("h2", "PHP Variables");
            using (var table = container.Tag("table"))
            {
                using (var tr = table.Tag("tr", new { @class = "h" }))
                {
                    tr.EchoTag("th", "Variable");
                    tr.EchoTag("th", "Value");
                }

                Action <string, string> Line = (name, value) =>
                {
                    using (var tr = table.Tag("tr", new { @class = "h" }))
                    {
                        tr.EchoTag("td", name, new { @class = "e" });
                        using (var td = tr.Tag("td", new { @class = "v" }))
                        {
                            if (string.IsNullOrEmpty(value))
                            {
                                td.EchoRaw("&nbsp;");
                            }
                            else
                            {
                                td.EchoEscaped(value);
                            }
                        }
                    }
                };

                Action <PhpArray, string> DumpArray = (arr, name) =>
                {
                    foreach (var entry in arr.Keys)
                    {
                        Line($"{name}[{entry}]", arr[entry].ToStringOrNull());
                    }
                };

                DumpArray(container.Context.Cookie, "_COOKIE");
                DumpArray(container.Context.Server, "_SERVER");
            }
        }
Exemplo n.º 4
0
        private static void Env(HtmlTagWriter container)
        {
            container.EchoTag("h2", "Environment");
            using (var table = container.Tag("table"))
            {
                using (var tr = table.Tag("tr", new { @class = "h" }))
                {
                    tr.EchoTag("th", "Variable");
                    tr.EchoTag("th", "Value");
                }

                Action <string, string> Line = (name, value) =>
                {
                    using (var tr = table.Tag("tr", new { @class = "h" }))
                    {
                        tr.EchoTag("td", name, new { @class = "e" });
                        using (var td = tr.Tag("td", new { @class = "v" }))
                        {
                            if (string.IsNullOrEmpty(value))
                            {
                                td.EchoRaw("&nbsp;");
                            }
                            else
                            {
                                td.EchoEscaped(value);
                            }
                        }
                    }
                };

                foreach (var entry in container.Context.Env.Keys)
                {
                    Line(entry.ToString(), container.Context.Env[entry].ToStringOrNull());
                }
            }
        }