dotgnu-pnet-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Dotgnu-pnet-commits] CVS: pnetlib/System.Configuration.Install .cvsigno


From: Rhys Weatherley <address@hidden>
Subject: [Dotgnu-pnet-commits] CVS: pnetlib/System.Configuration.Install .cvsignore, NONE, 1.1 AssemblyInstaller.cs, NONE, 1.1 ComponentInstaller.cs, NONE, 1.1 EventLogInstaller.cs, NONE, 1.1 IManagedInstaller.cs, NONE, 1.1 InstallContext.cs, NONE, 1.1 InstallEventArgs.cs, NONE, 1.1 InstallEventHandler.cs, NONE, 1.1 InstallException.cs, NONE, 1.1 InstallUtil.cs, NONE, 1.1 Installer.cs, NONE, 1.1 InstallerCollection.cs, NONE, 1.1 Makefile.am, NONE, 1.1 ManagedInstallerClass.cs, NONE, 1.1 PerformanceCounterInstaller.cs, NONE, 1.1 S.cs, NONE, 1.1 System.Configuration.Install.build, NONE, 1.1 TransactedInstaller.cs, NONE, 1.1 UninstallAction.cs, NONE, 1.1 ilinstall-run.sh, NONE, 1.1
Date: Fri, 08 Aug 2003 21:36:38 -0400

Update of /cvsroot/dotgnu-pnet/pnetlib/System.Configuration.Install
In directory subversions:/tmp/cvs-serv4609/System.Configuration.Install

Added Files:
        .cvsignore AssemblyInstaller.cs ComponentInstaller.cs 
        EventLogInstaller.cs IManagedInstaller.cs InstallContext.cs 
        InstallEventArgs.cs InstallEventHandler.cs InstallException.cs 
        InstallUtil.cs Installer.cs InstallerCollection.cs Makefile.am 
        ManagedInstallerClass.cs PerformanceCounterInstaller.cs S.cs 
        System.Configuration.Install.build TransactedInstaller.cs 
        UninstallAction.cs ilinstall-run.sh 
Log Message:


Check in the "System.Configuration.Install" implementation.


--- NEW FILE ---
Makefile
Makefile.in
.deps
*.dll
*.exe

