Example #1
0
 public void RemoveInvalidFilePaths()
 {
     Editors = Editors.Where(x => File.Exists(x.FilePath)).ToArray();
 }
Example #2
0
 private int GetEditor(Type editorType) => Editors.FindIndex((e) => e.GetType() == editorType);
Example #3
0
 public MoreConvs()
 {
     Editors.IfPropertyIs <DateTime>().AddClass("datepicker");
 }
Example #4
0
 public CustomHtmlConventions()
 {
     Displays.Builder <EnumRadioButtonListDisplay>();
     Editors.Builder <EnumRadioButtonListEditor>();
 }
Example #5
0
		/// <summary>
		/// Constructor
		/// </summary>
		/// <param name="cellValue"></param>
		/// <param name="pEditor"></param>
		public Cell(object cellValue, Editors.EditorBase pEditor):this(cellValue)
		{
			Editor = pEditor;
		}
Example #6
0
 /// <summary>Find out if a principal has a certain permission by default.</summary>
 /// <param name="user">The principal to check for allowance.</param>
 /// <param name="permission">The type of permission to map against.</param>
 /// <returns>True if the system is configured to allow the user to the given permission.</returns>
 public virtual bool IsAuthorized(IPrincipal user, Permission permission)
 {
     return((Administrators.MapsTo(permission) && Administrators.Contains(user)) ||
            (Editors.MapsTo(permission) && Editors.Contains(user)) ||
            (Writers.MapsTo(permission) && Writers.Contains(user)));
 }
        public static void AddEditor(Editors.IEditor editor, bool show)
        {
            OpenEditors.Add(editor);
            ToolsPane.PanelFiles.DocumentsListbox.Items.Add(editor);

            if (show)
                ChangeActiveEditor(editor);
        }
Example #8
0
 private void FButton_Click(object sender, EventArgs e)
 {
     Text = Editors.EditExpression(Report, Text);
     FTimer.Start();
 }
Example #9
0
        protected override void ShowPage()
        {
            if (config.Enablemall == 0) //未启用交易服务
            {
                AddErrLine("系统未开启交易服务, 当前页面暂时无法访问!");
                return;
            }
            else
            {
                goodscategoryfid = Discuz.Mall.GoodsCategories.GetGoodsCategoryWithFid();
            }

            headerad = "";
            footerad = "";
            floatad  = "";

            disablepostctrl = 0;

            // 如果商品ID无效
            if (goodsid == -1)
            {
                AddErrLine("无效的商品ID");
                return;
            }

            goodsinfo = Goods.GetGoodsInfo(goodsid);
            if (goodsinfo == null || goodsinfo.Closed > 1)
            {
                AddErrLine("不存在的商品ID");
                headerad = Advertisements.GetOneHeaderAd("", 0);
                footerad = Advertisements.GetOneFooterAd("", 0);
                floatad  = Advertisements.GetFloatAd("", 0);
                return;
            }

            UserInfo userinfo = Users.GetUserInfo(goodsinfo.Selleruid);

            if (userinfo != null)
            {
                joindate = Convert.ToDateTime(userinfo.Joindate).ToString("yyyy-MM-dd");
            }

            sb_usercredit       = GoodsUserCredits.GetUserCreditJsonData(goodsinfo.Selleruid);
            creditrulesjsondata = GoodsUserCredits.GetCreditRulesJsonData().ToString();

            if (config.Enablemall == 1) //开启普通模式
            {
                forumid = GoodsCategories.GetCategoriesFid(goodsinfo.Categoryid);
                forum   = Forums.GetForumInfo(forumid);
                if (forum == null)
                {
                    AddErrLine("当前商品所属分类未绑定相应版块");
                    return;
                }

                forumname = forum.Name;
                forumnav  = ForumUtils.UpdatePathListExtname(forum.Pathlist.Trim(), config.Extname);

                ///得到广告列表
                ///头部
                headerad = Advertisements.GetOneHeaderAd("", forumid);
                footerad = Advertisements.GetOneFooterAd("", forumid);
                doublead = Advertisements.GetDoubleAd("", forumid);
                floatad  = Advertisements.GetFloatAd("", forumid);

                // 检查是否具有版主的身份
                if (useradminid != 0)
                {
                    ismoder = Moderators.IsModer(useradminid, userid, forumid) ? 1 : 0;
                    //得到管理组信息
                    admininfo = AdminGroups.GetAdminGroupInfo(usergroupid);
                    if (admininfo != null)
                    {
                        disablepostctrl = admininfo.Disablepostctrl;
                    }
                }
            }
            goodscategoryinfo = GoodsCategories.GetGoodsCategoryInfoById(goodsinfo.Categoryid);
            pagetitle         = goodsinfo.Title;
            navhomemenu       = Caches.GetForumListMenuDivCache(usergroupid, userid, config.Extname);

            //验证不通过则返回
            if (!IsConditionsValid())
            {
                return;
            }

            //编辑器状态
            StringBuilder sb = new StringBuilder("var Allowhtml=1;\r\n");

            parseurloff = 0;
            bbcodeoff   = 1;
            if (config.Enablemall == 1) //开启普通模式
            {
                smileyoff = 1 - forum.Allowsmilies;

                if (forum.Allowbbcode == 1 && usergroupinfo.Allowcusbbcode == 1)
                {
                    bbcodeoff = 0;
                }

                allowimg = forum.Allowimgcode;
            }
            else if (config.Enablemall == 2) //当为高级模式时
            {
                if (usergroupinfo.Allowcusbbcode == 1)
                {
                    bbcodeoff = 0;
                }

                allowimg = 1;
            }

            sb.Append("var Allowsmilies=" + (1 - smileyoff) + ";\r\n");
            sb.Append("var Allowbbcode=" + (1 - bbcodeoff) + ";\r\n");
            usesig = ForumUtils.GetCookie("sigstatus") == "0" ? 0 : 1;
            sb.Append("var Allowimgcode=" + allowimg + ";\r\n");

            AddScript(sb.ToString());

            if (config.Enablemall == 2)
            {
                recommendgoodslist = Goods.GetGoodsRecommendList(goodsinfo.Selleruid, 6, 1,
                                                                 DbProvider.GetInstance().GetGoodsIdCondition((int)MallUtils.OperaCode.NoEuqal, goodsinfo.Goodsid));
            }

            smilietypes = Caches.GetSmilieTypesCache();

            if (newpmcount > 0)
            {
                pmlist     = PrivateMessages.GetPrivateMessageListForIndex(userid, 5, 1, 1);
                showpmhint = Convert.ToInt32(Users.GetShortUserInfo(userid).Newsletter) > 4;
            }


            // 得到pptradelog设置
            pptradelog = Utils.StrToInt(ForumUtils.GetCookie("ppp"), config.Ppp);
            if (pptradelog <= 0)
            {
                pptradelog = config.Ppp;
            }

            //快速发帖广告
            if (config.Enablemall == 1) //开启普通模式
            {
                quickeditorad = Advertisements.GetQuickEditorAD("", forumid);
            }

            //更新页面Meta中的Description项, 提高SEO友好性
            string metadescritpion = Utils.RemoveHtml(goodsinfo.Message);

            metadescritpion = metadescritpion.Length > 100 ? metadescritpion.Substring(0, 100) : metadescritpion;
            UpdateMetaInfo(config.Seokeywords, metadescritpion, config.Seohead);

            GoodspramsInfo goodspramsInfo = new GoodspramsInfo();

            goodspramsInfo.Goodsid = goodsinfo.Goodsid;

            if (config.Enablemall == 1) //开启普通模式
            {
                goodspramsInfo.Fid           = forum.Fid;
                goodspramsInfo.Jammer        = forum.Jammer;
                goodspramsInfo.Getattachperm = forum.Getattachperm;
                goodspramsInfo.Showimages    = forum.Allowimgcode;
            }
            else if (config.Enablemall == 2) //当为高级模式时
            {
                goodspramsInfo.Jammer        = 0;
                goodspramsInfo.Getattachperm = "";
                goodspramsInfo.Showimages    = 1;
            }
            goodspramsInfo.Pageindex          = pageid;
            goodspramsInfo.Usergroupid        = usergroupid;
            goodspramsInfo.Attachimgpost      = config.Attachimgpost;
            goodspramsInfo.Showattachmentpath = config.Showattachmentpath;
            goodspramsInfo.Hide  = 0;
            goodspramsInfo.Price = 0;
            goodspramsInfo.Usergroupreadaccess = usergroupinfo.Readaccess;

            if (ismoder == 1)
            {
                goodspramsInfo.Usergroupreadaccess = int.MaxValue;
            }

            goodspramsInfo.CurrentUserid          = userid;
            goodspramsInfo.Smiliesinfo            = Smilies.GetSmiliesListWithInfo();
            goodspramsInfo.Customeditorbuttoninfo = Editors.GetCustomEditButtonListWithInfo();
            goodspramsInfo.Smiliesmax             = config.Smiliesmax;
            goodspramsInfo.Bbcodemode             = config.Bbcodemode;
            goodspramsInfo.CurrentUserGroup       = usergroupinfo;
            goodspramsInfo.Sdetail     = goodsinfo.Message;
            goodspramsInfo.Smileyoff   = goodsinfo.Smileyoff;
            goodspramsInfo.Bbcodeoff   = goodsinfo.Bbcodeoff;
            goodspramsInfo.Parseurloff = goodsinfo.Parseurloff;
            goodspramsInfo.Allowhtml   = 1;
            goodspramsInfo.Sdetail     = goodsinfo.Message;

            message = Goods.MessgeTranfer(goodspramsInfo, GoodsAttachments.GetGoodsAttachmentsByGoodsid(goodsinfo.Goodsid));

            forumlistboxoptions = Caches.GetForumListBoxOptionsCache();
            tradecount          = TradeLogs.GetGoodsTradeLogCount(goodsid);
            leavewordcount      = GoodsLeaveWords.GetGoodsLeaveWordCount(goodsid);
            pptradelog          = 16;

            ForumUtils.WriteCookie("referer", string.Format(base.ShowGoodsAspxRewrite(goodsinfo.Goodsid)));

            if (config.Enablemall == 1) //开启普通模式
            {
                ForumUtils.UpdateVisitedForumsOptions(forumid);
            }

            visitedforumsoptions = ForumUtils.GetVisitedForumsOptions(config.Visitedforums);

            //删除留言
            if (DNTRequest.GetInt("deleteleaveword", 0) == 1)
            {
                isdeleteop = true;
                int leavewordid = DNTRequest.GetInt("leavewordid", 0);

                if (leavewordid <= 0)
                {
                    AddErrLine("您要删除的留言已被删除, 现在转入商品页面");
                    return;
                }
                if (GoodsLeaveWords.DeleteLeaveWordById(leavewordid, userid, goodsinfo.Selleruid, useradminid))
                {
                    SetUrl(base.ShowGoodsAspxRewrite(goodsinfo.Goodsid));
                    SetMetaRefresh();
                    AddMsgLine("该留言已被删除, 现在转入商品页面<br />(<a href=\"" + base.ShowGoodsAspxRewrite(goodsinfo.Goodsid) + "\">如果您的浏览器没有自动跳转, 请点击这里</a>)<br />");
                    return;
                }
                else
                {
                    AddErrLine("您的用户身份无效删除该留言, 现在转入商品页面");
                    return;
                }
            }

            //删除商品
            if (DNTRequest.GetInt("deletegoods", 0) == 1)
            {
                isdeleteop = true;
                //是否为卖家或版主
                if (Goods.IsSeller(goodsinfo.Goodsid.ToString(), userid) || ismoder == 1)
                {
                    Goods.DeleteGoods(goodsinfo.Goodsid.ToString(), false);

                    SetUrl(this.ShowGoodsListAspxRewrite(goodsinfo.Categoryid, 1));
                    SetMetaRefresh();
                    AddMsgLine("操作成功. <br />(<a href=\"" + this.ShowGoodsListAspxRewrite(goodsinfo.Categoryid, 1) + "\">点击这里返回</a>)<br />");
                    return;
                }
                else
                {
                    AddErrLine("你不是当前商品的卖家或版主,因此无法删除该商品");
                    return;
                }
            }


            //如果是提交
            if (ispost)
            {
                //如果不是提交...
                if (ForumUtils.IsCrossSitePost())
                {
                    AddErrLine("您的请求来路不正确,无法提交。如果您安装了某种默认屏蔽来路信息的个人防火墙软件(如 Norton Internet Security),请设置其不要禁止来路信息后再试。");
                    return;
                }

                if (DNTRequest.GetString("postleaveword") == "add")
                {
                    //当验证密码正确后,则发送相应留言
                    Goodsleavewordinfo goodsleavewordinfo = new Goodsleavewordinfo();
                    goodsleavewordinfo.Ip         = DNTRequest.GetIP();
                    goodsleavewordinfo.Goodsid    = goodsinfo.Goodsid;
                    goodsleavewordinfo.Tradelogid = 0;
                    goodsleavewordinfo.Uid        = userid;
                    goodsleavewordinfo.Username   = username;
                    goodsleavewordinfo.Message    = DNTRequest.GetString("message");
                    goodsleavewordinfo.Isbuyer    = goodsinfo.Selleruid != userid ? 1 : 0;
                    if (GoodsLeaveWords.CreateLeaveWord(goodsleavewordinfo, goodsinfo.Selleruid, DNTRequest.GetString("sendnotice") == "on" ? true : false) > 0)
                    {
                        SetUrl(base.ShowGoodsAspxRewrite(goodsinfo.Goodsid));
                        SetMetaRefresh();
                        AddMsgLine("您的留言已发布, 现在转入商品页面<br />(<a href=\"" + base.ShowGoodsAspxRewrite(goodsinfo.Goodsid) + "\">如果您的浏览器没有自动跳转, 请点击这里</a>)<br />");
                    }
                }
                else
                {
                    //当验证密码正确后,则发送相应留言
                    Goodsleavewordinfo goodsleavewordinfo = GoodsLeaveWords.GetGoodsLeaveWordById(DNTRequest.GetInt("leavewordid", 0));
                    if (goodsleavewordinfo != null && goodsleavewordinfo.Id > 0)
                    {
                        goodsleavewordinfo.Ip           = DNTRequest.GetIP();
                        goodsleavewordinfo.Uid          = userid;
                        goodsleavewordinfo.Username     = username;
                        goodsleavewordinfo.Message      = DNTRequest.GetString("message");
                        goodsleavewordinfo.Postdatetime = DateTime.Now;
                        if (GoodsLeaveWords.UpdateLeaveWord(goodsleavewordinfo))
                        {
                            SetUrl(base.ShowGoodsAspxRewrite(goodsinfo.Goodsid));
                            SetMetaRefresh();
                            AddMsgLine("留言更新成功, 现在转入商品页面<br />(<a href=\"" + base.ShowGoodsAspxRewrite(goodsinfo.Goodsid) + "\">如果您的浏览器没有自动跳转, 请点击这里</a>)<br />");
                        }
                    }
                    else
                    {
                        AddErrLine("当前留言不存在或已被删除");
                        return;
                    }
                }
            }
            else
            {
                goodsinfo.Viewcount += 1; //浏览量加1
                Goods.UpdateGoods(goodsinfo);
            }
        }
