static PropertyService() { Counters.PropertyServiceInitialization.BeginTiming(); string migrateVersion = null; UserProfile migratableProfile = null; var prefsPath = UserProfile.Current.ConfigDir.Combine(FileName); if (!File.Exists(prefsPath)) { if (GetMigratableProfile(out migratableProfile, out migrateVersion)) { FilePath migratePrefsPath = migratableProfile.ConfigDir.Combine(FileName); try { var parentDir = prefsPath.ParentDirectory; //can't use file service until property service is initialized if (!Directory.Exists(parentDir)) { Directory.CreateDirectory(parentDir); } File.Copy(migratePrefsPath, prefsPath); LoggingService.LogInfo("Migrated core properties from {0}", migratePrefsPath); } catch (IOException ex) { string message = string.Format("Failed to migrate core properties from {0}", migratePrefsPath); LoggingService.LogError(message, ex); } } else { LoggingService.LogInfo("Did not find previous version from which to migrate data"); } } if (!LoadProperties(prefsPath)) { properties = new Properties(); properties.Set("MonoDevelop.Core.FirstRun", true); } if (migratableProfile != null) { UserDataMigrationService.SetMigrationSource(migratableProfile, migrateVersion); } properties.PropertyChanged += delegate(object sender, PropertyChangedEventArgs args) { if (PropertyChanged != null) { PropertyChanged(sender, args); } }; Counters.PropertyServiceInitialization.EndTiming(); }
public static void Initialize(bool updateAddinRegistry) { if (initialized) { return; } Counters.RuntimeInitialization.BeginTiming(); SetupInstrumentation(); // Set a default sync context if (SynchronizationContext.Current == null) { SynchronizationContext.SetSynchronizationContext(new SynchronizationContext()); } AddinManager.AddinLoadError += OnLoadError; AddinManager.AddinLoaded += OnLoad; AddinManager.AddinUnloaded += OnUnload; try { Counters.RuntimeInitialization.Trace("Initializing Addin Manager"); AddinManager.Initialize( PropertyService.Locations.Config, PropertyService.Locations.Addins, PropertyService.Locations.Cache); AddinManager.InitializeDefaultLocalizer(new DefaultAddinLocalizer()); if (updateAddinRegistry) { AddinManager.Registry.Update(null); } setupService = new SetupService(AddinManager.Registry); Counters.RuntimeInitialization.Trace("Initialized Addin Manager"); //have to do this after the addin service is initialized if (UserDataMigrationService.HasSource) { Counters.RuntimeInitialization.Trace("Migrating User Data from MD " + UserDataMigrationService.SourceVersion); UserDataMigrationService.StartMigration(); } RegisterAddinRepositories(); Counters.RuntimeInitialization.Trace("Initializing Assembly Service"); systemAssemblyService = new SystemAssemblyService(); systemAssemblyService.Initialize(); initialized = true; } catch (Exception ex) { Console.WriteLine(ex); AddinManager.AddinLoadError -= OnLoadError; AddinManager.AddinLoaded -= OnLoad; AddinManager.AddinUnloaded -= OnUnload; } finally { Counters.RuntimeInitialization.EndTiming(); } }
public static void Initialize(bool updateAddinRegistry) { if (initialized) { return; } Counters.RuntimeInitialization.BeginTiming(); SetupInstrumentation(); Platform.Initialize(); mainThread = Thread.CurrentThread; // Set a default sync context if (SynchronizationContext.Current == null) { defaultSynchronizationContext = new SynchronizationContext(); SynchronizationContext.SetSynchronizationContext(defaultSynchronizationContext); } else { defaultSynchronizationContext = SynchronizationContext.Current; } // Hook up the SSL certificate validation codepath ServicePointManager.ServerCertificateValidationCallback += delegate(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) { if (sslPolicyErrors == SslPolicyErrors.None) { return(true); } if (sender is WebRequest) { sender = ((WebRequest)sender).RequestUri.Host; } return(WebCertificateService.GetIsCertificateTrusted(sender as string, certificate.GetPublicKeyString())); }; AddinManager.AddinLoadError += OnLoadError; AddinManager.AddinLoaded += OnLoad; AddinManager.AddinUnloaded += OnUnload; try { Counters.RuntimeInitialization.Trace("Initializing Addin Manager"); string configDir, addinsDir, databaseDir; GetAddinRegistryLocation(out configDir, out addinsDir, out databaseDir); AddinManager.Initialize(configDir, addinsDir, databaseDir); AddinManager.InitializeDefaultLocalizer(new DefaultAddinLocalizer()); if (updateAddinRegistry) { AddinManager.Registry.Update(null); } setupService = new AddinSetupService(AddinManager.Registry); Counters.RuntimeInitialization.Trace("Initialized Addin Manager"); PropertyService.Initialize(); WebRequestHelper.Initialize(); Mono.Addins.Setup.WebRequestHelper.SetRequestHandler(WebRequestHelper.GetResponse); //have to do this after the addin service and property service have initialized if (UserDataMigrationService.HasSource) { Counters.RuntimeInitialization.Trace("Migrating User Data from MD " + UserDataMigrationService.SourceVersion); UserDataMigrationService.StartMigration(); } RegisterAddinRepositories(); Counters.RuntimeInitialization.Trace("Initializing Assembly Service"); systemAssemblyService = new SystemAssemblyService(); systemAssemblyService.Initialize(); LoadMSBuildLibraries(); initialized = true; } catch (Exception ex) { Console.WriteLine(ex); AddinManager.AddinLoadError -= OnLoadError; AddinManager.AddinLoaded -= OnLoad; AddinManager.AddinUnloaded -= OnUnload; } finally { Counters.RuntimeInitialization.EndTiming(); } }
public static void Initialize(bool updateAddinRegistry) { if (initialized) { return; } Counters.RuntimeInitialization.BeginTiming(); SetupInstrumentation(); if (Platform.IsMac) { InitMacFoundation(); } // Set a default sync context if (SynchronizationContext.Current == null) { SynchronizationContext.SetSynchronizationContext(new SynchronizationContext()); } // Hook up the SSL certificate validation codepath System.Net.ServicePointManager.ServerCertificateValidationCallback += delegate(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) { if (sslPolicyErrors == SslPolicyErrors.None) { return(true); } if (sender is WebRequest) { sender = ((WebRequest)sender).RequestUri.Host; } return(WebCertificateService.GetIsCertificateTrusted(sender as string, certificate.GetPublicKeyString())); }; AddinManager.AddinLoadError += OnLoadError; AddinManager.AddinLoaded += OnLoad; AddinManager.AddinUnloaded += OnUnload; //provides a development-time way to load addins that are being developed in a asperate solution var devAddinDir = Environment.GetEnvironmentVariable("MONODEVELOP_DEV_ADDINS"); if (devAddinDir != null && devAddinDir.Length == 0) { devAddinDir = null; } try { Counters.RuntimeInitialization.Trace("Initializing Addin Manager"); AddinManager.Initialize( UserProfile.Current.ConfigDir, devAddinDir ?? UserProfile.Current.LocalInstallDir.Combine("Addins"), devAddinDir ?? UserProfile.Current.CacheDir); AddinManager.InitializeDefaultLocalizer(new DefaultAddinLocalizer()); if (updateAddinRegistry) { AddinManager.Registry.Update(null); } setupService = new AddinSetupService(AddinManager.Registry); Counters.RuntimeInitialization.Trace("Initialized Addin Manager"); PropertyService.Initialize(); //have to do this after the addin service and property service have initialized if (UserDataMigrationService.HasSource) { Counters.RuntimeInitialization.Trace("Migrating User Data from MD " + UserDataMigrationService.SourceVersion); UserDataMigrationService.StartMigration(); } RegisterAddinRepositories(); Counters.RuntimeInitialization.Trace("Initializing Assembly Service"); systemAssemblyService = new SystemAssemblyService(); systemAssemblyService.Initialize(); initialized = true; } catch (Exception ex) { Console.WriteLine(ex); AddinManager.AddinLoadError -= OnLoadError; AddinManager.AddinLoaded -= OnLoad; AddinManager.AddinUnloaded -= OnUnload; } finally { Counters.RuntimeInitialization.EndTiming(); } }
public static void Initialize(bool updateAddinRegistry) { if (initialized) { return; } Counters.RuntimeInitialization.BeginTiming(); SetupInstrumentation(); if (Platform.IsMac) { InitMacFoundation(); } // Set a default sync context if (SynchronizationContext.Current == null) { SynchronizationContext.SetSynchronizationContext(new SynchronizationContext()); } AddinManager.AddinLoadError += OnLoadError; AddinManager.AddinLoaded += OnLoad; AddinManager.AddinUnloaded += OnUnload; //provides a development-time way to load addins that are being developed in a asperate solution var devAddinDir = Environment.GetEnvironmentVariable("MONODEVELOP_DEV_ADDINS"); if (devAddinDir != null && devAddinDir.Length == 0) { devAddinDir = null; } try { Counters.RuntimeInitialization.Trace("Initializing Addin Manager"); AddinManager.Initialize( UserProfile.Current.ConfigDir, devAddinDir ?? UserProfile.Current.LocalInstallDir.Combine("Addins"), devAddinDir ?? UserProfile.Current.CacheDir); AddinManager.InitializeDefaultLocalizer(new DefaultAddinLocalizer()); if (updateAddinRegistry) { AddinManager.Registry.Update(null); } setupService = new AddinSetupService(AddinManager.Registry); Counters.RuntimeInitialization.Trace("Initialized Addin Manager"); PropertyService.Initialize(); //have to do this after the addin service and property service have initialized if (UserDataMigrationService.HasSource) { Counters.RuntimeInitialization.Trace("Migrating User Data from MD " + UserDataMigrationService.SourceVersion); UserDataMigrationService.StartMigration(); } RegisterAddinRepositories(); Counters.RuntimeInitialization.Trace("Initializing Assembly Service"); systemAssemblyService = new SystemAssemblyService(); systemAssemblyService.Initialize(); initialized = true; } catch (Exception ex) { Console.WriteLine(ex); AddinManager.AddinLoadError -= OnLoadError; AddinManager.AddinLoaded -= OnLoad; AddinManager.AddinUnloaded -= OnUnload; } finally { Counters.RuntimeInitialization.EndTiming(); } }
static PropertyService() { Counters.PropertyServiceInitialization.BeginTiming(); IsWindows = Path.DirectorySeparatorChar == '\\'; IsMac = !IsWindows && IsRunningOnMac(); FilePath testProfileRoot = Environment.GetEnvironmentVariable("MONODEVELOP_PROFILE"); if (!testProfileRoot.IsNullOrEmpty) { Locations = UserDataLocations.ForTest(CURRENT_PROFILE_VERSION, testProfileRoot); } else { Locations = GetLocations(CURRENT_PROFILE_VERSION); } string migrateVersion = null; UserDataLocations migratableProfile = null; var prefsPath = Locations.Config.Combine(FileName); if (!File.Exists(prefsPath)) { if (GetMigratableProfile(testProfileRoot, out migratableProfile, out migrateVersion)) { FilePath migratePrefsPath = migratableProfile.Config.Combine(FileName); try { var parentDir = prefsPath.ParentDirectory; //can't use file service until property sevice in initialized if (!Directory.Exists(parentDir)) { Directory.CreateDirectory(parentDir); } File.Copy(migratePrefsPath, prefsPath); LoggingService.LogInfo("Migrated core properties from {0}", migratePrefsPath); } catch (IOException ex) { string message = string.Format("Failed to migrate core properties from {0}", migratePrefsPath); LoggingService.LogError(message, ex); } } else { LoggingService.LogInfo("Did not find previous version from which to migrate data"); } } if (!LoadProperties(prefsPath)) { properties = new Properties(); properties.Set("MonoDevelop.Core.FirstRun", true); } if (migratableProfile != null) { UserDataMigrationService.SetMigrationSource(migratableProfile, migrateVersion); } properties.PropertyChanged += delegate(object sender, PropertyChangedEventArgs args) { if (PropertyChanged != null) { PropertyChanged(sender, args); } }; Counters.PropertyServiceInitialization.EndTiming(); }