Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version

dotNetInstaller - Setup Bootstrapper for .NET Application

, 4 Jan 2004 MIT
With this tool the developer can define the application prerequisites and install the correct version of these components in the correct order based on the user operating system type and language, allow the user to download these components from the web or install these components directly.
dotnetinstaller_source.zip
dotNetInstaller_source
dotNetInstaller
dotNetInstaller.vcproj.vspscc
dotNetInstaller.vssscc
mssccprj.scc
res
banner.bmp
dotNetInstaller.ico
dotNetInstaller.manifest
Thumbs.db
vssver.scc
Tools
vssver.scc
vssver.scc
InstallerEditor
App.ico
banner.bmp
bin
Release
InstallerEditor.exe
SourceLibrary.dll
vssver.scc
InstallerEditor.csproj.user
InstallerEditor.csproj.vspscc
InstallerEditor.suo
InstallerEditor.vssscc
mssccprj.scc
References
SourceLibrary.dll
vssver.scc
Thumbs.db
vssver.scc
Sample
banner.bmp
dotNetInstaller.exe
SupportFiles
DataAccess
Jet
Jet40Sp7
Win2000_English
Win2000_Italiano
Win9x_NT
WinME
WinXp_English
WinXp_Italiano
MDAC2.7Sp1Refresh
Win_98_ME_NT_2000
dotNet
v1.1
English
Italiano
InternetExplorer
IE60SP1_English
IE60SP1_Italiano
ServicePack
2000_SP4_English
2000_SP4_Italiano
NT4_SP6a_English
NT4_SP6a_Italiano
Win98_Y2k_Update_English
Win98_Y2k_Update_Italiano
using System;
using System.Xml;
using System.ComponentModel;

namespace InstallerEditor
{
	/// <summary>
	/// Summary description for Configuration.
	/// </summary>
	public abstract class Component : IXmlClass
	{
		public Component(string p_type):this(p_type, "COMPONENT_NAME")
		{
		}
		public Component(string p_type, string p_ComponentName)
		{
			m_type = p_type;

			m_mustreboot = false;
			m_os_filter_greater = "";
			m_os_filter_lcid = "";
			m_os_filter_smaller = "";
			if (LanguageUI.Language == SupportedLanguage.Italian)
			{
				m_description = p_ComponentName;
				m_installcompletemessage = "";
				m_installmessage = "Premi avanti per installare " + p_ComponentName;
			}
			else //english
			{
				m_description = p_ComponentName;
				m_installcompletemessage = "";
				m_installmessage = "Click Next to install " + p_ComponentName;
			}
		}

		#region Attributi
		private string m_type; //can be cmd or msi or openfile
		[Description("The type of the component; can be 'cmd' for executing generic command line installation or 'msi' for installing Windows Installer MSI package or 'openfile' to open a file. (REQUIRED)")]
		public string type
		{
			get{return m_type;}
		}

		private string m_os_filter_greater;
		[Description("A filter to install this component only on all operating system id greater than the id specified (see Help->Operating System Table). For example to install a component only in Windows 2000 or later write '44'. (OPTIONAL)")]
		public string os_filter_greater
		{
			get{return m_os_filter_greater;}
			set{m_os_filter_greater = value;}
		}

		private string m_os_filter_smaller;
		[Description("A filter to install this component only on all operating system id smaller than the id specified (see operating system table). For example to install a component preceding Windows 2000 write '45'. (OPTIONAL)")]
		public string os_filter_smaller
		{
			get{return m_os_filter_smaller;}
			set{m_os_filter_smaller = value;}
		}

		private string m_os_filter_lcid;
		[Description("A filter to install this component only on all operating system language equals or not equals than the LCID specified (see Help->LCID table). Separate multiple LCID with comma (',') and use not symbol ('!') for NOT logic (es. '1044,1033,!1038' ). You can also filter all the configuration element. (OPTIONAL)")]
		public string os_filter_lcid
		{
			get{return m_os_filter_lcid;}
			set{m_os_filter_lcid = value;}
		}

		private string m_installcompletemessage; //se vuoto non viene visualizzato nessun messagio al termine del download
		[Description("The message used when a component is successfully installed. To disable this message leave this property empty. (OPTIONAL)")]
		public string installcompletemessage
		{
			get{return m_installcompletemessage;}
			set{m_installcompletemessage = value;}
		}

		private bool m_mustreboot;
		[Description("Indicates if ask to reboot after this component is installed successfully (True/False). Normally if the system must be restarted is automatically the component that tells this setup (with special return code) to stop and restart the system, but in special circumstances (for example in Windows 98) we must force a reboot to install correctly some components (for example the .NET Framework). (REQUIRED)")]
		public bool mustreboot
		{
			get{return m_mustreboot;}
			set{m_mustreboot = value;}
		}

		private string m_description;
		[Description("Description of this component. This value is used also in some message to replace the %s string. (REQUIRED)")]
		public string description
		{
			get{return m_description;}
			set{m_description = value;OnDescriptionChanged();}
		}

		private string m_installmessage;
		[Description("The message used to confirm the installation of this component. (REQUIRED)")]
		public string installmessage
		{
			get{return m_installmessage;}
			set{m_installmessage = value;}
		}

