Esempio n. 1
0
        public GenieConfig(GenieLamp lamp, XmlNode node)
        {
            this.lamp = lamp;
            macro     = new MacroExpander(lamp.Macro);

            name         = Utils.Xml.GetAttrValue(node, "name");
            assemblyName = Utils.Xml.GetAttrValue(node, "assembly");
            typeName     = Utils.Xml.GetAttrValue(node, "type");
            active       = Utils.Xml.GetAttrValue(node, "active", true);

            targetVersion = Environment.ExpandEnvironmentVariables(Utils.Xml.GetAttrValue(node, "targetVersion", TargetVersionWildcard));
            macro.SetMacro("%TARGET_VERSION%", targetVersion);

            outDir               = macro.Subst(Lamp.ExpandFileName(Utils.Xml.GetAttrValue(node, "outDir")));
            outFileName          = macro.Subst(Lamp.Macro.Subst(Utils.Xml.GetAttrValue(node, "outFileName")));
            this.OutFileEncoding = Encoding.GetEncoding(Utils.Xml.GetAttrValue(node, "outFileEncoding", Encoding.UTF8.BodyName));
            this.UpdateDatabase  = Utils.Xml.GetAttrValue(node, "updateDatabase", false);

            configParams = new GenieConfigParams(this, lamp.QueryNode(node, "./{0}:Param"));

            this.AssistantConfigs = new GenieAssistantConfigs(this, node);
            this.Assistants       = new List <IGenieAssistant>();

            if (!Directory.Exists(outDir))
            {
                Directory.CreateDirectory(outDir);
            }
        }