public void OnRegistration(ICollection <IAuthorizationHandler> handlers) { var methId = GetScriptMethod("ПриРегистрацииОбработчиков", "OnHandlersRegistration"); if (methId == -1) { return; } ArrayImpl newClasses = new ArrayImpl(); var args = new IValue[] { newClasses }; CallScriptMethod(methId, args); foreach (var classPath in newClasses.Select(x => x.AsString())) { var fInfo = _filesystem.GetFileInfo(classPath); if (!fInfo.Exists || fInfo.IsDirectory) { throw new InvalidOperationException($"Module {classPath} is not found"); } var codeSource = new FileInfoCodeSource(fInfo); var instance = ScriptedAuthorizationHandler.CreateInstance(codeSource, _runtime); handlers.Add(instance); } }
public IWebProxy GetProxy(string protocol) { var settings = GetSettings(protocol); IWebProxy returnProxy; if (settings.proxy == null) { if (String.IsNullOrEmpty(settings.server)) { throw new RuntimeException("Не заданы настройки прокси-сервера для протокола, используемого в запросе"); } var wp = new WebProxy(settings.server, settings.port); wp.Credentials = settings.creds; wp.BypassList = _bypassProxyOnAddresses.Select(x => x.AsString()).ToArray(); wp.BypassProxyOnLocal = _bypassLocal; settings.proxy = wp; returnProxy = wp; } else { returnProxy = _proxies[protocol].proxy; } return(returnProxy); }
public void Set(string protocol, string server, int port = 0, string username = "", string password = "", bool useOSAuthentication = true) { protocol = protocol.ToLower(); if (!ProtocolNameIsValid(protocol)) { throw RuntimeException.InvalidArgumentValue(); } var builderServer = new UriBuilder(server); if (builderServer.Scheme.Equals(string.Empty)) { builderServer.Scheme = protocol; } if (port != 0) { builderServer.Port = port; } var proxyCredentials = useOSAuthentication ? CredentialCache.DefaultNetworkCredentials : GetBasicCredential(builderServer.Uri, username, password); _proxies[protocol] = new WebProxy(builderServer.Uri, _bypassLocal, _bypassProxyOnAddresses?.Select(x => x.AsString()).ToArray() ?? new string[] {}, proxyCredentials); }
public void LoadValues(ArrayImpl source) { Clear(); _items.AddRange(source.Select(x => new ValueListItem() { Value = x })); }
public IWebProxy GetProxy() { if (!_isDefault) { var wp = (WebProxy)_proxy; wp.Credentials = _creds; wp.BypassList = _bypassProxyOnAddresses.Select(x => x.AsString()).ToArray(); wp.BypassProxyOnLocal = _bypassLocal; } return(_proxy); }
public DirectorySearcherImpl(DirectoryEntryImpl directoryEntry, string filter, ArrayImpl propsToLoad, SearchScopeImpl searchScope) { _directorySearcher = new DirectorySearcher(directoryEntry._directoryEntry, filter, propsToLoad.Select(p => p.AsString()).ToArray(), SearchScopeConverter.ToSearchScope(searchScope)); SearchRoot = directoryEntry; PropertiesToLoad = propsToLoad; SearchScope = searchScope; }