Exemplo n.º 1
0
        public static ExeAlias AnalyseUrl(Alias al)
        {
            string stringIn = al.Name, OutString = al.Path;
            var    fc = new Func(); var ea = new ExeAlias();

            //1 是网页
            //2 dos命令
            //3 k 杀死进程
            //4 资源管理器
            //5


            if (stringIn.IndexOf("kill ") >= 0 || stringIn.IndexOf(" kill") >= 0 || stringIn.IndexOf(" k") >= 0)
            {
                string NameOrID = stringIn.Replace("kill", ""); NameOrID = NameOrID.Replace("k", ""); NameOrID = NameOrID.Replace(" ", "");
                if (fc.IsInt(NameOrID))
                {
                    OutString = "ntsd -c q -p " + NameOrID;
                }
                else
                {
                    OutString = string.Format("tskill \"{0}\"", fc.GetCmdString(NameOrID.Trim(), null));
                }
                //kill 结束进程命令
                ea.text    = stringIn;
                ea.value   = OutString;
                ea.cmdType = CmdType.kill;
                return(ea);
            }
            else if (OutString.IndexOf("dos:") >= 0)
            {
                OutString  = OutString.Replace("dos:", "");
                ea.text    = stringIn;
                ea.value   = OutString;
                ea.cmdType = CmdType.Dos;
                return(ea);
            }
            else if (fc.IsNumber(stringIn))
            {
                //i = 3;  //是数字符串
            }
            else if (OutString == "")
            {
                //i = 2;      //cmd命令
                ea.text    = stringIn;
                ea.value   = stringIn;
                ea.cmdType = CmdType.cmd;
            }
            ea.text    = stringIn;
            ea.value   = OutString;
            ea.cmdType = CmdType.exe;
            return(ea);
        }
Exemplo n.º 2
0
        public static void ExeCmd(ExeAlias al)
        {
            switch (al.cmdType)
            {
            case CmdType.cmd: ExeExe(al.value); break;

            case CmdType.kill: Cmd.Run(al.text); break;

            case CmdType.exe:
                break;

            case CmdType.Dos: ExeProcessCmd(al.text); break;

            default: break;
            }
        }