private static void CreateWixFile( string groupId, string frameworkMoniker, string groupDirectory = null, string filePrefix = null, GacStatus gac = GacStatus.NotInGac) { Console.WriteLine($"Creating the {groupId} Group"); groupDirectory = groupDirectory ?? $"{frameworkMoniker}"; filePrefix = filePrefix ?? $"{frameworkMoniker.Replace(".", string.Empty)}_"; var solutionDirectory = EnvironmentHelper.GetSolutionDirectory(); var wixProjectRoot = Path.Combine( solutionDirectory, "src", "WindowsInstaller"); var filePaths = DependencyHelpers.GetTracerBinContent(frameworkMoniker); var components = string.Empty; foreach (var filePath in filePaths) { var fileName = Path.GetFileName(filePath); var component = ItemTemplate .Replace(FileIdPrefixTemplate, filePrefix) .Replace(FrameworkMonikerTemplate, frameworkMoniker) .Replace(FileNameTemplate, fileName); if (gac == GacStatus.NotInGac) { component = component.Replace(@" Assembly="".net""", string.Empty); component = component.Replace(Net461Condition, string.Empty); } else if (gac == GacStatus.Net45) { component = component.Replace(Net461Property, $"NOT {Net461Property}"); } components += component; } var wixFileContent = FileTemplate .Replace(ComponentGroupDirectoryTemplate, groupDirectory) .Replace(ComponentGroupIdTemplate, groupId) .Replace(ComponentListTemplate, components); var wixFilePath = Path.Combine(wixProjectRoot, groupId + ".wxs"); File.WriteAllText(wixFilePath, wixFileContent, new UTF8Encoding(encoderShouldEmitUTF8Identifier: false)); Console.WriteLine($"{groupId} Group successfully created."); }
private static void CopyNativeProfiler(string architecture) { var outputDirectory = Path.Combine(_tracerHomeDirectory, architecture); if (Directory.Exists(outputDirectory)) { Directory.Delete(outputDirectory, recursive: true); } Directory.CreateDirectory(outputDirectory); var sourceFiles = DependencyHelpers.GetTracerBinContent(architecture); foreach (var sourceFile in sourceFiles) { var fileName = Path.GetFileName(sourceFile); var destinationPath = Path.Combine(outputDirectory, fileName); File.Copy(sourceFile, destinationPath); } }
private static void CopyTargetFrameworkPrivateBin(string frameworkMoniker) { var outputDirectory = Path.Combine(_tracerHomeDirectory, frameworkMoniker); if (Directory.Exists(outputDirectory)) { Directory.Delete(outputDirectory, recursive: true); } Directory.CreateDirectory(outputDirectory); var sourceFiles = DependencyHelpers.GetTracerBinContent(frameworkMoniker); foreach (var sourceFile in sourceFiles) { var fileName = Path.GetFileName(sourceFile); var destinationPath = Path.Combine(outputDirectory, fileName); File.Copy(sourceFile, destinationPath); } }
/// <summary> /// Measures the children of a <see cref="T:System.Windows.Controls.Grid"/> in anticipation of arranging them during the <see cref="M:ArrangeOverride"/> pass. /// </summary> /// <param name="constraint">Indicates an upper limit size that should not be exceeded.</param> /// <returns> /// <see cref="Size"/> that represents the required size to arrange child content. /// </returns> protected override Size MeasureOverride(Size constraint) { bool isVertical = Orientation == Orientation.Vertical; if (_shouldReindex || (IsAutoIndexing && ((isVertical && _rowOrColumnCount != ColumnDefinitions.Count) || (!isVertical && _rowOrColumnCount != RowDefinitions.Count)))) { _shouldReindex = false; if (IsAutoIndexing) { _rowOrColumnCount = (isVertical) ? ColumnDefinitions.Count : RowDefinitions.Count; if (_rowOrColumnCount == 0) { _rowOrColumnCount = 1; } int cellCount = 0; foreach (UIElement child in Children) { cellCount += (isVertical) ? Grid.GetColumnSpan(child) : Grid.GetRowSpan(child); } // Update the number of rows/columns if (isVertical) { int newRowCount = ((cellCount - 1) / _rowOrColumnCount + 1); while (RowDefinitions.Count < newRowCount) { RowDefinitions.Add(new RowDefinition()); } if (RowDefinitions.Count > newRowCount) { RowDefinitions.RemoveRange(newRowCount, RowDefinitions.Count - newRowCount); } } else // horizontal { int newColumnCount = ((cellCount - 1) / _rowOrColumnCount + 1); while (ColumnDefinitions.Count < newColumnCount) { ColumnDefinitions.Add(new ColumnDefinition()); } if (ColumnDefinitions.Count > newColumnCount) { ColumnDefinitions.RemoveRange(newColumnCount, ColumnDefinitions.Count - newColumnCount); } } } // Update children indices int position = 0; foreach (UIElement child in Children) { if (IsAutoIndexing) { if (isVertical) { Grid.SetRow(child, position / _rowOrColumnCount); Grid.SetColumn(child, position % _rowOrColumnCount); position += Grid.GetColumnSpan(child); } else { Grid.SetRow(child, position % _rowOrColumnCount); Grid.SetColumn(child, position / _rowOrColumnCount); position += Grid.GetRowSpan(child); } } // Set margin and alignment if (ChildMargin != null) { DependencyHelpers.SetIfDefault(child, FrameworkElement.MarginProperty, ChildMargin.Value); } if (ChildHorizontalAlignment != null) { DependencyHelpers.SetIfDefault(child, FrameworkElement.HorizontalAlignmentProperty, ChildHorizontalAlignment.Value); } if (ChildVerticalAlignment != null) { DependencyHelpers.SetIfDefault(child, FrameworkElement.VerticalAlignmentProperty, ChildVerticalAlignment.Value); } } } return(base.MeasureOverride(constraint)); }