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


C# DirectoryInfo.EndsWith方法代码示例

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


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

示例1: AddFolder

 /// <summary>
 /// Adds a folder to the zip file
 /// </summary>
 /// <param name="Folder">Folder to add</param>
 public virtual void AddFolder(string Folder)
 {
     Folder.ThrowIfNullOrEmpty("Folder");
     Folder = new DirectoryInfo(Folder).FullName;
     if (Folder.EndsWith(@"\"))
         Folder = Folder.Remove(Folder.Length - 1);
     using (Package Package = ZipPackage.Open(ZipFileStream, FileMode.OpenOrCreate))
     {
         new DirectoryInfo(Folder)
             .GetFiles()
             .ForEach(x => AddFile(x.FullName.Replace(Folder, ""), x, Package));
     }
 }
开发者ID:summer-breeze,项目名称:ChengGouHui,代码行数:17,代码来源:ZipFile.cs

示例2: AddFolder

 public virtual void AddFolder(string Folder)
 {
     Contract.Requires<ArgumentNullException>(!string.IsNullOrEmpty(Folder), "Folder");
     Folder = new DirectoryInfo(Folder).FullName;
     if (Folder.EndsWith(@"\", StringComparison.InvariantCulture))
         Folder = Folder.Remove(Folder.Length - 1);
     using (Package Package = ZipPackage.Open(ZipFileStream, FileMode.OpenOrCreate))
     {
         new DirectoryInfo(Folder)
             .GetFiles()
             .ForEach(x => AddFile(x.FullName.Replace(Folder, ""), x, Package));
     }
 }
开发者ID:kaytie,项目名称:Craig-s-Utility-Library,代码行数:13,代码来源:ZipFile.cs

示例3: IsIgnoredDirectory

        private static bool IsIgnoredDirectory(string sourcePath)
        {
            var sourcePathLowerAbsolute = new DirectoryInfo(sourcePath).FullName.ToLower();
            var apiPath =
                new DirectoryInfo(
                    Path.Combine(
                        Directory.GetCurrentDirectory(),
                        Settings.Default.SourceDirectory,
                        Settings.Default.APIFolderLocation)).FullName.ToLower();

            return !sourcePathLowerAbsolute.StartsWith(apiPath)
                   && IgnoredFolders.Any(e => sourcePathLowerAbsolute.EndsWith(Path.DirectorySeparatorChar + e));
        }
开发者ID:Art1stical,项目名称:AHRUnrealEngine,代码行数:13,代码来源:Program.cs

示例4: WriteRESTFile

        /// <summary>
        /// Writes the REST file for a given type
        /// </summary>
        /// <param name="rootFolder"></param>
        /// <param name="type"></param>
        private void WriteRESTFile( string rootFolder, Type type )
        {
            string pluralizedName = pls.Pluralize( type.Name );

            string baseName = new DirectoryInfo( rootFolder ).Name;
            if ( baseName.EndsWith( ".Rest", StringComparison.OrdinalIgnoreCase ) )
            {
                baseName = baseName.Substring( 0, baseName.Length - 5 );
            }

            string restNamespace = type.Namespace;
            if ( restNamespace.StartsWith( baseName + ".", true, null ) )
            {
                restNamespace = baseName + ".Rest" + restNamespace.Substring( baseName.Length );
            }
            else
            {
                restNamespace = ".Rest." + restNamespace;
            }

            restNamespace = restNamespace.Replace( ".Model", ".Controllers" );

            var sb = new StringBuilder();

            sb.AppendLine( "//------------------------------------------------------------------------------" );
            sb.AppendLine( "// <auto-generated>" );
            sb.AppendLine( "//     This code was generated by the Rock.CodeGeneration project" );
            sb.AppendLine( "//     Changes to this file will be lost when the code is regenerated." );
            sb.AppendLine( "// </auto-generated>" );
            sb.AppendLine( "//------------------------------------------------------------------------------" );
            sb.AppendLine( "// <copyright>" );
            sb.AppendLine( "// Copyright 2013 by the Spark Development Network" );
            sb.AppendLine( "//" );
            sb.AppendLine( "// Licensed under the Apache License, Version 2.0 (the \"License\");" );
            sb.AppendLine( "// you may not use this file except in compliance with the License." );
            sb.AppendLine( "// You may obtain a copy of the License at" );
            sb.AppendLine( "//" );
            sb.AppendLine( "// http://www.apache.org/licenses/LICENSE-2.0" );
            sb.AppendLine( "//" );
            sb.AppendLine( "// Unless required by applicable law or agreed to in writing, software" );
            sb.AppendLine( "// distributed under the License is distributed on an \"AS IS\" BASIS," );
            sb.AppendLine( "// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied." );
            sb.AppendLine( "// See the License for the specific language governing permissions and" );
            sb.AppendLine( "// limitations under the License." );
            sb.AppendLine( "// </copyright>" );
            sb.AppendLine( "//" );
            sb.AppendLine( "" );

            sb.AppendFormat( "using {0};" + Environment.NewLine, type.Namespace );
            sb.AppendLine( "" );

            sb.AppendFormat( "namespace {0}" + Environment.NewLine, restNamespace );
            sb.AppendLine( "{" );
            sb.AppendLine( "    /// <summary>" );
            sb.AppendFormat( "    /// {0} REST API" + Environment.NewLine, pluralizedName );
            sb.AppendLine( "    /// </summary>" );
            sb.AppendFormat( "    public partial class {0}Controller : Rock.Rest.ApiController<{1}.{2}>" + Environment.NewLine, pluralizedName, type.Namespace, type.Name );
            sb.AppendLine( "    {" );
            sb.AppendFormat( "        public {0}Controller() : base( new {1}.{2}Service( new Rock.Data.RockContext() ) ) {{ }} " + Environment.NewLine, pluralizedName, type.Namespace, type.Name );
            sb.AppendLine( "    }" );
            sb.AppendLine( "}" );

            var file = new FileInfo( Path.Combine( NamespaceFolder( rootFolder, restNamespace ).FullName, "CodeGenerated", pluralizedName + "Controller.cs" ) );
            WriteFile( file, sb );
        }
开发者ID:Ganon11,项目名称:Rock,代码行数:70,代码来源:Form1.cs

示例5: WriteRESTFile

        /// <summary>
        /// Writes the REST file for a given type
        /// </summary>
        /// <param name="rootFolder"></param>
        /// <param name="type"></param>
        private void WriteRESTFile( string rootFolder, Type type )
        {
            string pluralizedName = pls.Pluralize( type.Name );

            string baseName = new DirectoryInfo( rootFolder ).Name;
            if ( baseName.EndsWith( ".Rest", StringComparison.OrdinalIgnoreCase ) )
            {
                baseName = baseName.Substring( 0, baseName.Length - 5 );
            }

            string restNamespace = type.Namespace;
            if ( restNamespace.StartsWith( baseName + ".", true, null ) )
            {
                restNamespace = baseName + ".Rest" + restNamespace.Substring( baseName.Length );
            }
            else
            {
                restNamespace = ".Rest." + restNamespace;
            }

            restNamespace = restNamespace.Replace( ".Model", ".Controllers" );

            var properties = GetEntityProperties( type );

            var sb = new StringBuilder();

            sb.AppendLine( "//------------------------------------------------------------------------------" );
            sb.AppendLine( "// <auto-generated>" );
            sb.AppendLine( "//     This code was generated by the Rock.CodeGeneration project" );
            sb.AppendLine( "//     Changes to this file will be lost when the code is regenerated." );
            sb.AppendLine( "// </auto-generated>" );
            sb.AppendLine( "//------------------------------------------------------------------------------" );
            sb.AppendLine( "//" );
            sb.AppendLine( "// THIS WORK IS LICENSED UNDER A CREATIVE COMMONS ATTRIBUTION-NONCOMMERCIAL-" );
            sb.AppendLine( "// SHAREALIKE 3.0 UNPORTED LICENSE:" );
            sb.AppendLine( "// http://creativecommons.org/licenses/by-nc-sa/3.0/" );
            sb.AppendLine( "//" );
            sb.AppendLine( "" );

            sb.AppendFormat( "using {0};" + Environment.NewLine, type.Namespace );
            sb.AppendLine( "" );

            sb.AppendFormat( "namespace {0}" + Environment.NewLine, restNamespace );
            sb.AppendLine( "{" );
            sb.AppendLine( "    /// <summary>" );
            sb.AppendFormat( "    /// {0} REST API" + Environment.NewLine, pluralizedName );
            sb.AppendLine( "    /// </summary>" );
            sb.AppendFormat( "    public partial class {0}Controller : Rock.Rest.ApiController<{1}.{2}, {1}.{2}Dto>" + Environment.NewLine, pluralizedName, type.Namespace, type.Name );
            sb.AppendLine( "    {" );
            sb.AppendFormat( "        public {0}Controller() : base( new {1}.{2}Service() ) {{ }} " + Environment.NewLine, pluralizedName, type.Namespace, type.Name );
            sb.AppendLine( "    }" );
            sb.AppendLine( "}" );

            var file = new FileInfo( Path.Combine( NamespaceFolder( rootFolder, restNamespace ).FullName, "CodeGenerated", pluralizedName + "Controller.cs" ) );
            WriteFile( file, sb );
        }
开发者ID:jh2mhs8,项目名称:Rock-ChMS,代码行数:61,代码来源:Form1.cs


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