Example #10
0
 public SampleHtmlConventions()
 {
     Editors.IfPropertyIs <int>().Modify(tag => tag.AddClass("number"));
 }
Example #11
0
        /// <summary>
        /// 创建新用户
        /// </summary>
        /// <param name="userName"></param>
        /// <param name="email"></param>
        /// <param name="birthday"></param>
        /// <returns></returns>
        private UserInfo CreateUser(string userName, string email, string birthday)
        {
            UserInfo userInfo = new UserInfo();

            userInfo.Username      = userName;
            userInfo.Email         = email;
            userInfo.Bday          = birthday;
            userInfo.Nickname      = Utils.HtmlEncode(ForumUtils.BanWordFilter(DNTRequest.GetString("nickname")));
            userInfo.Password      = Utils.MD5(ForumUtils.CreateAuthStr(16));
            userInfo.Secques       = "";
            userInfo.Gender        = DNTRequest.GetInt("gender", 0);
            userInfo.Adminid       = 0;
            userInfo.Groupexpiry   = 0;
            userInfo.Extgroupids   = "";
            userInfo.Regip         = userInfo.Lastip = DNTRequest.GetIP();
            userInfo.Joindate      = userInfo.Lastvisit = userInfo.Lastactivity = userInfo.Lastpost = Utils.GetDateTime();
            userInfo.Lastpostid    = 0;
            userInfo.Lastposttitle = "";
            userInfo.Posts         = 0;
            userInfo.Digestposts   = 0;
            userInfo.Oltime        = 0;
            userInfo.Pageviews     = 0;
            userInfo.Credits       = 0;
            userInfo.Extcredits1   = Scoresets.GetScoreSet(1).Init;
            userInfo.Extcredits2   = Scoresets.GetScoreSet(2).Init;
            userInfo.Extcredits3   = Scoresets.GetScoreSet(3).Init;
            userInfo.Extcredits4   = Scoresets.GetScoreSet(4).Init;
            userInfo.Extcredits5   = Scoresets.GetScoreSet(5).Init;
            userInfo.Extcredits6   = Scoresets.GetScoreSet(6).Init;
            userInfo.Extcredits7   = Scoresets.GetScoreSet(7).Init;
            userInfo.Extcredits8   = Scoresets.GetScoreSet(8).Init;

            userInfo.Sigstatus  = DNTRequest.GetInt("sigstatus", 1) != 0 ? 1 : 0;
            userInfo.Tpp        = DNTRequest.GetInt("tpp", 0);
            userInfo.Ppp        = DNTRequest.GetInt("ppp", 0);
            userInfo.Templateid = DNTRequest.GetInt("templateid", 0);
            userInfo.Pmsound    = DNTRequest.GetInt("pmsound", 0);
            userInfo.Showemail  = DNTRequest.GetInt("showemail", 0);
            userInfo.Salt       = "";

            int receivepmsetting = config.Regadvance == 0 ? 3 : DNTRequest.GetInt("receivesetting", 3);//关于短信息枚举值的设置看ReceivePMSettingType类型注释,此处不禁止用户接受系统短信息

            userInfo.Newsletter   = (ReceivePMSettingType)receivepmsetting;
            userInfo.Invisible    = DNTRequest.GetInt("invisible", 0);
            userInfo.Newpm        = config.Welcomemsg == 1 ? 1 : 0;
            userInfo.Medals       = "";
            userInfo.Accessmasks  = DNTRequest.GetInt("accessmasks", 0);
            userInfo.Website      = DNTRequest.GetHtmlEncodeString("website");
            userInfo.Icq          = DNTRequest.GetHtmlEncodeString("icq");
            userInfo.Qq           = DNTRequest.GetHtmlEncodeString("qq");
            userInfo.Yahoo        = DNTRequest.GetHtmlEncodeString("yahoo");
            userInfo.Msn          = DNTRequest.GetHtmlEncodeString("msn");
            userInfo.Skype        = DNTRequest.GetHtmlEncodeString("skype");
            userInfo.Location     = DNTRequest.GetHtmlEncodeString("location");
            userInfo.Customstatus = (usergroupinfo.Allowcstatus == 1) ? DNTRequest.GetHtmlEncodeString("customstatus") : "";
            userInfo.Bio          = ForumUtils.BanWordFilter(DNTRequest.GetString("bio"));
            userInfo.Signature    = Utils.HtmlEncode(ForumUtils.BanWordFilter(DNTRequest.GetString("signature")));

            PostpramsInfo postpramsinfo = new PostpramsInfo();

            postpramsinfo.Usergroupid        = usergroupid;
            postpramsinfo.Attachimgpost      = config.Attachimgpost;
            postpramsinfo.Showattachmentpath = config.Showattachmentpath;
            postpramsinfo.Hide                   = 0;
            postpramsinfo.Price                  = 0;
            postpramsinfo.Sdetail                = userInfo.Signature;
            postpramsinfo.Smileyoff              = 1;
            postpramsinfo.Bbcodeoff              = 1 - usergroupinfo.Allowsigbbcode;
            postpramsinfo.Parseurloff            = 1;
            postpramsinfo.Showimages             = usergroupinfo.Allowsigimgcode;
            postpramsinfo.Allowhtml              = 0;
            postpramsinfo.Smiliesinfo            = Smilies.GetSmiliesListWithInfo();
            postpramsinfo.Customeditorbuttoninfo = Editors.GetCustomEditButtonListWithInfo();
            postpramsinfo.Smiliesmax             = config.Smiliesmax;
            userInfo.Sightml  = UBB.UBBToHTML(postpramsinfo);
            userInfo.Authtime = Utils.GetDateTime();
            userInfo.Realname = DNTRequest.GetString("realname");
            userInfo.Idcard   = DNTRequest.GetString("idcard");
            userInfo.Mobile   = DNTRequest.GetString("mobile");
            userInfo.Phone    = DNTRequest.GetString("phone");

            //系统管理员进行后台验证
            if (config.Regverify == 2)
            {
                userInfo.Authstr  = DNTRequest.GetString("website");
                userInfo.Groupid  = 8;
                userInfo.Authflag = 1;
            }
            else
            {
                userInfo.Authstr  = "";
                userInfo.Authflag = 0;
                userInfo.Groupid  = CreditsFacade.GetCreditsUserGroupId(0).Groupid;
            }
            userInfo.Uid = Users.CreateUser(userInfo);
            return(userInfo);
        }
