private static void AppendMonoFramework(FrameworkCollection frameworks, string monoPrefix, string version) { if (monoPrefix != null) { string displayFmt = version != null ? "Mono " + version + " - {0} Profile" : "Mono {0} Profile"; if (File.Exists(Path.Combine(monoPrefix, "lib/mono/1.0/mscorlib.dll"))) { RuntimeFramework framework = new RuntimeFramework(RuntimeType.Mono, new Version(1, 1, 4322)); framework.displayName = string.Format(displayFmt, "1.0"); frameworks.Add(framework); } if (File.Exists(Path.Combine(monoPrefix, "lib/mono/2.0/mscorlib.dll"))) { RuntimeFramework framework = new RuntimeFramework(RuntimeType.Mono, new Version(2, 0, 50727)); framework.displayName = string.Format(displayFmt, "2.0"); frameworks.Add(framework); } if (File.Exists(Path.Combine(monoPrefix, "lib/mono/4.0/mscorlib.dll"))) { RuntimeFramework framework = new RuntimeFramework(RuntimeType.Mono, new Version(4, 0, 30319)); framework.displayName = string.Format(displayFmt, "4.0"); frameworks.Add(framework); } } }
private static void AppendAllMonoFrameworks(FrameworkCollection frameworks) { // TODO: Find multiple installed Mono versions under Linux if (Environment.OSVersion.Platform == PlatformID.Win32NT) { // Use registry to find alternate versions RegistryKey key = Registry.LocalMachine.OpenSubKey(@"Software\Novell\Mono"); if (key == null) { return; } foreach (string version in key.GetSubKeyNames()) { RegistryKey subKey = key.OpenSubKey(version); string monoPrefix = subKey.GetValue("SdkInstallRoot") as string; AppendMonoFramework(frameworks, monoPrefix, version); } } else { AppendDefaultMonoFramework(frameworks); } }
// This method works for Windows and Linux but currently // is only called under Linux. private static void AppendDefaultMonoFramework(FrameworkCollection frameworks) { string monoPrefix = null; string version = null; if (Environment.OSVersion.Platform == PlatformID.Win32NT) { RegistryKey key = Registry.LocalMachine.OpenSubKey(@"Software\Novell\Mono"); if (key != null) { version = key.GetValue("DefaultCLR") as string; if (version != null && version != "") { key = key.OpenSubKey(version); if (key != null) { monoPrefix = key.GetValue("SdkInstallRoot") as string; } } } } else // Assuming we're currently running Mono - change if more runtimes are added { string libMonoDir = Path.GetDirectoryName(typeof(object).Assembly.Location); monoPrefix = Path.GetDirectoryName(Path.GetDirectoryName(Path.GetDirectoryName(libMonoDir))); } AppendMonoFramework(frameworks, monoPrefix, version); }
private static void AppendDotNetFrameworks(FrameworkCollection frameworks) { if (Environment.OSVersion.Platform == PlatformID.Win32NT) { // Handle Version 1.0, using a different registry key AppendExtremelyOldDotNetFrameworkVersions(frameworks); RegistryKey key = Registry.LocalMachine.OpenSubKey(@"Software\Microsoft\NET Framework Setup\NDP"); if (key != null) { foreach (string name in key.GetSubKeyNames()) { if (name.StartsWith("v")) { RegistryKey versionKey = key.OpenSubKey(name); if (name == "v4") { // Version 4 and 4.5 AppendDotNetFourFrameworkVersions(frameworks, versionKey); } else { // Versions 1.1 through 3.5 AppendOlderDotNetFrameworkVersion(frameworks, versionKey, new Version(name.Substring(1))); } } } } } }
private static void AppendOlderDotNetFrameworkVersion(FrameworkCollection frameworks, RegistryKey versionKey, Version version) { if (CheckInstallDword(versionKey)) { frameworks.Add(new RuntimeFramework(RuntimeType.Net, version)); } }
public StartProfilingSessionRequestHandler(ConfigurationCollection configurations, SessionCollection sessions, FrameworkCollection frameworks, ProfilingTypeCollection profilingTypes, ProfilingTargetCollection profilingTargets) { _configurations = configurations; _sessions = sessions; _frameworks = frameworks; _profilingTypes = profilingTypes; _profilingTargets = profilingTargets; Uid = new Guid("B68D7CDC-E999-416A-A9D0-E4A22D243E5F"); }
private static void AppendMonoFrameworks(FrameworkCollection frameworks) { if (Environment.OSVersion.Platform == PlatformID.Win32NT) { AppendAllMonoFrameworks(frameworks); } else { AppendDefaultMonoFramework(frameworks); } }
private static void AppendExtremelyOldDotNetFrameworkVersions(FrameworkCollection frameworks) { RegistryKey key = Registry.LocalMachine.OpenSubKey(@"Software\Microsoft\.NETFramework\policy\v1.0"); if (key != null) { foreach (string build in key.GetValueNames()) { frameworks.Add(new RuntimeFramework(RuntimeType.Net, new Version("1.0." + build))); } } }
protected override void RunInternal() { _hostApplications = new Host.ApplicationCollection(); _profilingTypes = new ProfilingTypeCollection(Catalog.ProfilingTypes, ExportLoader, ApplicationCode, _hostApplications); _frameworks = new FrameworkCollection(Catalog.Frameworks, ExportLoader, ApplicationCode, _hostApplications); _profilingTargets = new ProfilingTargetCollection(Catalog.ProfilingTargets, ExportLoader, ApplicationCode, _hostApplications); _productivities = new ProductivityCollection(Catalog.Productivities, ExportLoader, ApplicationCode); _profilingTypes.SetupDependencies(_frameworks); _frameworks.SetupDependencies(_profilingTypes); _configurations = new ConfigurationCollection(_hostApplications); _sessions = new SessionCollection(_hostApplications); }
// Note: this method cannot be generalized past V4, because (a) it has // specific code for detecting .NET 4.5 and (b) we don't know what // microsoft will do in the future private static void AppendDotNetFourFrameworkVersions(FrameworkCollection frameworks, RegistryKey versionKey) { // For now, we just look at the Full profile RegistryKey profileKey = versionKey.OpenSubKey("Full"); if (CheckInstallDword(profileKey)) { RuntimeFramework framework = new RuntimeFramework(RuntimeType.Net, new Version(4, 0)); frameworks.Add(framework); int release = (int)profileKey.GetValue("Release", 0); if (release > 0) { framework = new RuntimeFramework(RuntimeType.Net, new Version(4, 5)); frameworks.Add(framework); } } }
protected override void RunInternal() { _frameworks = new FrameworkCollection(Catalog.Frameworks, ExportLoader); _profilingTypes = new ProfilingTypeCollection(Catalog.ProfilingTypes, ExportLoader); _profilingTargets = new ProfilingTargetCollection(Catalog.ProfilingTargets, ExportLoader); _configurations = new ConfigurationCollection(_profilingTargets, _frameworks, this); _sessions = new SessionCollection(this); _requestServer = new RequestServer(); _requestServer.RegisterHandler(new StartProfilingSessionRequestHandler( _configurations, _sessions, _frameworks, _profilingTypes, _profilingTargets)); //TODO: Host must listen all possible types of streams (NamePipes, SharedMemory, RPC) _ //TODO: _ because agents may use different transports, depending on apps they profile IServerStream serverStream = Connector.Native.StreamFactory.CreateInvokeStream(); _requestServer.Run(serverStream); ServiceContainer.Register(new Remote.IO.FileSystemAccessor(true)); }
private static void AppendDotNetFrameworks(FrameworkCollection frameworks) { if (Environment.OSVersion.Platform == PlatformID.Win32NT) { RegistryKey key = Registry.LocalMachine.OpenSubKey(@"Software\Microsoft\.NETFramework\policy"); if (key != null) { foreach (string name in key.GetSubKeyNames()) { if (name.StartsWith("v")) { RegistryKey key2 = key.OpenSubKey(name); foreach (string build in key2.GetValueNames()) { frameworks.Add(new RuntimeFramework(RuntimeType.Net, new Version(name.Substring(1) + "." + build))); } } } } } }
private static void AppendMonoFrameworks(FrameworkCollection frameworks) { #if true string monoPrefix = null; string version = null; if (Environment.OSVersion.Platform == PlatformID.Win32NT) { RegistryKey key = Registry.LocalMachine.OpenSubKey(@"Software\Novell\Mono"); if (key != null) { version = key.GetValue("DefaultCLR") as string; if (version != null && version != "") { key = key.OpenSubKey(version); if (key != null) { monoPrefix = key.GetValue("SdkInstallRoot") as string; } } } } else // Assuming we're currently running Mono - change if more runtimes are added { string libMonoDir = Path.GetDirectoryName(typeof(object).Assembly.Location); monoPrefix = Path.GetDirectoryName(Path.GetDirectoryName(libMonoDir)); } if (monoPrefix != null) { string displayFmt = version != null ? "Mono " + version + " - {0} Profile" : "Mono {0} Profile"; RuntimeFramework framework = new RuntimeFramework(RuntimeType.Mono, new Version(1, 1, 4322)); framework.displayName = string.Format(displayFmt, "1.0"); frameworks.Add(framework); framework = new RuntimeFramework(RuntimeType.Mono, new Version(2, 0, 50727)); framework.displayName = string.Format(displayFmt, "2.0"); frameworks.Add(framework); if (File.Exists(Path.Combine(monoPrefix, "lib/Mono/4.0/mscorlib.dll"))) { framework = new RuntimeFramework(RuntimeType.Mono, new Version(4, 0, 30319)); framework.displayName = string.Format(displayFmt, "4.0"); frameworks.Add(framework); } } #else // Code to list various versions of Mono - currently not used // because it only works on Windows RegistryKey key = Registry.LocalMachine.OpenSubKey(@"Software\Novell\Mono"); if (key == null) { return; } foreach (string name in key.GetSubKeyNames()) { RuntimeFramework framework = new RuntimeFramework(RuntimeType.Mono, new Version(1, 0)); framework.displayName = "Mono " + name + " - 1.0 Profile"; frameworks.Add(framework); framework = new RuntimeFramework(RuntimeType.Mono, new Version(2, 0)); framework.displayName = "Mono " + name + " - 2.0 Profile"; frameworks.Add(framework); } #endif }