--- NEW FILE ---
/*
 * AssemblyInstaller.cs - Implementation of the
 *          "System.Configuration.Install.AssemblyInstaller" class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.Configuration.Install
{

using System.Reflection;
using System.Collections;
using System.ComponentModel;
using System.IO;

public class AssemblyInstaller : Installer
{
        // Internal state.
        private Assembly assembly;
        private String assemblyPath;
        private String[] commandLine;
        private bool useNewContext;
        private AssemblyInfo info;
        private static AssemblyInfo[] assemblies;

        private class AssemblyInfo
        {
                public String filename;
                public Assembly assembly;
                public AssemblyInstaller installer;
                public Exception loadException;

        }; // class AssemblyInfo

        // Constructors.
        public AssemblyInstaller()
                        {
                                this.useNewContext = true;
                        }
        public AssemblyInstaller(Assembly assembly, String[] commandLine)
                        {
                                this.assembly = assembly;
                                this.commandLine = commandLine;
                                this.useNewContext = true;
                        }
        public AssemblyInstaller(String filename, String[] commandLine)
                        {
                                this.assemblyPath = filename;
                                this.commandLine = commandLine;
                                this.useNewContext = true;
                        }

        // Get or set this object's properties.
        public Assembly Assembly
                        {
                                get
                                {
                                        return assembly;
                                }
                                set
                                {
                                        assembly = value;
                                }
                        }
        public String[] CommandLine
                        {
                                get
                                {
                                        return commandLine;
                                }
                                set
                                {
                                        commandLine = value;
                                }
                        }
        public override String HelpText
                        {
                                get
                                {
                                        Initialize();
                                        String text = String.Empty;
                                        foreach(Installer inst in Installers)
                                        {
                                                text += inst.HelpText + 
Environment.NewLine;
                                        }
                                        return text;
                                }
                        }
        public String Path
                        {
                                get
                                {
                                        return assemblyPath;
                                }
                                set
                                {
                                        assemblyPath = value;
                                }
                        }
        public bool UseNewContext
                        {
                                get
                                {
                                        return useNewContext;
                                }
                                set
                                {
                                        useNewContext = value;
                                }
                        }

        // Load all installers from a particular assembly.
        private static void LoadInstallers(AssemblyInfo info)
                        {
                                Type[] types = info.assembly.GetTypes();
                                ConstructorInfo ctor;
                                foreach(Type type in types)
                                {
                                        // Type must not be abstract and must
                                        // inherit from the "Installer" class.
                                        if(!type.IsAbstract &&
                                           type.IsSubclassOf(typeof(Installer)))
                                        {
                                                // Check for a zero-argument 
public ctor.
                                                ctor = 
type.GetConstructor(Type.EmptyTypes);
                                                if(ctor == null)
                                                {
                                                        continue;
                                                }

                                        #if !ECMA_COMPAT
                                                // Check for the "RunInstaller" 
attribute.
                                                Object[] attrs =
                                                        type.GetCustomAttributes
                                                                
(typeof(RunInstallerAttribute), false);
                                                if(attrs != null && 
attrs.Length > 0)
                                                {
                                                        
if(((RunInstallerAttribute)(attrs[0]))
                                                                        
.RunInstaller)
                                                        {
                                                                // This is a 
valid installer.
                                                                
info.installer.Installers.Add
                                                                        
(ctor.Invoke(new Object [0])
                                                                                
as Installer);
                                                        }
                                                }
                                        #endif
                                        }
                                }
                        }

        // Initialize this object if necessary.
        private void Initialize()
                        {
                                if(info == null)
                                {
                                        if(Context == null)
                                        {
                                                Context = new 
InstallContext(null, commandLine);
                                        }
                                        if(assembly != null)
                                        {
                                                info = new AssemblyInfo();
                                                info.assembly = assembly;
                                                info.installer = this;
                                                LoadInstallers(info);
                                        }
                                        else
                                        {
                                                
LoadInstallerAssembly(assemblyPath, Context);
                                        }
                                }
                        }

        // Check to see if a particular assembly is installable.
        public static void CheckIfInstallable(String assemblyName)
                        {
                                AssemblyInfo info = LoadInstallerAssembly
                                        (assemblyName, new InstallContext());
                                if(info.installer.Installers.Count == 0)
                                {
                                        throw new InvalidOperationException
                                                
(S._("Installer_NoInstallersFound"));
                                }
                        }

    // Commit the installation transaction.
    public override void Commit(IDictionary savedState)
                        {
                                Initialize();
                                // TODO
                        }

    // Perform the installation process, saving the previous
    // state in the "stateSaver" object.
    public override void Install(IDictionary stateSaver)
                        {
                                Initialize();
                                // TODO
                        }

    // Roll back the current installation to "savedState".
    public override void Rollback(IDictionary savedState)
                        {
                                Initialize();
                                // TODO
                        }

    // Uninstall and return to a previously saved state.
    public override void Uninstall(IDictionary savedState)
                        {
                                Initialize();
                                // TODO
                        }

        // Load an assembly by name and get the information object for it.
        internal static AssemblyInfo LoadInstallerAssembly
                                (String filename, InstallContext logContext)
                        {
                                String fullName;
                                AssemblyInfo info;
                                AssemblyInfo[] newAssemblies;
                                int index;
                                lock(typeof(AssemblyInstaller))
                                {
                                        try
                                        {
                                                // See if we have a cached 
information block,
                                                // from when we loaded the 
assembly previously.
                                                fullName = 
Path.GetFullPath(filename);
                                                if(assemblies != null)
                                                {
                                                        for(index = 0; index < 
assemblies.Length; ++index)
                                                        {
                                                                info = 
assemblies[index];
                                                                
if(info.filename == fullName)
                                                                {
                                                                        
if(info.loadException == null)
                                                                        {
                                                                                
return info;
                                                                        }
                                                                        throw 
info.loadException;
                                                                }
                                                        }
                                                        newAssemblies = new 
AssemblyInfo
                                                                
[assemblies.Length + 1];
                                                        Array.Copy(assemblies, 
0, newAssemblies, 0,
                                                                           
assemblies.Length);
                                                        info = new 
AssemblyInfo();
                                                        
newAssemblies[assemblies.Length] = info;
                                                        assemblies = 
newAssemblies;
                                                }
                                                else
                                                {
                                                        info = new 
AssemblyInfo();
                                                        assemblies = new 
AssemblyInfo [] {info};
                                                }

                                                // Try to load the assembly 
into memory.
                                                info.filename = fullName;
                                                try
                                                {
                                                        info.assembly = 
Assembly.LoadFrom(fullName);
                                                }
                                                catch(SystemException e)
                                                {
                                                        info.loadException = e;
                                                        throw;
                                                }

                                                // Wrap the assembly in an 
installer.
                                                info.installer = new 
AssemblyInstaller();
                                                info.installer.assemblyPath = 
filename;
                                                info.installer.info = info;

                                                // Search for all public 
installer types.
                                                LoadInstallers(info);

                                                // The assembly is ready to go.
                                                return info;
                                        }
                                        catch(SystemException e)
                                        {
                                                if(logContext != null)
                                                {
                                                        
if(logContext.IsParameterTrue("ShowCallStack"))
                                                        {
                                                                
logContext.LogLine
                                                                        
("LoadAssembly: " + e.ToString());
                                                        }
                                                        else
                                                        {
                                                                
logContext.LogLine
                                                                        
("LoadAssembly: " + e.Message);
                                                        }
                                                }
                                                throw new 
InvalidOperationException
                                                        
(S._("Installer_CouldNotLoadAssembly"), e);
                                        }
                                }
                        }

}; // class AssemblyInstaller

}; // namespace System.Configuration.Install

--- NEW FILE ---
/*
 * ComponentInstaller.cs - Implementation of the
 *          "System.Configuration.Install.ComponentInstaller" class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.Configuration.Install
{

#if CONFIG_COMPONENT_MODEL

using System.ComponentModel;

public abstract class ComponentInstaller : Installer
{
        // Constructor.
        protected ComponentInstaller() {}

        // Copy installation properties from a component.
        public abstract void CopyFromComponent(IComponent component);

        // Determine if another installer is equivalent to this one.
        public virtual bool IsEquivalentInstaller
                                (ComponentInstaller otherInstaller)
                        {
                                return false;
                        }

}; // class ComponentInstaller

#endif // CONFIG_COMPONENT_MODEL

}; // namespace System.Configuration.Install

--- NEW FILE ---
/*
 * EventLogInstaller.cs - Implementation of the
 *          "System.Configuration.Install.EventLogInstaller" class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.Diagnostics
{

#if CONFIG_COMPONENT_MODEL && CONFIG_EXTENDED_DIAGNOSTICS

using System.Collections;
using System.ComponentModel;
using System.Configuration.Install;

public class EventLogInstaller : ComponentInstaller
{
        // Internal state.
        private String log;
        private String source;
        private UninstallAction action;

        // Constructor.
        public EventLogInstaller()
                        {
                                log = String.Empty;
                                source = String.Empty;
                                action = UninstallAction.Remove;
                        }

        // Get or set this object's properties.
        public String Log
                        {
                                get
                                {
                                        return log;
                                }
                                set
                                {
                                        log = value;
                                }
                        }
        public String Source
                        {
                                get
                                {
                                        return source;
                                }
                                set
                                {
                                        source = value;
                                }
                        }
        public UninstallAction UninstallAction
                        {
                                get
                                {
                                        return action;
                                }
                                set
                                {
                                        action = value;
                                }
                        }

        // Copy installation properties from a component.
        public override void CopyFromComponent(IComponent component)
                        {
                                EventLog el = (component as EventLog);
                                if(el != null)
                                {
                                        if(el.Log == null)
                                        {
                                                throw new ArgumentException
                                                        
(S._("Installer_LogIsNull"), "component");
                                        }
                                        if(el.Source == null)
                                        {
                                                throw new ArgumentException
                                                        
(S._("Installer_SourceIsNull"), "component");
                                        }
                                        log = el.Log;
                                        source = el.Source;
                                }
                                else
                                {
                                        throw new ArgumentException
                                                
(S._("Installer_NotAnEventLog"), "component");
                                }
                        }

        // Determine if another installer is equivalent to this one.
        public override bool IsEquivalentInstaller
                                (ComponentInstaller otherInstaller)
                        {
                                EventLogInstaller other = (otherInstaller as 
EventLogInstaller);
                                if(other != null)
                                {
                                        if(log == other.log && source == 
other.source)
                                        {
                                                return true;
                                        }
                                }
                                return false;
                        }

        // Installation methods.  We don't support event logs in this
        // implementation as they are highly Windows NT specific.
        public override void Install(IDictionary stateSaver)
                        {
                                throw new PlatformNotSupportedException
                                        (S._("Installer_NoEventLogs"));
                        }
        public override void Rollback(IDictionary savedState)
                        {
                                // Nothing to do here, because there will never
                                // be an installation to be rolled back.
                        }
        public override void Uninstall(IDictionary savedState)
                        {
                                // Nothing to do here, because there will never
                                // be an installation to be uninstalled.
                        }

}; // class EventLogInstaller

#endif // CONFIG_COMPONENT_MODEL && CONFIG_EXTENDED_DIAGNOSTICS

}; // namespace System.Diagnostics

--- NEW FILE ---
/*
 * IManagedInstaller.cs - Implementation of the
 *          "System.Configuration.Install.IManagedInstaller" class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.Configuration.Install
{

using System.Runtime.InteropServices;

#if CONFIG_COM_INTEROP
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
#endif
#if !ECMA_COMPAT
[Guid("1E233FE7-C16D-4512-8C3B-2E9988F08D38")]
#endif
public interface IManagedInstaller
{
        int ManagedInstall(String commandLine, int hInstall);

}; // interface IManagedInstaller

}; // namespace System.Configuration.Install

--- NEW FILE ---
/*
 * InstallContext.cs - Implementation of the
 *          "System.Configuration.Install.InstallContext" class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.Configuration.Install
{

using System.IO;
using System.Collections;
using System.Collections.Specialized;

public class InstallContext
{
    // Internal state.
    private String logFilePath;
    private StringDictionary parameters;

    // Constructors.
    public InstallContext()
                        {
                                this.logFilePath = null;
                                this.parameters = new StringDictionary();
                        }
    public InstallContext(String logFilePath, String[] commandLine)
                        {
                                this.logFilePath = logFilePath;
                                this.parameters = ParseCommandLine(commandLine);
                        }

    // Get the command-line parameters.
    public StringDictionary Parameters
                        {
                                get
                                {
                                        return parameters;
                                }
                        }

    // Determine if a particular parameter is true.
    public bool IsParameterTrue(String paramName)
                        {
                                String value = parameters[paramName.ToLower()];
                                if(value == null)
                                {
                                        return false;
                                }
                                else if(String.Compare(value, "true", true) == 
0 ||
                                                String.Compare(value, "yes", 
true) == 0 ||
                                                value == "1" || value == 
String.Empty)
                                {
                                    return true;
                                }
                                else
                                {
                                    return false;
                                }
                    }

    // Write a message to the log file.
    public void LogMessage(String message)
                    {
                                if(logFilePath != null && message != null)
                                {
                                    if(IsParameterTrue("LogToConsole"))
                                    {
                                                Console.Write(message);
                                    }
                                    StreamWriter writer = new 
StreamWriter(logFilePath, true);
                                    writer.Write(message);
                                    writer.Flush();
                                    writer.Close();
                                }
                    }
    internal void LogLine(String message)
                        {
                                if(logFilePath != null && message != null)
                                {
                                    if(IsParameterTrue("LogToConsole"))
                                    {
                                                Console.WriteLine(message);
                                    }
                                    StreamWriter writer = new 
StreamWriter(logFilePath, true);
                                    writer.WriteLine(message);
                                    writer.Flush();
                                    writer.Close();
                                }
                        }

    // Parse a command line into a string dictionary.
    protected static StringDictionary ParseCommandLine(String[] args)
                    {
                                StringDictionary dict = new StringDictionary();
                                if(args != null)
                                {
                                    int posn = 0;
                                    String str;
                                    while(posn < args.Length)
                                    {
                                                str = args[posn];
                                                if(str.Length > 0 &&
                                                   (str[0] == '/' || str[0] == 
'-'))
                                                {
                                                    int index = 
str.IndexOf('=');
                                                    if(index < 0)
                                                    {
                                                                if((posn + 1) < 
args.Length &&
                                                                   args[posn + 
1].StartsWith("="))
                                                                {
                                                                    
if(args[posn + 1].Length == 1)
                                                                    {
                                                                                
// Option of the form "/name = value".
                                                                                
if((posn + 2) < args.Length)
                                                                                
{
                                                                                
    dict.Add
                                                                                
                (str.Substring(1).ToLower(),
                                                                                
                 "");
                                                                                
    ++posn;
                                                                                
}
                                                                                
else
                                                                                
{
                                                                                
    dict.Add
                                                                                
                (str.Substring(1).ToLower(),
                                                                                
                 args[posn + 2]);
                                                                                
    posn += 2;
                                                                                
}
                                                                    }
                                                                    else
                                                                    {
                                                                                
// Option of the form "/name =value".
                                                                                
dict.Add(str.Substring(1).ToLower(),
                                                                                
                 args[posn + 1].Substring(1));
                                                                                
++posn;
                                                                    }
                                                                }
                                                                else
                                                                {
                                                                    // Option 
of the form "/name".
                                                                    
dict.Add(str.Substring(1).ToLower(), "");
                                                                }
                                                    }
                                                    else if((index + 1) < 
str.Length &&
                                                                        (posn + 
1) < args.Length)
                                                    {
                                                                // Option of 
the form "/name= value".
                                                                
dict.Add(str.Substring(1, index - 1).ToLower(),
                                                                                
 args[posn + 1]);
                                                    }
                                                    else
                                                    {
                                                                // Option of 
the form "/name=value".
                                                                
dict.Add(str.Substring(1, index - 1).ToLower(),
                                                                                
 str.Substring(index + 1));
                                                    }
                                                }
                                                ++posn;
                                    }
                                }
                                return dict;
                    }

}; // class InstallContext

}; // namespace System.Configuration.Install

--- NEW FILE ---
/*
 * InstallEventArgs.cs - Implementation of the
 *          "System.Configuration.Install.InstallEventArgs" class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.Configuration.Install
{

using System.Collections;

public class InstallEventArgs : EventArgs
{
    // Internal state.
    private IDictionary savedState;

    // Constructors.
    public InstallEventArgs() {}
    public InstallEventArgs(IDictionary savedState)
                        {
                                this.savedState = savedState;
                        }

    // Get this object's properties.
    public IDictionary SavedState
                        {
                                get
                                {
                                        return savedState;
                                }
                        }

}; // class InstallEventArgs

}; // namespace System.Configuration.Install

--- NEW FILE ---
/*
 * InstallEventHandler.cs - Implementation of the
 *          "System.Configuration.Install.InstallEventHandler" class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.Configuration.Install
{

public delegate void InstallEventHandler(Object sender, InstallEventArgs e);

}; // namespace System.Configuration.Install

--- NEW FILE ---
/*
 * InstallException.cs - Implementation of the
 *          "System.Configuration.Install.InstallException" class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.Configuration.Install
{

using System.Runtime.Serialization;

public class InstallException : SystemException
{
        // Constructors.
        public InstallException()
                : base(S._("Installer_Exception")) {}
        public InstallException(String msg)
                : base(msg) {}
        public InstallException(String msg, Exception inner)
                : base(msg, inner) {}
#if CONFIG_SERIALIZATION
        protected InstallException(SerializationInfo info,
                                                           StreamingContext 
context)
                : base(info, context) {}
#endif

}; // class InstallException

}; // namespace System.Configuration.Install

--- NEW FILE ---
/*
 * InstallUtil.cs - Implementation of the
 *          "System.Configuration.Install.InstallUtil" class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.Configuration.Install
{

// This class implements the .NET assembly installation utility,
// which is typically called "InstallUtil.exe".  We call it
// "ilinstall" to prevent naming conflicts with other systems.

public class InstallUtil
{
        // Main entry point for the program.
        public static int Main(String[] args)
                        {
                                int exitCode = 0;
                                try
                                {
                                        
ManagedInstallerClass.InstallHelper(args);
                                }
                                catch(SystemException e)
                                {
                                        Console.WriteLine(e.Message);
                                        exitCode = 1;
                                }
                                return exitCode;
                        }

}; // class InstallUtil

}; // namespace System.Configuration.Install

--- NEW FILE ---
/*
 * Installer.cs - Implementation of the
 *          "System.Configuration.Install.Installer" class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.Configuration.Install
{

using System.Collections;
using System.ComponentModel;

#if CONFIG_COMPONENT_MODEL
public class Installer : Component
#else
public class Installer
#endif
{
    // Internal state.
    private InstallContext context;
    internal InstallerCollection installers;
    internal Installer parent;

    // Constructor.
    public Installer() {}

    // Get or set the installer's context.
    public InstallContext Context
                        {
                                get
                                {
                                        return context;
                                }
                                set
                                {
                                        context = value;
                                }
                        }

    // Get the help text for this installer.
    public virtual String HelpText
                        {
                                get
                                {
                                        return null;
                                }
                        }

    // Get the collection of installers contained within this one.
    public InstallerCollection Installers
                        {
                                get
                                {
                                        if(installers == null)
                                        {
                                                installers = new 
InstallerCollection(this);
                                        }
                                        return installers;
                                }
                        }

    // Get or set this installer's parent collection.
    public Installer Parent
                        {
                                get
                                {
                                        return parent;
                                }
                                set
                                {
                                        if(parent != value)
                                        {
                                                if(parent != null)
                                                {
                                                        
parent.Installers.Remove(this);
                                                }
                                                if(value != null)
                                                {
                                                        
value.Installers.Add(this);
                                                }
                                        }
                                }
                        }

        // Check a state argument for null.
        private static void CheckNullState(IDictionary savedState)
                        {
                                if(savedState == null)
                                {
                                        throw new ArgumentException
                                                
(S._("Installer_InvalidSavedState"), "savedState");
                                }
                        }

        // Log an exception.
        internal void LogException(String request, Exception e)
                        {
                                if(Context.IsParameterTrue("ShowCallStack"))
                                {
                                        Context.LogLine(request + ": " + 
e.ToString());
                                }
                                else
                                {
                                        Context.LogLine(request + ": " + 
e.Message);
                                }
                        }

        // Get the nested state for a pariticular installer.
        private IDictionary GetNestedState(IDictionary state, int index)
                        {
                                IDictionary[] table = 
(state["reserved_nestedSavedStates"]
                                                                                
        as IDictionary[]);
                                if(table == null)
                                {
                                        table = new IDictionary 
[Installers.Count];
                                        state["reserved_nestedSavedStates"] = 
table;
                                }
                                if(table[index] == null)
                                {
                                        table[index] = new Hashtable(index);
                                }
                                return table[index];
                        }

    // Commit the installation transaction.
    public virtual void Commit(IDictionary savedState)
                        {
                                Exception e = null;
                                int index;
                                IDictionary nestedState;

                                // Validate the parameter.
                                CheckNullState(savedState);

                                // Raise the "Committing" event.
                                try
                                {
                                        OnCommitting(savedState);
                                }
                                catch(SystemException e1)
                                {
                                        LogException("OnCommitting", e1);
                                        e = e1;
                                }

                                // Copy the parent's context down to the 
children.
                                for(index = 0; index < Installers.Count; 
++index)
                                {
                                        Installers[index].Context = Context;
                                }

                                // Commit each of the installers in turn.
                                for(index = 0; index < Installers.Count; 
++index)
                                {
                                        nestedState = 
GetNestedState(savedState, index);
                                        try
                                        {
                                                
Installers[index].Commit(nestedState);
                                        }
                                        catch(SystemException e2)
                                        {
                                                if(e2.InnerException == null)
                                                {
                                                        LogException("Commit", 
e2);
                                                }
                                                e = e2;
                                        }
                                }

                                // Raise the "Committed" event.
                                try
                                {
                                        OnCommitted(savedState);
                                }
                                catch(SystemException e3)
                                {
                                        LogException("OnCommitted", e3);
                                        e = e3;
                                }

                                // Re-throw the last-occurring exception.
                                if(e != null)
                                {
                                        if(e.InnerException == null)
                                        {
                                                e = new 
InstallException(e.Message, e);
                                        }
                                        throw e;
                                }
                        }

    // Perform the installation process, saving the previous
    // state in the "stateSaver" object.
    public virtual void Install(IDictionary stateSaver)
                        {
                                Exception e = null;
                                int index;
                                IDictionary nestedState;

                                // Validate the parameter.
                                if(stateSaver == null)
                                {
                                        throw new ArgumentException
                                                
(S._("Installer_InvalidSavedState"), "stateSaver");
                                }

                                // Raise the "BeforeInstall" event.
                                try
                                {
                                        OnBeforeInstall(stateSaver);
                                }
                                catch(SystemException e1)
                                {
                                        LogException("OnBeforeInstall", e1);
                                        e = e1;
                                }

                                // Copy the parent's context down to the 
children.
                                for(index = 0; index < Installers.Count; 
++index)
                                {
                                        Installers[index].Context = Context;
                                }

                                // Run each of the installers in turn.
                                for(index = 0; index < Installers.Count; 
++index)
                                {
                                        nestedState = 
GetNestedState(stateSaver, index);
                                        try
                                        {
                                                
Installers[index].Install(nestedState);
                                        }
                                        catch(SystemException e2)
                                        {
                                                if(e2.InnerException == null)
                                                {
                                                        LogException("Install", 
e2);
                                                }
                                                e = e2;
                                        }
                                }

                                // Raise the "AfterInstall" event.
                                try
                                {
                                        OnAfterInstall(stateSaver);
                                }
                                catch(SystemException e3)
                                {
                                        LogException("OnAfterInstall", e3);
                                        e = e3;
                                }

                                // Re-throw the last-occurring exception.
                                if(e != null)
                                {
                                        if(e.InnerException == null)
                                        {
                                                e = new 
InstallException(e.Message, e);
                                        }
                                        throw e;
                                }
                        }

    // Roll back the current installation to "savedState".
    public virtual void Rollback(IDictionary savedState)
                        {
                                Exception e = null;
                                int index;
                                IDictionary nestedState;

                                // Validate the parameter.
                                CheckNullState(savedState);

                                // Raise the "BeforeRollback" event.
                                try
                                {
                                        OnBeforeRollback(savedState);
                                }
                                catch(SystemException e1)
                                {
                                        LogException("OnBeforeRollback", e1);
                                        e = e1;
                                }

                                // Copy the parent's context down to the 
children.
                                for(index = Installers.Count - 1; index >= 0; 
--index)
                                {
                                        Installers[index].Context = Context;
                                }

                                // Rollback each of the installers in turn, in 
reverse order.
                                for(index = Installers.Count - 1; index >= 0; 
--index)
                                {
                                        nestedState = 
GetNestedState(savedState, index);
                                        try
                                        {
                                                
Installers[index].Rollback(nestedState);
                                        }
                                        catch(SystemException e2)
                                        {
                                                if(e2.InnerException == null)
                                                {
                                                        
LogException("Rollback", e2);
                                                }
                                                e = e2;
                                        }
                                }

                                // Raise the "AfterRollback" event.
                                try
                                {
                                        OnAfterRollback(savedState);
                                }
                                catch(SystemException e3)
                                {
                                        LogException("OnAfterRollback", e3);
                                        e = e3;
                                }

                                // Re-throw the last-occurring exception.
                                if(e != null)
                                {
                                        if(e.InnerException == null)
                                        {
                                                e = new 
InstallException(e.Message, e);
                                        }
                                        throw e;
                                }
                        }

    // Uninstall and return to a previously saved state.
    public virtual void Uninstall(IDictionary savedState)
                        {
                                Exception e = null;
                                int index;
                                IDictionary nestedState;

                                // Validate the parameter.
                                CheckNullState(savedState);

                                // Raise the "BeforeUninstall" event.
                                try
                                {
                                        OnBeforeUninstall(savedState);
                                }
                                catch(SystemException e1)
                                {
                                        LogException("OnBeforeUninstall", e1);
                                        e = e1;
                                }

                                // Copy the parent's context down to the 
children.
                                for(index = Installers.Count - 1; index >= 0; 
--index)
                                {
                                        Installers[index].Context = Context;
                                }

                                // Uninstall each of the installers in turn, in 
reverse order.
                                for(index = Installers.Count - 1; index >= 0; 
--index)
                                {
                                        nestedState = 
GetNestedState(savedState, index);
                                        try
                                        {
                                                
Installers[index].Uninstall(nestedState);
                                        }
                                        catch(SystemException e2)
                                        {
                                                if(e2.InnerException == null)
                                                {
                                                        
LogException("Uninstall", e2);
                                                }
                                                e = e2;
                                        }
                                }

                                // Raise the "AfterUninstall" event.
                                try
                                {
                                        OnAfterUninstall(savedState);
                                }
                                catch(SystemException e3)
                                {
                                        LogException("OnAfterUninstall", e3);
                                        e = e3;
                                }

                                // Re-throw the last-occurring exception.
                                if(e != null)
                                {
                                        if(e.InnerException == null)
                                        {
                                                e = new 
InstallException(e.Message, e);
                                        }
                                        throw e;
                                }
                        }

    // Public events.
    public event InstallEventHandler AfterInstall;
    public event InstallEventHandler AfterRollback;
    public event InstallEventHandler AfterUninstall;
    public event InstallEventHandler BeforeInstall;
    public event InstallEventHandler BeforeRollback;
    public event InstallEventHandler BeforeUninstall;
    public event InstallEventHandler Committed;
    public event InstallEventHandler Committing;

    // Raise the public events.
    protected virtual void OnAfterInstall(IDictionary savedState)
                        {
                                if(AfterInstall != null)
                                {
                                        AfterInstall(this, new 
InstallEventArgs(savedState));
                                }
                        }
    protected virtual void OnAfterRollback(IDictionary savedState)
                        {
                                if(AfterRollback != null)
                                {
                                        AfterRollback(this, new 
InstallEventArgs(savedState));
                                }
                        }
    protected virtual void OnAfterUninstall(IDictionary savedState)
                        {
                                if(AfterUninstall != null)
                                {
                                        AfterUninstall(this, new 
InstallEventArgs(savedState));
                                }
                        }
    protected virtual void OnBeforeInstall(IDictionary savedState)
                        {
                                if(BeforeInstall != null)
                                {
                                        BeforeInstall(this, new 
InstallEventArgs(savedState));
                                }
                        }
    protected virtual void OnBeforeRollback(IDictionary savedState)
                        {
                                if(BeforeRollback != null)
                                {
                                        BeforeRollback(this, new 
InstallEventArgs(savedState));
                                }
                        }
    protected virtual void OnBeforeUninstall(IDictionary savedState)
                        {
                                if(BeforeUninstall != null)
                                {
                                        BeforeUninstall(this, new 
InstallEventArgs(savedState));
                                }
                        }
    protected virtual void OnCommitted(IDictionary savedState)
                        {
                                if(Committed != null)
                                {
                                        Committed(this, new 
InstallEventArgs(savedState));
                                }
                        }
    protected virtual void OnCommitting(IDictionary savedState)
                        {
                                if(Committing != null)
                                {
                                        Committing(this, new 
InstallEventArgs(savedState));
                                }
                        }

}; // class Installer

}; // namespace System.Configuration.Install

--- NEW FILE ---
/*
 * InstallerCollection.cs - Implementation of the
 *          "System.Configuration.Install.InstallerCollection" class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.Configuration.Install
{

using System.Collections;

public class InstallerCollection : CollectionBase
{
    // Internal state.
    private Installer parent;

    // Constructor.
    internal InstallerCollection(Installer parent)
                        {
                                this.parent = parent;
                        }

    // Get or set a collection member, by index.
    public Installer this[int index]
                        {
                                get
                                {
                                        return 
(Installer)(((IList)this)[index]);
                                }
                                set
                                {
                                        ((IList)this)[index] = value;
                                }
                        }

    // Add an installer to this collection.
    public int Add(Installer value)
                        {
                                return ((IList)this).Add(value);
                        }

    // Add a range of installers to this collection.
    public void AddRange(Installer[] value)
                        {
                                if(value == null)
                                {
                                        throw new 
ArgumentNullException("value");
                                }
                                foreach(Installer inst in value)
                                {
                                        Add(inst);
                                }
                        }
    public void AddRange(InstallerCollection value)
                        {
                                if(value == null)
                                {
                                        throw new 
ArgumentNullException("value");
                                }
                                foreach(Installer inst in value)
                                {
                                        Add(inst);
                                }
                        }

    // Determine if a particular installer is contained in this collection.
    public bool Contains(Installer value)
                        {
                                return ((IList)this).Contains(value);
                        }

    // Copy the elements of this collection into an array.
    public void CopyTo(Installer[] array, int index)
                        {
                                ((IList)this).CopyTo(array, index);
                        }

    // Get the index of a specific installer within this collection
    public int IndexOf(Installer value)
                        {
                                return ((IList)this).IndexOf(value);
                        }

    // Insert an installer into this collection.
    public void Insert(int index, Installer value)
                        {
                                ((IList)this).Insert(index, value);
                        }

    // Remove an installer from this collection.
    public void Remove(Installer value)
                        {
                                ((IList)this).Remove(value);
                        }

    // Record that an installer is being inserted into this collection.
    protected override void OnInsert(int index, Object value)
                        {
                                Installer inst = (value as Installer);
                                if(inst != null)
                                {
                                        if(inst.parent != null && inst.parent 
!= parent)
                                        {
                                                
inst.parent.Installers.Remove(inst);
                                        }
                                        inst.parent = parent;
                                }
                                else
                                {
                                        throw new InvalidOperationException();
                                }
                        }

    // Record that an installer is being removed from this collection.
    protected override void OnRemove(int index, Object value)
                        {
                                Installer inst = (value as Installer);
                                if(inst != null)
                                {
                                        inst.parent = null;
                                }
                        }

    // Record that a collection member is being set to a new value.
    protected override void OnSet(int index, Object oldValue, Object newValue)
                        {
                                Installer oldInst = (oldValue as Installer);
                                Installer newInst = (newValue as Installer);
                                if(oldValue != newValue)
                                {
                                        if(newInst == null)
                                        {
                                                throw new 
InvalidOperationException();
                                        }
                                        oldInst.parent = null;
                                        if(newInst.parent != null && 
newInst.parent != parent)
                                        {
                                                
newInst.parent.Installers.Remove(newInst);
                                        }
                                        newInst.parent = parent;
                                }
                        }

}; // class InstallerCollection

}; // namespace System.Configuration.Install

--- NEW FILE ---

.PHONY: System.Configuration.Install.dll

all-local: System.Configuration.Install.dll

System.Configuration.Install.dll:
        "$(CSANT)" $(CSANT_FLAGS) -f System.Configuration.Install.build all

CLEANFILES = System.Configuration.Install.dll ilinstall.exe

install-exec-local:
        @$(NORMAL_INSTALL)
        $(mkinstalldirs) $(DESTDIR)$(libdir)/cscc/lib
        $(INSTALL_DATA) System.Configuration.Install.dll \
                        
$(DESTDIR)$(libdir)/cscc/lib/System.Configuration.Install.dll
        $(mkinstalldirs) $(DESTDIR)$(bindir)
        $(INSTALL_PROGRAM) ilinstall.exe $(DESTDIR)$(bindir)/ilinstall.exe
        $(INSTALL_PROGRAM) $(srcdir)/ilinstall-run.sh 
$(DESTDIR)$(bindir)/ilinstall

uninstall-local:
        @$(NORMALL_UNINSTALL)
        rm -f $(DESTDIR)$(libdir)/cscc/lib/System.Configuration.Install.dll
        rm -f $(DESTDIR)$(bindir)/ilinstall.exe
        rm -f $(DESTDIR)$(bindir)/ilinstall

--- NEW FILE ---
/*
 * ManagedInstallerClass.cs - Implementation of the
 *          "System.Configuration.Install.ManagedInstallerClass" class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.Configuration.Install
{

using System.Runtime.InteropServices;

#if !ECMA_COMPAT
[ComVisible(true)]
[Guid("42EB0342-0393-448f-84AA-D4BEB0283595")]
#endif
public class ManagedInstallerClass : IManagedInstaller
{
        // Entry point that is called by "InstallUtil".
        public static void InstallHelper(String[] args)
                        {
                                // TODO
                        }

        // Not used in this implementation.
        int IManagedInstaller.ManagedInstall(String commandLine, int hInstall)
                        {
                                return 0;
                        }

}; // class ManagedInstallerClass

}; // namespace System.Configuration.Install

--- NEW FILE ---
/*
 * PerformanceCounterInstaller.cs - Implementation of the
 *          "System.Configuration.Install.PerformanceCounterInstaller" class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.Diagnostics
{

#if CONFIG_COMPONENT_MODEL && CONFIG_EXTENDED_DIAGNOSTICS

using System.Collections;
using System.ComponentModel;
using System.Configuration.Install;

public class PerformanceCounterInstaller : ComponentInstaller
{
        // Internal state.
        private String categoryHelp;
        private String categoryName;
        private CounterCreationDataCollection counters;
        private UninstallAction action;

        // Constructor.
        public PerformanceCounterInstaller()
                        {
                                categoryHelp = String.Empty;
                                categoryName = String.Empty;
                                counters = new CounterCreationDataCollection();
                                action = UninstallAction.Remove;
                        }

        // Get or set this object's properties.
        public String CategoryHelp
                        {
                                get
                                {
                                        return categoryHelp;
                                }
                                set
                                {
                                        if(value == null)
                                        {
                                                throw new 
ArgumentNullException("value");
                                        }
                                        categoryHelp = value;
                                }
                        }
        public String CategoryName
                        {
                                get
                                {
                                        return categoryName;
                                }
                                set
                                {
                                        if(value == null)
                                        {
                                                throw new 
ArgumentNullException("value");
                                        }
                                        categoryName = value;
                                }
                        }
        public CounterCreationDataCollection Counters
                        {
                                get
                                {
                                        return counters;
                                }
                        }
        public UninstallAction UninstallAction
                        {
                                get
                                {
                                        return action;
                                }
                                set
                                {
                                        action = value;
                                }
                        }

        // Copy installation properties from a component.
        public override void CopyFromComponent(IComponent component)
                        {
                                PerformanceCounter pc = (component as 
PerformanceCounter);
                                if(pc != null)
                                {
                                        if(pc.CounterHelp == null)
                                        {
                                                throw new ArgumentException
                                                        
(S._("Installer_HelpIsNull"), "component");
                                        }
                                        if(pc.CategoryName == null)
                                        {
                                                throw new ArgumentException
                                                        
(S._("Installer_NameIsNull"), "component");
                                        }
                                        categoryHelp = pc.CounterHelp;
                                        categoryName = pc.CategoryName;
                                }
                                else
                                {
                                        throw new ArgumentException
                                                
(S._("Installer_NotAPerformanceCounter"), "component");
                                }
                        }

        // Installation methods.  We don't support performance counters
        // in this implementation.
        public override void Install(IDictionary stateSaver)
                        {
                                // Nothing to do here in this implementation.
                        }
        public override void Rollback(IDictionary savedState)
                        {
                                // Nothing to do here, because there will never
                                // be an installation to be rolled back.
                        }
        public override void Uninstall(IDictionary savedState)
                        {
                                // Nothing to do here, because there will never
                                // be an installation to be uninstalled.
                        }

}; // class PerformanceCounterInstaller

#endif // CONFIG_COMPONENT_MODEL && CONFIG_EXTENDED_DIAGNOSTICS

}; // namespace System.Diagnostics

--- NEW FILE ---
/*
 * S.cs - Implementation of string resource handling.
 *
 * Copyright (C) 2002, 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.Configuration.Install
{

using System.Reflection;
using System.Resources;

// This class provides string resource support to the rest
// of the System.Drawing library assembly.  It is accessed using
// the "S._(tag)" convention.

internal sealed class S
{

#if CONFIG_RUNTIME_INFRA

        // Cached copy of the resources for this assembly and mscorlib.
#if ECMA_COMPAT
        private static ECMAResourceManager ourResources = null;
        private static ECMAResourceManager runtimeResources = null;
#else
        private static ResourceManager ourResources = null;
        private static ResourceManager runtimeResources = null;
#endif

        // Helper for obtaining string resources for this assembly.
        public static String _(String tag)
                        {
                                lock(typeof(S))
                                {
                                        String value;

                                        // Try the resources in this assembly 
first.
                                        if(ourResources == null)
                                        {
                                        #if ECMA_COMPAT
                                                ourResources = new 
ECMAResourceManager
                                                        
("System.Configuration.Install", (typeof(S)).Assembly);
                                        #else
                                                ourResources = new 
ResourceManager
                                                        
("System.Configuration.Install", (typeof(S)).Assembly);
                                        #endif
                                        }
                                        value = ourResources.GetString(tag, 
null);
                                        if(value != null)
                                        {
                                                return value;
                                        }

                                        // Try the fallbacks in the runtime 
library.
                                        if(runtimeResources == null)
                                        {
                                        #if ECMA_COMPAT
                                                runtimeResources = new 
ECMAResourceManager
                                                        ("runtime", 
(typeof(String)).Assembly);
                                        #else
                                                runtimeResources = new 
ResourceManager
                                                        ("runtime", 
(typeof(String)).Assembly);
                                        #endif
                                        }
                                        return runtimeResources.GetString(tag, 
null);
                                }
                        }

#else // !CONFIG_RUNTIME_INFRA

        // We don't have sufficient runtime infrastructure to load resources.
        public static String _(String tag)
                        {
                                return tag;
                        }

#endif // !CONFIG_RUNTIME_INFRA

}; // class S

}; // namespace System.Configuration.Install

--- NEW FILE ---
<?xml version="1.0"?>
<project name="pnetlib System.Configuration.Install" default="all">
        <target name="all">

                <!-- Build the primary System.Configuration.Install.dll library 
-->
                <compile output="System.Configuration.Install.dll"
                                 target="library"
                                 unsafe="true"
                                 nostdlib="true"
                                 debug="${CONFIG_DEBUG_LINES}"
                                 optimize="true">

                        <sources>
                                <includes name="**/*.cs"/>
                                <excludes name="InstallUtil.cs"/>
                        </sources>

                        <references>
                                <file name="../System/System.dll"/>
                                <file name="../DotGNU.SSL/DotGNU.SSL.dll"/>
                                <file name="../runtime/mscorlib.dll"/>
                        </references>

