diff options
author | Mike Krüger <mkrueger@xamarin.com> | 2011-09-14 12:01:49 +0400 |
---|---|---|
committer | Mike Krüger <mkrueger@xamarin.com> | 2011-09-14 12:34:20 +0400 |
commit | 20dad0746a093ca5980be2bd27b5ddddafcb8694 (patch) | |
tree | bfda28816a0fcda500cd0ad0e37503db45bcdc3d | |
parent | 385b73dd22ae6dfbbf785c4532adbac776d20712 (diff) |
[Ide] Added assembly versions, introduced extension point for about
box infos & removed monotouch/droid version code.
This is moved to the addins.
3 files changed, 72 insertions, 113 deletions
diff --git a/main/src/core/MonoDevelop.Ide/ExtensionModel/MonoDevelop.Ide.addin.xml b/main/src/core/MonoDevelop.Ide/ExtensionModel/MonoDevelop.Ide.addin.xml index e77efff7b8..ddf8fe6741 100644 --- a/main/src/core/MonoDevelop.Ide/ExtensionModel/MonoDevelop.Ide.addin.xml +++ b/main/src/core/MonoDevelop.Ide/ExtensionModel/MonoDevelop.Ide.addin.xml @@ -149,8 +149,12 @@ <ExtensionPoint path = "/MonoDevelop/Ide/Updater/UpdateHandlers" name = "Update handlers"> <ExtensionNode name="Type" /> </ExtensionPoint> - - <!-- Extensions --> + + <ExtensionPoint path = "/MonoDevelop/Ide/AboutBoxInformation" name = "About box information"> + <ExtensionNode name="Class" /> + </ExtensionPoint> + + <!-- Extensions --> <Extension path = "/MonoDevelop/Core/Applications"> <Application id = "gsetup" diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/CommonAboutDialog.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/CommonAboutDialog.cs index d8dc116d6a..a199126edd 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/CommonAboutDialog.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/CommonAboutDialog.cs @@ -42,11 +42,37 @@ using Gtk; using GLib; using Pango; using System.IO; +using Mono.Addins; +using System.Collections.Generic; namespace MonoDevelop.Ide.Gui.Dialogs { + public interface IAboutInformation + { + string Description { + get; + } + } + internal class CommonAboutDialog : Dialog { + public static List<IAboutInformation> AdditionalInformation = new List<IAboutInformation> (); + + static CommonAboutDialog () + { + AddinManager.AddExtensionNodeHandler ("/MonoDevelop/Ide/AboutBoxInformation", delegate(object sender, ExtensionNodeEventArgs args) { + var codon = (IAboutInformation)args.ExtensionObject; + switch (args.Change) { + case ExtensionChange.Add: + AdditionalInformation.Add (codon); + break; + case ExtensionChange.Remove: + AdditionalInformation.Remove (codon); + break; + } + }); + } + public CommonAboutDialog () { Title = string.Format (GettextCatalog.GetString ("About {0}"), BrandingService.ApplicationName); diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/VersionInformationTabPage.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/VersionInformationTabPage.cs index 7217b99ee5..40d2313e12 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/VersionInformationTabPage.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/VersionInformationTabPage.cs @@ -33,6 +33,7 @@ using MonoDevelop.Core; using System.Reflection; using System.Text; using System.IO; +using MonoDevelop.Ide.Fonts; namespace MonoDevelop.Ide.Gui.Dialogs @@ -46,7 +47,7 @@ namespace MonoDevelop.Ide.Gui.Dialogs string mdversion = BuildVariables.PackageVersion == BuildVariables.PackageVersionLabel ? BuildVariables.PackageVersionLabel - : string.Format ("{0} ({1})", BuildVariables.PackageVersionLabel, BuildVariables.PackageVersion); + : string.Format ("{0} ({1})", BuildVariables.PackageVersionLabel, BuildVariables.PackageVersion); sb.Append ("MonoDevelop "); sb.AppendLine (mdversion); @@ -69,6 +70,7 @@ namespace MonoDevelop.Ide.Gui.Dialogs } else { sb.Append ("\tMicrosoft .NET " + Environment.Version); } + if (IntPtr.Size == 8) sb.Append (" (64-bit)"); sb.AppendLine (); @@ -76,18 +78,11 @@ namespace MonoDevelop.Ide.Gui.Dialogs sb.Append ("\tGTK " + GetGtkVersion ()); sb.AppendLine (" (GTK# " + typeof(VBox).Assembly.GetName ().Version + ")"); - if (Platform.IsMac) { - var mtVersion = GetMonotouchVersion (); - if (mtVersion != null) - sb.AppendLine ("MonoTouch: " + mtVersion); + foreach (var info in CommonAboutDialog.AdditionalInformation) { + sb.AppendLine (info.Description); } - -// TODO:Get mono droid version. -// var droidVersion = GetMonoDroidVersion (); -// if (droidVersion != null) -// sb.AppendLine ("\tMono for Android: " + droidVersion); - var biFile = ((FilePath)typeof (VersionInformationTabPage).Assembly.Location).ParentDirectory.Combine ("buildinfo"); + var biFile = ((FilePath)typeof(VersionInformationTabPage).Assembly.Location).ParentDirectory.Combine ("buildinfo"); if (File.Exists (biFile)) { sb.AppendLine ("Build information:"); foreach (var line in File.ReadAllLines (biFile)) { @@ -98,9 +93,42 @@ namespace MonoDevelop.Ide.Gui.Dialogs } } + sb.AppendLine ("Loaded assemblies:"); + + int nameLength = 0; + int versionLength = 0; + foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies ()) { + try { + if (assembly.IsDynamic) + continue; + var assemblyName = assembly.GetName (); + nameLength = Math.Max (nameLength, assemblyName.Name.Length); + versionLength = Math.Max (versionLength, assemblyName.Version.ToString ().Length); + } catch { + } + } + nameLength++; + versionLength++; + foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies ()) { + try { + if (assembly.IsDynamic) + continue; + var assemblyName = assembly.GetName (); + sb.AppendLine (ForceLength (assemblyName.Name, nameLength) + ForceLength (assemblyName.Version.ToString (), versionLength) + System.IO.Path.GetFullPath (assembly.Location)); + } catch { + } + } + return sb.ToString (); } + static string ForceLength (string str, int length) + { + if (str.Length < length) + return str + new string (' ', length - str.Length); + return str; + } + static bool IsMono () { return Type.GetType ("Mono.Runtime") != null; @@ -141,106 +169,6 @@ namespace MonoDevelop.Ide.Gui.Dialogs return v1 +"." + v2 + "."+ v3; } - #region Monotouch - static string GetMonotouchVersion () - { - var mtdir = GetMonotouchLocation (); - var mtouch = System.IO.Path.Combine (mtdir, "usr/bin/mtouch"); - if (!File.Exists (mtouch)) - return mtouch + "not found."; - var version = System.IO.Path.Combine (mtdir, "Version"); - if (!File.Exists (version)) - return "unknown version"; - bool isEvaluation = !File.Exists (System.IO.Path.Combine (mtdir, "usr/bin/arm-darwin-mono")); - if (isEvaluation) - return File.ReadAllText (version).Trim () + " (Evaluation)"; - return File.ReadAllText (version); - } - - static string GetMonotouchLocation () - { - const string DefaultLocation = "/Developer/MonoTouch"; - const string MTOUCH_LOCATION_ENV_VAR = "MD_MTOUCH_SDK_ROOT"; - var mtRoot = Environment.GetEnvironmentVariable (MTOUCH_LOCATION_ENV_VAR); - return mtRoot ?? GetConfiguredMonoTouchSdkRoot () ?? DefaultLocation; - } - - static string GetConfiguredMonoTouchSdkRoot () - { - const string MTOUCH_SDK_KEY = "MonoDevelop.IPhone.MonoTouchSdkRoot"; - return PropertyService.Get<string> (MTOUCH_SDK_KEY, null); - } - #endregion - - #region MonoDroid - static string GetMonoDroidVersion () - { - string monoDroidBinDir; - string monoDroidFrameworkDir; - GetMonoDroidSdk (out monoDroidBinDir, out monoDroidFrameworkDir); - return monoDroidBinDir; - } - - static void GetMonoDroidSdk (out string monoDroidBinDir, out string monoDroidFrameworkDir) - { - monoDroidBinDir = monoDroidFrameworkDir = null; - - if (Platform.IsWindows) { - // Find user's \Program Files - var programFilesX86 = GetProgramFilesX86 (); - - // We keep our tools in: - // \Program Files\MSBuild\Novell - monoDroidBinDir = programFilesX86 + @"\MSBuild\Novell"; - - // This will probably never be used on Windows - var fxDir = programFilesX86 + @"\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0"; - - if (System.IO.File.Exists (fxDir + @"\mscorlib.dll")) - monoDroidFrameworkDir = fxDir; - else - monoDroidFrameworkDir = null; - - return; - } - - string monoAndroidPath = Environment.GetEnvironmentVariable ("MONO_ANDROID_PATH"); - string libmandroid = System.IO.Path.Combine ("lib", "mandroid"); - string debugRuntime = "Mono.Android.DebugRuntime-debug.apk"; - - foreach (var loc in new[]{ - new { D = monoAndroidPath, L = libmandroid, E = debugRuntime }, - new { D = "/Developer/MonoAndroid/usr", L = libmandroid, E = debugRuntime }, - new { D = "/opt/mono-android", L = libmandroid, E = debugRuntime }}) - if (CheckMonoDroidPath (loc.D, loc.L, loc.E, out monoDroidBinDir, out monoDroidFrameworkDir)) - return; - } - - static bool CheckMonoDroidPath (string monoDroidPath, string relBinPath, string mandroid, out string monoDroidBinDir, out string monoDroidFrameworkDir) - { - monoDroidBinDir = monoDroidFrameworkDir = null; - - if (string.IsNullOrEmpty (monoDroidPath)) - return false; - - var bin = System.IO.Path.Combine (monoDroidPath, relBinPath); - if (!System.IO.File.Exists (System.IO.Path.Combine (bin, mandroid))) - return false; - - monoDroidBinDir = bin; - monoDroidFrameworkDir = System.IO.Path.Combine (monoDroidPath, "lib", "mono", "2.1"); - return true; - } - - static string GetProgramFilesX86 () - { - if (IntPtr.Size == 8 || !string.IsNullOrEmpty (Environment.GetEnvironmentVariable ("PROCESSOR_ARCHITEW6432"))) - return Environment.GetEnvironmentVariable ("PROGRAMFILES(X86)"); - else - return Environment.GetEnvironmentVariable ("PROGRAMFILES"); - } - #endregion - public VersionInformationTabPage () { var buf = new TextBuffer (null); @@ -258,6 +186,7 @@ namespace MonoDevelop.Ide.Gui.Dialogs } }; + sw.Child.ModifyFont (Pango.FontDescription.FromString (FontService.GetFontDescription ("Editor").Family + " 12")); PackStart (sw, true, true, 0); } } |