protected void ButtonNine_Click(object sender, EventArgs e)
        {
            if (WeTextBoxFive.Text.Trim() == "")
            {
                Label1.Text = "请输入关键字"; return;
            }

            try
            {
                string PathFile = System.IO.Path.Combine(Server.MapPath("~"), "USER_DIR\\sysuser\\MyPost\\txt\\" + WeTextBoxFive.Text.Trim() + ".dll"); //图文 关键词回复目录);

                TextMsgData CMsgData = new TextMsgData();
                CMsgData.Content = WeTextBoxOne.Text;
                CMsgData.SaveFile(PathFile);

                FileManager1.Visible = true;
                TextEditor.Visible = false;
                Label1.Text = "保存成功!";

                FileManager1.FileViewMode = IZ.WebFileManager.Components.FileViewRenderMode.Icons;

            }
            catch
            {
                Label1.Text = "保存失败,关键字中不能有特殊字符";
            }
        }
        protected void FileManager1_ExecuteCommand(object sender, ExecuteCommandEventArgs e)
        {
            if (Page.IsCallback)
            {
                e.ClientScript = "alert('Use ExecuteCommand event to handle your custom command.\\nCommandName=" + e.CommandName +
                                 "\\nItem=" + e.Items[0].VirtualPath + "')";
            }
            else
            {
                if (e.CommandName == "EditText")
                {
                    if (e.Items.Count == 0)
                        return;

                    FileManagerItemInfo item = e.Items[0];
                    ViewState["EditDocumentPath"] = item.PhysicalPath;

                    WeTextBoxFive.Text = ClassLibraryWeiBao.ClassWeiWeiXin.GetFileName(item.PhysicalPath);
                   //解析
                    TextMsgData CMsgData = new TextMsgData();
                    CMsgData.LoadFile(item.PhysicalPath);

                    WeTextBoxOne.Text = CMsgData.Content;
                    Label1.Text = "";
                    FileManager1.Visible = false;
                    TextEditor.Visible = true;
                }
            }
        }
Esempio n. 3
0
    /// <summary>
    /// 从 3个 系统关键词路径中寻找关键词匹配
    /// </summary>
    /// <param name="SysPath">系统路径</param>
    /// <param name="KeyWord">关键字</param>
    /// <param name="host">url基地址</param>
    /// <param name="timestr"> 时间戳</param>
    /// <returns></returns>
    public static RepMsgData GetMySetDataG(string SysPath, string KeyWord, string host , string timestr)
    {
        string NP_IMG = System.IO.Path.Combine(SysPath, "USER_DIR\\SYSUSER\\MyPost\\IMG\\" + KeyWord + ".dll");
        string NP_TXT = System.IO.Path.Combine(SysPath, "USER_DIR\\SYSUSER\\MyPost\\TXT\\" + KeyWord + ".dll");
        string NP_VOC = System.IO.Path.Combine(SysPath, "USER_DIR\\SYSUSER\\MyPost\\VOC\\" + KeyWord + ".dll");

        if (System.IO.File.Exists(NP_IMG))
        {
            TypeMsg = 1;
            NewsMsgData C = new NewsMsgData();

            C.LoadFile(NP_IMG);

            if (C.Items.Count == 1)
            {

                var X = C.Items[0];
                X.PicUrl = ClassLibraryWeiBao.ClassWeiWeiXin.GetUrlPath(X.PicUrl, host).Replace("<%ID%>", timestr).Replace("<%id%>", timestr);

                if (X.Url.Trim() == "")
                {
                    //生成一个指向 本关键词中设置的url
                    string URL = "cmd/tuwen.aspx?w=" + KeyWord + "&t=" + X.Title.Trim();

                    X.Url = ClassLibraryWeiBao.ClassWeiWeiXin.GetUrlPath(URL, host);
                }
                else
                {
                    X.Url = ClassLibraryWeiBao.ClassWeiWeiXin.GetUrlPath(X.Url, host).Replace("<%ID%>", timestr).Replace("<%id%>", timestr);
                }

                X.Description = ClassLibraryWeiBao.ClassWeiWeiXin.NoHTML(X.Description);

            }
            else
            {
                for (int i = 0; i < C.Items.Count; i++)
                {
                    var X = C.Items[i];
                    X.PicUrl = ClassLibraryWeiBao.ClassWeiWeiXin.GetUrlPath(X.PicUrl, host).Replace("<%ID%>", timestr).Replace("<%id%>", timestr);

                    if (X.Url.Trim() == "")
                    {
                        //生成一个指向 本关键词中设置的url
                        string URL = "cmd/tuwen.aspx?w=" + KeyWord + "&t=" + X.Title.Trim();

                        X.Url = ClassLibraryWeiBao.ClassWeiWeiXin.GetUrlPath(URL, host);
                    }
                    else
                    {
                        X.Url = ClassLibraryWeiBao.ClassWeiWeiXin.GetUrlPath(X.Url, host).Replace("<%ID%>", timestr).Replace("<%id%>", timestr);
                    }
                    X.Description = "";
                }
            }

            return C;
        }

        if (System.IO.File.Exists(NP_TXT))
        {
            TypeMsg = 2;
            TextMsgData C = new TextMsgData();
            C.LoadFile(NP_TXT);

            return C;
        }

        if (System.IO.File.Exists(NP_VOC))
        {
            TypeMsg = 3;
            MusicMsgData C = new MusicMsgData();
            C.LoadFile(NP_VOC);

            C.HQMusicUrl = ClassLibraryWeiBao.ClassWeiWeiXin.GetUrlPath(C.HQMusicUrl, host).Replace("<%ID%>", timestr).Replace("<%id%>", timestr);
            C.MusicUrl = ClassLibraryWeiBao.ClassWeiWeiXin.GetUrlPath(C.MusicUrl, host).Replace("<%ID%>", timestr).Replace("<%id%>", timestr);

            return C;
        }

        // TextMsgData XC = new TextMsgData();
        //XC.Content = "请输入正确关键字";
        return null;
    }