<!--
                        <resources>
                                <includes if="${CONFIG_RUNTIME_INFRA}"
                                        
name="../resources/en_US/System.Configuration.Install/System.Configuration.Install.resources"/>
                        </resources>
-->

                        <arg compiler="cscc" 
value="-fassembly-version=1.0.5000.0"/>
                        <arg compiler="cscc" value="-fassembly-key=ms"/>
                        <arg compiler="cscc" value="-Wno-empty-input"/>
                        <arg compiler="cscc" value="-fminimize-parameters"/>
                        <arg compiler="cscc" value="-flatin1-charset"/>
                        <arg compiler="csc" value="/nowarn:626"/>
                        <arg compiler="csc" value="/nowarn:649"/>
                        <arg compiler="csc" value="/nowarn:168"/>
                        <arg compiler="csc" value="/nowarn:67"/>
                        <arg compiler="csc" value="/nowarn:169"/>
                        <arg compiler="csc" value="/nowarn:679"/>
                </compile>

                <!-- Build the ilinstall.exe program -->
                <compile output="ilinstall.exe"
                                 target="exe"
                                 unsafe="true"
                                 nostdlib="true"
                                 optimize="true"
                                 debug="true">

                        <sources>
                                <file name="InstallUtil.cs"/>
                        </sources>

                        <references>
                                <file name="System.Configuration.Install.dll"/>
                                <file name="../System/System.dll"/>
                                <file name="../DotGNU.SSL/DotGNU.SSL.dll"/>
                                <file name="../runtime/mscorlib.dll"/>
                        </references>

                        <arg compiler="cscc" value="-Wno-empty-input"/>
                        <arg compiler="cscc" value="-flatin1-charset"/>
                        <arg compiler="csc" value="/nowarn:626"/>
                        <arg compiler="csc" value="/nowarn:649"/>
                        <arg compiler="csc" value="/nowarn:168"/>
                        <arg compiler="csc" value="/nowarn:67"/>
                        <arg compiler="csc" value="/nowarn:169"/>
                </compile>

        </target>
