protected PackageFileBase(string path) { Path = path; FrameworkNameUtility.ParseFrameworkNameFromFilePath(path, out var effectivePath); TargetFramework = new FrameworkName(NuGetFramework.Parse(effectivePath).DotNetFrameworkName); EffectivePath = effectivePath; }
public StreamPackageFile(Stream stream, string path) { _stream = stream; Path = path; TargetFramework = FrameworkNameUtility.ParseFrameworkNameFromFilePath(path, out var effectivePath); EffectivePath = effectivePath; LastWriteTime = DateTimeOffset.Now; }
private static IPackageFile CreatePackageFile(string name) { var file = new InMemoryFile(); file.Path = name; file.Stream = new MemoryStream(); string effectivePath; var fx = FrameworkNameUtility.ParseFrameworkNameFromFilePath(name, out effectivePath); file.EffectivePath = effectivePath; file.TargetFramework = fx; return(file); }
protected PackageFileBase(string path) { Path = path; FrameworkNameUtility.ParseFrameworkNameFromFilePath(path, out var effectivePath); EffectivePath = effectivePath; try { TargetFramework = new FrameworkName(NuGetFramework.Parse(effectivePath).DotNetFrameworkName); } catch (ArgumentException) // could be an invalid framework/version { } }
private static IPackageFile CreatePackageFile(string name) { var file = new Mock <IPackageFile>(); file.SetupGet(f => f.Path).Returns(name); file.Setup(f => f.GetStream()).Returns(new MemoryStream()); string effectivePath; var fx = FrameworkNameUtility.ParseFrameworkNameFromFilePath(name, out effectivePath); file.SetupGet(f => f.EffectivePath).Returns(effectivePath); file.SetupGet(f => f.TargetFramework).Returns(fx); return(file.Object); }
private static bool IsValidFrameworkName(string path) { FrameworkName fx; try { string effectivePath; fx = FrameworkNameUtility.ParseFrameworkNameFromFilePath(path, out effectivePath); } catch (ArgumentException) { fx = null; } return(fx != null); }
private static bool IsValidFrameworkName(string path) { FrameworkName fx; try { string effectivePath; fx = FrameworkNameUtility.ParseFrameworkNameFromFilePath(path, out effectivePath); } catch (ArgumentException) { fx = null; } // return false if the framework is Null or Unsupported return(fx != null && fx.Identifier != NuGetFramework.UnsupportedFramework.Framework); }
public static Mock <IPackageFile> CreateMockedPackageFile(string directory, string fileName, string content = null) { string path = Path.Combine(directory, fileName); content = content ?? path; var mockFile = new Mock <IPackageFile>(); mockFile.Setup(m => m.Path).Returns(path); mockFile.Setup(m => m.GetStream()).Returns(() => new MemoryStream(Encoding.Default.GetBytes(content))); string effectivePath; FrameworkName fn = FrameworkNameUtility.ParseFrameworkNameFromFilePath(path, out effectivePath); mockFile.Setup(m => m.TargetFramework).Returns(fn); mockFile.Setup(m => m.EffectivePath).Returns(effectivePath); mockFile.Setup(m => m.TargetFramework).Returns(fn); return(mockFile); }