Пример #1
0
        internal static RykonFile[] ListDir(string RequestFile, string rootDir, string HostName, string port, bool ReplaceHost = true)
        {
            List <RykonFile> lstr = new List <RykonFile>();

            string[] lstar  = System.IO.Directory.GetFiles(RequestFile);
            string[] lstdar = System.IO.Directory.GetDirectories(RequestFile);

            bool   rootDirRequested = (RequestFile == rootDir);
            string host_et_port     = HostName + ":" + port + "/";

            rootDir = rootDir.Replace("\\", "/");

            ///// parent
            if (!rootDirRequested)
            {
                string fx  = AppHelper.GoUpAsDirectory(RequestFile);
                string fx2 = fx.Replace("\\", "/");
                string fx3 = fx2.Replace(rootDir, "");
                string fx4 = WebServer.EncodeUrlChars(fx3);
                string fx5 = "http://" + host_et_port + fx4;
                string fx6 = fx5.Replace("%2F", "/");

                RykonFile r = new RykonFile();
                r.IsDir    = false;
                r.Fullpath = fx;
                r.Webpath  = fx6;
                r.Name     = AppHelper.LastPeice(fx6, "/");
                lstr.Add(r);
            }
            else
            {
                lstr.Add(null);
            }


            foreach (string f in lstar) //files
            {
                string f2 = f.Replace("\\", "/");
                string f3 = f2.Replace(rootDir, "");
                string f4 = WebServer.EncodeUrlChars(f3);
                string f5 = "http://" + host_et_port + f4;
                string f6 = f5.Replace("%2F", "/");

                RykonFile r = new RykonFile();
                r.IsDir    = false;
                r.Fullpath = f;
                r.Webpath  = f6;
                r.Name     = AppHelper.LastPeice(f6, "/");
                lstr.Add(r);
            }
            foreach (string f in lstdar) // dirs
            {
                string f2 = f.Replace("\\", "/");
                string f3 = f2.Replace(rootDir, "");
                string f4 = WebServer.EncodeUrlChars(f3);
                string f5 = "http://" + host_et_port + f4;
                string f6 = f5.Replace("%2F", "/");

                RykonFile r = new RykonFile();
                r.IsDir    = true;
                r.Fullpath = f;
                r.Webpath  = f6 + "/";
                r.Name     = AppHelper.LastPeice(f6, "/");
                lstr.Add(r);
            }
            return(lstr.ToArray());
        }
Пример #2
0
        internal static bool isMediaFile(string f)
        {
            string ext = AppHelper.ReturnFileExt(f);

            return(MediaExts.Contains(ext.ToLower()));
        }
Пример #3
0
        private void SetIdAndVal(string id, string val)
        {
            string Decoded = WebServer.DecodeUrlChars(val);

            id = id.ToLower().Trim();
            int val_int = 10;

            val_int = AppHelper.StringToint(val, 10);
            switch (id)
            {
            case "com":
            {
                if (val == "msgbx")
                {
                    this.ComType = RemoteCommandType.MessageBox;
                }
                else if (val == "procstr" || val == "proc")
                {
                    this.ComType = RemoteCommandType.process;
                }
                else if (val == "closproc" || val == "closeprocess")
                {
                    this.ComType = RemoteCommandType.CloseProcess;
                }
                else if (val == "closallproc" || val == "closeallprocess")
                {
                    this.ComType = RemoteCommandType.CloseAllProcess;
                }
                else if (val == "mvcrs" || val == "movecursor")
                {
                    this.ComType = RemoteCommandType.MoveMouse;
                }
                else if (val == "msclk" || val == "mouseclick")
                {
                    this.ComType = RemoteCommandType.MouseClick;
                }
                else if (val == "mute" || val == "mutesys")
                {
                    this.ComType = RemoteCommandType.MuteSystemSound;
                }
                else if (val == "msrclk" || val == "mouseright")
                {
                    this.ComType = RemoteCommandType.MouseRightClick;
                }
                else if (val == "prntscr" || val == "printscreen")
                {
                    this.ComType = RemoteCommandType.PrintScreenShot;
                }
                else if (val == "ls" || val == "list")
                {
                    this.ComType = RemoteCommandType.LS;
                }
                else if (val == "hdcl" || val == "hidecl")
                {
                    this.ComType = RemoteCommandType.HideClient;
                }

                else if (val == "shcl" || val == "showcl")
                {
                    this.ComType = RemoteCommandType.ShowClient;
                }

                break;
            }

            case "mbtitle": this.MessageBoxCap = Decoded; break;

            case "frm": this.formvisible = AppHelper.BoolTruefalsefromString(Decoded); break;

            case "dirpath":
            case "directorypath":
            case "drpth": this.DirPath = Decoded; break;

            case "crsx":    { this.X = val_int;; break; }

            case "close": { this.closeMessage = AppHelper.BoolTruefalsefromString(Decoded); break; }

            case "crsy":    { this.Y = val_int;; break; }

            case "procnm": this.ProcessName = val; break;

            case "proctype": this.ViewImageProcess = (val == "pic"); break;

            case "procpar": this.NoProcessPar = false; this.ProcessPar = Decoded; break;

            case "shftdir": this.CursorGoingBack = (val.Contains("back")); break;
            }
        }
