Example #1
0
 public String getHelp(String str)
 {
     if (helpText == "")
     {
         Dictionary <string, Object> helpdata = new Dictionary <string, object>();
         helpdata["runcmd"] = "cmd.cs";
         helpdata["dir"]    = "C:\\cygwin64\\bin";
         if (str == null || str == "")
         {
             helpdata["exepath"] = "";
         }
         else
         {
             helpdata["exepath"] = str + " -help ";
         }
         Func <String> fun = () =>
         {
             return(this.getHelp(""));
         };
         helpdata["back"] = fun;
         MsgCenter.push(ref helpdata);
     }
     return(helpText);
 }
Example #2
0
        public static bool BaseHeadHand(System.Web.UI.Page page, ref Dictionary <String, Object> data)
        {
            String Keys = page.Request["Keys"];
            String Cmd  = page.Request["Cmd"];
            String Help = page.Request["Help"];

            bool help = false;

            if ((Cmd == null || Keys == null) && Help == null)
            {
                help = true;
            }
            try
            {
                if (Help != null && Help != "")
                {
                    help = true;
                }
                else
                {
                    if (Cmd != null && Cmd != "" && Keys != null && Keys != "")
                    {
                        JavaScriptSerializer json = new JavaScriptSerializer();
                        String[]             keys = json.Deserialize <String[]>(Keys);
                        Func <String, bool>  fun  = (str) =>
                        {
                            return(false);
                        };
                        data["back"] = fun;
                        for (int i = 0; i < keys.Length; i++)
                        {
                            String temp = page.Request[keys[i]];
                            if (temp == null || temp == "")
                            {
                                throw new Exception("");
                            }
                            if (data.ContainsKey(temp))
                            {
                                throw new Exception("已经存在该key请检查是否重复或者占用系统key " + temp);
                            }
                            data[keys[i]] = temp;
                        }
                    }
                    else
                    {
                        help = true;
                    }
                }
            }
            catch (Exception ex)
            {
                help = true;
                page.Response.Write(ex.ToString());
            }
            finally
            {
                if (help == true)
                {
                    if (data.ContainsKey("gethelp"))
                    {
                        Func <String> fun = (Func <String>)data["gethelp"];
                        page.Response.Write(fun());
                    }
                }
                else
                {
                    MsgCenter.push(ref data);
                }
            }
            return(true);
        }