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


C# IFileSystem.GetFullPath方法代码示例

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


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

示例1: MySQL

        public MySQL(string ip, string user, string password, string database, IFileSystem disk)
        {
            myConnectionString = "server=" + ip + ";uid=" + user + ";pwd=" + password + ";database=" + database + ";useCompression=true;ConnectionTimeout=28880;DefaultCommandTimeout=28880;";

            this.path = disk.GetFullPath().Replace("\\", "/");
            this.disk = disk;
        }
开发者ID:jozefRudy,项目名称:BBdownloader,代码行数:7,代码来源:MySQL.cs

示例2: Execute

        public static string Execute(string fileParameterValue, IFileSystem fileSystem)
        {
            if (string.IsNullOrEmpty(fileParameterValue))
            {
                throw new ArgumentException(Resources.FileParameterMustBeSpecified);
            }

            if (!fileParameterValue.EndsWith(".ps1", StringComparison.OrdinalIgnoreCase))
            {
                var error = string.Format(CultureInfo.CurrentCulture,
                    Resources.PowerShellScriptFileMustBeSpecifiedFormat,
                    fileParameterValue);

                throw new ArgumentException(error);
            }

            var filePath = fileSystem.GetFullPath(fileParameterValue);
            if (!fileSystem.FileExists(filePath))
            {
                var error = string.Format(CultureInfo.CurrentCulture,
                    Resources.PowerShellScriptFileDoesNotExistFormat,
                    fileParameterValue);

                throw new ArgumentException(error);
            }

            return filePath;
        }
开发者ID:rafd123,项目名称:PowerBridge,代码行数:28,代码来源:ConvertPowerShellFileParameterValueToFullPath.cs

示例3: GetAllProjectFileNames

        public IEnumerable<string> GetAllProjectFileNames(IFileSystem fileSystem, string solutionFile)
        {
            var solution = new Solution(fileSystem, solutionFile);
            var solutionDirectory = Path.GetDirectoryName(fileSystem.GetFullPath(solutionFile));

            return solution.Projects.Where(p => !p.IsSolutionFolder)
                .Select(p => Path.Combine(solutionDirectory, p.RelativePath));
        }
开发者ID:Newtopian,项目名称:nuget,代码行数:8,代码来源:MSBuildSolutionParser.cs

示例4: ReadSettings

        public static ISettings ReadSettings(string solutionDir, string nugetConfigFile, IFileSystem fileSystem,
            IMachineWideSettings machineWideSettings)
        {
            // Read the solution-level settings
            var solutionSettingsFile = Path.Combine(solutionDir, NuGetConstants.NuGetSolutionSettingsFolder);
            var fullPath = fileSystem.GetFullPath(solutionSettingsFile);
            var solutionSettingsFileSystem = new PhysicalFileSystem(fullPath);

            if (nugetConfigFile != null)
            {
                nugetConfigFile = fileSystem.GetFullPath(nugetConfigFile);
            }

            var settings = Settings.LoadDefaultSettings(
                fileSystem: solutionSettingsFileSystem,
                configFileName: nugetConfigFile,
                machineWideSettings: machineWideSettings);

            return settings;
        }
开发者ID:elanwu123,项目名称:dnx,代码行数:20,代码来源:SettingsUtils.cs

示例5: RepositoryManager

        /// <summary>
        /// Initializes a new instance of the <see cref="RepositoryManager"/> class.
        /// </summary>
        /// <param name="repositoryConfig">The repository.config file to parse.</param>
        /// <param name="repositoryEnumerator">The repository enumerator.</param>
        /// <param name="fileSystem"> </param>
        /// <example>Can be a direct path to a repository.config file</example>
        ///   
        /// <example>Can be a path to a directory, which will recursively locate all contained repository.config files</example>
        public RepositoryManager(string repositoryConfig, IRepositoryEnumerator repositoryEnumerator, IFileSystem fileSystem)
        {
            Contract.Requires(fileSystem != null);
            this.fileSystem = fileSystem;

            if (fileSystem.FileExists(repositoryConfig) && repositoryConfig.EndsWith("repositories.config"))
                RepositoryConfig = new FileInfo(fileSystem.GetFullPath(repositoryConfig));
            else
                throw new ArgumentOutOfRangeException("repository");

            PackageReferenceFiles = repositoryEnumerator.GetPackageReferenceFiles(RepositoryConfig);// GetPackageReferenceFiles();
        }
