//=====================================================================
 // Methods, etc.
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="provider">The base path provider</param>
 public BindingRedirectSettings(IBasePathProvider provider)
 {
     configFile = new FilePath(provider);
     assemblyName = "assemblyName";
     oldVersionFrom = new Version(1, 0, 0, 0);
     newVersion = new Version(1, 0, 0, 1);
 }
        private static FilePathCollection GetFilePaths(IBasePathProvider basePathProvider, XPathNavigator navigator, string xpath)
        {
            var schemaFilePaths         = new FilePathCollection();
            var schemaFilePathsNodeList = navigator.Select(xpath);

            foreach (XPathNavigator pathAttribute in schemaFilePathsNodeList)
            {
                var filePath = new FilePath(pathAttribute.Value, basePathProvider);
                schemaFilePaths.Add(filePath);
            }
            return(schemaFilePaths);
        }
Exemple #3
0
        //=====================================================================

        /// <summary>
        /// Create a wildcard reference settings instance from an XElement
        /// containing the settings.
        /// </summary>
        /// <param name="pathProvider">The base path provider object</param>
        /// <param name="element">The XElement from which to obtain the settings.</param>
        /// <returns>A <see cref="WildcardReferenceSettings"/> object containing the
        /// settings from the XElement.</returns>
        /// <remarks>It should contain an element called <c>reference</c>
        /// with three attributes (<c>path</c>, <c>wildcard</c>, and <c>recurse</c>).
        /// </remarks>
        public static WildcardReferenceSettings FromXPathNavigator(IBasePathProvider pathProvider,
                                                                   XElement element)
        {
            WildcardReferenceSettings wr = new WildcardReferenceSettings();

            if (element != null)
            {
                wr.ReferencePath = new FolderPath(element.Attribute("path").Value.Trim(), pathProvider);
                wr.Wildcard      = element.Attribute("wildcard").Value;
                wr.Recursive     = (bool)element.Attribute("recurse");
            }

            return(wr);
        }
Exemple #4
0
        /// <summary>
        /// This is used to load the binding redirect settings list from the configuration settings
        /// </summary>
        /// <param name="pathProvider">The base path provider object</param>
        /// <param name="navigator">The XPath navigator from which the information is loaded</param>
        public void FromXml(IBasePathProvider pathProvider, XPathNavigator navigator)
        {
            XPathNodeIterator iterator;

            if (navigator == null)
            {
                throw new ArgumentNullException("navigator");
            }

            iterator = navigator.Select("assemblyBinding/dependentAssembly");

            foreach (XPathNavigator nav in iterator)
            {
                this.Add(BindingRedirectSettings.FromXPathNavigator(pathProvider, nav));
            }
        }
        /// <summary>
        /// This is used to load the version settings list from the configuration settings
        /// </summary>
        /// <param name="pathProvider">The base path provider object</param>
        /// <param name="navigator">The XPath navigator from which the information is loaded</param>
        public void FromXml(IBasePathProvider pathProvider, XPathNavigator navigator)
        {
            XPathNodeIterator iterator;

            if (navigator == null)
            {
                throw new ArgumentNullException("navigator");
            }

            iterator = navigator.Select("versions/version");

            foreach (XPathNavigator nav in iterator)
            {
                this.Add(VersionSettings.FromXPathNavigator(pathProvider, nav));
            }
        }
