public bool ExportResxResources(dynamic parms) { #if OnlineDemo throw new ApplicationException(WebUtils.GRes("FeatureDisabled")); #endif // Post: {outputBasePath: "~\Properties", resourceSets: ["rs1","rs2"] } string outputBasePath = parms["outputBasePath"]; string[] resourceSets = null; JArray t = parms["resourceSets"] as JArray; if (t != null) { resourceSets = t.ToObject <string[]>(); if (resourceSets != null && resourceSets.Length == 1 && string.IsNullOrEmpty(resourceSets[0])) { resourceSets = null; } } if (string.IsNullOrEmpty(outputBasePath)) { outputBasePath = DbResourceConfiguration.Current.ResxBaseFolder; } else if (outputBasePath.StartsWith("~")) { outputBasePath = Context.Server.MapPath(outputBasePath); } outputBasePath = outputBasePath.Replace("/", "\\").Replace("\\\\", "\\"); DbResXConverter exporter = new DbResXConverter(outputBasePath); if (DbResourceConfiguration.Current.ResxExportProjectType == GlobalizationResxExportProjectTypes.WebForms) { if (!exporter.GenerateLocalWebResourceResXFiles()) { throw new ApplicationException(WebUtils.GRes(STR_RESOURCESET, "ResourceGenerationFailed")); } if (!exporter.GenerateGlobalWebResourceResXFiles()) { throw new ApplicationException(WebUtils.GRes(STR_RESOURCESET, "ResourceGenerationFailed")); } } else { // if resourceSets is null all resources are generated if (!exporter.GenerateResXFiles(resourceSets)) { throw new ApplicationException(WebUtils.GRes(STR_RESOURCESET, "ResourceGenerationFailed")); } } return(true); }
public bool ExportResxResources([FromBody] dynamic parms) { #if OnlineDemo throw new ApplicationException(WebUtils.GRes("FeatureDisabled")); #endif // Post: {outputBasePath: "~\Properties", resourceSets: ["rs1","rs2"] } string outputBasePath = parms["outputBasePath"]; string[] resourceSets = null; JArray t = parms["resourceSets"] as JArray; if (t != null) { resourceSets = t.ToObject <string[]>(); if (resourceSets != null && resourceSets.Length == 1 && string.IsNullOrEmpty(resourceSets[0])) { resourceSets = null; } } if (string.IsNullOrEmpty(outputBasePath)) { outputBasePath = DbResourceConfiguration.Current.ResxBaseFolder; } if (outputBasePath.StartsWith("~")) { outputBasePath = Request.MapPath(outputBasePath, basePath: Host.ContentRootPath); } outputBasePath = FileUtils.NormalizePath(outputBasePath); DbResXConverter exporter = new DbResXConverter(outputBasePath); // if resourceSets is null all resources are generated if (!exporter.GenerateResXFiles(resourceSets)) { throw new ApplicationException(DbIRes.T("ResourceGenerationFailed", STR_RESOURCESET)); } return(true); }
public bool ExportResxResources(string outputBasePath = null) { #if OnlineDemo throw new ApplicationException(WebUtils.GRes("FeatureDisabled")); #endif if (string.IsNullOrEmpty(outputBasePath)) { outputBasePath = DbResourceConfiguration.Current.ResxBaseFolder; } else if (outputBasePath.StartsWith("~")) { outputBasePath = Context.Server.MapPath(outputBasePath); } outputBasePath = outputBasePath.Replace("/", "\\").Replace("\\\\", "\\"); DbResXConverter exporter = new DbResXConverter(outputBasePath); if (DbResourceConfiguration.Current.ResxExportProjectType == GlobalizationResxExportProjectTypes.WebForms) { if (!exporter.GenerateLocalWebResourceResXFiles()) { throw new ApplicationException(WebUtils.GRes(STR_RESOURCESET, "ResourceGenerationFailed")); } if (!exporter.GenerateGlobalWebResourceResXFiles()) { throw new ApplicationException(WebUtils.GRes(STR_RESOURCESET, "ResourceGenerationFailed")); } } else { if (!exporter.GenerateResXFiles()) { throw new ApplicationException(WebUtils.GRes(STR_RESOURCESET, "ResourceGenerationFailed")); } } return(true); }
public bool ExportResxResources([FromBody] dynamic parms) { #if OnlineDemo throw new WestwindException("Feature disabled"); #endif // Post: {outputBasePath: "~\Properties", resourceSets: ["rs1","rs2"] } string outputBasePath = parms["outputBasePath"]; string[] resourceSets = null; var t = parms["resourceSets"] as JArray; if (t != null) { resourceSets = t.ToObject <string[]>(); if (resourceSets != null && resourceSets.Length == 1 && string.IsNullOrEmpty(resourceSets[0])) { resourceSets = null; } } if (string.IsNullOrEmpty(outputBasePath)) { outputBasePath = configuration.ResxBaseFolder; } if (outputBasePath.StartsWith("~")) { outputBasePath = hostingEnvironment.MapPath(outputBasePath); } var exporter = new DbResXConverter(configuration, outputBasePath); // if resourceSets is null all resources are generated if (!exporter.GenerateResXFiles(resourceSets)) { throw new WestwindException("Resource generation failed"); } return(true); }
public bool ExportResxResources(dynamic parms) { #if OnlineDemo throw new ApplicationException(WebUtils.GRes("FeatureDisabled")); #endif // Post: {outputBasePath: "~\Properties", resourceSets: ["rs1","rs2"] } string outputBasePath = parms["outputBasePath"] ; string[] resourceSets = null; JArray t = parms["resourceSets"] as JArray; if (t != null) { resourceSets = t.ToObject<string[]>(); if (resourceSets != null && resourceSets.Length == 1 && string.IsNullOrEmpty(resourceSets[0])) resourceSets = null; } if (string.IsNullOrEmpty(outputBasePath)) outputBasePath = DbResourceConfiguration.Current.ResxBaseFolder; else if (outputBasePath.StartsWith("~")) outputBasePath = Context.Server.MapPath(outputBasePath); outputBasePath = outputBasePath.Replace("/", "\\").Replace("\\\\", "\\"); DbResXConverter exporter = new DbResXConverter(outputBasePath); if (DbResourceConfiguration.Current.ResxExportProjectType == GlobalizationResxExportProjectTypes.WebForms) { if (!exporter.GenerateLocalWebResourceResXFiles()) throw new ApplicationException(WebUtils.GRes(STR_RESOURCESET, "ResourceGenerationFailed")); if (!exporter.GenerateGlobalWebResourceResXFiles()) throw new ApplicationException(WebUtils.GRes(STR_RESOURCESET, "ResourceGenerationFailed")); } else { // if resourceSets is null all resources are generated if (!exporter.GenerateResXFiles(resourceSets)) throw new ApplicationException(WebUtils.GRes(STR_RESOURCESET, "ResourceGenerationFailed")); } return true; }
public void WriteResxFromDbResources() { DbResXConverter converter = new DbResXConverter(@"c:\temp\resources"); Assert.IsTrue(converter.GenerateResXFiles(), converter.ErrorMessage); }
public void WriteResxFromDbResources() { DbResXConverter converter = new DbResXConverter(configuration, @"c:\temp\resources"); Assert.True(converter.GenerateResXFiles(), converter.ErrorMessage); }
public bool ExportResxResources(string outputBasePath = null) { #if OnlineDemo throw new ApplicationException(WebUtils.GRes("FeatureDisabled")); #endif if (string.IsNullOrEmpty(outputBasePath)) outputBasePath = DbResourceConfiguration.Current.ResxBaseFolder; else if(outputBasePath.StartsWith("~")) outputBasePath = Context.Server.MapPath(outputBasePath); outputBasePath = outputBasePath.Replace("/", "\\").Replace("\\\\", "\\"); DbResXConverter exporter = new DbResXConverter(outputBasePath); if (DbResourceConfiguration.Current.ResxExportProjectType == GlobalizationResxExportProjectTypes.WebForms) { if (!exporter.GenerateLocalWebResourceResXFiles()) throw new ApplicationException(WebUtils.GRes(STR_RESOURCESET, "ResourceGenerationFailed")); if (!exporter.GenerateGlobalWebResourceResXFiles()) throw new ApplicationException(WebUtils.GRes(STR_RESOURCESET, "ResourceGenerationFailed")); } else { if (!exporter.GenerateResXFiles()) throw new ApplicationException(WebUtils.GRes(STR_RESOURCESET, "ResourceGenerationFailed")); } return true; }