From 6871aeab6a8b97396f4d07b93cf0a11b9c8e9626 Mon Sep 17 00:00:00 2001 From: Miguel de Icaza Date: Thu, 22 Nov 2007 04:31:55 +0000 Subject: Implement basic installer functionality svn path=/trunk/mcs/; revision=90122 --- .../AssemblyInstaller.cs | 14 +++--- .../ComponentInstaller.cs | 8 ++-- .../System.Configuration.Install/InstallContext.cs | 43 +++++++++++++----- .../System.Configuration.Install/Installer.cs | 51 +++++++--------------- .../TransactedInstaller.cs | 4 +- 5 files changed, 57 insertions(+), 63 deletions(-) (limited to 'mcs/class/System.Configuration.Install') diff --git a/mcs/class/System.Configuration.Install/System.Configuration.Install/AssemblyInstaller.cs b/mcs/class/System.Configuration.Install/System.Configuration.Install/AssemblyInstaller.cs index cb6deda2b33..5ea5b878d6b 100644 --- a/mcs/class/System.Configuration.Install/System.Configuration.Install/AssemblyInstaller.cs +++ b/mcs/class/System.Configuration.Install/System.Configuration.Install/AssemblyInstaller.cs @@ -59,28 +59,24 @@ namespace System.Configuration.Install throw new NotImplementedException (); } - [MonoTODO] public override void Commit (IDictionary savedState) { - throw new NotImplementedException (); + base.Commit (savedState); } - [MonoTODO] public override void Install (IDictionary savedState) { - throw new NotImplementedException (); + base.Install (savedState); } - [MonoTODO] public override void Rollback (IDictionary savedState) { - throw new NotImplementedException (); + base.Rollback (savedState); } - [MonoTODO] public override void Uninstall (IDictionary savedState) { - throw new NotImplementedException (); + base.Uninstall (savedState); } public Assembly Assembly { @@ -103,7 +99,7 @@ namespace System.Configuration.Install public override string HelpText { get { - throw new NotImplementedException (); + return base.HelpText; } } public string Path { diff --git a/mcs/class/System.Configuration.Install/System.Configuration.Install/ComponentInstaller.cs b/mcs/class/System.Configuration.Install/System.Configuration.Install/ComponentInstaller.cs index 11abc869079..d699d18ed07 100644 --- a/mcs/class/System.Configuration.Install/System.Configuration.Install/ComponentInstaller.cs +++ b/mcs/class/System.Configuration.Install/System.Configuration.Install/ComponentInstaller.cs @@ -33,17 +33,15 @@ namespace System.Configuration.Install { public abstract class ComponentInstaller : Installer { - [MonoTODO] protected ComponentInstaller () { - throw new NotImplementedException (); } public abstract void CopyFromComponent (IComponent component); - - [MonoTODO] + + [MonoTODO ("Mono always returns false")] public virtual bool IsEquivalentInstaller (ComponentInstaller otherInstaller) { - throw new NotImplementedException (); + return false; } } } diff --git a/mcs/class/System.Configuration.Install/System.Configuration.Install/InstallContext.cs b/mcs/class/System.Configuration.Install/System.Configuration.Install/InstallContext.cs index 040bca64684..f9c89c8631e 100644 --- a/mcs/class/System.Configuration.Install/System.Configuration.Install/InstallContext.cs +++ b/mcs/class/System.Configuration.Install/System.Configuration.Install/InstallContext.cs @@ -34,15 +34,21 @@ namespace System.Configuration.Install public class InstallContext { private StringDictionary parameters; + string log_file; + bool log = false; - [MonoTODO] - public InstallContext () { - throw new NotImplementedException (); + public InstallContext () + { + log_file = null; + log = false; + parameters = ParseCommandLine (new string [0]); } - [MonoTODO] - public InstallContext (string logFilePath, string[] commandLine) { - throw new NotImplementedException (); + public InstallContext (string logFilePath, string[] commandLine) + { + log_file = logFilePath; + parameters = ParseCommandLine (commandLine); + log = IsParameterTrue ("LogtoConsole"); } public StringDictionary Parameters { @@ -51,22 +57,35 @@ namespace System.Configuration.Install } } - [MonoTODO] public bool IsParameterTrue (string paramName) { - throw new NotImplementedException (); + return parameters [paramName] == "true"; } - [MonoTODO] public void LogMessage (string message) { - throw new NotImplementedException (); + if (log) + Console.WriteLine (message); } - [MonoTODO] protected static StringDictionary ParseCommandLine (string[] args) { - throw new NotImplementedException (); + StringDictionary d = new StringDictionary (); + + foreach (string s in args){ + int p = s.IndexOf ("="); + if (p == -1) + d [s] = "true"; + else { + string key = s.Substring (0, p); + string value = s.Substring (p+1).ToLower (); + if (value == "yes" || value == "true" || value == "1") + value = "true"; + + d [key] = value; + } + } + return d; } } } diff --git a/mcs/class/System.Configuration.Install/System.Configuration.Install/Installer.cs b/mcs/class/System.Configuration.Install/System.Configuration.Install/Installer.cs index 455afcb559f..e0b17d91276 100644 --- a/mcs/class/System.Configuration.Install/System.Configuration.Install/Installer.cs +++ b/mcs/class/System.Configuration.Install/System.Configuration.Install/Installer.cs @@ -34,10 +34,6 @@ using System.ComponentModel.Design; namespace System.Configuration.Install { [DefaultEvent("AfterInstall")] -#if (!NET_2_0) - // .NET 2.0 (Community Preview) no longer has this attribute - [Designer("Microsoft.VisualStudio.Configuration.InstallerDesigner, " + Consts.AssemblyMicrosoft_VisualStudio, typeof(IRootDesigner))] -#endif public class Installer : Component { private InstallContext context; @@ -45,9 +41,7 @@ namespace System.Configuration.Install private InstallerCollection installers; internal Installer parent; - [MonoTODO] public Installer () { - throw new NotImplementedException (); } [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] @@ -68,17 +62,12 @@ namespace System.Configuration.Install } } - [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)] - [BrowsableAttribute(false)] public InstallerCollection Installers { get { return installers; } } - [TypeConverter ("System.Configuration.Design.InstallerParentConverter")] - [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] - [BrowsableAttribute (true)] public Installer Parent { get { return parent; @@ -89,76 +78,68 @@ namespace System.Configuration.Install } } - [MonoTODO] public virtual void Commit (IDictionary savedState) { - throw new NotImplementedException (); } - [MonoTODO] public virtual void Install (IDictionary stateSaver) { - throw new NotImplementedException (); } - [MonoTODO] protected virtual void OnAfterInstall (IDictionary savedState) { - throw new NotImplementedException (); + if (AfterInstall != null) + AfterInstall (this, new InstallEventArgs (savedState)); } - [MonoTODO] protected virtual void OnAfterRollback (IDictionary savedState) { - throw new NotImplementedException (); + if (AfterRollback != null) + AfterRollback (this, new InstallEventArgs (savedState)); } - [MonoTODO] protected virtual void OnAfterUninstall (IDictionary savedState) { - throw new NotImplementedException (); + if (AfterUninstall != null) + AfterUninstall (this, new InstallEventArgs (savedState)); } - [MonoTODO] protected virtual void OnBeforeInstall (IDictionary savedState) { - throw new NotImplementedException (); + if (BeforeInstall != null) + BeforeInstall (this, new InstallEventArgs (savedState)); } - [MonoTODO] protected virtual void OnBeforeRollback (IDictionary savedState) { - throw new NotImplementedException (); + if (BeforeRollback != null) + BeforeRollback (this, new InstallEventArgs (savedState)); } - [MonoTODO] protected virtual void OnBeforeUninstall (IDictionary savedState) { - throw new NotImplementedException (); + if (BeforeUninstall != null) + BeforeUninstall (this, new InstallEventArgs (savedState)); } - [MonoTODO] protected virtual void OnCommitted (IDictionary savedState) { - throw new NotImplementedException (); + if (Committed != null) + Committed (this, new InstallEventArgs (savedState)); } - [MonoTODO] protected virtual void OnCommitting (IDictionary savedState) { - throw new NotImplementedException (); + if (Committing != null) + Committing (this, new InstallEventArgs (savedState)); } - [MonoTODO] public virtual void Rollback (IDictionary savedState) { - throw new NotImplementedException (); } - [MonoTODO] public virtual void Uninstall (IDictionary savedState) { - throw new NotImplementedException (); } public event InstallEventHandler AfterInstall; diff --git a/mcs/class/System.Configuration.Install/System.Configuration.Install/TransactedInstaller.cs b/mcs/class/System.Configuration.Install/System.Configuration.Install/TransactedInstaller.cs index 9e628d1e18b..67e22969e29 100644 --- a/mcs/class/System.Configuration.Install/System.Configuration.Install/TransactedInstaller.cs +++ b/mcs/class/System.Configuration.Install/System.Configuration.Install/TransactedInstaller.cs @@ -37,14 +37,14 @@ namespace System.Configuration.Install { } - [MonoTODO] public override void Install (IDictionary savedState) { + base.Install (savedState); } - [MonoTODO] public override void Uninstall (IDictionary savedState) { + base.Uninstall (savedState); } } } -- cgit v1.2.3