开发者ID:modulexcite,项目名称:NuGet.Extensions,代码行数:21,代码来源:RepositoryManager.cs

示例6: PackageReferenceRepository

 public PackageReferenceRepository(IFileSystem fileSystem, ISharedPackageRepository sourceRepository)
 {
     if (fileSystem == null)
     {
         throw new ArgumentNullException("fileSystem");
     }
     if (sourceRepository == null)
     {
         throw new ArgumentNullException("sourceRepository");
     }
     _packageReferenceFile = new PackageReferenceFile(fileSystem, Constants.PackageReferenceFile);
     _fullPath = fileSystem.GetFullPath(Constants.PackageReferenceFile);
     SourceRepository = sourceRepository;
 }
开发者ID:xero-github,项目名称:Nuget,代码行数:14,代码来源:PackageReferenceRepository.cs

示例7: SafeResolveRefreshPath

 private static string SafeResolveRefreshPath(IFileSystem fileSystem, string file)
 {
     string relativePath;
     try
     {
         using (var stream = fileSystem.OpenFile(file))
         {
             relativePath = stream.ReadToEnd();
         }
         return fileSystem.GetFullPath(relativePath);
     }
     catch 
     {
         // Ignore the .refresh file if it cannot be read.
     }
     return null;
 }
开发者ID:Newtopian,项目名称:nuget,代码行数:17,代码来源:ProjectSystemExtensions.cs

示例8: UnzippedPackage

        public UnzippedPackage(IFileSystem fileSystem, string manifestPath)
        {
            if (fileSystem == null)
            {
                throw new ArgumentNullException("fileSystem");
            }

            if (String.IsNullOrEmpty(manifestPath))
            {
                throw new ArgumentNullException("manifestPath");
            }

            string manifestFullPath = fileSystem.GetFullPath(manifestPath);
            string directory = Path.GetDirectoryName(manifestFullPath);
            _fileSystem = new PhysicalFileSystem(directory);
            _manifestPath = Path.GetFileName(manifestFullPath);

            EnsureManifest();
        }
开发者ID:AlanFrey,项目名称:dnx,代码行数:19,代码来源:UnzippedPackage.cs

示例9: LoadUserSpecificSettings

        private static void LoadUserSpecificSettings(
            List<Settings> validSettingFiles,
            IFileSystem fileSystem,
            string configFileName)
        {
            // for the default location, allow case where file does not exist, in which case it'll end
            // up being created if needed
            Settings appDataSettings = null;
            if (configFileName == null)
            {
                // load %AppData%\NuGet\NuGet.config
            #if DNX451
                var appDataPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
            #else
                var appDataPath = Environment.GetEnvironmentVariable("APPDATA");
            #endif
                if (!String.IsNullOrEmpty(appDataPath))
                {
                    var defaultSettingsPath = Path.Combine(appDataPath, "NuGet");
                    appDataSettings = ReadSettings(new PhysicalFileSystem(defaultSettingsPath),
                        Constants.SettingsFileName);
                }
            }
            else
            {
                if (!fileSystem.FileExists(configFileName))
                {
                    string message = String.Format(CultureInfo.CurrentCulture,
                        NuGetResources.FileDoesNotExit,
                        fileSystem.GetFullPath(configFileName));
                    throw new InvalidOperationException(message);
                }

                appDataSettings = ReadSettings(fileSystem, configFileName);
            }

            if (appDataSettings != null)
            {
                validSettingFiles.Add(appDataSettings);
            }
        }
开发者ID:elanwu123,项目名称:dnx,代码行数:41,代码来源:Settings.cs

