public static void Write(string perfMapFileName, int perfMapFormatVersion, IEnumerable <MethodInfo> methods, IEnumerable <AssemblyInfo> inputAssemblies, TargetOS targetOS, TargetArchitecture targetArch) { if (perfMapFormatVersion > CurrentFormatVersion) { throw new NotSupportedException(perfMapFormatVersion.ToString()); } using (TextWriter writer = new StreamWriter(perfMapFileName)) { IEnumerable <AssemblyInfo> orderedInputs = inputAssemblies.OrderBy(asm => asm.Name, StringComparer.OrdinalIgnoreCase); PerfMapWriter perfMapWriter = new PerfMapWriter(writer); List <byte> inputHash = new List <byte>(); foreach (AssemblyInfo inputAssembly in orderedInputs) { inputHash.AddRange(inputAssembly.Mvid.ToByteArray()); } inputHash.Add((byte)targetOS); inputHash.Add((byte)targetArch); Guid outputGuid = new Guid(MD5.HashData(inputHash.ToArray())); perfMapWriter.WriteLine(outputGuid.ToString(), (uint)PseudoRVA.OutputGuid, 0); perfMapWriter.WriteLine(targetOS.ToString(), (uint)PseudoRVA.TargetOS, 0); perfMapWriter.WriteLine(targetArch.ToString(), (uint)PseudoRVA.TargetArchitecture, 0); perfMapWriter.WriteLine(CurrentFormatVersion.ToString(), (uint)PseudoRVA.FormatVersion, 0); foreach (MethodInfo methodInfo in methods) { if (methodInfo.HotRVA != 0 && methodInfo.HotLength != 0) { perfMapWriter.WriteLine(methodInfo.Name, methodInfo.HotRVA, methodInfo.HotLength); } if (methodInfo.ColdRVA != 0 && methodInfo.ColdLength != 0) { perfMapWriter.WriteLine(methodInfo.Name, methodInfo.ColdRVA, methodInfo.ColdLength); } } } }
private void SaveSettings(TargetOS targetOS, string[] selectedProjects) { var settingsManager = new ShellSettingsManager(ServiceProvider); var settingsStore = settingsManager.GetWritableSettingsStore(SettingsScope.UserSettings); if (!settingsStore.CollectionExists(DockerToolsCollectionPath)) { settingsStore.CreateCollection(DockerToolsCollectionPath); } settingsStore.SetString(DockerToolsCollectionPath, DockerToolsTargetOSProperty, targetOS.ToString()); settingsStore.SetString(DockerToolsCollectionPath, DockerToolsAvailableComposeProjectsProperty, string.Join("&", selectedProjects)); }