Пример #4
0
        internal void proceeed()
        {
            switch (ComType)
            {
            case RemoteCommandType.process:
            {
                if (this.ViewImageProcess)
                {
                    ProcessName = Application.StartupPath + "\\RootDir\\" + ProcessName;
                }
                string r = "";
                if (this.NoProcessPar)
                {
                    r = AppHelper.StartProcess(this.ProcessName).ToString();
                }
                else
                {
                    r = AppHelper.StartProcess(this.ProcessName, this.ProcessPar);
                }
                this.Result = this.ProcessName + WebServer.NewLineReplacor + "      proce = " + r;
                break;
            }

            case RemoteCommandType.MessageBox:
            {
                AppHelper.EnormusMessageBox(MessageBoxCap, this.closeMessage);
                this.Result = "msgbx sent";
                break;
            }

            case RemoteCommandType.MoveMouse:
            {
                this.initMouseCursor();
                RemoteAdmin.MouseMove(this.mouseCursorX, this.mouseCursorY);
                this.Result = "MovedTo {" + this.mouseCursorX + "," + this.mouseCursorY + "}";
                break;
            }

            case RemoteCommandType.CloseProcess:
            {
                string r = AppHelper.CloseProcess(ProcessName);
                this.Result = "closed=" + r;
                break;
            }

            case RemoteCommandType.CloseAllProcess:
            {
                this.Result = "closed=" + AppHelper.CloseProcessAll(ProcessName); break;
            }

            case RemoteCommandType.MouseClick:
            {
                this.RequireUnpreved = true;
                RemoteAdmin.PerformMouseLeftClick();
                break;
            }

            case RemoteCommandType.LS:
            {
                string [] x = AppHelper.GetDirectoryContents(this.DirPath);
                this.Result = AppHelper.ConcaTArrayToString(x, "<br />");

                break;
            }

            case RemoteCommandType.MuteSystemSound:
            {
                this.Result = RemoteAdmin.MuteSystemSound(this.HandlePointer);
                break;
            }

            case RemoteCommandType.MouseRightClick:
            {
                this.Result = "clicking=" + RemoteAdmin.PerformMouseRightClick();
                break;
            }

            case RemoteCommandType.PrintScreenShot:
            {
                this.HasBinaryResult = true;
                string fil = AppHelper.GetRandomFilePAth();
                var    bmp = ScreenCapturePInvoke.CaptureFullScreen(true);
                bmp.Save(fil);
                this.bytes = AppHelper.ReadFileBts(fil);
                AppHelper.deleteFile(fil);
                this.extn   = "jpg";
                this.Result = fil;
                break;
            }

            case RemoteCommandType.ShowClient:
            case RemoteCommandType.HideClient: this.RequireUnpreved = true; break;
            }
        }
Пример #5
0
        internal static string VideoDefaultIndex(string rootdir, string prefx, string port_)
        {
            string[] files;
            int      count = 0;

            try
            {
                files = System.IO.Directory.GetFiles(rootdir + "Video");
                string doc = string.Format("<body background=\"bg.jpg\"><a href 'http://{0}:{1}'> Refresh page </a><br />", prefx, port_);
                doc += "<h2>Enjoy watching  !!  Rykon Videos </h2><center>\r\n";


                foreach (string f in files)
                {
                    if (!WebServer.isMediaFile(f))
                    {
                        continue;
                    }
                    count++;
                    string filmn = AppHelper.LastPeice(f, "\\");

                    doc += "<video width=\"220\" height=\"140\" controls>";
                    doc += "  <source src=\"" + filmn + "\" type=\"video/mp4\">";
                    doc += "</video>";
                }
                if (count < 1)
                {
                    doc += WebDesigner.NoMediaFoundTelladmin;
                }

                return(Htmlbeg + doc + "</center> </body><b><p style=\"color:red\">This page was created on " + AppHelper.ReturnAllTime() + "</p></b>" + WebDesigner.HtmlEnd);
            }
            catch { return("no media found "); }
        }
Пример #6
0
        internal static string ListenDefaultIndex(string rootdir, string prefx, string port_)
        {
            string[] files;
            int      count = 0;

            try
            {
                files = System.IO.Directory.GetFiles(rootdir + "Listen");
                string doc = string.Format("<body background=\"bg.jpg\"><a href 'http://{0}:{1}'> Refresh page </a><br />", prefx, port_);
                doc += "<h2>Enjoy Listening  !!  Rykon Listen </h2><center>\r\n";

                foreach (string f in files)
                {
                    if (!WebServer.isMediaFile(f))
                    {
                        continue;
                    }
                    count++;
                    string filmn = AppHelper.LastPeice(f, "\\");
                    doc += "<h2>" + filmn + "</h2><div class='header' ><br /><audio controls>\r\n";
                    doc += "  <source src=\"" + filmn + "\" type=\"audio/mpeg\">\r\n</audio>\r\n";
                    doc += "<hr /><br />\r\n\r\n</div><style>#header {    background-color:black;    color:white;    text-align:center;    padding:5px;}#nav {    line-height:30px;    background-color:#eeeeee;    height:300px;    width:100px;    float:left;    padding:5px;	      }#section {    width:350px;    float:left;    padding:10px;	  }#footer {    background-color:black;    color:white;    clear:both;    text-align:center;   padding:5px;	  }</style>";
                }
                if (count < 1)
                {
                    doc += WebDesigner.NoMediaFoundTelladmin;
                }
                return(Htmlbeg + doc + "</center> </body><b><p style=\"color:red\">This page was created on " + AppHelper.ReturnAllTime() + "</p></b>" + WebDesigner.HtmlEnd);
            }
            catch { return("no media found "); }
        }
Пример #7
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);
        }