Esempio n. 1
0
        public OptionGroupModel(XElement node, OptionPageModel model)
        {
            _model = model;
            Instance = new OptionGroup { DataContext = this };

            GroupName = Guid.NewGuid().ToString();
            Title = node.ChildNodeValue("Title");

            ChildModels = new List<ExpandableOptionModel>();
            foreach (var entryNode in node.Elements("Entry"))
                ChildModels.Add(new ExpandableOptionModel(entryNode, this));
        }
Esempio n. 2
0
        public void Initialize(string installPath)
        {
            try
            {
                _installPath = installPath;

                var cabPath = Path.Combine(installPath, "settings.cab");
                if (!File.Exists(cabPath))
                {
                    Logger.Error("Could not retrieve uninstall entries: settings.cab does not exist in folder {0}", installPath);
                    return;
                }

                var bytes = CabArchiveUtilities.ExtractFile(cabPath, "uninstall.xml");
                if (bytes == null)
                {
                    Logger.Error("Could not retrieve uninstall entries: uninstall.xml does not exist");
                    return;
                }

                using (var stream = new MemoryStream(bytes, false))
                {
                    var node = XDocument.Load(stream).Element("UninstallConfiguration");
                    if (node == null)
                    {
                        Logger.Error("Could not retrieve uninstall entries: 'UninstallConfiguration' node not present");
                        return;
                    }

                    UninstallOptions = new OptionPageModel(_model, node);
                }
            }
            catch (Exception e)
            {
                Logger.Error("An exception occurred while attempting to retrieve uninstall options: {0}", e.Message);
            }
        }