</project>

--- NEW FILE ---
/*
 * TransactedInstaller.cs - Implementation of the
 *          "System.Configuration.Install.TransactedInstaller" class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.Configuration.Install
{

using System.Reflection;
using System.Collections;

public class TransactedInstaller : Installer
{
        // Constructor.
        public TransactedInstaller() {}

    // Perform the installation process, saving the previous
    // state in the "stateSaver" object.
    public override void Install(IDictionary stateSaver)
                        {
                                // Make sure that we have a context.
                                if(Context == null)
                                {
                                        Context = new InstallContext("con", new 
String [0]);
                                }

                                // Log the start of the transaction.
                                
Context.LogLine(S._("Installer_BeginInstallTransaction"));
                                try
                                {
                                        // Run the installation process.
                                        try
                                        {
                                                
Context.LogLine(S._("Installer_BeginInstall"));
                                                base.Install(stateSaver);
                                        }
                                        catch(SystemException e)
                                        {
                                                // Roll back the transaction.
                                                
Context.LogLine(S._("Installer_BeginRollback"));
                                                try
                                                {
                                                        Rollback(stateSaver);
                                                }
                                                catch(SystemException)
                                                {
                                                        // Ignore errors during 
rollback.
                                                }
                                                
Context.LogLine(S._("Installer_EndRollback"));
        
                                                // Notify the caller about the 
rollback.
                                                throw new 
InvalidOperationException
                                                        
(S._("Installer_RollbackPerformed"));
                                        }
        
                                        // Commit the transaction.
                                        
Context.LogLine(S._("Installer_BeginCommit"));
                                        try
                                        {
                                                Commit(stateSaver);
                                        }
                                        finally
                                        {
                                                
Context.LogLine(S._("Installer_EndCommit"));
                                        }
                                }
                                finally
                                {
                                        
Context.LogLine(S._("Installer_EndInstallTransaction"));
                                }
                        }
        
    // Uninstall and return to a previously saved state.
    public override void Uninstall(IDictionary savedState)
                        {
                                // Make sure that we have a context.
                                if(Context == null)
                                {
                                        Context = new InstallContext("con", new 
String [0]);
                                }

                                // Log the start of the transaction.
                                
Context.LogLine(S._("Installer_BeginUninstallTransaction"));
                                try
                                {
                                        // Run the uninstallation process.
                                        base.Uninstall(savedState);
                                }
                                finally
                                {
                                        Context.LogLine
                                                
(S._("Installer_EndUninstallTransaction"));
                                }
                        }

}; // class TransactedInstaller

}; // namespace System.Configuration.Install

--- NEW FILE ---
/*
 * UninstallAction.cs - Implementation of the
 *          "System.Configuration.Install.UninstallAction" class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.Configuration.Install
{

public enum UninstallAction
{
        Remove          = 0,
        NoAction        = 1

}; // enum UninstallAction

}; // namespace System.Configuration.Install

--- NEW FILE ---
#!/usr/bin/env clrwrap
ilinstall.exe





reply via email to

[Prev in Thread] Current Thread [Next in Thread]