Example #12
0
		private void ShowDialogEditor(CollectionItemValue value, Editors.Editor editor)
		{
			// TODO: Finish DialogTemplate implementation
			
			value.Value = editor.ShowDialog(value.ParentProperty, value.Value, this);
			
		}
        public void Reload()
        {
            this.ProjectName = MainForm.CurrentProject.Name;

            try
            {
                if (!ModuleHandler.Exists(ProjectName))
                {
                    ModuleHandler = ModuleHandler.CreateNew(ProjectName, string.Empty, this.Node);
                }
                else
                {
                    ModuleHandler = new ModuleHandler(this.Node, MainForm.CurrentProject.Name);
                }
            }
            catch (Exception ex)
            {
                string msg = ex.Message;

                string err = "檔案管理服務無法使用({0})";
                if (!ProjectHandler.ValidName(ProjectName))
                {
                    this.Node.Text = string.Format(err, "專案名稱含有不合法字元");
                }
                else
                {
                    Regex reg = new Regex("ischool.dsa.exception.DSAServiceException: (.*)\n");
                    Match m   = reg.Match(msg);
                    if (m.Success)
                    {
                        this.Node.Text = string.Format(err, m.Groups[1].Value);
                    }
                    else
                    {
                        this.Node.Text = string.Format(err, "檔案管理服務初始化失敗");
                    }
                    this.Node.ToolTipText = ex.Message;
                }

                this.Editors = new List <IEditable>();
                return;
            }

            //ModuleHandler.StatusChanged += new EventHandler<ModuleStatusEventArgs>(ModuleHandler_StatusChanged);
            if (this.Editors == null)
            {
                this.Editors = new List <IEditable>();
                FileEditable edit = new FileEditable(this);

                Editors.Add(edit);
                this.CurrentEditor = edit;
            }
            else
            {
                FileEditable fe = CurrentEditor as FileEditable;
                FileUIEditor ui = fe.Editor as FileUIEditor;
                ui.Reload();
            }

            if (Directory.Exists(ModuleHandler.LocalPath))
            {
                this.Node.Text = "檔案管理 ( 本機路徑 : " + ModuleHandler.LocalPath + " )";
            }
            else
            {
                this.Node.Text = "檔案管理 ( 本機路徑不存在 : " + ModuleHandler.LocalPath + " )";
            }

            ModuleHandler.CheckItemStatus();
        }
Example #14
0
        public EditorSettings GetSettings(Editors.Editors editor)
        {
            switch (editor)
            {
                case Editors.Editors.Console:
                    return ConsoleEditor;
                case Editors.Editors.GameObject:
                    return EntityEditor;
                case Editors.Editors.Scene:
                    return GameScreenEditor;
                //case Editors.Editors.GUI:
                //    return GameScreenEditor;
                default:
                    break;
            }

            return GameScreenEditor;
        }
Example #15
0
        private async Task <IReadOnlyDictionary <IAssemblyInfo, ILookup <string, ITypeInfo> > > GetAssignableTypesAsync()
        {
            AssignableTypesResult result = await Editors.GetCommonAssignableTypes(Property, childTypes : false).ConfigureAwait(false);

            return(result.GetTypeTree());
        }
Example #16
0
            /// <summary>
            /// Determines whether the <see cref="EditorDictionary"/> contains
            /// the specified file path key.
            /// </summary>
            /// <param name="key">
            /// The file path key to locate in the <see cref="
            /// EditorDictionary"/>.
            /// </param>
            /// <returns>
            /// <see langword="true"/> if the <see cref=" EditorDictionary"/>
            /// contains an element with the specified file path key, otherwise
            /// <see langword=" false"/>.
            /// </returns>
            /// <exception cref="ArgumentException">
            /// <paramref name="key"/> is a zero-length string, contains only
            /// whitespace, or contains one or more of the invalid characters
            /// defined in <see cref=" GetInvalidPathChars"/>.
            /// <para/>
            /// -or-
            /// <para/>
            /// The system could not retrieve the absolute path.
            /// </exception>
            /// <exception cref="System.Security.SecurityException">
            /// The caller does not have the required permissions.
            /// </exception>
            /// <exception cref="ArgumentNullException">
            /// <paramref name="key"/> is <see langword="null"/>.
            /// </exception>
            /// <exception cref="NotSupportedException">
            /// <paramref name="key"/> contains a colon (":") that is not part
            /// of a volume identifier (for example, "c:\").
            /// </exception>
            /// <exception cref="System.IO.PathTooLongException">
            /// The specified path, file name, or both exceed the
            /// system-defined maximum length.
            /// </exception>
            public bool ContainsKey(string key)
            {
                var actualKey = GetFullPath(key);

                return(Editors.ContainsKey(actualKey));
            }
Example #17
0
        /// <summary>
        /// 创建用户信息
        /// </summary>
        /// <param name="tmpUsername"></param>
        /// <param name="email"></param>
        /// <param name="tmpBday"></param>
        /// <returns></returns>
        private UserInfo CreateUser(string tmpUsername, string email, string tmpBday)
        {
            // 如果找不到0积分的用户组则用户自动成为待验证用户
            UserInfo userinfo = new UserInfo();

            userinfo.Username      = tmpUsername;
            userinfo.Nickname      = Utils.HtmlEncode(ForumUtils.BanWordFilter(DNTRequest.GetString("nickname")));
            userinfo.Password      = DNTRequest.GetString("password");
            userinfo.Secques       = ForumUtils.GetUserSecques(DNTRequest.GetInt("question", 0), DNTRequest.GetString("answer"));
            userinfo.Gender        = DNTRequest.GetInt("gender", 0);
            userinfo.Adminid       = 0;
            userinfo.Groupexpiry   = 0;
            userinfo.Extgroupids   = "";
            userinfo.Regip         = DNTRequest.GetIP();
            userinfo.Joindate      = Utils.GetDateTime();
            userinfo.Lastip        = DNTRequest.GetIP();
            userinfo.Lastvisit     = Utils.GetDateTime();
            userinfo.Lastactivity  = Utils.GetDateTime();
            userinfo.Lastpost      = Utils.GetDateTime();
            userinfo.Lastpostid    = 0;
            userinfo.Lastposttitle = "";
            userinfo.Posts         = 0;
            userinfo.Digestposts   = 0;
            userinfo.Oltime        = 0;
            userinfo.Pageviews     = 0;
            userinfo.Credits       = 0;
            userinfo.Extcredits1   = Scoresets.GetScoreSet(1).Init;
            userinfo.Extcredits2   = Scoresets.GetScoreSet(2).Init;
            userinfo.Extcredits3   = Scoresets.GetScoreSet(3).Init;
            userinfo.Extcredits4   = Scoresets.GetScoreSet(4).Init;
            userinfo.Extcredits5   = Scoresets.GetScoreSet(5).Init;
            userinfo.Extcredits6   = Scoresets.GetScoreSet(6).Init;
            userinfo.Extcredits7   = Scoresets.GetScoreSet(7).Init;
            userinfo.Extcredits8   = Scoresets.GetScoreSet(8).Init;
            //userinfo.Avatarshowid = 0;
            userinfo.Email      = email;
            userinfo.Bday       = tmpBday;
            userinfo.Sigstatus  = DNTRequest.GetInt("sigstatus", 1) != 0 ? 1 : 0;
            userinfo.Tpp        = DNTRequest.GetInt("tpp", 0);
            userinfo.Ppp        = DNTRequest.GetInt("ppp", 0);
            userinfo.Templateid = DNTRequest.GetInt("templateid", 0);
            userinfo.Pmsound    = DNTRequest.GetInt("pmsound", 0);
            userinfo.Showemail  = DNTRequest.GetInt("showemail", 0);
            userinfo.Salt       = "";

            int receivepmsetting = config.Regadvance == 0 ? 3 : DNTRequest.GetInt("receivesetting", 3);//关于短信息枚举值的设置看ReceivePMSettingType类型注释,此处不禁止用户接受系统短信息

            //foreach (string rpms in DNTRequest.GetString("receivesetting").Split(','))
            //{
            //    if (!Utils.StrIsNullOrEmpty(rpms))
            //        receivepmsetting = receivepmsetting | int.Parse(rpms);
            //}

            //if (config.Regadvance == 0)
            //    receivepmsetting = 7;

            userinfo.Newsletter   = (ReceivePMSettingType)receivepmsetting;
            userinfo.Invisible    = DNTRequest.GetInt("invisible", 0);
            userinfo.Newpm        = config.Welcomemsg == 1 ? 1 : 0;
            userinfo.Medals       = "";
            userinfo.Accessmasks  = DNTRequest.GetInt("accessmasks", 0);
            userinfo.Website      = Utils.HtmlEncode(DNTRequest.GetString("website"));
            userinfo.Icq          = Utils.HtmlEncode(DNTRequest.GetString("icq"));
            userinfo.Qq           = Utils.HtmlEncode(DNTRequest.GetString("qq"));
            userinfo.Yahoo        = Utils.HtmlEncode(DNTRequest.GetString("yahoo"));
            userinfo.Msn          = Utils.HtmlEncode(DNTRequest.GetString("msn"));
            userinfo.Skype        = Utils.HtmlEncode(DNTRequest.GetString("skype"));
            userinfo.Location     = Utils.HtmlEncode(DNTRequest.GetString("location"));
            userinfo.Customstatus = (usergroupinfo.Allowcstatus == 1) ? Utils.HtmlEncode(DNTRequest.GetString("customstatus")) : "";
            //userinfo.Avatar = @"avatars\common\0.gif";
            //userinfo.Avatarwidth = 0;
            //userinfo.Avatarheight = 0;
            userinfo.Bio       = ForumUtils.BanWordFilter(DNTRequest.GetString("bio"));
            userinfo.Signature = Utils.HtmlEncode(ForumUtils.BanWordFilter(DNTRequest.GetString("signature")));

            PostpramsInfo postpramsinfo = new PostpramsInfo();

            postpramsinfo.Usergroupid        = usergroupid;
            postpramsinfo.Attachimgpost      = config.Attachimgpost;
            postpramsinfo.Showattachmentpath = config.Showattachmentpath;
            postpramsinfo.Hide                   = 0;
            postpramsinfo.Price                  = 0;
            postpramsinfo.Sdetail                = userinfo.Signature;
            postpramsinfo.Smileyoff              = 1;
            postpramsinfo.Bbcodeoff              = 1 - usergroupinfo.Allowsigbbcode;
            postpramsinfo.Parseurloff            = 1;
            postpramsinfo.Showimages             = usergroupinfo.Allowsigimgcode;
            postpramsinfo.Allowhtml              = 0;
            postpramsinfo.Smiliesinfo            = Smilies.GetSmiliesListWithInfo();
            postpramsinfo.Customeditorbuttoninfo = Editors.GetCustomEditButtonListWithInfo();
            postpramsinfo.Smiliesmax             = config.Smiliesmax;
            userinfo.Sightml = UBB.UBBToHTML(postpramsinfo);

            userinfo.Authtime = Utils.GetDateTime();

            //邮箱激活链接验证
            if (config.Regverify == 1)
            {
                userinfo.Authstr  = ForumUtils.CreateAuthStr(20);
                userinfo.Authflag = 1;
                userinfo.Groupid  = 8;
                SendEmail(tmpUsername, DNTRequest.GetString("password").Trim(), DNTRequest.GetString(config.Antispamregisteremail).Trim(), userinfo.Authstr);
            }
            //系统管理员进行后台验证
            else if (config.Regverify == 2)
            {
                userinfo.Authstr  = DNTRequest.GetString("website");
                userinfo.Groupid  = 8;
                userinfo.Authflag = 1;
            }
            else
            {
                userinfo.Authstr  = "";
                userinfo.Authflag = 0;
                userinfo.Groupid  = UserCredits.GetCreditsUserGroupId(0).Groupid;
            }
            userinfo.Realname = DNTRequest.GetString("realname");
            userinfo.Idcard   = DNTRequest.GetString("idcard");
            userinfo.Mobile   = DNTRequest.GetString("mobile");
            userinfo.Phone    = DNTRequest.GetString("phone");

            //第三方加密验证模式
            if (config.Passwordmode > 1 && PasswordModeProvider.GetInstance() != null)
            {
                userinfo.Uid = PasswordModeProvider.GetInstance().CreateUserInfo(userinfo);
            }
            else
            {
                userinfo.Password = Utils.MD5(userinfo.Password);
                userinfo.Uid      = Users.CreateUser(userinfo);
            }
            return(userinfo);
        }
Example #18
0
 /// <summary>
 /// Returns an enumerator that enumerates through the <see
 /// cref="EditorDictionary"/>.
 /// </summary>
 /// <returns>
 /// A <see cref="Dictionary{TKey, TValue}.Enumerator"/> for the
 /// <see cref="EditorDictionary"/>.
 /// </returns>
 public Dictionary <string, IEditor> .Enumerator GetEnumerator()
 {
     return(Editors.GetEnumerator());
 }
Example #19
0
		/// <summary>
		/// Exchanges data with a StringId field control
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="args"></param>
		public override void DoDataExchange(object sender, Editors.DoDataExchangeEventArgs args)
		{
			if (args.IsPolling) { }
			else { }
		}
Example #20
0
        private void UpdateGui()
        {
            this.InvokeIfRequired(() =>
            {
                if (!IsDeviceConnected)
                {
                    _receivingData = false;
                }

                pictureBoxStatus.Image = IsDeviceConnected ? Resources.connected : Resources.disconnected;

                if (_sending)
                {
                    labelStatusSubtitle.Text = String.IsNullOrEmpty(_sendingStatus)
                        ? Resources.StatusSending
                        : _sendingStatus;
                }
                else
                {
                    labelStatusSubtitle.Text = IsDeviceConnected
                        ? Resources.StatusConnected +
                                               (_receivingData ? Environment.NewLine + Environment.NewLine +
                                                (_receivedData.Count > 0
                                    ? String.Format(Resources.StatusReceived, GetKilobytes(_receivedData.Count), 1)
                                    : Resources.StatusWaiting)
                              : "")
                        : Resources.StatusNotConnected;
                }

                if (!IsBusy)
                {
                    IsBusy = _receivedData.Count > 0;
                }

                buttonReceive.Enabled                  = IsDeviceConnected && !IsBusy;
                buttonReceive.Text                     = _receivingData? "&Cancel" : "&Receive";
                receiveToolStripMenuItem.Enabled       = buttonReceive.Enabled && !_receivingData;
                cancelReceiveToolStripMenuItem.Enabled = _receivingData;

                var canSend = IsDeviceConnected && !IsBusy;

                buttonSend.Text  = canSend ? "&Send..." : "&Open...";
                buttonSend.Image = canSend ? Resources.editor_send_to_device : Resources.editor_open;
                sendFileToolStripMenuItemopenToolStripMenuItemContextual.Visible = canSend;
                sendFileToolStripSeparator.Visible               = canSend;
                sendFilesToolStripMenuItem.Enabled               = canSend;
                sendClipboardToolStripMenuItem.Enabled           = canSend;
                sendClipboardToolStripMenuItemContextual.Visible = canSend;

                buttonCaptureScreen.Enabled            = IsDeviceConnected && !IsBusy;
                captureScreenToolStripMenuItem.Enabled = buttonCaptureScreen.Enabled;

                if (Editors != null)
                {
                    foreach (var n in Editors.Where(ed => !ed.IsDisposed))
                    {
                        n.UpdateGui();
                    }
                }

                if (_receivingData == false)
                {
                    if (_receivedFile != null && _receivedFile.IsComplete)
                    {
                        saveFileDialogProgram.FileName = _receivedFile.Name + ".hpprgm";
                        if (saveFileDialogProgram.ShowDialog() == DialogResult.OK)
                        {
                            _receivedFile.Save(saveFileDialogProgram.FileName);
                        }

                        ResetProgram();
                    }
                }
            });
        }
        public static void RemoveEditor(Editors.IEditor editor)
        {
            ToolsPane.PanelFiles.DocumentsListbox.Items.Remove(editor);
            editor.OnClosed();
            OpenEditors.Remove(editor);

            if (OpenEditors.Count == 0)
                ShowStartup();
            else
                ChangeActiveEditor(OpenEditors[0]);
        }
Example #22
0
 private int CountActiveEditors()
 {
     return(Editors == null ? 0 : Editors.Count(n => n != null && !n.IsDisposed && !n.IsClosed));
 }
        public LandscapeBackgroundDoF()
        {
            Name = "LandscapeBackgroundDoF";

            var radialGradient = new RadialGradient(new Point(0.5, 0.3), new EllipseRadius(0.2, 0.4))
            {
                Stops = new [] {
                    new GradientStop()
                    {
                        Color = foreground, Offset = 0
                    },
                    new GradientStop()
                    {
                        Color = foreground, Offset = 0.5
                    },
                    new GradientStop()
                    {
                        Color = background, Offset = 0.51
                    },
                    new GradientStop()
                    {
                        Color = background, Offset = 0.9
                    }
                }
            };

            m_scribbles = new GradientImageSource(new Size(500, 500), radialGradient);

            //Editors.Add(new EnumEditorViewModel<LandscapeBackgroundDoF, DepthOfFieldQuality>("Quality", this, (effect) =>
            //{
            //    if (effect.m_effectEffect == null) return DepthOfFieldQuality.Preview;
            //    return effect.m_effectEffect.Quality;
            //}, (effect, value) =>
            //{
            //    if (effect.m_effectEffect == null)
            //        return;
            //    effect.m_effectEffect.Quality = value;
            //}));

            Editors.Add(new RangeEditorViewModelEx <LandscapeBackgroundDoF>("Strength above horizon", 0, 1.0, this, (effect) =>
            {
                if (effect.m_effectEffect == null)
                {
                    return(1.0);
                }
                return(effect.m_effectEffect.StrengthAboveHorizon);
            }, (effect, value) =>
            {
                if (effect.m_effectEffect == null)
                {
                    return;
                }
                effect.m_effectEffect.StrengthAboveHorizon = value;
            }));

            Editors.Add(new RangeEditorViewModelEx <LandscapeBackgroundDoF>("Strength below horizon", 0, 1.0, this, (effect) =>
            {
                if (effect.m_effectEffect == null)
                {
                    return(1.0);
                }
                return(effect.m_effectEffect.StrengthBelowHorizon);
            }, (effect, value) =>
            {
                if (effect.m_effectEffect == null)
                {
                    return;
                }
                effect.m_effectEffect.StrengthBelowHorizon = value;
            }));
        }
Example #24
0
        /// <summary>
        /// 获取帖子信息
        /// </summary>
        /// <param name="dt"></param>
        public void GetPostInfo(DataTable dt)
        {
            if (dt != null)
            {
                if (dt.Rows.Count > 0)
                {
                    isexist = true;
                    PostpramsInfo _postpramsinfo = new PostpramsInfo();
                    _postpramsinfo.Fid                    = Convert.ToInt32(dt.Rows[0]["fid"].ToString());
                    _postpramsinfo.Tid                    = Convert.ToInt32(dt.Rows[0]["tid"].ToString());
                    _postpramsinfo.Pid                    = Convert.ToInt32(dt.Rows[0]["pid"].ToString());
                    _postpramsinfo.Jammer                 = 1;
                    _postpramsinfo.Attachimgpost          = config.Attachimgpost;
                    _postpramsinfo.Showattachmentpath     = 1;
                    _postpramsinfo.Showimages             = 1;
                    _postpramsinfo.Smiliesinfo            = Smilies.GetSmiliesListWithInfo();
                    _postpramsinfo.Customeditorbuttoninfo = Editors.GetCustomEditButtonListWithInfo();
                    _postpramsinfo.Smiliesmax             = config.Smiliesmax;
                    _postpramsinfo.Bbcodemode             = config.Bbcodemode;

                    _postpramsinfo.Smileyoff   = Utils.StrToInt(dt.Rows[0]["smileyoff"], 0);
                    _postpramsinfo.Bbcodeoff   = Utils.StrToInt(dt.Rows[0]["bbcodeoff"], 0);
                    _postpramsinfo.Parseurloff = Utils.StrToInt(dt.Rows[0]["parseurloff"], 0);
                    _postpramsinfo.Allowhtml   = Utils.StrToInt(dt.Rows[0]["htmlon"], 0);
                    _postpramsinfo.Sdetail     = dt.Rows[0]["message"].ToString();

                    message = dt.Rows[0]["message"].ToString();

                    //是不是加干扰码
                    if (_postpramsinfo.Jammer == 1)
                    {
                        message = ForumUtils.AddJammer(message);
                    }

                    _postpramsinfo.Sdetail = message;

                    if (!_postpramsinfo.Ubbmode)
                    {
                        message = UBB.UBBToHTML(_postpramsinfo);
                    }
                    else
                    {
                        message = Utils.HtmlEncode(message);
                    }

                    #region 附件

                    // 处理上传图片图文混排问题
                    if (dt.Rows[0]["attachment"].ToString().Equals("1") || new Regex(@"\[attach\](\d+?)\[\/attach\]", RegexOptions.IgnoreCase).IsMatch(message))
                    {
                        DataTable dtAttachment = DatabaseProvider.GetInstance().GetAttachmentsByPid(Utils.StrToInt(dt.Rows[0]["pid"], 0));
                        dtAttachment.Columns.Add("attachimgpost", Type.GetType("System.Int16"));

                        string replacement = "";
                        string filesize    = "";

                        foreach (DataRow drAt in dtAttachment.Rows)
                        {
                            if (message.IndexOf("[attach]" + drAt["aid"].ToString() + "[/attach]") != -1)
                            {
                                if (Convert.ToInt64(drAt["filesize"]) > 1024)
                                {
                                    filesize = Convert.ToString(Math.Round(Convert.ToDecimal(drAt["filesize"]) / 1024, 2)) + " K";
                                }
                                else
                                {
                                    filesize = drAt["filesize"].ToString() + " B";
                                }

                                if (Utils.IsImgFilename(drAt["attachment"].ToString().Trim()))
                                {
                                    drAt["attachimgpost"] = 1;

                                    if (_postpramsinfo.Showattachmentpath == 1)
                                    {
                                        replacement = "<img src=\"../../upload/" + drAt["filename"].ToString() + "\" onload=\"if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='点击在新窗口浏览图片 CTRL+鼠标滚轮可放大/缩小';}\" onmouseover=\"if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='点击在新窗口浏览图片 CTRL+Mouse 滚轮可放大/缩小';}\" onclick=\"if(!this.resized) { return true; } else { window.open(this.src); }\" onmousewheel=\"return imgzoom(this);\" />";
                                    }
                                    else
                                    {
                                        replacement = "<img src=\"../../attachment.aspx?attachmentid=" + drAt["aid"].ToString() + "\" onload=\"if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='点击在新窗口浏览图片 CTRL+鼠标滚轮可放大/缩小';}\" onmouseover=\"if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='点击在新窗口浏览图片 CTRL+Mouse 滚轮可放大/缩小';}\" onclick=\"if(!this.resized) { return true; } else { window.open(this.src); }\" onmousewheel=\"return imgzoom(this);\" />";
                                    }
                                }
                                else
                                {
                                    drAt["attachimgpost"] = 0;
                                    replacement           = "<p><img alt=\"\" src=\"../../images/attachicons/attachment.gif\" border=\"0\" /><span class=\"bold\">附件</span>: <a href=\"../../attachment.aspx?attachmentid=" + drAt["aid"].ToString() + "\" target=\"_blank\">" + drAt["attachment"].ToString().Trim() + "</a> (" + drAt["postdatetime"].ToString() + ", " + filesize + ")<br />该附件被下载次数 " + drAt["downloads"].ToString() + "</p>";
                                }

                                message = message.Replace("[attach]" + drAt["aid"].ToString() + "[/attach]", replacement);
                            }
                        }
                        dtAttachment.Dispose();
                    }

                    #endregion

                    title = Utils.RemoveHtml(dt.Rows[0]["title"].ToString().Trim());
                }
            }
        }
Example #25
0
		/// <summary>
		/// Exchanges data with a field control
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="args"></param>
		public abstract void DoDataExchange(object sender, Editors.DoDataExchangeEventArgs args);
Example #26
0
        /// <summary>创建用户信息</summary>
        private static UserInfo CreateUser(GeneralConfigInfo config, IPKSPrincipal principal, bool isAdmin)
        {
            var tmpUsername = principal.Identity.Name;
            // 如果找不到0积分的用户组则用户自动成为待验证用户
            UserInfo userinfo = new UserInfo();

            userinfo.Username      = tmpUsername;
            userinfo.Nickname      = tmpUsername;
            userinfo.Password      = Guid.NewGuid().ToString();
            userinfo.Secques       = "";
            userinfo.Gender        = 0;
            userinfo.Adminid       = isAdmin ? 1 : 0;
            userinfo.Groupexpiry   = 0;
            userinfo.Extgroupids   = "";
            userinfo.Regip         = DNTRequest.GetIP();
            userinfo.Joindate      = Discuz.Common.Utils.GetDateTime();
            userinfo.Lastip        = userinfo.Regip;
            userinfo.Lastvisit     = userinfo.Joindate;
            userinfo.Lastactivity  = userinfo.Joindate;
            userinfo.Lastpost      = userinfo.Joindate;
            userinfo.Lastpostid    = 0;
            userinfo.Lastposttitle = "";
            userinfo.Posts         = 0;
            userinfo.Digestposts   = 0;
            userinfo.Oltime        = 0;
            userinfo.Pageviews     = 0;
            userinfo.Credits       = 0;
            userinfo.Extcredits1   = Scoresets.GetScoreSet(1).Init;
            userinfo.Extcredits2   = Scoresets.GetScoreSet(2).Init;
            userinfo.Extcredits3   = Scoresets.GetScoreSet(3).Init;
            userinfo.Extcredits4   = Scoresets.GetScoreSet(4).Init;
            userinfo.Extcredits5   = Scoresets.GetScoreSet(5).Init;
            userinfo.Extcredits6   = Scoresets.GetScoreSet(6).Init;
            userinfo.Extcredits7   = Scoresets.GetScoreSet(7).Init;
            userinfo.Extcredits8   = Scoresets.GetScoreSet(8).Init;
            //userinfo.Avatarshowid = 0;
            userinfo.Email      = principal.Identity.Email ?? "";
            userinfo.Bday       = "";
            userinfo.Sigstatus  = 1;
            userinfo.Tpp        = 0;
            userinfo.Ppp        = 0;
            userinfo.Templateid = 0;
            userinfo.Pmsound    = 0;
            userinfo.Showemail  = 0;
            userinfo.Salt       = "";

            int receivepmsetting = 3;//关于短信息枚举值的设置看ReceivePMSettingType类型注释,此处不禁止用户接受系统短信息

            //foreach (string rpms in DNTRequest.GetString("receivesetting").Split(','))
            //{
            //    if (!Utils.StrIsNullOrEmpty(rpms))
            //        receivepmsetting = receivepmsetting | int.Parse(rpms);
            //}

            //if (config.Regadvance == 0)
            //    receivepmsetting = 7;

            userinfo.Newsletter   = (ReceivePMSettingType)receivepmsetting;
            userinfo.Invisible    = 0;
            userinfo.Newpm        = config.Welcomemsg == 1 ? 1 : 0;
            userinfo.Medals       = "";
            userinfo.Accessmasks  = 0;
            userinfo.Website      = "";
            userinfo.Icq          = "";
            userinfo.Qq           = "";
            userinfo.Yahoo        = "";
            userinfo.Msn          = "";
            userinfo.Skype        = "";
            userinfo.Location     = "";
            userinfo.Customstatus = "";
            //userinfo.Avatar = @"avatars\common\0.gif";
            //userinfo.Avatarwidth = 0;
            //userinfo.Avatarheight = 0;
            userinfo.Bio       = "";
            userinfo.Signature = "";

            var usergroupid   = isAdmin ? 1 : 7;
            var usergroupinfo = UserGroups.GetUserGroupInfo(usergroupid);

            PostpramsInfo postpramsinfo = new PostpramsInfo();

            postpramsinfo.Usergroupid        = usergroupid;
            postpramsinfo.Attachimgpost      = config.Attachimgpost;
            postpramsinfo.Showattachmentpath = config.Showattachmentpath;
            postpramsinfo.Hide                   = 0;
            postpramsinfo.Price                  = 0;
            postpramsinfo.Sdetail                = userinfo.Signature;
            postpramsinfo.Smileyoff              = 1;
            postpramsinfo.Bbcodeoff              = 1 - usergroupinfo.Allowsigbbcode;
            postpramsinfo.Parseurloff            = 1;
            postpramsinfo.Showimages             = usergroupinfo.Allowsigimgcode;
            postpramsinfo.Allowhtml              = 0;
            postpramsinfo.Smiliesinfo            = Smilies.GetSmiliesListWithInfo();
            postpramsinfo.Customeditorbuttoninfo = Editors.GetCustomEditButtonListWithInfo();
            postpramsinfo.Smiliesmax             = config.Smiliesmax;
            userinfo.Sightml = UBB.UBBToHTML(postpramsinfo);

            userinfo.Authtime = userinfo.Joindate;

            if (isAdmin)
            {
                userinfo.Authstr  = "";
                userinfo.Authflag = 0;
                userinfo.Groupid  = usergroupid;
            }
            //邮箱激活链接验证
            else if (config.Regverify == 1)
            {
                userinfo.Authstr  = ForumUtils.CreateAuthStr(20);
                userinfo.Authflag = 1;
                userinfo.Groupid  = 8;
                //SendEmail(tmpUsername, DNTRequest.GetString("password").Trim(), DNTRequest.GetString(config.Antispamregisteremail).Trim(), userinfo.Authstr);
                //Emails.DiscuzSmtpMail(tmpUsername, emailaddress, password, authstr);
            }
            //系统管理员进行后台验证
            else if (config.Regverify == 2)
            {
                userinfo.Authstr  = "";
                userinfo.Groupid  = 8;
                userinfo.Authflag = 1;
            }
            else
            {
                userinfo.Authstr  = "";
                userinfo.Authflag = 0;
                userinfo.Groupid  = UserCredits.GetCreditsUserGroupId(0).Groupid;
            }
            userinfo.Realname = "";
            userinfo.Idcard   = "";
            userinfo.Mobile   = "";
            userinfo.Phone    = principal.Identity.PhoneNumber;

            //第三方加密验证模式
            if (config.Passwordmode > 1 && PasswordModeProvider.GetInstance() != null)
            {
                userinfo.Uid = PasswordModeProvider.GetInstance().CreateUserInfo(userinfo);
            }
            else
            {
                userinfo.Password = Discuz.Common.Utils.MD5(userinfo.Password);
                userinfo.Uid      = Users.CreateUser(userinfo);
            }
            return(userinfo);
        }
