示例#1
0
 public PackageTest()
 {
     _packageHtml          = ResourcesReader.GetResourceAsString("Pacote.html");
     _packageDeliveredHtml = ResourcesReader.GetResourceAsString("PacoteEntregue.html");
     _packageErrorHtml     = ResourcesReader.GetResourceAsString("PacoteNaoEncontrado.html");
     _packageCodeNotFound  = ResourcesReader.GetResourceAsString("PacoteSemCodigo.html");
 }
示例#2
0
        /// <summary>
        /// 项目列表
        /// </summary>
        protected string List_Get()
        {
            string prjsListHtml,
            //项目列表Html
                   propertyHtml;


            StringBuilder sb          = new StringBuilder();
            StringBuilder propertyStr = new StringBuilder();


            Project[] projects = this.director.GetProjects();
            if (projects == null)
            {
                sb.Append("<li>暂无采集项目![<a href=\"?action=create\">点击添加</a>]</li>");
            }
            else
            {
                foreach (Project prj in projects)
                {
                    //项目属性
                    foreach (string key in prj.Rules)
                    {
                        propertyStr.Append("[").Append(key).Append("],");
                    }
                    if (propertyStr.Length == 0)
                    {
                        propertyHtml = "无";
                    }
                    else
                    {
                        propertyHtml = propertyStr.Remove(propertyStr.Length - 1, 1).ToString();
                        propertyStr.Remove(0, propertyStr.Length);
                    }

                    //项目基本信息
                    sb.Append("<div class=\"project\"><h2><strong>项目名称:")
                    .Append(prj.Name)
                    .Append("</strong>(编号:")
                    .Append(prj.Id)
                    .Append(")</h2><p class=\"details\"> 编码方式:").Append(prj.RequestEncoding).Append("<br />列表规则:")
                    .Append(prj.ListUriRule).Append("<br />页面规则:")
                    .Append(prj.PageUriRule).Append("<br />采集属性:").Append(propertyHtml)
                    .Append("</p><span class=\"project_operate\">[&nbsp;<a href=\"?action=invoke&projectId=")
                    .Append(prj.Id).Append("\">开始采集</a>&nbsp;]&nbsp;&nbsp;[&nbsp;<a href=\"?action=edit&projectId=")
                    .Append(prj.Id).Append("\">修改</a>&nbsp;]&nbsp;&nbsp;[&nbsp;<a href=\"?action=delete&projectId=")
                    .Append(prj.Id).Append("\">删除</a>&nbsp;]</span></div>");
                }
            }

            prjsListHtml = sb.ToString();

            var html  = ResourcesReader.Read(assembly, prefix + "project_list.html");
            var html2 = ResourcesReader.Read(assembly, prefix + "partial_navigator.html");

            return(html.Replace("${ct_css}", ct_css)
                   .Replace("${subtitle}", subtitle)
                   .Replace("${navigator}", html2)
                   .Replace("${listHtml}", prjsListHtml));
        }
示例#3
0
 public SelectChannelsForm()
 {
     InitializeComponent();
     ResourcesReader.SetControlPropertyHelper(this);
     GetChannelNames();
     SetCheckedNodes(Channels, treeChannels.Nodes);
 }
示例#4
0
文件: HttpTags.cs 项目: lyfb/cms-1
        /// <summary>
        /// 返回样式表链接
        /// </summary>
        /// <returns></returns>
        public virtual string ReturnStyleLink()
        {
            var assembly = typeof(TagsManager).Assembly;
            var style    = ResourcesReader.Read(assembly, "HttpTag/Assets/style.html");

            return($"<style type=\"text/css\">{style}</style>");
        }
示例#5
0
 public PackageTest()
 {
     CultureInfo.CurrentCulture = CultureInfo.GetCultureInfo("pt-BR");
     _packageHtml          = ResourcesReader.GetResourceAsString("Pacote.html");
     _packageDeliveredHtml = ResourcesReader.GetResourceAsString("PacoteEntregue.html");
     _packageErrorHtml     = ResourcesReader.GetResourceAsString("PacoteNaoEncontrado.html");
     _packageCodeNotFound  = ResourcesReader.GetResourceAsString("PacoteSemCodigo.html");
 }
