Esempio n. 1
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (Summary.Length != 0)
            {
                hash ^= Summary.GetHashCode();
            }
            hash ^= pages_.GetHashCode();
            hash ^= rules_.GetHashCode();
            if (DocumentationRootUrl.Length != 0)
            {
                hash ^= DocumentationRootUrl.GetHashCode();
            }
            if (ServiceRootUrl.Length != 0)
            {
                hash ^= ServiceRootUrl.GetHashCode();
            }
            if (Overview.Length != 0)
            {
                hash ^= Overview.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
Esempio n. 2
0
        public DefaultDocumentConfiguration Sanitize()
        {
            try
            {
                if (string.IsNullOrWhiteSpace(DocumentationRootUrl))
                {
                    DocumentationRootUrlString = new PathString();
                }
                else
                {
                    if (!DocumentationRootUrl.StartsWith("/"))
                    {
                        DocumentationRootUrl = "/" + DocumentationRootUrl;
                    }

                    DocumentationRootUrlString = new PathString(DocumentationRootUrl);
                }

                if (string.IsNullOrWhiteSpace(DefaultPage))
                {
                    DocumentationRootUrlString = new PathString();
                }
                else
                {
                    if (!DefaultPage.StartsWith("/"))
                    {
                        DefaultPage = "/" + DefaultPage;
                    }

                    DefaultPageString = new PathString(DefaultPage);
                }
            }
            catch
            {
                Enabled = false;
                throw;
            }

            if (DefaultFolderPaths != null)
            {
                for (var i = 0; i < DefaultFolderPaths.Count; i++)
                {
                    var path = DefaultFolderPaths[i];
                    try
                    {
                        path.FolderPathString  = new PathString(path.FolderPath);
                        path.DefaultPageString = new PathString(path.DefaultPage);
                    }
                    catch
                    {
                        DefaultFolderPaths.RemoveAt(i);
                        i--;
                    }
                }
                if (DefaultFolderPaths.Count == 0)
                {
                    DefaultFolderPaths = null;
                }
            }
            return(this);
        }