当前位置: 首页>>代码示例>>C#>>正文


C# Uri.EnsureTrailingSlash方法代码示例

本文整理汇总了C#中System.Uri.EnsureTrailingSlash方法的典型用法代码示例。如果您正苦于以下问题:C# Uri.EnsureTrailingSlash方法的具体用法?C# Uri.EnsureTrailingSlash怎么用?C# Uri.EnsureTrailingSlash使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Uri的用法示例。


在下文中一共展示了Uri.EnsureTrailingSlash方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: EntryEndpoint

 /// <summary>
 /// Creates a new entry point using an OAuth token.
 /// </summary>
 /// <param name="uri">The base URI of the REST interface. Missing trailing slash will be appended automatically.</param>
 /// <param name="token">The OAuth token to present as a "Bearer" to the REST interface.</param>
 /// <param name="serializer">Controls the serialization of entities sent to and received from the server. Defaults to a JSON serializer if unset.</param>
 public EntryEndpoint(Uri uri, string token, MediaTypeFormatter serializer = null) : base(
     uri: uri.EnsureTrailingSlash(),
     httpClient: BuildHttpClient(uri),
     serializer: serializer ?? BuildSerializer())
 {
     HttpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
 }
开发者ID:1and1,项目名称:TypedRest-DotNet,代码行数:13,代码来源:EntryEndpoint.cs

示例2: AddInstance

 public void AddInstance(string displayName, Uri serverUrl, bool requiresAuthentication)
 {
     this.Instances.Add(new JenkinsInstance
     {
         DisplayName = displayName,
         Url = serverUrl.EnsureTrailingSlash().ToString(),
         RequiresAuthentication = requiresAuthentication,
         FavoriteJobs = new System.Collections.Generic.List<string>()
     });
 }
开发者ID:Novakov,项目名称:VisualStudio.Jenkins,代码行数:10,代码来源:Settings.cs

示例3: GetUriForImage

        public Uri GetUriForImage(string imageResourceName)
        {
            var uri = new Uri(_baseImageUri, new Uri(imageResourceName, UriKind.Relative));

            // we put a trailing slash here because the image resource names will contain at least one . about which the
            // mvc routing engine and IIS get confused.
            var uriWithTrailingSlash = uri.EnsureTrailingSlash();

            return uriWithTrailingSlash;
        }
开发者ID:uglybugger,项目名称:BlogMonster,代码行数:10,代码来源:PathFactory.cs

示例4: ConnectionInformation

        internal ConnectionInformation(Uri serverUri, string userName, SecureString password)
        {
            if (serverUri == null)
            {
                throw new ArgumentNullException(nameof(serverUri));
            }

            this.ServerUri = serverUri.EnsureTrailingSlash();
            this.UserName = userName;
            this.Password = password?.CopyAsReadOnly();
            this.Authentication = AuthenticationType.Basic; // Only one supported at this point
        }
开发者ID:SonarSource-VisualStudio,项目名称:sonarlint-visualstudio,代码行数:12,代码来源:ConnectionInformation.cs

示例5: PathFactory

 public PathFactory(Uri basePostUri, Uri baseImageUri)
 {
     _basePostUri = basePostUri.EnsureTrailingSlash();
     _baseImageUri = baseImageUri.EnsureTrailingSlash();
 }
开发者ID:uglybugger,项目名称:BlogMonster,代码行数:5,代码来源:PathFactory.cs

示例6: GetRawLogFiles

        public async Task<IEnumerable<RawLogFileInfo>> GetRawLogFiles(Uri uri)
        {
            if (uri == null)
            {
                throw new ArgumentNullException("uri");
            }

            var uriString = uri.ToString();
            try
            {
                _jobEventSource.BeginningDirectoryListing(uriString);
                Trace.TraceInformation("Listing directory '{0}'.", uri);

                var request = CreateRequest(uri);
                request.Method = WebRequestMethods.Ftp.ListDirectory;
                var webResponse = (FtpWebResponse)await request.GetResponseAsync();

                string directoryList;
                using (var streamReader = new StreamReader(webResponse.GetResponseStream(), Encoding.ASCII))
                {
                    directoryList = await streamReader.ReadToEndAsync();
                }

                _jobEventSource.FinishingDirectoryListing(uriString);

                var fileNames = directoryList.Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
                var rawLogFiles = fileNames.Select(fn => new RawLogFileInfo(new Uri(uri.EnsureTrailingSlash(), fn)));

                return rawLogFiles;
            }
            catch (Exception e)
            {
                _jobEventSource.FailedToGetRawLogFiles(uriString, e.ToString());
                Trace.TraceError("Failed to get raw log files: {0}", e);
                return Enumerable.Empty<RawLogFileInfo>();
            }
        }
开发者ID:joyhui,项目名称:NuGet.Jobs,代码行数:37,代码来源:FtpRawLogClient.cs

示例7: Construct

        private void Construct(string id, Uri urlBase, bool useMime = false, IDictionary<string, string> nameValues = null) {
            ParameterCheck.ParameterRequired(id, "id");
            ParameterCheck.ParameterRequired(urlBase, "uriBase");

            this.id = id;
            this.urlBase = urlBase.EnsureTrailingSlash();
            this.useMime = useMime;
            this.nameValues = new ReadOnlyDictionary<string, string>(nameValues ?? new Dictionary<string, string>());

            this.folderInfo = new List<FileTransmitterFolderInfo>();

            this.localPath = urlBase.EnsureTrailingSlash().GetLocalPath();
        }
开发者ID:OnpointOnDemand,项目名称:fluentjdf,代码行数:13,代码来源:FileTransmitterEncoder.cs


注:本文中的System.Uri.EnsureTrailingSlash方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。