示例#6
0
 protected override void OnCreateControl()
 {
     base.OnCreateControl();
     if (!this.DesignMode)
     {
         ResourcesReader.SetControlPropertyHelper(this);
     }
 }
示例#7
0
 protected override void OnLoad(EventArgs e)
 {
     base.OnLoad(e);
     if (!this.DesignMode)
     {
         ResourcesReader.SetControlPropertyHelper(this);
     }
 }
示例#8
0
文件: ResourceMap.cs 项目: lyfb/cms-1
        /// <summary>
        /// 获取内置语言文件
        /// </summary>
        /// <returns></returns>
        public static string GetXmlLangPackage()
        {
            if (InternalXmlLangPackage == null)
            {
                InternalXmlLangPackage = ResourcesReader.Read(typeof(ResourceMap).Assembly, "Infrastructure/Resources/lang_package.xml");
            }

            return(InternalXmlLangPackage);
        }
示例#9
0
 internal ResourceDirectory(PeImage image, uint offset, ResourcesReader reader, ResourceDirectoryEntry parentEntry, PE.Structures.IMAGE_RESOURCE_DIRECTORY rawDirectory)
 {
     this.image        = image;
     this.ParentEntry  = parentEntry;
     this.offset       = offset;
     this.fileOffset   = offset + image.ParentAssembly.ntHeader.OptionalHeader.DataDirectories[(int)DataDirectoryName.Resource].TargetOffset.FileOffset;
     this.rawDirectory = rawDirectory;
     this.reader       = reader;
 }
示例#10
0
        protected Task Show_WelcomePage(HttpContext ctx)
        {
            var welcomeHtml   = ResourcesReader.Read(assembly, prefix + "welcome_page.html");
            var navigatorHtml = ResourcesReader.Read(assembly, prefix + "partial_navigator.html");
            var html          = welcomeHtml.Replace("${ct_css}", ct_css)
                                .Replace("${navigator}", navigatorHtml);

            return(ctx.Response.WriteAsync(html));
        }
示例#11
0
 internal ResourceDirectory(PeImage image, uint offset, ResourcesReader reader, ResourceDirectoryEntry parentEntry, PE.Structures.IMAGE_RESOURCE_DIRECTORY rawDirectory)
 {
     this._image = image;
     this.ParentEntry = parentEntry;
     this._offset = offset;
     this._fileOffset = offset + image.ParentAssembly._ntHeader.OptionalHeader.DataDirectories[(int)DataDirectoryName.Resource].TargetOffset.FileOffset;
     this._rawDirectory = rawDirectory;
     this._reader = reader;
 }
示例#12
0
        private void SetImageList()
        {
            Dictionary <string, Image> dic = ResourcesReader.ImageReader(this);

            foreach (var item in dic)
            {
                this._imageList.Images.Add(item.Key, item.Value);
            }
        }
示例#13
0
        protected string CreateProject_Get()
        {
            var html  = ResourcesReader.Read(assembly, prefix + "project_list.html");
            var html2 = ResourcesReader.Read(assembly, prefix + "partial_navigator.html");

            return(html.Replace("${ct_css}", ct_css)
                   .Replace("${subtitle}", subtitle)
                   .Replace("${navigator}", html2));
        }
示例#14
0
        public void Shoul_Not_Create_New_Feedstock_With_Name_Is_Empty()
        {
            var domainException = Assert.Throws <DomainException>(() => Domain.Entities.Feedstock.New("", _status, _measureId, _stock, _colorId, _tenantId));
            var domainError     = domainException.Errors.First();

            var fieldName = ResourcesReader.Field(nameof(_feedstock.Name));

            Assert.Equal(fieldName, domainError.Property);
            Assert.Equal(ValidationMessage.Required(fieldName), domainError.Messages.First());
        }