示例10: GetAssemblyReferences

        /// <summary>
        /// Gets all assembly references for a package
        /// </summary>
        private IEnumerable<IPackageAssemblyReference> GetAssemblyReferences(
            IFileSystem fileSystem, string packageId, SemanticVersion version, out string packageDirectory)
        {
            // REVIEW: do we need to search for all variations of versions here? (e.g. 1.0, 1.0.0, 1.0.0.0)
            string packageName = packageId + "." + version.ToString();
            if (fileSystem.DirectoryExists(packageName))
            {
                string libFolderPath = Path.Combine(packageName, Constants.LibDirectory);
                if (fileSystem.DirectoryExists(libFolderPath))
                {
                    packageDirectory = fileSystem.GetFullPath(packageName);
                    // TODO: SearchFilesWithinOneSubFolders seems fragile. In the event conventions in the lib directory change to allow more than one level of nesting, it would 
                    // not work. We should let VS perform a regular install instead of doing this. 
                    return Constants.AssemblyReferencesExtensions
                                    .Select(extension => "*" + extension)
                                    .SelectMany(extension => SearchFilesWithinOneSubFolders(fileSystem, libFolderPath, extension))
                                    .Select(assembly => new FileAssemblyReference(assembly.Substring(packageName.Length).Trim(Path.DirectorySeparatorChar)));
                }
            }

            packageDirectory = null;
            return Enumerable.Empty<IPackageAssemblyReference>();
        }
开发者ID:themotleyfool,项目名称:NuGet,代码行数:26,代码来源:VsWebsiteHandler.cs

示例11: LoadUserSpecificSettings

        private static void LoadUserSpecificSettings(
            List<Settings> validSettingFiles,
            IFileSystem fileSystem,
            string configFileName)
        {
            // for the default location, allow case where file does not exist, in which case it'll end
            // up being created if needed
            Settings appDataSettings = null;
            if (configFileName == null)
            {
                // load %AppData%\NuGet\NuGet.config
                var userSettingsDir = DnuEnvironment.GetFolderPath(DnuFolderPath.UserSettingsDirectory);
                var fileName = SettingsFileNames
                    .Select(settingsFileName => Path.Combine(userSettingsDir, settingsFileName))
                    .FirstOrDefault(fileSystem.FileExists);

                if (fileName != null)
                {
                    appDataSettings = ReadSettings(
                        new PhysicalFileSystem(userSettingsDir),
                        fileName);
                }
            }
            else
            {
                if (!fileSystem.FileExists(configFileName))
                {
                    string message = String.Format(CultureInfo.CurrentCulture,
                        NuGetResources.FileDoesNotExit,
                        fileSystem.GetFullPath(configFileName));
                    throw new InvalidOperationException(message);
                }

                appDataSettings = ReadSettings(fileSystem, configFileName);
            }

            if (appDataSettings != null)
            {
                validSettingFiles.Add(appDataSettings);
            }
        }
开发者ID:rajeevkb,项目名称:dnx,代码行数:41,代码来源:Settings.cs

示例12: LoadUserSpecificSettings

        private static void LoadUserSpecificSettings(
            List<Settings> validSettingFiles,
            IFileSystem fileSystem,
            string configFileName)
        {
            // for the default location, allow case where file does not exist, in which case it'll end
            // up being created if needed
            Settings appDataSettings = null;
            if (configFileName == null)
            {
                // load %AppData%\NuGet\NuGet.config
                string appDataPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
                if (!String.IsNullOrEmpty(appDataPath))
                {
                    var defaultSettingsFilePath = Path.Combine(
                        appDataPath, "NuGet", Constants.SettingsFileName);

                    // Since defaultSettingsFilePath is a full path, so it doesn't matter what value is
                    // used as root for the PhysicalFileSystem.
                    appDataSettings = ReadSettings(
                        fileSystem ?? new PhysicalFileSystem(@"c:\"),
                        defaultSettingsFilePath);
                }
            }
            else
            {
                if (!fileSystem.FileExists(configFileName))
                {
                    string message = String.Format(CultureInfo.CurrentCulture,
                        NuGetResources.FileDoesNotExit,
                        fileSystem.GetFullPath(configFileName));
                    throw new InvalidOperationException(message);
                }

                appDataSettings = ReadSettings(fileSystem, configFileName);
            }

            if (appDataSettings != null)
            {
                validSettingFiles.Add(appDataSettings);
            }
        }
开发者ID:sistoimenov,项目名称:NuGet2,代码行数:42,代码来源:Settings.cs


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