		private string m_note;
		[Description("Note, not used by the setup. (OPTIONAL)")]
		public string note
		{
			get{return m_note;}
			set{m_note = value;}
		}
		#endregion

		protected void OnDescriptionChanged()
		{
			if (DescriptionChanged!=null)
				DescriptionChanged(this,EventArgs.Empty);
		}

		public event EventHandler DescriptionChanged;

		#region IXmlClass Members

		public void ToXml(XmlWriter p_Writer)
		{
			p_Writer.WriteStartElement("component");
				OnXmlWriteTagcomponent(new XmlWriterEventArgs(p_Writer));

				if (m_DownloadDialog!=null)
				{
					m_DownloadDialog.ToXml(p_Writer);
				}

				foreach(installedcheck i in installchecks)
				{
					i.ToXml(p_Writer);
				}

			p_Writer.WriteEndElement();
		}

		public void FromXml(XmlElement p_Element)
		{
			if (p_Element.Attributes["type"] == null ||
				p_Element.Attributes["type"].InnerText != m_type)
				throw new ApplicationException("Invalid type");

			OnXmlReadTagcomponent(new XmlElementEventArgs(p_Element));

			XmlElement l_ElementDownloadDialog = (XmlElement)p_Element.SelectSingleNode("downloaddialog");
			if (l_ElementDownloadDialog != null)
			{
				DownloadDialog l_dialog = new DownloadDialog();
				l_dialog.FromXml(l_ElementDownloadDialog);
				m_DownloadDialog = l_dialog;
			}

			XmlNodeList l_List = p_Element.SelectNodes("installedcheck");
			foreach(XmlElement l_XmlCheck in l_List)
			{
				if (l_XmlCheck.Attributes["type"] != null)
				{
					installedcheck l_check;
					if (l_XmlCheck.Attributes["type"].InnerText == "check_file")
						l_check = new installedcheck_file();
					else if (l_XmlCheck.Attributes["type"].InnerText == "check_registry_value")
						l_check = new installedcheck_registry();
					else
						throw new ApplicationException("Invalid type");

					l_check.FromXml(l_XmlCheck);

					installchecks.Add(l_check);
				}
			}
		}
		#endregion

		protected virtual void OnXmlWriteTagcomponent(XmlWriterEventArgs e)
		{
			e.XmlWriter.WriteAttributeString("os_filter_greater",m_os_filter_greater);
			e.XmlWriter.WriteAttributeString("os_filter_smaller",m_os_filter_smaller);
			e.XmlWriter.WriteAttributeString("os_filter_lcid",m_os_filter_lcid);
			e.XmlWriter.WriteAttributeString("type",m_type);
			e.XmlWriter.WriteAttributeString("installcompletemessage",m_installcompletemessage);
			e.XmlWriter.WriteAttributeString("mustreboot",m_mustreboot.ToString());
			e.XmlWriter.WriteAttributeString("description",m_description);
			e.XmlWriter.WriteAttributeString("installmessage",m_installmessage);
			e.XmlWriter.WriteAttributeString("note",m_note);
		}
		protected virtual void OnXmlReadTagcomponent(XmlElementEventArgs e)
		{
			if (e.XmlElement.Attributes["description"]!=null)
				m_description = e.XmlElement.Attributes["description"].InnerText;

			if (e.XmlElement.Attributes["installcompletemessage"]!=null)
				m_installcompletemessage = e.XmlElement.Attributes["installcompletemessage"].InnerText;

			if (e.XmlElement.Attributes["installmessage"]!=null)
				m_installmessage = e.XmlElement.Attributes["installmessage"].InnerText;

			if (e.XmlElement.Attributes["mustreboot"]!=null)
				m_mustreboot = bool.Parse(e.XmlElement.Attributes["mustreboot"].InnerText);

			if (e.XmlElement.Attributes["os_filter_greater"]!=null)
				m_os_filter_greater = e.XmlElement.Attributes["os_filter_greater"].InnerText;

			if (e.XmlElement.Attributes["os_filter_lcid"]!=null)
				m_os_filter_lcid = e.XmlElement.Attributes["os_filter_lcid"].InnerText;

			if (e.XmlElement.Attributes["os_filter_smaller"]!=null)
				m_os_filter_smaller = e.XmlElement.Attributes["os_filter_smaller"].InnerText;

			if (e.XmlElement.Attributes["note"]!=null)
				m_note = e.XmlElement.Attributes["note"].InnerText;

//			if (e.XmlElement.Attributes["type"]!=null)
//				m_type = e.XmlElement.Attributes["type"].InnerText;
		}

		private installedcheckCollection m_installchecks = new installedcheckCollection();
		[System.ComponentModel.Browsable(false)]
		public installedcheckCollection installchecks
		{
			get{return m_installchecks;}
			set{m_installchecks = value;}
		}

		private DownloadDialog m_DownloadDialog = null; //di default non � presente
		[System.ComponentModel.Browsable(false)]
		public DownloadDialog DownloadDialog
		{
			get{return m_DownloadDialog;}
			set{m_DownloadDialog = value;}
		}
	}

}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The MIT License

Share

About the Author

Davide Icardi
Software Developer
Italy Italy
No Biography provided

| Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.150414.1 | Last Updated 5 Jan 2004
Article Copyright 2003 by Davide Icardi
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid