예제 #1
0
        public async override Task RenderAsync(TextWriter writer)
        {
            var tagBuilder = new TagBuilder("img")
            {
                TagRenderMode = TagRenderMode.Normal
            };

            tagBuilder.Attributes.Add("alt", AlternateText);
            tagBuilder.Attributes.Add("src", ImageUrl);
            if (!String.IsNullOrEmpty(DescriptionUrl))
            {
                tagBuilder.Attributes.Add("longdesc", DescriptionUrl);
            }

            if (ImageAlign != ImageAlign.NotSet)
            {
                tagBuilder.Attributes.Add("align", ImageAlign.ToString().ToLower());
            }

            tagBuilder.WriteTo(writer, HtmlEncoder.Default);

            await Task.CompletedTask;
        }
예제 #2
0
 protected virtual void SetAlign(ImageAlign align)
 {
     this.Call("setAlign", align.ToString().ToLowerInvariant());
 }
예제 #3
0
        Stream SaveClientFile()
        {
            MemoryStream ms = new MemoryStream();

            try
            {
                // file-identification data
                WriteFiles.WriteHeader(ms, "IUCDFV2");

                //Company Name
                WriteFiles.WriteDeprecatedString(ms, 0x01, CompanyName);

                //Product Name
                WriteFiles.WriteDeprecatedString(ms, 0x02, ProductName);

                // GUID
                if (m_GUID != null)
                {
                    WriteFiles.WriteString(ms, 0x0A, m_GUID);
                }

                //Installed Version
                WriteFiles.WriteDeprecatedString(ms, 0x03, InstalledVersion);

                foreach (string site in ServerFileSites)
                {
                    //Server File Site
                    WriteFiles.WriteDeprecatedString(ms, 0x04, site);
                }

                foreach (string site in ClientServerSites)
                {
                    //Client Server File Site
                    WriteFiles.WriteDeprecatedString(ms, 0x09, site);
                }

                //Header image alignment
                WriteFiles.WriteDeprecatedString(ms, 0x11, HeaderImageAlign.ToString());

                //Header text indent
                WriteFiles.WriteInt(ms, 0x12, HeaderTextIndent);

                //Header text color
                if (!string.IsNullOrEmpty(HeaderTextColorName))
                {
                    WriteFiles.WriteDeprecatedString(ms, 0x13, HeaderTextColorName);
                }

                //Top image filename
                if (!string.IsNullOrEmpty(TopImageFilename))
                {
                    WriteFiles.WriteDeprecatedString(ms, 0x14, TopImageFilename);
                }

                //Side image filename
                if (!string.IsNullOrEmpty(SideImageFilename))
                {
                    WriteFiles.WriteDeprecatedString(ms, 0x15, SideImageFilename);
                }

                foreach (DictionaryEntry dLang in Languages)
                {
                    LanguageCulture lang = (LanguageCulture)dLang.Value;

                    //Language culture
                    WriteFiles.WriteDeprecatedString(ms, 0x18, lang.Culture);

                    //Language filename
                    if (!string.IsNullOrEmpty(lang.Filename))
                    {
                        WriteFiles.WriteDeprecatedString(ms, 0x16, lang.Filename);
                    }
                }


                //Hide the header divider
                if (HideHeaderDivider)
                {
                    WriteFiles.WriteBool(ms, 0x17, true);
                }

                if (CloseOnSuccess)
                {
                    WriteFiles.WriteBool(ms, 0x19, true);
                }

                if (!string.IsNullOrEmpty(CustomWyUpdateTitle))
                {
                    WriteFiles.WriteString(ms, 0x1A, CustomWyUpdateTitle);
                }

                if (!string.IsNullOrEmpty(PublicSignKey))
                {
                    WriteFiles.WriteString(ms, 0x1B, PublicSignKey);
                }

                if (!string.IsNullOrEmpty(UpdatePassword))
                {
                    WriteFiles.WriteString(ms, 0x1C, UpdatePassword);
                }

                ms.WriteByte(0xFF);

                ms.Position = 0;
            }
            catch (Exception)
            {
                ms.Dispose();
                throw;
            }

            return(ms);
        }
예제 #4
0
 protected virtual void SetAlign(ImageAlign align)
 {
     this.Call("setAlign", align.ToString().ToLowerInvariant());
 }
예제 #5
0
        /// <summary>
        /// 生成图片的Html代码
        /// </summary>
        /// <param name="name">名称</param>
        /// <param name="path">路径</param>
        /// <param name="width">宽</param>
        /// <param name="widthUnit">宽单位</param>
        /// <param name="height">高</param>
        /// <param name="heightUnit">高单位</param>
        /// <param name="align">图片显示方式</param>
        /// <param name="border">边框</param>
        /// <param name="vspace"></param>
        /// <param name="hspace"></param>
        /// <param name="alt">说明文字</param>
        /// <param name="linkUrl">链接的URL</param>
        /// <param name="pic2Path">替换图片的路径</param>
        /// <param name="linkTarget">目标</param>
        /// <param name="linkTitle">标题</param>
        /// <param name="linkAccesskey">访问键</param>
        /// <returns></returns>
        public string ImageHtml(
            string name,
            string path,
            string width,
            string widthUnit,
            string height,
            string heightUnit,
            ImageAlign align,
            string border,
            string vspace,
            string hspace,
            string alt,
            string linkUrl,
            string pic2Path,
            string linkTarget,
            string linkTitle,
            string linkAccesskey,
            string mediaID
            )
        {
            string picMouseOut  = "";
            string picMouseOver = "";
            string picCode      = "";

            if (path == "")
            {
                return("");
            }

            //图片设置*/
            string imgHtml = "<img src=\"${srs_" + mediaID + "}\" ";

            imgHtml += "style = \"WIDTH:" + width + widthUnit + "; HEIGHT:" + height + heightUnit + "\" ";
            imgHtml += "border=\"" + border + "\" vspace=\"" + vspace + "\" ";
            imgHtml += "hspace=\"" + hspace + "\" alt=\"" + alt + "\" ";
            imgHtml += "name=\"" + name + "\" align=\"" + align.ToString().ToLower() + "\" />";

            //链接设置*/
            string linkHtml = "";

            if (linkUrl != "" || pic2Path != "")
            {
                if (linkUrl != "")
                {
                    linkHtml  = "<a href=\"" + linkUrl + "\" ";
                    linkHtml += "target=\"" + linkTarget + "\" ";
                    linkHtml += "title=\"" + linkTitle + "\" ";
                    linkHtml += "accesskey=\"" + linkAccesskey + "\"";
                }
                else
                {
                    linkHtml = "<a href=\"#\"";
                }
                //图片替换
                if (pic2Path != "")
                {
                    picMouseOut  = " na_restore_img_src('" + name + "', 'document')";
                    linkHtml    += "OnMouseOut=\"" + picMouseOut + "\"";
                    picMouseOver = "na_change_img_src('" + name + "', 'document'," + pic2Path + ",true)";
                    linkHtml    += "OnMouseOver=\"" + picMouseOver + "\"";
                }

                linkHtml += ">";
                picCode   = linkHtml + imgHtml + @"</a>";
                return(picCode);
            }
            else
            {
                picCode = picCode = imgHtml;
                return(picCode);
            }
        }
예제 #6
0
 protected virtual void SetAlign(ImageAlign align)
 {
     this.AddScript("{0}.setAlign({1});", this.ClientID, JSON.Serialize(align.ToString().ToLower()));
 }
예제 #7
0
        private Stream SaveClientFile()
        {
            MemoryStream memoryStream = new MemoryStream();

            try
            {
                WriteFiles.WriteHeader(memoryStream, "IUCDFV2");
                WriteFiles.WriteDeprecatedString(memoryStream, 1, CompanyName);
                WriteFiles.WriteDeprecatedString(memoryStream, 2, ProductName);
                if (m_GUID != null)
                {
                    WriteFiles.WriteString(memoryStream, 10, m_GUID);
                }
                WriteFiles.WriteDeprecatedString(memoryStream, 3, InstalledVersion);
                foreach (string serverFileSite in ServerFileSites)
                {
                    WriteFiles.WriteDeprecatedString(memoryStream, 4, serverFileSite);
                }
                foreach (string clientServerSite in ClientServerSites)
                {
                    WriteFiles.WriteDeprecatedString(memoryStream, 9, clientServerSite);
                }
                WriteFiles.WriteDeprecatedString(memoryStream, 17, HeaderImageAlign.ToString());
                WriteFiles.WriteInt(memoryStream, 18, HeaderTextIndent);
                if (!string.IsNullOrEmpty(HeaderTextColorName))
                {
                    WriteFiles.WriteDeprecatedString(memoryStream, 19, HeaderTextColorName);
                }
                if (!string.IsNullOrEmpty(TopImageFilename))
                {
                    WriteFiles.WriteDeprecatedString(memoryStream, 20, TopImageFilename);
                }
                if (!string.IsNullOrEmpty(SideImageFilename))
                {
                    WriteFiles.WriteDeprecatedString(memoryStream, 21, SideImageFilename);
                }
                foreach (DictionaryEntry language in Languages)
                {
                    LanguageCulture languageCulture = (LanguageCulture)language.Value;
                    WriteFiles.WriteDeprecatedString(memoryStream, 24, languageCulture.Culture);
                    if (!string.IsNullOrEmpty(languageCulture.Filename))
                    {
                        WriteFiles.WriteDeprecatedString(memoryStream, 22, languageCulture.Filename);
                    }
                }
                if (HideHeaderDivider)
                {
                    WriteFiles.WriteBool(memoryStream, 23, val: true);
                }
                if (CloseOnSuccess)
                {
                    WriteFiles.WriteBool(memoryStream, 25, val: true);
                }
                if (!string.IsNullOrEmpty(CustomWyUpdateTitle))
                {
                    WriteFiles.WriteString(memoryStream, 26, CustomWyUpdateTitle);
                }
                if (!string.IsNullOrEmpty(PublicSignKey))
                {
                    WriteFiles.WriteString(memoryStream, 27, PublicSignKey);
                }
                if (!string.IsNullOrEmpty(UpdatePassword))
                {
                    WriteFiles.WriteString(memoryStream, 28, UpdatePassword);
                }
                memoryStream.WriteByte(byte.MaxValue);
                memoryStream.Position = 0L;
                return(memoryStream);
            }
            catch (Exception)
            {
                memoryStream.Dispose();
                throw;
            }
        }