示例#15
0
        /// <summary>
        /// https://antoinevastel.com/bots/
        /// </summary>
        /// <param name="page"></param>
        /// <returns></returns>
        public async Task <JObject> GetFingerPrint(Page page)
        {
            var script = ResourcesReader.ReadFile("Extra.Tests.StealthPluginTests.Script.fpCollect.js", Assembly.GetExecutingAssembly());
            await page.EvaluateExpressionAsync(script);

            var fingerPrint =
                await page.EvaluateFunctionAsync <JObject>("async () => await fpCollect().generateFingerprint()");

            return(fingerPrint);
        }
示例#16
0
        public void Shoul_Not_Create_New_Color_With_Name_Is_EmptySpace()
        {
            var domainException = Assert.Throws <DomainException>(() => Color.New(" ", _status, _tenantId));

            var domainError = domainException.Errors.First();
            var fieldName   = ResourcesReader.Field(nameof(_color.Name));

            Assert.Equal(fieldName, domainError.Property);
            Assert.Equal(ValidationMessage.Required(fieldName), domainError.Messages.First());
        }
示例#17
0
        public void Should_Not_Be_Valid_When_ColorId_Is_Null()
        {
            var domainException = Assert.Throws <DomainException>(() =>
                                                                  Domain.Entities.Feedstock.New(_feedstockId, _feedstockName, _status, _creationDate, _updateDate, _measureId, _stock, null, _tenantId));
            var domainError = domainException.Errors.First();
            var fieldName   = ResourcesReader.Field(nameof(_feedstock.ColorId));

            Assert.Equal(fieldName, domainError.Property);
            Assert.Equal(ValidationMessage.NotNull(fieldName), domainError.Messages.First());
        }
示例#18
0
        public void Shoul_Not_Create_New_Measure_With_Name_Is_Null()
        {
            var domainException = Assert.Throws <DomainException>(() => Measure.New(null, _status, _tenantId));
            var domainError     = domainException.Errors.First();

            var fieldName = ResourcesReader.Field(nameof(_measure.Name));

            Assert.Equal(fieldName, domainError.Property);
            Assert.Equal(ValidationMessage.Required(fieldName), domainError.Messages.First());
        }
示例#19
0
        /// <summary>
        ///
        /// </summary>
        public TmpltBaseTreeNode(AnyXmlElement element)
        {
            Element = element;

            /// 调用Jeelu.ResourcesReader管理控件所使用的资源
            ResourcesReader.SetObjectResourcesHelper(this);
            this.SetImageList();
            this._imageList.ColorDepth = ColorDepth.Depth32Bit;
            this.SetImage();
        }
示例#20
0
        public void Should_Not_Be_Valid_When_ColorId_Is_Empty()
        {
            var domainException = Assert.Throws <DomainException>(() =>
                                                                  Color.New(ColorId.Empty, _colorName, _status, _creationDate, _updateDate, _tenantId));

            var domainError = domainException.Errors.First();
            var fieldName   = ResourcesReader.Field(nameof(_color.ColorId));

            Assert.Equal(fieldName, domainError.Property);
            Assert.Equal(ValidationMessage.Required(fieldName), domainError.Messages.First());
        }
示例#21
0
        public static string GetScript(string name)
        {
            var builder = new StringBuilder(typeof(Utils).Namespace);

            builder.Append(".Scripts");
            builder.Append("." + name);

            var file = ResourcesReader.ReadFile(builder.ToString());

            return(file);
        }
