/// <param name="type">Allowed type of operations.</param> /// <param name="raw">Solution raw data.</param> /// <param name="projects">Dictionary of raw xml projects by Guid.</param> public Sln(SlnItems type, RawText raw, IDictionary <string, RawText> projects) { parser.RawXmlProjects = projects; using (var reader = new StreamReader(raw.data.GetStream(raw.encoding), raw.encoding)) { Result = parser.Parse(reader, type); } }
private static IEnumerable <string> FindSolutionConfigs(ISlnResult sln, SlnItems items) { string dfile = Path.GetFullPath(Path.Combine(sln.SolutionDir, PackagesConfig.FNAME)); if (File.Exists(dfile)) { yield return(dfile); } if (sln.SolutionFolders != null) { foreach (RawText file in sln.SolutionFolders.SelectMany(f => f.items)) { if (!file.trimmed.EndsWith(PackagesConfig.FNAME)) { continue; } string input = Path.GetFullPath(Path.Combine(sln.SolutionDir, file)); if (File.Exists(input)) { yield return(input); } } } }
public XProject(ISlnResult data, ProjectItemCfg pItem, Project prj) { Sln = data; ProjectItem = pItem; Project = prj ?? throw new ArgumentNullException(nameof(prj), MsgResource.ValueNoEmptyOrNull); PId = CalculatePId(prj); }
private static IEnumerable <string> FindLegacyConfigs(ISlnResult sln) { string dfile = Path.GetFullPath(Path.Combine(sln.SolutionDir, DIR, PackagesConfig.FNAME)); if (File.Exists(dfile)) { yield return(dfile); } if (sln.ProjectItems != null) { foreach (var prj in sln.ProjectItems) { string input = Path.Combine(Path.GetDirectoryName(prj.fullPath), PackagesConfig.FNAME); if (File.Exists(input)) { yield return(input); } } } }
public void CorrectProjectInstnacesTest(string configuration, string platform, SlnItems opt) { using Sln sln = new(TestData.PathTo(@"XProjectEnv\projectInstnaces\ClassLibrary1.sln"), opt); ISlnResult l = sln.Result; ConfigItem input = new(configuration, platform); ProjectItem prj = l.ProjectItems.FirstOrDefault(); IXProject xp = l.Env.XProjectByFile ( prj.fullPath, input, new Dictionary <string, string>() { { PropertyNames.CONFIG, configuration }, { PropertyNames.PLATFORM, platform } } ); Assert.True(input.Equals(xp.ProjectItem.projectConfig)); Assert.Equal ( input, new(xp.Project.GlobalProperties[PropertyNames.CONFIG], xp.Project.GlobalProperties[PropertyNames.PLATFORM]) ); var p = l.Env.GetOrLoadProject ( l.ProjectItems.FirstOrDefault(), l.ProjectItemsConfigs .FirstOrDefault(p => input.Equals(p.solutionConfig) == true) .projectConfig ); Assert.Equal ( new(p.GlobalProperties[PropertyNames.CONFIG], p.GlobalProperties[PropertyNames.PLATFORM]), input ); }
private static IEnumerable <string> FindAllConfigs(ISlnResult sln, SlnItems items) { if (sln == null) { throw new ArgumentNullException(nameof(sln)); } if (items.HasFlag(SlnItems.PackagesConfigSolution)) { foreach (var config in FindSolutionConfigs(sln, items)) { yield return(config); } } if (items.HasFlag(SlnItems.PackagesConfigLegacy)) { foreach (var config in FindLegacyConfigs(sln)) { yield return(config); } } }
/// <param name="reader"></param> /// <param name="type">Allowed type of operations.</param> public Sln(StreamReader reader, SlnItems type) { Result = parser.Parse(reader, type); }
/// <param name="file">Solution file</param> /// <param name="type">Allowed type of operations.</param> public Sln(string file, SlnItems type) { Result = parser.Parse(file, type); }
protected abstract void UpdateSlnEnv(ISlnResult sln);
public static IEnumerable <string> FindConfigs(ISlnResult sln, SlnItems items) => FindAllConfigs(sln, items).Distinct();
public static IEnumerable <PackagesConfig> FindAndLoadConfigs(ISlnResult sln, SlnItems items) => FindConfigs(sln, items) .Select(c => new PackagesConfig(c, PackagesConfigOptions.Load | PackagesConfigOptions.PathToStorage | PackagesConfigOptions.SilentLoading));
public DxpIsolatedEnv(ISlnResult data) : base(data) { }
/// <param name="data">Prepared data from solution parser.</param> /// <param name="raw">Optional dictionary of raw xml projects by Guid.</param> public IsolatedEnv(ISlnResult data, IDictionary <string, RawText> raw = null) : base(data, raw) { }
internal XProjectEnvStub(ISlnResult data, IDictionary <string, string> properties, IDictionary <string, RawText> raw = null) : base(data, properties, raw) { }