Example #27
0
        /// <summary>
        /// 获取帖子参数信息(PostPramsInfo)
        /// </summary>
        /// <param name="price"></param>
        /// <returns></returns>
        private List <ShowtopicPageAttachmentInfo> GetAttachList(int price, string onlyauthor, int ismoder, int posterid, UserInfo userinfo, UserGroupInfo usergroupinfo, TopicInfo topic, ForumInfo forum)
        {
            GeneralConfigInfo config = GeneralConfigs.GetConfig();
            //获取当前页主题列表
            PostpramsInfo postpramsInfo = new PostpramsInfo();

            postpramsInfo.Fid                    = forum.Fid;
            postpramsInfo.Tid                    = topic.Tid;
            postpramsInfo.Jammer                 = forum.Jammer;
            postpramsInfo.Pagesize               = 10000; // 得到Ppp设置
            postpramsInfo.Pageindex              = 1;
            postpramsInfo.Getattachperm          = forum.Getattachperm;
            postpramsInfo.Usergroupid            = usergroupinfo.Groupid;
            postpramsInfo.Attachimgpost          = config.Attachimgpost;
            postpramsInfo.Showattachmentpath     = config.Showattachmentpath;
            postpramsInfo.Price                  = price;
            postpramsInfo.Usergroupreadaccess    = (ismoder == 1) ? int.MaxValue : usergroupinfo.Readaccess;
            postpramsInfo.CurrentUserid          = userinfo.Uid;
            postpramsInfo.Showimages             = forum.Allowimgcode;
            postpramsInfo.Smiliesinfo            = Smilies.GetSmiliesListWithInfo();
            postpramsInfo.Customeditorbuttoninfo = Editors.GetCustomEditButtonListWithInfo();
            postpramsInfo.Smiliesmax             = config.Smiliesmax;
            postpramsInfo.Bbcodemode             = config.Bbcodemode;
            postpramsInfo.CurrentUserGroup       = usergroupinfo;
            postpramsInfo.Topicinfo              = topic;
            //判断是否为回复可见帖, hide=0为不解析[hide]标签, hide>0解析为回复可见字样, hide=-1解析为以下内容回复可见字样显示真实内容
            //将逻辑判断放入取列表的循环中处理,此处只做是否为回复人的判断,主题作者也该可见
            postpramsInfo.Hide        = (topic.Hide == 1 && (Posts.IsReplier(topic.Tid, userinfo.Uid) || ismoder == 1)) ? -1 : 1;
            postpramsInfo.Hide        = topic.Posterid == userinfo.Uid ? -2 : postpramsInfo.Hide;
            postpramsInfo.Condition   = Posts.GetPostPramsInfoCondition(onlyauthor, topic.Tid, posterid);
            postpramsInfo.Usercredits = userinfo == null ? 0 : userinfo.Credits;
            List <ShowtopicPageAttachmentInfo> attachmentlist = new List <ShowtopicPageAttachmentInfo>();
            List <ShowtopicPagePostInfo>       postlist       = GetPostList(postpramsInfo, out attachmentlist, ismoder == 1);
            int allowGetAttach = GetAllowGetAttachValue(postpramsInfo);

            foreach (ShowtopicPageAttachmentInfo showtopicpageattachinfo in attachmentlist)
            {
                if (Forums.AllowGetAttachByUserID(forum.Permuserlist, userinfo.Uid))
                {
                    showtopicpageattachinfo.Getattachperm = 1;
                    showtopicpageattachinfo.Allowread     = 1;
                }
            }
            List <ShowtopicPageAttachmentInfo> attachDeleteList = new List <ShowtopicPageAttachmentInfo>();

            foreach (ShowtopicPageAttachmentInfo attachInfo in attachmentlist)
            {
                if (allowGetAttach == 1 && attachInfo.Allowread == 1)
                {
                    if (attachInfo.Filetype.IndexOf("jpeg") >= 0 || attachInfo.Filetype.IndexOf("png") >= 0)
                    {
                        if (!attachInfo.Filename.ToLower().StartsWith("http"))
                        {
                            attachInfo.Filename = Utils.GetRootUrl(BaseConfigs.GetForumPath) + "upload/" + attachInfo.Filename.Trim();
                        }
                    }
                    else
                    {
                        attachDeleteList.Add(attachInfo);//记录不是JPG或PNG的图片,以便进行remove操作
                    }
                }
                else
                {
                    attachDeleteList.Add(attachInfo);//记录不是JPG或PNG的图片,以便进行remove操作
                }
            }
            foreach (ShowtopicPageAttachmentInfo attach in attachDeleteList)
            {
                attachmentlist.Remove(attach);
            }
            return(attachmentlist);
        }
Example #28
0
 private void tbParameterExpression2_ButtonClick(object sender, EventArgs e)
 {
     tbParameterExpression2.Text = Editors.EditExpression(Report, tbParameterExpression2.Text);
 }
Example #29
0
        /// <summary>
        /// Закрытие редактора
        /// </summary>
        /// <param name="e">Редактор который необходимо закрыть</param>
        public static bool CloseEditor(Editor e, bool force = false)
        {
            if (Editors != null)
            {
                if (!Editors.Contains(e.Form))
                {
                    return(true);
                }
            }
            bool close = true;

            if (!force)
            {
                close = e.AllowClose();
            }

            if (close)
            {
                TabPage tp = null;
                foreach (TabPage t in W.projectTabs.TabPages)
                {
                    if (tp.Tag == (object)e.Form)
                    {
                        tp = t;
                        break;
                    }
                }
                if (tp != null)
                {
                    W.projectTabs.RemoveTab(tp);
                    List <BaseForm> edlist = Editors == null ? new List <BaseForm>() : Editors.ToList();
                    if (edlist.Contains(e.Form))
                    {
                        edlist.Remove(e.Form);
                    }
                    Editors = edlist.ToArray();
                }
            }
            return(close);
        }
Example #30
0
 private void tbCustomExpression_ButtonClick(object sender, EventArgs e)
 {
     tbCustomExpression.Text = Editors.EditExpression(Report, tbCustomExpression.Text);
 }