Exemple #6
0
        //=====================================================================

        /// <summary>
        /// Create a version settings instance from an XPath navigator
        /// containing the settings.
        /// </summary>
        /// <param name="pathProvider">The base path provider object</param>
        /// <param name="navigator">The XPath navigator from which to
        /// obtain the settings.</param>
        /// <returns>A <see cref="VersionSettings"/> object containing the
        /// settings from the XPath navigator.</returns>
        /// <remarks>It should contain an element called <c>version</c>
        /// with three attributes (<c>label</c>, <c>version</c> and
        /// <c>helpFileProject</c>).</remarks>
        public static VersionSettings FromXPathNavigator(
            IBasePathProvider pathProvider, XPathNavigator navigator)
        {
            VersionSettings vs = new VersionSettings();

            if (navigator != null)
            {
                vs.FrameworkLabel = navigator.GetAttribute("label",
                                                           String.Empty).Trim();
                vs.Version = navigator.GetAttribute("version",
                                                    String.Empty).Trim();
                vs.HelpFileProject = new FilePath(navigator.GetAttribute(
                                                      "helpFileProject", String.Empty).Trim(), pathProvider);
            }

            return(vs);
        }
Exemple #7
0
        /// <summary>
        /// This is used to load the reference link settings list from the
        /// configuration settings.
        /// </summary>
        /// <param name="pathProvider">The base path provider object</param>
        /// <param name="navigator">The XPath navigator from which the
        /// information is loaded.</param>
        public void FromXml(IBasePathProvider pathProvider,
                            XPathNavigator navigator)
        {
            XPathNodeIterator iterator;

            if (navigator == null)
            {
                throw new ArgumentNullException("navigator");
            }

            iterator = navigator.Select("targets/target");
            foreach (XPathNavigator nav in iterator)
            {
                this.Add(ReferenceLinkSettings.FromXPathNavigator(pathProvider,
                                                                  nav));
            }
        }
