예제 #1
0
        internal static string ListDirectory(string requestdir, Classes.RykonFile[] f, ServerConfig Config)
        {
            string indexofdire = requestdir;

            if (Config.ShowFullPaths)
            {
                indexofdire = indexofdire.Remove(0, Config.RootDirectory.Length);
            }
            string doc = "<h2>\r\n";

            doc += " Index of \r\n";
            doc += " </h2><h4>\r\n";
            doc += WebServer.EncodeHtmlChars(requestdir) + "\r\n";
            doc += "</h4>\r\n";
            doc += "<hr/><table>\r\n";
            if (f == null || f.Length < 1)            // empty
            {
                return("Empty Dir");
            }

            string folderic = "";
            string fileicon = "";

            if (Config.ShowDirIcon)
            {
                folderic = WebDesigner.FileIcoTag;
                fileicon = WebDesigner.FileIcoTag;
            }
            int    i        = -1;
            string endtable = "</table><hr />" + WebDesigner.PoweredBy(Config) + " ";

            foreach (var p in f)
            {
                i++;

                if (p == null)
                {
                    continue;
                }

                string tr = "<span style=\"text-decoration:underline\">";
                tr += "<tr>\r\n";
                tr += "<td>" + ((p.IsDir) ? folderic : fileicon) + "\r\n";
                tr += "<a style='text-decoration: underline;' draggable='true' href ='" + (p.Webpath) + "' >\r\n";
                tr += ((i == 0) ? "Parent Directory" : (i.ToString() + "&nbsp;&nbsp;&nbsp;" + p.Name));
                tr += "</a>\r\n";
                tr += "</td>\r\n";
                tr += "</tr></span>\r\n";


                doc += tr;
            }
            //}
            doc += endtable;
            return(doc);
        }
예제 #2
0
 public static string invalidAuthTok(string main, ServerConfig s)
 {
     if (s.InstalledHostFound(s, s.GET_InstalledHost_Dirname(main)))
     {
         main = "http://" + main + ":" + s.Port;
     }
     else
     {
         main = "http://" + s.GetHostAndPort();
     }
     return("Your Broswer sent outdated parameters <a href='" + WebServer.EncodeHtmlChars(main) + "/' >Go To Main Page</a>");
 }
예제 #3
0
        internal static string ListDirectory(string Dir, string[] f, ServerConfig Config)
        {
            int    i   = 0;
            string doc = "<h2>\r\n";

            doc += " Index of \r\n";
            doc += " </h2><h4>\r\n";
            doc += WebServer.EncodeHtmlChars(Dir) + "\r\n";
            doc += "</h4>\r\n";
            doc += "<hr/><table>\r\n";

            if (f == null || f.Length < 1)            // empty
            {
                return("Empty Dir");
            }

            string fic = (Config.ShowDirIcon?WebDesigner.FolderIcoTag:"");

            foreach (string p in f)
            {
                string tr = "<span style=\"text-decoration:underline\">";
                tr += "<tr>\r\n";
                tr += "<td>" + fic + "\r\n";
                tr += "<a style='text-decoration: underline;' draggable='true' href ='" + (p) + "/' >\r\n";
                string name = WebServer.EncodeHtmlChars("          ") + WebServer.EncodeHtmlChars(AppHelper.LastPeice(p, "/"));
                tr += ((i == 0)?"Parent Directory":(i.ToString() + name));
                tr += "</a>\r\n";
                tr += "</td>\r\n";
                tr += "</tr></span>\r\n";
                i++;

                if (p == "")
                {
                    continue;
                }
                doc += tr;
            }
            //}
            doc += "</table><hr />" + WebDesigner.PoweredBy(Config) + " ";
            return(doc);
        }