Example #31
0
        /// <summary>
        /// 获取帖子参数信息(PostPramsInfo)
        /// </summary>
        /// <param name="price"></param>
        /// <returns></returns>
        public PostpramsInfo GetPostPramsInfo(int price)
        {
            //获取当前页主题列表
            PostpramsInfo postpramsInfo = new PostpramsInfo();

            postpramsInfo.Fid                    = forum.Fid;
            postpramsInfo.Tid                    = topicid;
            postpramsInfo.Jammer                 = forum.Jammer;
            postpramsInfo.Pagesize               = ppp; // 得到Ppp设置
            postpramsInfo.Pageindex              = pageid;
            postpramsInfo.Getattachperm          = forum.Getattachperm;
            postpramsInfo.Usergroupid            = usergroupid;
            postpramsInfo.Attachimgpost          = config.Attachimgpost;
            postpramsInfo.Showattachmentpath     = config.Showattachmentpath;
            postpramsInfo.Price                  = price;
            postpramsInfo.Usergroupreadaccess    = (ismoder == 1) ? int.MaxValue : usergroupinfo.Readaccess;
            postpramsInfo.CurrentUserid          = userid;
            postpramsInfo.Showimages             = forum.Allowimgcode;
            postpramsInfo.Smiliesinfo            = Smilies.GetSmiliesListWithInfo();
            postpramsInfo.Customeditorbuttoninfo = Editors.GetCustomEditButtonListWithInfo();
            postpramsInfo.Smiliesmax             = config.Smiliesmax;
            postpramsInfo.Bbcodemode             = config.Bbcodemode;
            postpramsInfo.CurrentUserGroup       = usergroupinfo;
            postpramsInfo.Topicinfo              = topic;
            //判断是否为回复可见帖, hide=0为不解析[hide]标签, hide>0解析为回复可见字样, hide=-1解析为以下内容回复可见字样显示真实内容
            //将逻辑判断放入取列表的循环中处理,此处只做是否为回复人的判断,主题作者也该可见
            postpramsInfo.Hide = topic.Hide >= 1 ? (ismoder == 1 || Posts.IsReplier(topicid, userid) ? -1 : topic.Hide) : topic.Hide;
            //postpramsInfo.Hide = ismoder == 1 || Posts.IsReplier(topicid, userid) ? -1 : 1;
            postpramsInfo.Hide = topic.Posterid == userid ? -2 : postpramsInfo.Hide;
            hide = postpramsInfo.Hide;
            postpramsInfo.Condition     = Posts.GetPostPramsInfoCondition(onlyauthor, topicid, posterid);
            postpramsInfo.TemplateWidth = Templates.GetTemplateWidth(templatepath);//获取当前模版的宽度
            postpramsInfo.Usercredits   = userInfo == null ? 0 : userInfo.Credits;
            postpramsInfo.Invisible     = invisible;
            switch (stand)
            {
            case 0:
                postlist = Posts.GetPostList(postpramsInfo, out attachmentlist, ismoder == 1);
                break;

            case 1:
                postlist = Debates.GetPositivePostList(postpramsInfo, out attachmentlist, ismoder == 1);
                break;

            case 2:
                postlist = Debates.GetNegativePostList(postpramsInfo, out attachmentlist, ismoder == 1);
                break;
            }
            if (topic.Special == 4)
            {
                string pidList = "";
                foreach (ShowtopicPagePostInfo post in postlist)
                {
                    pidList += post.Pid + ",";
                }
                Dictionary <int, int> postdiggs = Debates.GetPostDiggs(pidList.Trim(','));
                foreach (ShowtopicPagePostInfo post in postlist)
                {
                    if (postdiggs.ContainsKey(post.Pid))
                    {
                        post.Diggs = postdiggs[post.Pid];
                    }
                }
            }
            if (postlist.Count == 0)
            {
                TopicAdmins.RepairTopicList(topicid.ToString());
                topic = GetTopicInfo();
                BindPageCountAndId();
                postpramsInfo.Pageindex = pagecount;
                postlist = Posts.GetPostList(postpramsInfo, out attachmentlist, ismoder == 1);
            }

            foreach (ShowtopicPageAttachmentInfo showtopicpageattachinfo in attachmentlist)
            {
                if (Forums.AllowGetAttachByUserID(forum.Permuserlist, userid))
                {
                    showtopicpageattachinfo.Getattachperm = 1;
                    showtopicpageattachinfo.Allowread     = 1;
                }
            }
            BindDownloadAttachmentTip();

            return(postpramsInfo);
        }
Example #32
0
        public static void SendSaveMission(int missionRank, Editors.Missions.EditableMissionPool missionPool)
        {
            TcpPacket packet = new TcpPacket("savemission");

            packet.AppendParameter(missionRank.ToString());

            packet.AppendParameter(missionPool.Clients.Count);
            foreach (Logic.Editors.Missions.EditableMissionClient missionClient in missionPool.Clients) {

                packet.AppendParameters(missionClient.DexNum, missionClient.FormNum);
            }

            packet.AppendParameter(missionPool.Enemies.Count);
            for (int i = 0; i < missionPool.Enemies.Count; i++) {
                packet.AppendParameters(missionPool.Enemies[i]);
            }

            packet.AppendParameter(missionPool.Rewards.Count);
            foreach (Logic.Editors.Missions.EditableMissionReward missionReward in missionPool.Rewards) {

                packet.AppendParameters(missionReward.ItemNum, missionReward.ItemAmount);
                packet.AppendParameters(missionReward.ItemTag);
            }

            packet.FinalizePacket();

            SendPacket(packet);
        }
Example #33
0
        protected override void ShowPage()
        {
            topictitle = "";
            forumnav   = "";

            ////加载帖内广告
            //inpostad = Advertisements.GetInPostAd("", fid, templatepath, postlist.Count > ppp ? ppp : postlist.Count);

            //AdminGroupInfo admininfo = AdminGroups.GetAdminGroupInfo(useradminid);

            showpayments = DNTRequest.GetInt("showpayments", 0);
            buyit        = DNTRequest.GetInt("buyit", 0);
            topicid      = DNTRequest.GetInt("topicid", -1);
            // 如果主题ID非数字
            if (topicid == -1)
            {
                AddErrLine(WRONG_TOPIC);
                return;
            }

            // 获取该主题的信息
            TopicInfo topic = Topics.GetTopicInfo(topicid);

            // 如果该主题不存在
            if (topic == null)
            {
                AddErrLine(NOT_EXIST_TOPIC);
                return;
            }

            if (topic.Posterid == userid)
            {
                HttpContext.Current.Response.Redirect(base.ShowTopicAspxRewrite(topic.Tid, 0));
                return;
            }

            if (topic.Price <= 0)
            {
                HttpContext.Current.Response.Redirect(base.ShowTopicAspxRewrite(topic.Tid, 0));
                return;
            }

            topictitle = topic.Title.Trim();
            topicprice = topic.Price;
            poster     = topic.Poster;
            posterid   = topic.Posterid;
            pagetitle  = topictitle.Trim();
            forumid    = topic.Fid;
            ForumInfo forum = Forums.GetForumInfo(forumid);

            forumname = forum.Name.Trim();
            forumnav  = ForumUtils.UpdatePathListExtname(forum.Pathlist.Trim(), config.Extname);

            //判断是否为回复可见帖, price=0为非购买可见(正常), price>0 为购买可见, price=-1为购买可见但当前用户已购买
            price = 0;
            if (topic.Price > 0)
            {
                price = topic.Price;
                if (PaymentLogs.IsBuyer(topicid, userid) || (Utils.StrDateDiffHours(topic.Postdatetime, Scoresets.GetMaxChargeSpan()) > 0 && Scoresets.GetMaxChargeSpan() != 0))//判断当前用户是否已经购买
                {
                    price = -1;
                }
            }

            if (useradminid != 0)
            {
                ismoder = Moderators.IsModer(useradminid, userid, forumid) ? 1 : 0;
            }

            if (topic.Readperm > usergroupinfo.Readaccess && topic.Posterid != userid && useradminid != 1 &&
                ismoder != 1)
            {
                AddErrLine(string.Format("本主题阅读权限为: {0}, 您当前的身份 \"{1}\" 阅读权限不够", topic.Readperm.ToString(), usergroupinfo.Grouptitle));
                return;
            }

            if (topic.Displayorder == -1)
            {
                AddErrLine("此主题已被删除!");
                return;
            }

            if (topic.Displayorder == -2)
            {
                AddErrLine("此主题未经审核!");
                return;
            }

            if (forum.Password != "" &&
                Utils.MD5(forum.Password) != ForumUtils.GetCookie("forum" + forumid.ToString() + "password"))
            {
                AddErrLine("本版块被管理员设置了密码");
                //SetBackLink("showforum-" + forumid.ToString() + config.Extname);
                HttpContext.Current.Response.Redirect("showforum-" + forumid.ToString() + config.Extname, true);
                return;
            }

            if (!Forums.AllowViewByUserID(forum.Permuserlist, userid))        //判断当前用户在当前版块浏览权限
            {
                if (forum.Viewperm == null || forum.Viewperm == string.Empty) //当板块权限为空时,按照用户组权限
                {
                    if (usergroupinfo.Allowvisit != 1)
                    {
                        AddErrLine("您当前的身份 \"" + usergroupinfo.Grouptitle + "\" 没有浏览该版块的权限");
                        return;
                    }
                }
                else //当板块权限不为空,按照板块权限
                {
                    if (!Forums.AllowView(forum.Viewperm, usergroupid))
                    {
                        AddErrLine("您没有浏览该版块的权限");
                        return;
                    }
                }
            }

            userextcreditsinfo = Scoresets.GetScoreSet(Scoresets.GetCreditsTrans());
            maxincpertopic     = Scoresets.GetMaxIncPerTopic();
            maxchargespan      = Scoresets.GetMaxChargeSpan();
            creditstax         = Scoresets.GetCreditsTax() * 100;

            netamount = topicprice - topicprice * creditstax / 100;
            if (topicprice > maxincpertopic)
            {
                netamount = maxincpertopic - maxincpertopic * creditstax / 100;
            }

            if (price != -1)
            {
                IDataReader reader = Users.GetUserInfoToReader(userid);
                if (reader == null)
                {
                    AddErrLine(NO_PERMISSION);
                    return;
                }

                if (!reader.Read())
                {
                    AddErrLine(NO_PERMISSION);
                    reader.Close();
                    return;
                }

                if (Utils.StrToFloat(reader["extcredits" + Scoresets.GetCreditsTrans().ToString()], 0) < topic.Price)
                {
                    AddErrLine(string.Format(NOT_ENOUGH_MONEY_TO, Utils.StrToFloat(reader["extcredits" + Scoresets.GetCreditsTrans().ToString()], 0), topic.Price));
                    reader.Close();

                    return;
                }

                userlastprice = Utils.StrToFloat(reader["extcredits" + Scoresets.GetCreditsTrans().ToString()], 0) - topic.Price;
                reader.Close();
            }



            //如果不是提交...
            if (!ispost)
            {
                buyers = PaymentLogs.GetPaymentLogByTidCount(topic.Tid);

                //显示购买信息列表
                if (showpayments == 1)
                {
                    //得到当前用户请求的页数
                    pageid = DNTRequest.GetInt("page", 1);
                    //获取主题总数
                    //获取总页数
                    pagecount = buyers % pagesize == 0 ? buyers / pagesize : buyers / pagesize + 1;
                    if (pagecount == 0)
                    {
                        pagecount = 1;
                    }
                    //修正请求页数中可能的错误
                    if (pageid < 1)
                    {
                        pageid = 1;
                    }
                    if (pageid > pagecount)
                    {
                        pageid = pagecount;
                    }

                    //获取收入记录并分页显示
                    paymentloglist = PaymentLogs.GetPaymentLogByTid(pagesize, pageid, topic.Tid);
                }

                //判断是否为回复可见帖, hide=0为非回复可见(正常), hide>0为回复可见, hide=-1为回复可见但当前用户已回复
                int hide = 0;
                if (topic.Hide == 1)
                {
                    hide = topic.Hide;
                    if (Posts.IsReplier(topicid, userid))
                    {
                        hide = -1;
                    }
                }

                PostpramsInfo _postpramsinfo = new PostpramsInfo();
                _postpramsinfo.Fid                = forum.Fid;
                _postpramsinfo.Tid                = topicid;
                _postpramsinfo.Jammer             = forum.Jammer;
                _postpramsinfo.Pagesize           = 5;
                _postpramsinfo.Pageindex          = 1;
                _postpramsinfo.Getattachperm      = forum.Getattachperm;
                _postpramsinfo.Usergroupid        = usergroupid;
                _postpramsinfo.Attachimgpost      = config.Attachimgpost;
                _postpramsinfo.Showattachmentpath = config.Showattachmentpath;
                _postpramsinfo.Hide               = hide;
                _postpramsinfo.Price              = price;
                _postpramsinfo.Ubbmode            = false;

                _postpramsinfo.Showimages             = forum.Allowimgcode;
                _postpramsinfo.Smiliesinfo            = Smilies.GetSmiliesListWithInfo();
                _postpramsinfo.Customeditorbuttoninfo = Editors.GetCustomEditButtonListWithInfo();
                _postpramsinfo.Smiliesmax             = config.Smiliesmax;
                _postpramsinfo.Bbcodemode             = config.Bbcodemode;

                lastpostlist = Posts.GetLastPostList(_postpramsinfo);
            }
            else
            {
                int reval = PaymentLogs.BuyTopic(userid, topic.Tid, topic.Posterid, topic.Price, netamount);
                if (reval > 0)
                {
                    SetUrl(base.ShowTopicAspxRewrite(topic.Tid, 0));

                    SetMetaRefresh();
                    SetShowBackLink(false);
                    AddMsgLine(PURCHASE_SUCCESS);
                    return;
                }
                else
                {
                    SetBackLink(base.ShowForumAspxRewrite(topic.Fid, 0));

                    if (reval == -1)
                    {
                        AddErrLine(NOT_ENOUGH_MONEY);
                        return;
                    }
                    else if (reval == -2)
                    {
                        AddErrLine(NO_PERMISSION);
                        return;
                    }
                    else
                    {
                        AddErrLine(UNKNOWN_REASON);
                        return;
                    }
                }
            }
        }
