protected void btnImport_Click(object sender, EventArgs e) { #if OnlineDemo this.ErrorDisplay.ShowError(WebUtils.LRes("FeatureDisabled")); return; #endif DbResXConverter Converter = new DbResXConverter(Context.Request.PhysicalApplicationPath); bool res = false; if (DbResourceConfiguration.Current.ResxExportProjectType == GlobalizationResxExportProjectTypes.WebForms) { res = Converter.ImportWebResources(); } else { res = Converter.ImportWinResources(Server.MapPath("~/")); } if (res) { ErrorDisplay.ShowMessage(WebUtils.LRes("ResourceImportComplete")); } else { ErrorDisplay.ShowError(WebUtils.LRes("ResourceImportFailed")); } lstResourceIds.ClearSelection(); lstResourceSet.ClearSelection(); GetResourceSet(); }
public bool ImportResxResources(string inputBasePath = null) { #if OnlineDemo throw new ApplicationException(WebUtils.GRes("FeatureDisabled")); #endif if (string.IsNullOrEmpty(inputBasePath)) inputBasePath = DbResourceConfiguration.Current.ResxBaseFolder; if (inputBasePath.Contains("~")) inputBasePath = Request.MapPath(inputBasePath,basePath: Host.ContentRootPath); inputBasePath = DbResourceUtils.NormalizePath(inputBasePath); DbResXConverter converter = new DbResXConverter(inputBasePath); bool res = false; if (DbResourceConfiguration.Current.ResxExportProjectType == GlobalizationResxExportProjectTypes.WebForms) res = converter.ImportWebResources(inputBasePath); else res = converter.ImportWinResources(inputBasePath); if (!res) new ApplicationException(DbIRes.T("ResourceImportFailed", STR_RESOURCESET)); return true; }
public void ImportResxResources() { bool result = false; //var manager = Activator.CreateInstance(DbResourceConfiguration.Current.DbResourceDataManagerType) as IDbResourceDataManager; //result = manager.CreateLocalizationTable("Localizations"); //Assert.IsTrue(result, manager.ErrorMessage); string physicalPath = Path.GetFullPath(@"..\..\..\Westwind.Globalization.Sample"); DbResXConverter converter = new DbResXConverter(physicalPath); result = converter.ImportWebResources(); Assert.IsTrue(result, converter.ErrorMessage); }
public bool ImportResxResources(string inputBasePath = null) { #if OnlineDemo throw new ApplicationException(WebUtils.GRes("FeatureDisabled")); #endif if (string.IsNullOrEmpty(inputBasePath)) { inputBasePath = DbResourceConfiguration.Current.ResxBaseFolder; } if (inputBasePath.Contains("~")) { inputBasePath = Context.Server.MapPath(inputBasePath); } inputBasePath = inputBasePath.Replace("/", "\\").Replace("\\\\", "\\"); DbResXConverter converter = new DbResXConverter(inputBasePath); bool res = false; if (DbResourceConfiguration.Current.ResxExportProjectType == GlobalizationResxExportProjectTypes.WebForms) { res = converter.ImportWebResources(inputBasePath); } else { res = converter.ImportWinResources(inputBasePath); } if (!res) { new ApplicationException(WebUtils.GRes(STR_RESOURCESET, "ResourceImportFailed")); } return(true); }
public bool ImportResxResources(string inputBasePath = null) { #if OnlineDemo throw new ApplicationException(WebUtils.GRes("FeatureDisabled")); #endif if (string.IsNullOrEmpty(inputBasePath)) inputBasePath = DbResourceConfiguration.Current.ResxBaseFolder; if (inputBasePath.Contains("~")) inputBasePath = Context.Server.MapPath(inputBasePath); inputBasePath = inputBasePath.Replace("/", "\\").Replace("\\\\", "\\"); DbResXConverter converter = new DbResXConverter(inputBasePath); bool res = false; if (DbResourceConfiguration.Current.ResxExportProjectType == GlobalizationResxExportProjectTypes.WebForms) res = converter.ImportWebResources(inputBasePath); else res = converter.ImportWinResources(inputBasePath); if (!res) new ApplicationException(WebUtils.GRes(STR_RESOURCESET, "ResourceImportFailed")); return true; }