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


C# FileSystem.ReadTextFile方法代码示例

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


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

示例1: ReadFromFile

        public static FileMatcher ReadFromFile(string file)
        {
            var system = new FileSystem();
            var matcher = new FileMatcher();

            system.ReadTextFile(file, text => {
                if (text.IsEmpty()) return;

                var match = Build(text);
                matcher.Add(match);
            });

            return matcher;
        }
开发者ID:DarthFubuMVC,项目名称:fubu,代码行数:14,代码来源:FileMatcher.cs

示例2: ReadFrom

        public static Profile ReadFrom(DeploymentSettings settings, string profileName)
        {
            var profile = new Profile(profileName);
            var profileFile = settings.ProfileFileNameFor(profileName);

            var fileSystem = new FileSystem();
            if (!fileSystem.FileExists(profileFile))
            {
                var sb = new StringBuilder();
                sb.AppendFormat("Couldn't find the profile '{0}'", profileFile);
                sb.AppendLine();
                sb.AppendLine("Looked in:");
                settings.Directories.Each(d => sb.AppendLine("  {0}".ToFormat(d)));

                throw new Exception(sb.ToString());
            }

            fileSystem.ReadTextFile(profileFile, profile.ReadText);

            return profile;
        }
开发者ID:rsanders1,项目名称:bottles,代码行数:21,代码来源:Profile.cs

示例3: ReadFrom

        public static Profile ReadFrom(DeploymentSettings settings, string profileName, string settingsProfileName = null)
        {
            var profile = new Profile(profileName);
            var profileFile = settings.ProfileFileNameFor(profileName);

            var fileSystem = new FileSystem();
            if (!fileSystem.FileExists(profileFile))
            {
                var sb = new StringBuilder();
                sb.AppendFormat("Couldn't find the profile '{0}'", profileFile);
                sb.AppendLine();
                sb.AppendLine("Looked in:");
                settings.Directories.Each(d => sb.AppendLine("  {0}".ToFormat(d)));

                throw new Exception(sb.ToString());
            }

            // Settings profile goes first
            if (settingsProfileName != null)
            {
                profile.AddProfileDependency(settingsProfileName);
            }

            fileSystem.ReadTextFile(profileFile, profile.ReadText);

            profile._childProfileNames.Each(childName =>
                {
                    var childProfile = ReadFrom(settings, childName);
                    profile._childProfiles.Add(childProfile);
                    childProfile.Data.AllKeys.Each(childKey =>
                        {
                            // do not override main profile settings from dependencies.
                            // NOTE: Has(childKey) doesn't work here because SettingsData has a weird inner dictionary with a special key structure
                            if (profile.Data.AllKeys.Any(k => k == childKey)) return;

                            profile.Data[childKey] = childProfile.Data[childKey];
                        });
                });

            return profile;
        }
开发者ID:DarthFubuMVC,项目名称:milkman,代码行数:41,代码来源:Profile.cs

示例4: ForFile

        public static StringPropertyReader ForFile(string file)
        {
            var fileSystem = new FileSystem();

            return new StringPropertyReader(callback => fileSystem.ReadTextFile(file, callback));
        }
开发者ID:nieve,项目名称:FubuRESTInnovation,代码行数:6,代码来源:StringPropertyReader.cs


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