示例#22
0
        public void Should_Not_Be_Valid_When_TenantId_Is_Nully()
        {
            var domainException = Assert.Throws <DomainException>(() =>
                                                                  Measure.New(_measureId, _measureName, _status, _creationDate, _updateDate, null));
            var domainError = domainException.Errors.First();

            var fieldName = ResourcesReader.Field(nameof(_measure.TenantId));

            Assert.Equal(fieldName, domainError.Property);
            Assert.Equal(ValidationMessage.NotNull(fieldName), domainError.Messages.First());
        }
 protected override void OnLoad(EventArgs e)
 {
     base.OnLoad(e);
     if (!this.DesignMode)
     {
         ResourcesReader.SetControlPropertyHelper(this);
     }
     this.labelProductName.Text = AssemblyProduct;
     this.labelVersion.Text     = String.Format("Version: {0}", AssemblyVersion);
     this.labelCopyright.Text   = AssemblyCopyright;
     this.labelCompanyName.Text = AssemblyCompany;
 }
 internal static void InitializeBeforeRun()
 {
     ///初始资源文件的使用环境
     ResourcesReader.InitializeResources(Service.Path.Directory.ConfigLanguage, null);
     ///初始软件选项
     Service.Option.InitializeOption(Service.Path.File.OptionFile);
     ///初始化数据库服务
     Service.DbHelper = DbHelper.Creator(Service.Path.File.SqlXml);
     timer.Tick      += new EventHandler(timer_Tick);
     timer.Interval   = 1000 * 60 * 30;
     timer.Start();
 }
示例#25
0
 /// <summary>
 /// Performs assembly's types checking.
 /// </summary>
 /// <param name="sharedData">Used types and assemblies candidates.</param>
 /// <param name="evaluator">The project evaluator.</param>
 public void Check(CheckerSharedData sharedData, IProjectEvaluator evaluator)
 {
     try
     {
         var reader = new ResourcesReader(evaluator);
         CheckXamlDeclaredTypes(sharedData, evaluator, reader.GetXamlDeclaredTypes());
     }
     catch (Exception ex)
     {
         throw Error.CheckType(evaluator.ProjectAssembly.FullName,
                               Resources.BamlTypesChecker_CheckTypeException, ex);
     }
 }
示例#26
0
 /// <summary>
 /// 初始化的核心方法
 /// </summary>
 internal static void Initialize()
 {
     ///初始资源文件的使用环境
     ResourcesReader.InitializeResources(Service.PathService.Directory.ConfigLanguage, null);
     //Service.Logger.Log(.Add(new Log(LogType.Information,"初始资源文件的使用环境"));
     ///初始软件选项
     Service.Option.InitializeOption(Service.PathService.File.OptionFile);
     ///初始化一个供全局使用的分词类型对象(WordSeg)
     Service.JWordSegmentor = JWordSegmentorService.Creator(
         Service.PathService.Directory.Config,
         Service.PathService.Directory.SegData);
     ///初始化数据库服务
     Service.DbHelper = DbHelper.Creator(Service.PathService.File.SqlXml);
 }
示例#27
0
        public void Should_Not_Be_Valid_When_Name_Has_More_Than_200_Chars()
        {
            var name            = @"01234567890123456789012345678901234567890123456789
                        01234567890123456789012345678901234567890123456789
                        01234567890123456789012345678901234567890123456789
                        01234567890123456789012345678901234567890123456789
                        0123456789";
            var domainException = Assert.Throws <DomainException>(() =>
                                                                  Domain.Entities.Feedstock.New(name, _status, _measureId, _stock, _colorId, _tenantId));
            var domainError = domainException.Errors.First();
            var fieldName   = ResourcesReader.Field(nameof(_feedstock.Name));

            Assert.Equal(fieldName, domainError.Property);
            Assert.Equal(ValidationMessage.MaxLength(fieldName, 200), domainError.Messages.First());
        }
示例#28
0
        public TmpltDrawPanel(DesignPanel tDPanel, int width, int height, Image backImage)
            : base(tDPanel, width, height, backImage)
        {
            ResourcesReader.SetObjectResourcesHelper(this);

            InitializeComponent();

            //双缓存
            this.DoubleBuffered = true;
            this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
            this.SetStyle(ControlStyles.UserPaint, true);
            _lockedImg      = GetImage("lockedImage");
            _selectedImg    = GetImage("selectedImage");
            _hasSnip        = GetImage("hasSnipImage");
            _hasContentSnip = GetImage("hasContentSnipImage");
        }