Exemple #8
0
        public static MvcHtmlString AddPageEditing(this HtmlHelper html)
        {
            if (ModeProvider == null)
            {
                ModeProvider = DependencyResolver.Current.GetService <IModeProvider>();
            }

            if (ModeProvider.GetIsPageEditing(html.ViewContext.HttpContext) != true)
            {
                return(null);
            }

            if (BasePathProvider == null)
            {
                BasePathProvider = DependencyResolver.Current.GetService <IBasePathProvider>();
            }

            return(MvcHtmlString.Create($"<script src=\"/{BasePathProvider.BasePath}/PageEditing/Scripts/target-page-editor.js\" async></script>"));
        }
 private XsdPlugInConfiguration(IBasePathProvider basePathProvider, XPathNavigator navigator)
 {
     BasePathProvider     = basePathProvider;
     DocumentRootSchemas  = GetBoolean(navigator, "configuration/document/@rootSchemas", true);
     DocumentRootElements = GetBoolean(navigator, "configuration/document/@rootElements", true);
     DocumentConstraints  = GetBoolean(navigator, "configuration/document/@constraints", true);
     DocumentSchemas      = GetBoolean(navigator, "configuration/document/@schemas", true);
     DocumentSyntax       = GetBoolean(navigator, "configuration/document/@syntax", true);
     UseTypeDocumentationForUndocumentedAttributes = GetBoolean(navigator, "configuration/useTypeDocumentation/@forUndocumentedAttributes", true);
     UseTypeDocumentationForUndocumentedElements   = GetBoolean(navigator, "configuration/useTypeDocumentation/@forUndocumentedElements", true);
     SchemaSetContainer          = GetBoolean(navigator, "configuration/schemaSet/@container", false);
     SchemaSetTitle              = GetString(navigator, "configuration/schemaSet/@title", string.Empty);
     NamespaceContainer          = GetBoolean(navigator, "configuration/namespace/@container", true);
     SortOrder                   = GetInt32(navigator, "configuration/sortOrder", 1);
     IncludeLinkUriInKeywordK    = GetBoolean(navigator, "configuration/includeLinkUriInKeywordK", false);
     AnnotationTransformFilePath = GetFilePath(basePathProvider, navigator, "configuration/annotationTransformFile/@path");
     SchemaFilePaths             = GetFilePaths(basePathProvider, navigator, "configuration/schemaFiles/schemaFile/@path");
     SchemaDependencyFilePaths   = GetFilePaths(basePathProvider, navigator, "configuration/dependencyFiles/schemaFile/@path");
     DocFilePaths                = GetFilePaths(basePathProvider, navigator, "configuration/docFiles/docFile/@path");
 }
        //=====================================================================

        /// <summary>
        /// Create a version settings instance from an XPath navigator
        /// containing the settings.
        /// </summary>
        /// <param name="pathProvider">The base path provider object</param>
        /// <param name="navigator">The XPath navigator from which to
        /// obtain the settings.</param>
        /// <returns>A <see cref="VersionSettings"/> object containing the
        /// settings from the XPath navigator.</returns>
        /// <remarks>It should contain an element called <c>version</c>
        /// with four attributes (<c>label</c>, <c>version</c>,
        /// <c>ripOldApis</c>, and <c>helpFileProject</c>).</remarks>
        public static VersionSettings FromXPathNavigator(
            IBasePathProvider pathProvider, XPathNavigator navigator)
        {
            VersionSettings vs = new VersionSettings();

            if (navigator != null)
            {
                vs.FrameworkLabel = navigator.GetAttribute("label",
                                                           String.Empty).Trim();
                vs.Version = navigator.GetAttribute("version",
                                                    String.Empty).Trim();

                string ripOldApis = navigator.GetAttribute("ripOldApis", String.Empty);
                vs.RipOldApis = !String.IsNullOrEmpty(ripOldApis) && Convert.ToBoolean(ripOldApis);

                vs.HelpFileProject = new FilePath(navigator.GetAttribute(
                                                      "helpFileProject", String.Empty).Trim(), pathProvider);
            }

            return(vs);
        }
        /// <summary>
        /// Generate the table of contents for the conceptual topics
        /// </summary>
        /// <param name="toc">The table of contents collection</param>
        /// <param name="pathProvider">The base path provider</param>
        /// <param name="includeInvisibleItems">True to include items marked invisible (useful for previewing)
        /// or false to exclude them.</param>
        public void GenerateTableOfContents(TocEntryCollection toc, IBasePathProvider pathProvider,
                                            bool includeInvisibleItems)
        {
            TocEntry entry;

            foreach (Topic t in this)
            {
                if (t.Visible || includeInvisibleItems)
                {
                    entry = new TocEntry(pathProvider);

                    if (t.TopicFile != null)
                    {
                        entry.SourceFile = new FilePath(t.TopicFile.FullPath,
                                                        t.TopicFile.FileItem.ProjectElement.Project);
                        entry.DestinationFile = "html\\" + t.Id + ".htm";
                    }

                    entry.Id             = t.Id;
                    entry.PreviewerTitle = String.IsNullOrEmpty(t.Title) ?
                                           Path.GetFileNameWithoutExtension(t.TopicFilename) : t.Title;
                    entry.LinkText       = String.IsNullOrEmpty(t.LinkText) ? t.DisplayTitle : t.LinkText;
                    entry.Title          = t.DisplayTitle;
                    entry.IsDefaultTopic = t.IsDefaultTopic;
                    entry.ApiParentMode  = t.ApiParentMode;
                    entry.IsExpanded     = t.IsExpanded;
                    entry.IsSelected     = t.IsSelected;

                    if (t.Subtopics.Count != 0)
                    {
                        t.Subtopics.GenerateTableOfContents(entry.Children, pathProvider, includeInvisibleItems);
                    }

                    toc.Add(entry);
                }
            }
        }