Example #34
0
 private void tbFilter_ButtonClick(object sender, EventArgs e)
 {
     tbFilter.Text = Editors.EditExpression(Report, tbFilter.Text);
 }
Example #35
0
 /// <summary>Find out if a princpial has edit access.</summary>
 /// <param name="user">The princpial to check.</param>
 /// <returns>A boolean indicating whether the principal has edit access.</returns>
 public virtual bool IsEditor(IPrincipal user)
 {
     return(IsAdmin(user) || Editors.Contains(user) || Writers.Contains(user));
 }
Example #36
0
 public void AddEditors(params Person[] editors)
 {
     Editors.AddRange(editors);
 }
Example #37
0
		/// <summary>
		/// Exchanges data with a ByteInteger field control
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="args"></param>
		public override void DoDataExchange(object sender, Editors.DoDataExchangeEventArgs args)
		{
			if (args.IsPolling)	{ (args.FieldInterface as Editors.IByteInteger).Field = this.Value; }
			else				{ this.Value = (args.FieldInterface as Editors.IByteInteger).Field; }
		}
Example #38
0
        public void GetPostInfo(Post pi)
        {
            if (pi != null)
            {
                this.isexist = true;
                var ppi = new PostpramsInfo();
                ppi.Fid                    = pi.Fid;
                ppi.Tid                    = pi.Tid;
                ppi.Pid                    = pi.ID;
                ppi.Jammer                 = 0;
                ppi.Attachimgpost          = this.config.Attachimgpost;
                ppi.Showattachmentpath     = 1;
                ppi.Showimages             = 1;
                ppi.Smiliesinfo            = Smilies.GetSmiliesListWithInfo();
                ppi.Customeditorbuttoninfo = Editors.GetCustomEditButtonListWithInfo();
                ppi.Smiliesmax             = this.config.Smiliesmax;
                ppi.Bbcodemode             = this.config.Bbcodemode;
                ppi.Smileyoff              = pi.SmileyOff;
                ppi.BBCode                 = pi.BBCodeOff == 0;
                ppi.Parseurloff            = pi.ParseUrlOff;
                ppi.Allowhtml              = pi.HtmlOn;
                ppi.Sdetail                = pi.Message;
                this.message               = pi.Message;
                if (ppi.Jammer == 1)
                {
                    this.message = ForumUtils.AddJammer(this.message);
                }

                ppi.Sdetail = this.message;
                if (!ppi.Ubbmode)
                {
                    this.message = UBB.UBBToHTML(ppi);
                }
                else
                {
                    this.message = Utils.HtmlEncode(this.message);
                }

                if (pi.Attachment == 1 || new Regex("\\[attach\\](\\d+?)\\[\\/attach\\]", RegexOptions.IgnoreCase).IsMatch(this.message))
                {
                    var list = Attachment.FindAllByPid(pi.ID);
                    //list.Columns.Add("attachimgpost", typeof(Int16));
                    foreach (var att in list)
                    {
                        if (this.message.IndexOf("[attach]" + att.ID + "[/attach]") != -1)
                        {
                            string text;
                            if (att.FileSize > 1024)
                            {
                                text = Math.Round((Double)att.FileSize / 1024, 2) + " K";
                            }
                            else
                            {
                                text = att.FileSize + " B";
                            }

                            string newValue;
                            if (att.ImgPost)
                            {
                                att["attachimgpost"] = 1;
                                if (ppi.Showattachmentpath == 1)
                                {
                                    newValue = "<img src=\"../../upload/" + att.FileName + "\" onload=\"if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='点击在新窗口浏览图片 CTRL+鼠标滚轮可放大/缩小';}\" onmouseover=\"if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='点击在新窗口浏览图片 CTRL+Mouse 滚轮可放大/缩小';}\" onclick=\"if(!this.resized) { return true; } else { window.open(this.src); }\" onmousewheel=\"return imgzoom(this);\" />";
                                }
                                else
                                {
                                    newValue = "<img src=\"../../attachment.aspx?attachmentid=" + att.ID + "\" onload=\"if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='点击在新窗口浏览图片 CTRL+鼠标滚轮可放大/缩小';}\" onmouseover=\"if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='点击在新窗口浏览图片 CTRL+Mouse 滚轮可放大/缩小';}\" onclick=\"if(!this.resized) { return true; } else { window.open(this.src); }\" onmousewheel=\"return imgzoom(this);\" />";
                                }
                            }
                            else
                            {
                                att["attachimgpost"] = 0;
                                newValue             = "<p><img alt=\"\" src=\"../../images/attachicons/attachment.gif\" border=\"0\" /><span class=\"bold\">附件</span>: <a href=\"../../attachment.aspx?attachmentid=" + att["aid"].ToString() + "\" target=\"_blank\">" + att["attachment"].ToString().Trim() + "</a> (" + att["postdatetime"].ToString() + ", " + text + ")<br />该附件被下载次数 " + att["downloads"].ToString() + "</p>";
                            }
                            this.message = this.message.Replace("[attach]" + att.ID + "[/attach]", newValue);
                        }
                    }
                    //list.Dispose();
                }
                this.title = Utils.RemoveHtml(pi.Title);
            }
        }
Example #39
0
		public override void DoDataExchange(object sender, Editors.DoDataExchangeEventArgs args) { }
Example #40
0
 public static IEnumerable <SchematicEditor> Show(Window Owner, string Message, MessageBoxButton Buttons, params SchematicEditor[] Editors)
 {
     return(Show(Owner, Message, Buttons, Editors.AsEnumerable()));
 }
        public static void ChangeActiveEditor(Editors.IEditor editor)
        {
            AllowKeyboardToMoveConsole = true;

            if (ActiveEditor != null)
            {
                ActiveEditor.OnDeselected();
                Consoles.Remove(ActiveEditor.RenderedConsole);
                Consoles.Remove(borderConsole);
            }

            if (OpenEditors.Contains(editor))
            {
                ActiveEditor = editor;
                CenterEditor();
                ToolsPane.RedrawPanels();
                ActiveEditor.OnSelected();

                Consoles.Insert(0, ActiveEditor.RenderedConsole);
                UpdateBorder(editor.Position);

                if (ToolsPane.PanelFiles.DocumentsListbox.SelectedItem != editor)
                    ToolsPane.PanelFiles.DocumentsListbox.SelectedItem = editor;
            }
        }
 private static void changeDisplay(Editors a)
 {
     displayWindows[(int)a] = !displayWindows[(int)a];
 }
        private static void CreateNewEditor(Editors.Editors editorType, int width, int height, Color defaultForeground, Color defaultBackground)
        {
            Editors.IEditor editor = null;

            switch (editorType)
            {
                case SadConsoleEditor.Editors.Editors.Console:
                    editor = new Editors.LayeredConsoleEditor();
                    editor.New(defaultForeground, defaultBackground, width, height);
                    break;
                case SadConsoleEditor.Editors.Editors.GameObject:
                    editor = new Editors.GameObjectEditor();
                    editor.New(defaultForeground, defaultBackground, width, height);
                    break;
                case SadConsoleEditor.Editors.Editors.Scene:
                    editor = new Editors.SceneEditor();
                    editor.New(defaultForeground, defaultBackground, width, height);
                    break;
                case SadConsoleEditor.Editors.Editors.GUI:
                    break;
                default:
                    break;
            }

            if (editor != null)
            {
                AddEditor(editor, true);
            }

            topBarPane.IsVisible = true;
            ToolsPane.IsVisible = true;
            scrollerContainer.IsVisible = true;
        }
Example #44
0
 //Form
 public void ShowEditor(Editors.IEditorForm editor)
 {
     if (m_formMdiParent != null && editor.MdiParent != m_formMdiParent)
         editor.MdiParent = m_formMdiParent;
     editor.Show();
 }