Exemple #1
0
        public ProductLayout3(ControlsLayout controlsLayout)
        {
            InitializeComponent();

            controlsLayout.SetLayout(pnlLayout.Controls);

            Dock = DockStyle.Fill;
        }
Exemple #2
0
        public ProductLayout6(ControlsLayout controlsLayout)
        {
            InitializeComponent();

            Color FontColor = ConfigParser.GetConfig().GetColorValue("//Main/FormDesign/FontColor");

            if (FontColor != null)
            {
                txtDisclaimer.ForeColor  = FontColor;
                txtDescription.ForeColor = FontColor;
                txtTitle.ForeColor       = FontColor;
            }

            controlsLayout.SetLayout(pnlLayout.Controls);

            Dock = DockStyle.Fill;
        }
Exemple #3
0
        public ProductSettings ExtractProductSettings(XmlNode productSettingsNode)
        {
#if DEBUG
            Logger.GetLogger().Info("Read config file - Product Settings:", Logger.Level.MEDIUM_DEBUG_LEVEL);
#endif
            var productSettings = new ProductSettings
            {
                IsOptional    = XmlParser.GetBoolAttribute(productSettingsNode, "optional"),
                IsExtractable = XmlParser.GetBoolAttribute(productSettingsNode, "extractable", true)
            };

            XmlNode productStaticData  = productSettingsNode.SelectSingleNode("StaticData");
            XmlNode productDynamicData = productSettingsNode.SelectSingleNode("DynamicData");
            productSettings.Name = XmlParser.GetStringValue(productStaticData, "Title");
            if (productSettings.IsOptional)
            {
                productSettings.Name = "sec:" + XmlParser.GetStringValue(productDynamicData, "InternalName");
            }
            productSettings.Skin  = XmlParser.GetStringValue(productDynamicData, "Skin");
            productSettings.Class = XmlParser.GetStringValue(productDynamicData, "Class");

            EvalCustomVariables(productStaticData.SelectSingleNode("CustomData/CustomVars"));

            productSettings.Filename    = XmlParser.GetStringValue(productStaticData, "Filename");
            productSettings.ExtractPath = XmlParser.GetStringValue(productStaticData, "ExtractPath");
            productSettings.RunPath     = XmlParser.GetStringValue(productStaticData, "RunPath");

            productSettings.DownloadURLs = new List <ProductSettings.DownloadURL>();
            foreach (XmlNode DownloadURLNode in productStaticData.SelectNodes("DownloadURLs/DownloadURL"))
            {
                ProductSettings.DownloadURL downloadURL = new ProductSettings.DownloadURL
                {
                    Arch = XmlParser.GetStringAttribute(DownloadURLNode, "arch").Trim(),
                    URL  = XmlParser.GetStringValue(DownloadURLNode).Trim()
                };
                productSettings.DownloadURLs.Add(downloadURL);
            }

            bool runWithBitsDefault = XmlParser.GetBoolValue(xmlDoc.SelectSingleNode("//Config"), ConfigConsts.RUN_WITH_BITS, true);

            foreach (XmlNode productLogicNode in productStaticData.SelectNodes("Logic"))
            {
                productSettings.Behavior       = XmlParser.GetStringValue(productLogicNode, "Behavior");
                productSettings.RunWithBits    = XmlParser.GetBoolValue(productLogicNode, "RunWithBits", runWithBitsDefault);
                productSettings.DownloadMethod = XmlParser.GetStringValue(productLogicNode, "DownloadMethod");
                if (String.IsNullOrEmpty(productSettings.DownloadMethod))
                {
                    productSettings.DownloadMethod = GetConfigValue("DOWNLOAD_METHOD");
                }
                productSettings.SecondaryDownloadMethod = XmlParser.GetStringValue(productLogicNode, "SecondaryDownloadMethod");
                if (String.IsNullOrEmpty(productSettings.SecondaryDownloadMethod))
                {
                    productSettings.SecondaryDownloadMethod = GetConfigValue("SECONDARY_DOWNLOAD_METHOD");
                }
                productSettings.MsiTimeoutMS  = XmlParser.GetIntValue(productLogicNode, "MsiTimeoutMs");
                productSettings.ProductEvents = new List <ProductSettings.ProductEvent>();
                foreach (XmlNode EventNode in productLogicNode.SelectNodes("Events/Event"))
                {
                    ProductSettings.ProductEvent productEvent = new ProductSettings.ProductEvent
                    {
                        Type   = XmlParser.GetStringValue(EventNode),
                        Triger = XmlParser.GetStringAttribute(EventNode, "reportOn")
                    };
                    productSettings.ProductEvents.Add(productEvent);
                }
            }

            productSettings.RunParams = "";
            foreach (XmlNode runParamsNode in productStaticData.SelectNodes("RunParams/RunParam"))
            {
                string RunParam = XmlParser.GetStringValue(runParamsNode).Trim();

                productSettings.RunParams += (string.IsNullOrEmpty(productSettings.RunParams) ? RunParam : " " + RunParam);
            }
            productSettings.PreInstall      = ExtractProductRequirementsRoot(productStaticData.SelectNodes("PreInstall/Requirements"));
            productSettings.PostInstall     = ExtractProductRequirementsRoot(productStaticData.SelectNodes("PostInstall/Requirements"));
            productSettings.AnalyticsParams = ExtractProductAnalyticsParams(productStaticData.SelectNodes("AnalyticsParams/Param"));
            productSettings.LayoutName      = XmlParser.GetStringValue(productStaticData, "Layout");

            ControlsLayout defLocaleControlsLayout = null;
            productSettings.ControlsLayouts = null;

            XmlNodeList Locales = productSettingsNode.SelectNodes("Locales/Locale");
            if (Locales.Count > 0)
            {
                foreach (XmlNode localeNode in Locales)
                {
                    if (XmlParser.GetBoolAttribute(localeNode, "default"))
                    {
                        defLocaleControlsLayout = new ControlsLayout(new XmlNodeList[] { localeNode.SelectNodes("Texts/Text"), localeNode.SelectNodes("Images/Image"), localeNode.SelectNodes("UILayouts") }, formDesign.DefaultControlDesign);
                    }
                    string localeLanguage = XmlParser.GetStringAttribute(localeNode, "name");
                    if (localeLanguage == LocaleCode)
                    {
                        productSettings.ControlsLayouts = new ControlsLayout(new XmlNodeList[] { localeNode.SelectNodes("Texts/Text"), localeNode.SelectNodes("Images/Image"), localeNode.SelectNodes("UILayouts") }, formDesign.DefaultControlDesign);
                    }
                }

                if (productSettings.ControlsLayouts == null)
                {
                    productSettings.ControlsLayouts = defLocaleControlsLayout;
                }

#if DEBUG
                if (productSettings.ControlsLayouts == null)
                {
                    Logger.GetLogger().Error("Missing locale for product: " + productSettings.Name + " language code: " + LocaleCode);
                }
#endif
            }

            return(productSettings);
        }