本文整理汇总了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;
}
示例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;
}
示例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));
}
示例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;
}
示例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();
}
示例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;
}
示例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;
}
示例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();
}
示例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);
}
}
示例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>();
}
示例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);
}
}
示例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);
}
}