public bool ImportResxResources(string inputBasePath = null)
        {
#if OnlineDemo
            throw new WestwindException("Feature disabled");
#endif

            if (string.IsNullOrEmpty(inputBasePath))
            {
                inputBasePath = configuration.ResxBaseFolder;
            }

            if (inputBasePath.Contains("~"))
            {
                inputBasePath = hostingEnvironment.MapPath(inputBasePath);
            }

            var converter = new DbResXConverter(configuration, inputBasePath);

            var res = false;
            res = converter.ImportWinResources(inputBasePath);

            if (!res)
            {
                throw new WestwindException("Resource import failed");
            }

            return(true);
        }
Exemplo n.º 2
0
        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.True(result, manager.ErrorMessage);

            string          physicalPath = Path.GetFullPath(@"..\..\..\Westwind.Globalization.Sample");
            DbResXConverter converter    = new DbResXConverter(configuration, physicalPath);

            result = converter.ImportWinResources(physicalPath);

            Assert.True(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;
        }