Exemple #12
0
        //=====================================================================

        /// <summary>
        /// Create a reference link settings instance from an XPath navigator
        /// containing the settings.
        /// </summary>
        /// <param name="pathProvider">The base path provider object</param>
        /// <param name="navigator">The XPath navigator from which to
        /// obtain the settings.</param>
        /// <returns>A <see cref="ReferenceLinkSettings"/> object containing the
        /// settings from the XPath navigator.</returns>
        /// <remarks>It should contain an element called <c>target</c>
        /// with two attributes (<c>linkType</c> and <c>helpFileProject</c>).
        /// </remarks>
        public static ReferenceLinkSettings FromXPathNavigator(
            IBasePathProvider pathProvider, XPathNavigator navigator)
        {
            ReferenceLinkSettings rl = new ReferenceLinkSettings();

            if (navigator != null)
            {
                // Ignore if it's the older style
                if (navigator.GetAttribute("linkType", String.Empty).Length == 0)
                {
                    rl.HtmlSdkLinkType = (HtmlSdkLinkType)Enum.Parse(typeof(HtmlSdkLinkType), navigator.GetAttribute(
                                                                         "htmlSdkLinkType", String.Empty).Trim(), true);
                    rl.MSHelpViewerSdkLinkType = (MSHelpViewerSdkLinkType)Enum.Parse(typeof(MSHelpViewerSdkLinkType),
                                                                                     navigator.GetAttribute("helpViewerSdkLinkType", String.Empty).Trim(), true);
                    rl.WebsiteSdkLinkType = (HtmlSdkLinkType)Enum.Parse(typeof(HtmlSdkLinkType), navigator.GetAttribute(
                                                                            "websiteSdkLinkType", String.Empty).Trim(), true);
                }

                rl.HelpFileProject = new FilePath(navigator.GetAttribute("helpFileProject", String.Empty).Trim(),
                                                  pathProvider);
            }

            return(rl);
        }
        //=====================================================================

        /// <summary>
        /// Create a binding redirect settings instance from an XPath navigator containing the settings
        /// </summary>
        /// <param name="pathProvider">The base path provider object</param>
        /// <param name="navigator">The XPath navigator from which to obtain the settings</param>
        /// <returns>A <see cref="BindingRedirectSettings"/> object containing the settings from the XPath
        /// navigator.</returns>
        /// <remarks>It should contain an element called <c>dependentAssembly</c> with a <c>configFile</c>
        /// attribute or a nested <c>assemblyIdentity</c> and <c>bindingRedirect</c> element that define
        /// the settings.</remarks>
        public static BindingRedirectSettings FromXPathNavigator(IBasePathProvider pathProvider,
                                                                 XPathNavigator navigator)
        {
            BindingRedirectSettings brs = new BindingRedirectSettings(pathProvider);
            XPathNavigator          nav;
            string value;

            string[] versions;
            Version  tempVersion;

            if (navigator != null)
            {
                value = navigator.GetAttribute("importFrom", String.Empty).Trim();

                if (value.Length != 0)
                {
                    brs.ConfigurationFile = new FilePath(value, pathProvider);
                }
                else
                {
                    nav = navigator.SelectSingleNode("assemblyIdentity");

                    if (nav != null)
                    {
                        brs.AssemblyName   = nav.GetAttribute("name", String.Empty).Trim();
                        brs.PublicKeyToken = nav.GetAttribute("publicKeyToken", String.Empty).Trim();
                        brs.Culture        = nav.GetAttribute("culture", String.Empty).Trim();
                    }

                    nav = navigator.SelectSingleNode("bindingRedirect");

                    if (nav != null)
                    {
                        value = nav.GetAttribute("newVersion", String.Empty).Trim();

                        if (value.Length != 0)
                        {
                            brs.NewVersion = new Version(value);
                        }

                        value    = nav.GetAttribute("oldVersion", String.Empty).Trim();
                        versions = value.Split('-');

                        if (versions.Length == 2)
                        {
                            if (versions[0].Trim().Length != 0)
                            {
                                brs.OldVersion = new Version(versions[0]);
                            }

                            if (versions[1].Trim().Length != 0)
                            {
                                brs.OldVersionTo = new Version(versions[1]);
                            }

                            if (brs.OldVersion > brs.oldVersionTo)
                            {
                                tempVersion      = brs.OldVersion;
                                brs.OldVersion   = brs.oldVersionTo;
                                brs.oldVersionTo = tempVersion;
                            }
                        }
                        else
                        {
                            brs.OldVersion = new Version(versions[0]);
                        }
                    }
                }
            }

            return(brs);
        }
