public HashSet <string> FlatProjectDependency() { var hashSet = new HashSet <string>(); Horizontals.ForAll(h => { hashSet.Add(h.ProjectName); h.Project .FlatProjectDependency() .ForAll(hfpd => hashSet.Add(hfpd)); }); Verticals.ForAll(v => { hashSet.Add(v.ProjectName); v.Project .FlatProjectDependency() .ForAll(vfpd => hashSet.Add(vfpd)); }); PlainProjectRefs.ForAll(p => { hashSet.Add(p.ProjectName); p.Project .FlatProjectDependency() .ForAll(pfpd => hashSet.Add(pfpd)); }); return(hashSet); }
private static void AssignVerticals(Panels panels, Verticals verticals) { foreach (var panel in panels.PanelItems) { panel.Verticals = verticals.VerticalItems .Where(vertical => vertical.PanelId == panel.PanelId) .OrderBy(item => item.VerticalNo) .ToList(); } }
private void ResolveDependentProjects(DependencyContext context) { //first resolve the projects Verticals.ForAll(v => { v.Project = context.ProjectTable.GetOrAdd( v.ProjectName, _ => new Project(new FileInfo(v.ProjectPath), context)); }); Horizontals.ForAll(h => { h.Project = context.ProjectTable.GetOrAdd( h.ProjectName, _ => new Project(new FileInfo(h.ProjectPath), context)); }); PlainProjectRefs.ForAll(p => { p.Project = context.ProjectTable.GetOrAdd( p.ProjectName, _ => new Project(new FileInfo(p.ProjectPath), context)); }); //now remove transient references var refs = new HashSet <string>(Horizontals .SelectMany(h => h.Project.FlatProjectDependency()) .Concat(Verticals .SelectMany(v => v.Project.FlatProjectDependency()) .Concat(PlainProjectRefs .SelectMany(p => p.Project.FlatProjectDependency())))); Verticals.ToArray().ForAll(v => { if (refs.Contains(v.ProjectName)) { Verticals.Remove(v); } }); Horizontals.ToArray().ForAll(h => { if (refs.Contains(h.ProjectName)) { Horizontals.Remove(h); } }); PlainProjectRefs.ToArray().ForAll(p => { if (refs.Contains(p.ProjectName)) { PlainProjectRefs.Remove(p); } }); }
static public IEnumerable <Vertical> ToValues(this Verticals flags) { if ((flags & Verticals.Up) != 0) { yield return(Vertical.Up); } if ((flags & Verticals.Down) != 0) { yield return(Vertical.Down); } }
static public Verticals Opposite(this Verticals flags) { var result = Verticals.None; if ((flags & Verticals.Up) != 0) { result |= Verticals.Down; } if ((flags & Verticals.Down) != 0) { result |= Verticals.Up; } return(result); }
string GetHomesForBuilding(List <VerticalsCsv> verticalsCsvList) { var verticalsList = new List <Verticals>(); List <VerticalsTechnology> verticalTechnologyList; foreach (var verticalItem in verticalsCsvList.GroupBy(x => x.Gescal37)) { var verticalResponse = CastHelper.GetRespuestaVertical(verticalItem.First().Gescal37); Verticals verticalMapped = MappingBasicInfoVertical(verticalResponse); verticalTechnologyList = verticalItem.ToList().Mapper <VerticalsCsv, VerticalsTechnology>(); verticalMapped.Technologies = new List <VerticalsTechnology>(); verticalMapped.Technologies.AddRange(verticalTechnologyList); verticalsList.Add(verticalMapped); } return(JsonConvert.SerializeObject(verticalsList)); }
public void Load(string formattedTileName) { BinaryReader reader = new BinaryReader(File.OpenRead(FilePaths.PathToUnityStreaming + "/TILECONFIGS/" + formattedTileName + ".DWB")); reader.BaseStream.Position += 4; int verticalCount = reader.ReadInt32(); int horizontalCount = reader.ReadInt32(); reader.Close(); string prefix = Environment.CurrentDirectory + "/" + FilePaths.PathToUnityTileResources + formattedTileName + "/"; for (int i = 0; i < verticalCount; i++) { Verticals.Add(prefix + "VERTICAL_" + i + ".png"); } for (int i = 0; i < horizontalCount; i++) { Horizontals.Add(prefix + "HORIZONTAL_" + i + ".png"); } }
public void CalculationOneTimeGroup() { Horizontals.ForEach(gc => CalcCellCollection(gc)); Verticals.ForEach(gc => CalcCellCollection(gc)); Squares.ForEach(gc => CalcCellCollection(gc)); }
private void BuildFromNewCsproj() { var propGroup = CsprojDoc.Root .FindAll("PropertyGroup") .First(Ext.ContainsProjectInfo); //build info typeof(ProjectInfo) .GetProperties() .Select(prop => new { Prop = prop, Element = propGroup.Find(prop.Name) }) .Where(map => map.Element != null) .ForAll(map => map.Prop.SetValue(Info, map.Element.Value)); Info.AssemblyName = CsprojFile.Name.TrimEnd(CsprojFile.Extension); //build dependencies //1. assembly references CsprojDoc.Root .FindAll("ItemGroup/Reference") .ForAll(element => Assemblies.Add(new AssemblyDependencyRef { ProjectName = element.Attribute("Include").Value })); //2. external packages CsprojDoc.Root .FindAll("ItemGroup/PackageReference") .Where(IsExternalPackageReference) .ForAll(element => ExternalPackages.Add(new PackageDependencyRef { ProjectName = element.Attribute("Include").Value, Version = SemVerRange.Parse(element.Attribute("Version").Value) })); //3. horizontal project references CsprojDoc.Root .FindAll("ItemGroup/ProjectReference") .Where(IsHorizontalProjectReference) .ForAll(element => { var path = element.Attribute("Include").Value; var projectName = path.ExtractProjectNameFromFilePath(); var versionArg = ResolveHorizontalVersionArg(new FileInfo(path)); Horizontals.Add(new ObgDependencyRef { ProjectPath = path, ProjectName = projectName, Version = SemVerRange.Parse(propGroup.Find(versionArg).Value) }); }); //4. vertical project references CsprojDoc.Root .FindAll("ItemGroup/ProjectReference") .Where(IsVerticalProjectReference) .ForAll(element => { var path = element.Attribute("Include").Value; var projectName = path.ExtractProjectNameFromFilePath(); Verticals.Add(new ObgDependencyRef { ProjectPath = path, ProjectName = projectName }); }); //5. plain project reference CsprojDoc.Root .FindAll("ItemGroup/ProjectReference") .Where(IsPlainProjectReference) .ForAll(element => { var path = element.Attribute("Include").Value; var projectName = path.ExtractProjectNameFromFilePath(); PlainProjectRefs.Add(new PlainProjectRef { ProjectPath = path, ProjectName = projectName }); }); }
private void BuildFromOldCsproj() { var nuspecFile = new FileInfo(Ext.ResolveNuspecPath(CsprojFile)); var nuspecDoc = nuspecFile.Exists ? nuspecFile.OpenRead().Using(XDocument.Load) : null; #region Generate project Info Info.AssemblyName = nuspecDoc?.Root.Find("metadata/id").Value ?? CsprojDoc.Root.Find("PropertyGroup/AssemblyName").Value; var textInfo = new CultureInfo("en-US", false).TextInfo; Info.Product = textInfo.ToTitleCase(Info.AssemblyName); Info.Authors = "OBG Api"; Info.Company = nuspecDoc?.Root.Find("metadata/owners")?.Value ?? "Betsson Group"; Info.Copyright = $"Copyright © {DateTimeOffset.Now.Year}"; Info.Description = nuspecDoc?.Root.Find("metadata/description")?.Value; Info.PackageReleaseNotes = nuspecDoc?.Root.Find("metadata/releaseNotes")?.Value; Info.PackageTags = nuspecDoc?.Root.Find("metadata/tags")?.Value; Info.PackageProjectUrl = nuspecDoc?.Root.Find("metadata/projectUrl")?.Value; Info.PackageIconUrl = nuspecDoc?.Root.Find("metadata/iconUrl")?.Value; #endregion //dependencies //1. assembly references CsprojDoc.Root .FindAll("ItemGroup/Reference") .Where(IsGacReference) .ForAll(element => Assemblies.Add(new AssemblyDependencyRef { ProjectName = element.Attribute("Include").Value })); //2. external packages CsprojDoc.Root .FindAll("ItemGroup/Reference") .Where(IsExternalNuspecDependency) .ForAll(element => { var assembly = element.Attribute("Include").Value .Split(',') .First(); var dependency = nuspecDoc?.Root .FindAll( "metadata/dependencies/dependency", "metadata/dependencies/group/dependency") .FirstOrDefault(Ext.HasAttribute("id", assembly)); if (dependency != null) { var version = dependency.Attribute("version").Value; ExternalPackages.Add(new PackageDependencyRef { ProjectName = assembly, Version = string.IsNullOrWhiteSpace(version) ? null : SemVerRange.Parse(version) }); } //else this is a transitive dependency; ignore it. }); //3. horizontal project reference //check the project references and determine, using the solution name, which are, and which aren't //horizontal references. Then check the nuspec file to determine the version to use CsprojDoc.Root .FindAll("ItemGroup/ProjectReference") .Where(IsOldHorizontalProjectReference) .ForAll(element => { var path = element.Attribute("Include").Value; var assembly = path.ExtractProjectNameFromFilePath(); var dependency = nuspecDoc?.Root .FindAll( "metadata/dependencies/group/dependency", "metadata/dependencies/dependency") .FirstOrDefault(Ext.HasAttribute("id", assembly)); if (dependency != null) { var version = dependency .Attribute("version") .Value; Horizontals.Add(new ObgDependencyRef { ProjectPath = path, ProjectName = assembly, Version = string.IsNullOrWhiteSpace(version) ? null : SemVerRange.Parse(version) }); } //else it is a transitive dependency; ignore it. //{ // PlainProjectRefs.Add(new PlainProjectRef // { // ProjectName = assembly, // ProjectPath = path // }); //} }); //4. vertical project references //check the project references and determine, using the solution name, which are, and whicha aren't //vertical references. CsprojDoc.Root .FindAll("ItemGroup/ProjectReference") .Where(IsOldVerticalProjectReference) .ForAll(element => { var path = element.Attribute("Include").Value; var projectName = path.ExtractProjectNameFromFilePath(); Verticals.Add(new ObgDependencyRef { ProjectPath = path, ProjectName = projectName }); }); }