Пример #1
0
            public void Initialize(IInitializationControl control)
            {
                if (HttpContext.Current == null)
                {
                    control.NotNow();
                    return;
                }
                _aliasses = new UwebshopAliassesXMLConfig();
                const string path = "/App_Plugins/uWebshop/config/ContentMapping.config";

                if (!System.IO.File.Exists(HttpContext.Current.Server.MapPath(path)))
                {
                    control.Debug("No Aliasses.config");
                }
                else
                {
                    try
                    {
                        _aliasses = DomainHelper.DeserializeXmlStringToObject <UwebshopAliassesXMLConfig>(System.IO.File.ReadAllText(HttpContext.Current.Server.MapPath(path)));
                        Log.Instance.LogDebug("ContentMapping xml loaded");
                        control.Debug("Done loading Aliasses.config");
                    }
                    catch (Exception ex)
                    {
                        Log.Instance.LogError(ex, "ContentMapping xml loading failed");
                        control.FatalError("Failure deserializing " + path);
                        throw;
                    }
                }

                InitNodeAliasses.Initialize(_aliasses);
            }
        public UwebshopAliassesXMLConfig Get()
        {
            const string path = "/App_Plugins/uWebshop/config/ContentMapping.config";

            if (!System.IO.File.Exists(HttpContext.Current.Server.MapPath(path)))
            {
                return(new UwebshopAliassesXMLConfig());
            }

            return(DomainHelper.DeserializeXmlStringToObject <UwebshopAliassesXMLConfig>(System.IO.File.ReadAllText(HttpContext.Current.Server.MapPath(path))));
        }