示例#29
0
        public async Task WriteToInput(Page page, string value)
        {
            await page.EvaluateFunctionAsync(
                $"() => {{document.getElementById('g-recaptcha-response').innerHTML='{value}'}}");


            var script = ResourcesReader.ReadFile(this.GetType().Namespace + ".Scripts.EnterRecaptchaCallBackScript.js");

            try
            {
                await page.EvaluateFunctionAsync($@"(value) => {{{script}}}", value);
            }
            catch (Exception ex)
            {
                // ignored
            }
        }
示例#30
0
        protected string Edit_Get()
        {
            string  projectId = request.GetParameter("projectId");
            Project prj       = this.director.GetProject(projectId);

            if (prj == null)
            {
                var html_  = ResourcesReader.Read(assembly, prefix + "error.html");
                var html2_ = ResourcesReader.Read(assembly, prefix + "partial_navigator.html");
                return(html_.Replace("${ct_css}", ct_css)
                       .Replace("${subtitle}", subtitle)
                       .Replace("${navigator}", html2_)
                       .Replace("${msg}", "项目不存在"));
            }

            StringBuilder sb = new StringBuilder();
            int           i  = 0;

            foreach (string key in prj.Rules)
            {
                ++i;
                sb.Append("<p><input type=\"text\" name=\"p").Append(i.ToString()).Append("\" value=\"")
                .Append(key).Append("\"/><textarea name=\"r").Append(i.ToString()).Append("\" class=\"rulebox2\">")
                .Append(prj.Rules[key]).Append("</textarea>")
                .Append(
                    "<span class=\"removeProperty\">[&nbsp;<a href=\"javascript:;\" onclick=\"removeProperty(this)\">删除</a>&nbsp;]</span></p>");
            }


            var html  = ResourcesReader.Read(assembly, prefix + "update_project.html");
            var html2 = ResourcesReader.Read(assembly, prefix + "partial_navigator.html");

            return(html
                   .Replace("${ct_css}", ct_css)
                   .Replace("${subtitle}", subtitle)
                   .Replace("${navigator}", html2)
                   .Replace("${id}", projectId)
                   .Replace("${name}", prj.Name)
                   .Replace("${encoding}", prj.RequestEncoding)
                   .Replace("${listUriRule}", prj.ListUriRule)
                   .Replace("${listBlockRule}", prj.ListBlockRule)
                   .Replace("${pageUriRule}", prj.PageUriRule)
                   .Replace("${filterWordsRule}", prj.FilterWordsRule)
                   .Replace("${propertiesHtml}", sb.ToString()));
        }
示例#31
0
        protected string Delete_Get()
        {
            string projectId = request.GetParameter("projectId");
            string confirm   = request.GetParameter("confirm");

            string msg; //返回信息


            Project prj = this.director.GetProject(projectId);

            if (prj == null)
            {
                msg = "<span style=\"color:red\">项目不存在!\"></span>";
            }


            if (String.IsNullOrEmpty(confirm))
            {
                msg = String.Format(
                    "您确定删除项目:<span style=\"color:red\">{0}</span>&nbsp;吗?<br /><a href=\"?action=delete&confirm=ok&projectid={1}\">确定</a>&nbsp;<a href=\"?action=list\">取消</a>"
                    , prj.Name, projectId);
            }
            else
            {
                msg = "项目删除成功!";

                this.director.RemoveProject(prj);

                //更新项目缓存
                this.director.ClearProjects();
            }

            var html  = ResourcesReader.Read(assembly, prefix + "delete_project.html");
            var html2 = ResourcesReader.Read(assembly, prefix + "partial_navigator.html");


            return(html
                   .Replace("${ct_css}", ct_css)
                   .Replace("${subtitle}", subtitle)
                   .Replace("${navigator}", html2)
                   .Replace("${msg}", msg));
        }