public async Task <bool> ChangeGlobalOption(IAriaOptions options) { var response = await _proxy.ChangeGlobalOption(XmlRpc.Options.From(options)); return(response == "OK"); }
public static Options From(IAriaOptions ariaOptions) { if (ariaOptions == null) { return(new Options()); } return(new Options() { AllProxy = ariaOptions.AllProxy, AllProxyPasswd = ariaOptions.AllProxyPasswd, AllProxyUser = ariaOptions.AllProxyUser, AllowOverwrite = ariaOptions.AllowOverwrite.ToString().ToLower(), AllowPieceLengthChange = ariaOptions.AllowPieceLengthChange.ToString().ToLower(), AlwaysResume = ariaOptions.AlwaysResume.ToString().ToLower(), AsyncDns = ariaOptions.AsyncDns.ToString().ToLower(), AutoFileRenaming = ariaOptions.AutoFileRenaming.ToString().ToLower(), BtEnableLpd = ariaOptions.BitTorrent.EnableLpd.ToString().ToLower(), BtExcludeTracker = string.Join(",", ariaOptions.BitTorrent.ExcludeTracker), BtExternalIp = ariaOptions.BitTorrent.ExternalIp, BtHashCheckSeed = ariaOptions.BitTorrent.HashCheckSeed, BtMaxOpenFiles = ariaOptions.BitTorrent.MaxOpenFiles.ToString(), BtMaxPeers = ariaOptions.BitTorrent.MaxPeers.ToString(), BtMetadataOnly = ariaOptions.BitTorrent.MetadataOnly.ToString().ToLower(), BtMinCryptoLevel = Enum.GetName(typeof(BitTorrentCryptoLevelOption), ariaOptions.BitTorrent.MinCryptoLevel), BtPrioritizePiece = ariaOptions.BitTorrent.PrioritizePiece, BtRemoveUnselectedFile = ariaOptions.BitTorrent.RemoveUnselectedFile.ToString().ToLower(), BtRequestPeerSpeedLimit = ariaOptions.BitTorrent.RequestPeerSpeedLimit.ToString(), BtRequireCrypto = ariaOptions.BitTorrent.RequireCrypto.ToString().ToLower(), BtSaveMetadata = ariaOptions.BitTorrent.SaveMetadata.ToString().ToLower(), BtSeedUnverified = ariaOptions.BitTorrent.SeedUnverified.ToString().ToLower(), BtStopTimeout = ariaOptions.BitTorrent.StopTimeout.ToString(), BtTracker = string.Join(",", ariaOptions.BitTorrent.Tracker), BtTrackerConnectTimeout = ariaOptions.BitTorrent.TrackerConnectTimeout.ToString(), BtTrackerInterval = ariaOptions.BitTorrent.TrackerInterval.ToString(), BtTrackerTimeout = ariaOptions.BitTorrent.TrackerTimeout.ToString(), CheckIntegrity = ariaOptions.CheckIntegrity.ToString().ToLower(), Checksum = ariaOptions.Checksum.Checksum, ConditionalGet = ariaOptions.ConditionalGet.ToString().ToLower(), ConnectTimeout = ariaOptions.ConnectTimeout.ToString(), Continue = ariaOptions.Continue.ToString().ToLower(), Dir = ariaOptions.Dir, DryRun = ariaOptions.DryRun.ToString().ToLower(), EnableAsyncDns6 = ariaOptions.EnableAsyncDns6.ToString().ToLower(), EnableHttpKeepAlive = ariaOptions.EnableHttpKeepAlive.ToString().ToLower(), EnableHttpPipelining = ariaOptions.EnableHttpPipelining.ToString().ToLower(), EnableMmap = ariaOptions.EnableMmap.ToString().ToLower(), EnablePeerExchange = ariaOptions.EnablePeerExchange.ToString().ToLower(), FileAllocation = Enum.GetName(typeof(FileAllocationOption), ariaOptions.FileAllocation), FollowMetalink = Enum.GetName(typeof(FollowOption), ariaOptions.FollowMetalink), FollowTorrent = Enum.GetName(typeof(FollowOption), ariaOptions.FollowTorrent), ForceSave = ariaOptions.ForceSave.ToString().ToLower(), FtpPasswd = ariaOptions.Ftp.Passwd, FtpPasv = ariaOptions.Ftp.Pasv.ToString().ToLower(), FtpProxy = ariaOptions.Ftp.Proxy, FtpProxyPasswd = ariaOptions.Ftp.ProxyPasswd, FtpProxyUser = ariaOptions.Ftp.ProxyUser, FtpReuseConnection = ariaOptions.Ftp.ReuseConnection.ToString().ToLower(), FtpType = Enum.GetName(typeof(FtpTransferTypeOption), ariaOptions.Ftp.TransferType), FtpUser = ariaOptions.Ftp.User, HashCheckOnly = ariaOptions.HashCheckOnly.ToString().ToLower(), Header = string.Join(",", ariaOptions.Header), HttpAcceptGzip = ariaOptions.Http.AcceptGzip.ToString().ToLower(), HttpAuthChallenge = ariaOptions.Http.AuthChallenge.ToString().ToLower(), HttpNoCache = ariaOptions.Http.NoCache.ToString().ToLower(), HttpPasswd = ariaOptions.Http.Passwd, HttpProxy = ariaOptions.Http.Proxy, HttpProxyPasswd = ariaOptions.Http.ProxyPasswd, HttpProxyUser = ariaOptions.Http.ProxyUser, HttpUser = ariaOptions.Http.User, HttpsProxy = ariaOptions.Https.Proxy, HttpsProxyPasswd = ariaOptions.Https.ProxyPasswd, HttpsProxyUser = ariaOptions.Https.ProxyUser, // IndexOut = ariaOptions.IndexOut, LowestSpeedLimit = ariaOptions.LowestSpeedLimit.ToString(), MaxConnectionPerServer = ariaOptions.MaxConnectionPerServer.ToString(), MaxDownloadLimit = ariaOptions.MaxDownloadLimit.ToString(), MaxFileNotFound = ariaOptions.MaxFileNotFound.ToString(), MaxResumeFailureTries = ariaOptions.MaxResumeFailureTries, MaxTries = ariaOptions.MaxTries.ToString(), MaxUploadLimit = ariaOptions.MaxUploadLimit.ToString(), MetalinkBaseUri = ariaOptions.Metalink.BaseUri, MetalinkEnableUniqueProtocol = ariaOptions.Metalink.EnableUniqueProtocol.ToString().ToLower(), MetalinkLanguage = ariaOptions.Metalink.Language, MetalinkLocation = ariaOptions.Metalink.Location, MetalinkOs = ariaOptions.Metalink.Os, MetalinkPreferredProtocol = Enum.GetName(typeof(ProtocolOption), ariaOptions.Metalink.PreferredProtocol), MetalinkVersion = ariaOptions.Metalink.Version, MinSplitSize = ariaOptions.MinSplitSize.ToString(), NoFileAllocationLimit = ariaOptions.NoFileAllocationLimit.ToString(), NoNetrc = ariaOptions.NoNetrc.ToString().ToLower(), NoProxy = string.Join(",", ariaOptions.NoProxy), Out = ariaOptions.Out, ParameterizedUri = ariaOptions.ParameterizedUri.ToString().ToLower(), Pause = ariaOptions.Pause.ToString().ToLower(), PieceLength = ariaOptions.PieceLength.ToString(), ProxyMethod = Enum.GetName(typeof(ProxyMethodOption), ariaOptions.ProxyMethod), RealtimeChunkChecksum = ariaOptions.RealtimeChunkChecksum.ToString().ToLower(), Referer = ariaOptions.Referer, RemoteTime = ariaOptions.RemoteTime.ToString().ToLower(), RemoveControlFile = ariaOptions.RemoveControlFile.ToString().ToLower(), RetryWait = ariaOptions.RetryWait.ToString(), ReuseUri = ariaOptions.ReuseUri.ToString().ToLower(), RpcSaveUploadMetadata = ariaOptions.RpcSaveUploadMetadata.ToString().ToLower(), SeedRatio = ariaOptions.SeedRatio.ToString(), SeedTime = ariaOptions.SeedTime.ToString(), SelectFile = ariaOptions.SelectFile, Split = ariaOptions.Split.ToString(), StreamPieceSelector = ariaOptions.StreamPieceSelector, Timeout = ariaOptions.Timeout.ToString(), UriSelector = Enum.GetName(typeof(URISelectorOption), ariaOptions.UriSelector), UseHead = ariaOptions.UseHead.ToString().ToLower(), UserAgent = ariaOptions.UserAgent }); }