private void LoadDefaultBrushes() { try { if (string.IsNullOrWhiteSpace(InstallerInfo.UiOverrides.DefaultBackgroundBrush)) { InstallerInfo.UiOverrides.DefaultBackgroundBrush = Brushes.White.ToString(); } if (string.IsNullOrWhiteSpace(InstallerInfo.UiOverrides.DefaultFontColor)) { InstallerInfo.UiOverrides.DefaultFontColor = Brushes.Black.ToString(); } if (zipManager.Exists(InstallerInfo.UiOverrides.DefaultBackgroundBrush) && !string.IsNullOrWhiteSpace(InstallerInfo.UiOverrides.DefaultBackgroundBrush)) { DefaultBackground = LoadBackgroundImage(InstallerInfo.UiOverrides.DefaultBackgroundBrush); } else { DefaultBackground = (Brush) new BrushConverter().ConvertFromString(InstallerInfo.UiOverrides.DefaultBackgroundBrush); } DefaultTextColor = (Brush) new BrushConverter().ConvertFromString(InstallerInfo.UiOverrides.DefaultFontColor); } catch { MessageBox.Show(String.Format("Failed loading the default background and font brushes (DefaultBackground={0}, DefaultFontColor={1}).", InstallerInfo.UiOverrides.DefaultBackgroundBrush, InstallerInfo.UiOverrides.DefaultFontColor), "Init Error", MessageBoxButton.OK, MessageBoxImage.Error); } }
private void LoadInstallInfoZip() { try { //Look for .installinfo file string path = System.IO.Path.GetFullPath(String.Format("{0}.installinfo", System.Diagnostics.Process.GetCurrentProcess().ProcessName)); if (!File.Exists(path)) { MessageBox.Show(String.Format("The file \"{0}\" could not be found!\nThis file should be in the same directory as the executable.\n\nThe installer will now close.", System.IO.Path.GetFileName(path)), "Initialization", MessageBoxButton.OK, MessageBoxImage.Error); Environment.Exit(0); } //Load .installinfo zipManager = new ZipReader(ZipFile.Open(path, ZipArchiveMode.Read)); //Load installerXml from .installinfo if (!zipManager.Exists(GeneralInfo.InstallerXml)) { MessageBox.Show(string.Format("Could not find \"{0}\" in \"{1}\". This file must be at the root level in the archive.\n\nThe installer will now close.", GeneralInfo.InstallerXml, System.IO.Path.GetFileName(path)), "Initialization", MessageBoxButton.OK, MessageBoxImage.Error); Environment.Exit(0); } InstallerInfo = zipManager.DeserializeXmlFromArchive <InstallerXml>(GeneralInfo.InstallerXml); InstallerInfo.Init(); GeneralInfo.InstallerXmlInfo = InstallerInfo; } catch (Exception ex) { MessageBox.Show(ex.Message, "InstallInfo open failed.", MessageBoxButton.OK, MessageBoxImage.Error); Environment.Exit(0); } }