Exemple #14
0
 /// <summary>
 /// Constructor.  Assign the specified path.
 /// </summary>
 /// <param name="path">A relative or absolute path.</param>
 /// <param name="provider">The base base provider</param>
 /// <remarks>Unless <see cref="IsFixedPath"/> is set to true,
 /// the path is always treated as a relative path.</remarks>
 public FilePath(string path, IBasePathProvider provider)
 {
     basePathProvider = provider;
     this.Path = path;
 }
Exemple #15
0
 //=====================================================================
 /// <summary>
 /// Default constructor.  The file path is undefined.
 /// </summary>
 /// <param name="provider">The base base provider</param>
 /// <overloads>There are three overloads for the constructor.</overloads>
 public FilePath(IBasePathProvider provider)
 {
     basePathProvider = provider;
     filePath = String.Empty;
 }
        public PathPrefixProvider(IBasePathProvider basePathProvider)
        {
            BasePathProvider = basePathProvider;

            Prefix = $"/{BasePathProvider.BasePath}/PageEditing/EditPage/";
        }
Exemple #17
0
		public ResourceReference(uint type, IResourceManager resourceManager, IBasePathProvider container)
		{
			this.type = type;
			this.resourceManager = resourceManager;
			this.container = container;
		}
        //=====================================================================

        /// <summary>
        /// Create a wildcard reference settings instance from an XElement
        /// containing the settings.
        /// </summary>
        /// <param name="pathProvider">The base path provider object</param>
        /// <param name="element">The XElement from which to obtain the settings.</param>
        /// <returns>A <see cref="WildcardReferenceSettings"/> object containing the
        /// settings from the XElement.</returns>
        /// <remarks>It should contain an element called <c>reference</c>
        /// with three attributes (<c>path</c>, <c>wildcard</c>, and <c>recurse</c>).
        /// </remarks>
        public static WildcardReferenceSettings FromXPathNavigator(IBasePathProvider pathProvider,
          XElement element)
        {
            WildcardReferenceSettings wr = new WildcardReferenceSettings();

            if(element != null)
            {
                wr.ReferencePath = new FolderPath(element.Attribute("path").Value.Trim(), pathProvider);
                wr.Wildcard = element.Attribute("wildcard").Value;
                wr.Recursive = (bool)element.Attribute("recurse");
            }

            return wr;
        }
        //=====================================================================

        /// <summary>
        /// Create a reference link settings instance from an XPath navigator
        /// containing the settings.
        /// </summary>
        /// <param name="pathProvider">The base path provider object</param>
        /// <param name="navigator">The XPath navigator from which to
        /// obtain the settings.</param>
        /// <returns>A <see cref="ReferenceLinkSettings"/> object containing the
        /// settings from the XPath navigator.</returns>
        /// <remarks>It should contain an element called <c>target</c>
        /// with two attributes (<c>linkType</c> and <c>helpFileProject</c>).
        /// </remarks>
        public static ReferenceLinkSettings FromXPathNavigator(
          IBasePathProvider pathProvider, XPathNavigator navigator)
        {
            ReferenceLinkSettings rl = new ReferenceLinkSettings();

            if(navigator != null)
            {
                // Ignore if it's the older style
                if(navigator.GetAttribute("linkType", String.Empty).Length == 0)
                {
                    rl.HtmlSdkLinkType = (HtmlSdkLinkType)Enum.Parse(typeof(HtmlSdkLinkType), navigator.GetAttribute(
                        "htmlSdkLinkType", String.Empty).Trim(), true);
                    rl.MSHelpViewerSdkLinkType = (MSHelpViewerSdkLinkType)Enum.Parse(typeof(MSHelpViewerSdkLinkType),
                        navigator.GetAttribute("helpViewerSdkLinkType", String.Empty).Trim(), true);
                    rl.WebsiteSdkLinkType = (HtmlSdkLinkType)Enum.Parse(typeof(HtmlSdkLinkType), navigator.GetAttribute(
                        "websiteSdkLinkType", String.Empty).Trim(), true);
                }

                rl.HelpFileProject = new FilePath(navigator.GetAttribute("helpFileProject", String.Empty).Trim(),
                    pathProvider);
            }

            return rl;
        }
Exemple #20
0
        //=====================================================================

        /// <summary>
        /// Default constructor.  The file path is undefined.
        /// </summary>
        /// <param name="provider">The base path provider</param>
        /// <overloads>There are three overloads for the constructor.</overloads>
        public FilePath(IBasePathProvider provider)
        {
            basePathProvider = provider;
            filePath         = String.Empty;
        }
Exemple #21
0
 public ControllerRouter(IBasePathProvider basePathProvider, IComponentRepository componentRepository)
 {
     BasePathProvider    = basePathProvider;
     ComponentRepository = componentRepository;
 }
Exemple #22
0
 public ContentFileProvider(IBasePathProvider basePathProvider)
 {
     this.basePathProvider = basePathProvider;
 }
Exemple #23
0
 public AddPageEditingHtmlGenerator(IBasePathProvider basePathProvider)
 {
     BasePathProvider = basePathProvider;
 }
        //=====================================================================

        /// <summary>
        /// Internal constructor
        /// </summary>
        /// <param name="filename">The filename of the documentation source</param>
        /// <param name="configuration">The configuration to use for projects</param>
        /// <param name="platform">The platform to use for projects</param>
        /// <param name="includeSubfolders">True to include subfolders, false to only search the top-level folder</param>
        /// <param name="basePathProvider">The base path provider</param>
        internal DocumentationSource(string filename, string configuration, string platform, bool includeSubfolders,
          IBasePathProvider basePathProvider)
        {
            this.includeSubFolders = includeSubfolders;
            this.configuration = configuration;
            this.platform = platform;
            this.SourceFile = new FilePath(filename, basePathProvider);
        }
Exemple #25
0
 /// <summary>
 /// Constructor.  Assign the specified path and fixed setting.
 /// </summary>
 /// <param name="path">A relative or absolute path.</param>
 /// <param name="isFixed">True to treat the path as fixed, false to treat it as a relative path.</param>
 /// <param name="provider">The base path provider</param>
 public FilePath(string path, bool isFixed, IBasePathProvider provider)
 {
     basePathProvider = provider;
     this.Path        = path;
     isFixedPath      = isFixed;
 }
 public EmbeddedFileProvider(IBasePathProvider basePathProvider, IEmbeddedResourceProvider embeddedResourceProvider)
 {
     EmbeddedResourceProvider = embeddedResourceProvider;
     Prefix = $"/{basePathProvider.BasePath}/";
 }
        //=====================================================================
        /// <summary>
        /// Create a version settings instance from an XPath navigator
        /// containing the settings.
        /// </summary>
        /// <param name="pathProvider">The base path provider object</param>
        /// <param name="navigator">The XPath navigator from which to
        /// obtain the settings.</param>
        /// <returns>A <see cref="VersionSettings"/> object containing the
        /// settings from the XPath navigator.</returns>
        /// <remarks>It should contain an element called <c>version</c>
        /// with three attributes (<c>label</c>, <c>version</c> and
        /// <c>helpFileProject</c>).</remarks>
        public static VersionSettings FromXPathNavigator(
          IBasePathProvider pathProvider, XPathNavigator navigator)
        {
            VersionSettings vs = new VersionSettings();

            if(navigator != null)
            {
                vs.FrameworkLabel = navigator.GetAttribute("label",
                    String.Empty).Trim();
                vs.Version = navigator.GetAttribute("version",
                    String.Empty).Trim();
                vs.HelpFileProject = new FilePath(navigator.GetAttribute(
                    "helpFileProject", String.Empty).Trim(), pathProvider);
            }

            return vs;
        }
Exemple #28
0
        //=====================================================================

        /// <summary>
        /// Create a version settings instance from an XPath navigator
        /// containing the settings.
        /// </summary>
        /// <param name="pathProvider">The base path provider object</param>
        /// <param name="navigator">The XPath navigator from which to
        /// obtain the settings.</param>
        /// <returns>A <see cref="VersionSettings"/> object containing the
        /// settings from the XPath navigator.</returns>
        /// <remarks>It should contain an element called <c>version</c>
        /// with four attributes (<c>label</c>, <c>version</c>,
        /// <c>ripOldApis</c>, and <c>helpFileProject</c>).</remarks>
        public static VersionSettings FromXPathNavigator(
          IBasePathProvider pathProvider, XPathNavigator navigator)
        {
            VersionSettings vs = new VersionSettings();

            if(navigator != null)
            {
                vs.FrameworkLabel = navigator.GetAttribute("label",
                    String.Empty).Trim();
                vs.Version = navigator.GetAttribute("version",
                    String.Empty).Trim();

                string ripOldApis = navigator.GetAttribute("ripOldApis", String.Empty);
                vs.RipOldApis = !String.IsNullOrEmpty(ripOldApis) && Convert.ToBoolean(ripOldApis);

                vs.HelpFileProject = new FilePath(navigator.GetAttribute(
                    "helpFileProject", String.Empty).Trim(), pathProvider);
            }

            return vs;
        }
Exemple #29
0
 /// <summary>
 /// Constructor.  Assign the specified path.
 /// </summary>
 /// <param name="path">A relative or absolute path.</param>
 /// <param name="provider">The base path provider</param>
 /// <remarks>Unless <see cref="FilePath.IsFixedPath"/> is set to true,
 /// the path is always treated as a relative path.</remarks>
 public FolderPath(string path, IBasePathProvider provider) :
   base(path, provider)
 {
 }
 public PoetryPortalController(IBasePathProvider basePathProvider)
 {
     BasePathProvider = basePathProvider;
 }
 public static XsdPlugInConfiguration FromXml(IBasePathProvider basePathProvider, XPathNavigator configuration)
 {
     return(new XsdPlugInConfiguration(basePathProvider, configuration));
 }
