public ScopeDisplayGroupInstance Create(string name, string description, UriInstance owningSiteUrl, bool displayInAdminUI)
        {
            var result = m_scopeDisplayGroupCollection.Create(name, description, owningSiteUrl.Uri, displayInAdminUI);

            return(result == null
                ? null
                : new ScopeDisplayGroupInstance(Engine, result));
        }
Exemplo n.º 2
0
 public override int GetHashCode()
 {
     return(HashCode.Combine(
                UriInstance.GetComponents(UriComponents.SchemeAndServer, UriFormat.Unescaped),
                UriInstance.GetComponents(UriComponents.Path, UriFormat.Unescaped),
                UriInstance.GetComponents(UriComponents.Query, UriFormat.Unescaped),
                MethodInstance
                ));
 }
Exemplo n.º 3
0
        public ScopeInstance Create(string name, string description, UriInstance owningSiteUrl, bool displayInAdminUI, string scopeCompilationType, string alternateResultsPage, string filter)
        {
            ScopeCompilationType type;

            scopeCompilationType.TryParseEnum(true, ScopeCompilationType.AlwaysCompile, out type);

            var result = m_scopeCollection.Create(name, description, owningSiteUrl.Uri, displayInAdminUI, alternateResultsPage, type, filter);

            return(result == null
                ? null
                : new ScopeInstance(Engine, result));
        }
Exemplo n.º 4
0
        public ScopeDisplayGroupInstance GetDisplayGroup(UriInstance siteUrl, string name)
        {
            if (siteUrl == null)
            {
                throw new JavaScriptException(Engine, "Error", "SiteUrl argument must be specified and an instance of UriInstance");
            }

            var result = m_remoteScopes.GetDisplayGroup(siteUrl.Uri, name);

            return(result == null
                ? null
                : new ScopeDisplayGroupInstance(Engine, result));
        }
Exemplo n.º 5
0
        public override string ToString()
        {
            var str = $"{Method} {UriInstance.ToString()}";

            if (Fields.Count > 0)
            {
                str += $" ({Fields.Count} fields)";
            }
            if (Headers.Count > 0)
            {
                str += $" ({Headers.Count} headers)";
            }
            return(str);
        }
Exemplo n.º 6
0
 public bool MatchesExceptQuery(HttpResource that)
 {
     if (UriInstance.GetComponents(UriComponents.SchemeAndServer, UriFormat.Unescaped) !=
         that.UriInstance.GetComponents(UriComponents.SchemeAndServer, UriFormat.Unescaped))
     {
         return(false);
     }
     if (UriInstance.GetComponents(UriComponents.Path, UriFormat.Unescaped) !=
         that.UriInstance.GetComponents(UriComponents.Path, UriFormat.Unescaped))
     {
         return(false);
     }
     if (!MethodInstance.Equals(that.MethodInstance))
     {
         return(false);
     }
     return(true);
 }
Exemplo n.º 7
0
        public override bool Equals(object obj)
        {
            if (!(obj is HttpResource))
            {
                return(false);
            }
            var that = (HttpResource)obj;

            if (!MatchesExceptQuery(that))
            {
                return(false);
            }
            if (UriInstance.GetComponents(UriComponents.Query, UriFormat.Unescaped) !=
                that.UriInstance.GetComponents(UriComponents.Query, UriFormat.Unescaped))
            {
                return(false);
            }
            return(true);
        }
Exemplo n.º 8
0
        public ArrayInstance GetUnusedScopesForSite(UriInstance siteUrl)
        {
            if (siteUrl == null)
            {
                throw new JavaScriptException(Engine, "Error", "SiteUrl argument must be specified and an instance of UriInstance");
            }

            var scopes = m_remoteScopes.GetUnusedScopesForSite(siteUrl.Uri);

            if (scopes == null)
            {
                return(null);
            }

            var result = Engine.Array.Construct();

            foreach (var scope in scopes.OfType <Scope>())
            {
                ArrayInstance.Push(result, new ScopeInstance(Engine, scope));
            }

            return(result);
        }