Exemple #32
0
 /// <summary>
 /// Constructor.  Assign the specified path.
 /// </summary>
 /// <param name="path">A relative or absolute path.</param>
 /// <param name="provider">The base path provider</param>
 /// <remarks>Unless <see cref="IsFixedPath"/> is set to true, the path is always treated as a relative
 /// path.</remarks>
 public FilePath(string path, IBasePathProvider provider)
 {
     basePathProvider = provider;
     this.Path        = path;
 }
        //=====================================================================

        /// <summary>
        /// Default constructor.  The folder path is undefined.
        /// </summary>
        /// <param name="provider">The base path provider</param>
        /// <overloads>There are three overloads for the constructor.</overloads>
        public FolderPath(IBasePathProvider provider) : base(provider)
        {
        }
        //=====================================================================

        /// <summary>
        /// Create a binding redirect settings instance from an XPath navigator containing the settings
        /// </summary>
        /// <param name="pathProvider">The base path provider object</param>
        /// <param name="navigator">The XPath navigator from which to obtain the settings</param>
        /// <returns>A <see cref="BindingRedirectSettings"/> object containing the settings from the XPath
        /// navigator.</returns>
        /// <remarks>It should contain an element called <c>dependentAssembly</c> with a <c>configFile</c>
        /// attribute or a nested <c>assemblyIdentity</c> and <c>bindingRedirect</c> element that define
        /// the settings.</remarks>
        public static BindingRedirectSettings FromXPathNavigator(IBasePathProvider pathProvider,
          XPathNavigator navigator)
        {
            BindingRedirectSettings brs = new BindingRedirectSettings(pathProvider);
            XPathNavigator nav;
            string value;
            string[] versions;
            Version tempVersion;

            if(navigator != null)
            {
                value = navigator.GetAttribute("importFrom", String.Empty).Trim();

                if(value.Length != 0)
                    brs.ConfigurationFile = new FilePath(value, pathProvider);
                else
                {
                    nav = navigator.SelectSingleNode("assemblyIdentity");

                    if(nav != null)
                    {
                        brs.AssemblyName = nav.GetAttribute("name", String.Empty).Trim();
                        brs.PublicKeyToken = nav.GetAttribute("publicKeyToken", String.Empty).Trim();
                        brs.Culture = nav.GetAttribute("culture", String.Empty).Trim();
                    }

                    nav = navigator.SelectSingleNode("bindingRedirect");

                    if(nav != null)
                    {
                        value = nav.GetAttribute("newVersion", String.Empty).Trim();

                        if(value.Length != 0)
                            brs.NewVersion = new Version(value);

                        value = nav.GetAttribute("oldVersion", String.Empty).Trim();
                        versions = value.Split('-');

                        if(versions.Length == 2)
                        {
                            if(versions[0].Trim().Length != 0)
                                brs.OldVersion = new Version(versions[0]);

                            if(versions[1].Trim().Length != 0)
                                brs.OldVersionTo = new Version(versions[1]);

                            if(brs.OldVersion > brs.oldVersionTo)
                            {
                                tempVersion = brs.OldVersion;
                                brs.OldVersion = brs.oldVersionTo;
                                brs.oldVersionTo = tempVersion;
                            }
                        }
                        else
                            brs.OldVersion = new Version(versions[0]);
                    }
                }
            }

            return brs;
        }
 /// <summary>
 /// Constructor.  Assign the specified path.
 /// </summary>
 /// <param name="path">A relative or absolute path.</param>
 /// <param name="provider">The base path provider</param>
 /// <remarks>Unless <see cref="FilePath.IsFixedPath"/> is set to true,
 /// the path is always treated as a relative path.</remarks>
 public FolderPath(string path, IBasePathProvider provider) :
     base(path, provider)
 {
 }
Exemple #36
0
        //=====================================================================

        /// <summary>
        /// Default constructor.  The folder path is undefined.
        /// </summary>
        /// <param name="provider">The base path provider</param>
        /// <overloads>There are three overloads for the constructor.</overloads>
        public FolderPath(IBasePathProvider provider) : base(provider)
        {
        }
 /// <summary>
 /// Constructor.  Assign the specified path and fixed setting.
 /// </summary>
 /// <param name="path">A relative or absolute path.</param>
 /// <param name="isFixed">True to treat the path as fixed, false
 /// to treat it as a relative path.</param>
 /// <param name="provider">The base path provider</param>
 public FolderPath(string path, bool isFixed, IBasePathProvider provider) :
     base(path, isFixed, provider)
 {
 }
Exemple #38
0
 /// <summary>
 /// Constructor.  Assign the specified path and fixed setting.
 /// </summary>
 /// <param name="path">A relative or absolute path.</param>
 /// <param name="isFixed">True to treat the path as fixed, false
 /// to treat it as a relative path.</param>
 /// <param name="provider">The base path provider</param>
 public FolderPath(string path, bool isFixed, IBasePathProvider provider) :
   base(path, isFixed, provider)
 {
 }
Exemple #39
0
 /// <summary>
 /// Constructor.  Assign the specified path and fixed setting.
 /// </summary>
 /// <param name="path">A relative or absolute path.</param>
 /// <param name="isFixed">True to treat the path as fixed, false
 /// to treat it as a relative path.</param>
 /// <param name="provider">The base base provider</param>
 public FilePath(string path, bool isFixed, IBasePathProvider provider)
 {
     basePathProvider = provider;
     this.Path = path;
     isFixedPath = isFixed;
 }