Ejemplo n.º 1
0
        public object Create(
			object parent, object configContext, XmlNode section)
        {
            if(null == _Config) {
                lock(_Lock) {
                    if(null == _Config) {
                        _Config = new Config();
                        if(section.IsNullOrEmpty()) {
                            return _Config;
                        }

                        foreach(XmlNode node in section.ChildNodes) {
                            if(node.IsNullOrEmpty()) { continue; }

                            switch(node.Name.ToPascalCasing()) {
                                case Config.Xml.Kernel:
                                    _Config.KernelSection =
                                        ParsedAsAnys(node);
                                    break;
                                case Config.Xml.Builtin:
                                    _Config.BuiltinSection =
                                        ParsedAsManys(node);
                                    break;
                                case Config.Xml.Plugin:
                                    _Config.PluginSection =
                                        ParsedAsManys(node);
                                    break;
                                case Config.Xml.Application:
                                    _Config.ApplicationSection =
                                        ParsedAsManys(node);
                                    break;
                            }
                        }
                    }
                }
            }

            return _Config;
        }
Ejemplo n.º 2
0
		private Clients.SCR.Template.Conflict[] GetConflicts(XmlNode[] aXmlNodes)
		{
			if (aXmlNodes.IsNullOrEmpty())
				return null;
			List<Clients.SCR.Template.Conflict> aINPs = new List<Clients.SCR.Template.Conflict>();
			int nID;
			Clients.SCR.Template.Bind eBind;
			foreach (XmlNode cXmlNodeConflict in aXmlNodes)
			{
                nID = cXmlNodeConflict.AttributeGet<int>("id_preset", false);
                eBind = cXmlNodeConflict.AttributeGet<Clients.SCR.Template.Bind>("bind", false);
				aINPs.Add(new Clients.SCR.Template.Conflict() { nPresetID = nID, eBind = eBind });
			}
			return aINPs.ToArray();
		}
Ejemplo n.º 3
0
		private Clients.SCR.Template.Parameters[] GetParameters(XmlNode[] aXmlNodes)
		{
			if (aXmlNodes.IsNullOrEmpty())
				return null;
			List<Clients.SCR.Template.Parameters> aParams = new List<Clients.SCR.Template.Parameters>();
			int nID;
			string sText;
			bool bIsVisible = true;
			bool bIsEnabled = true;
			bool bAutostart = true;
			Clients.SCR.Template.FirstAction eFirstAction;
			foreach (XmlNode cXmlNode in aXmlNodes)
			{
				nID = cXmlNode.AttributeGet<int>("id_preset", false);
				sText = cXmlNode.AttributeValueGet("text", false);
				if (!bool.TryParse(cXmlNode.AttributeValueGet("is_visible", false), out bIsVisible))
					bIsVisible = true;
				if (!bool.TryParse(cXmlNode.AttributeValueGet("is_enabled", false), out bIsEnabled))
					bIsEnabled = true;
				if (!bool.TryParse(cXmlNode.AttributeValueGet("autostart", false), out bAutostart))
					bAutostart = true;
				if (!Clients.SCR.Template.FirstAction.TryParse(cXmlNode.AttributeValueGet("first_action", false), true, out eFirstAction))
					eFirstAction = Clients.SCR.Template.FirstAction.start;
				aParams.Add(new Clients.SCR.Template.Parameters() { nPresetID = nID, sText = sText, bIsEnabled = bIsEnabled, bIsVisible = bIsVisible, bAutostart = bAutostart, eFirstAction = eFirstAction });
			}
			return aParams.ToArray();
		}
Ejemplo n.º 4
0
		private Clients.SCR.Template.Offset[] GetOffsets(XmlNode[] aXmlNodes)
		{
            if (aXmlNodes.IsNullOrEmpty())
                return null;
			List<Clients.SCR.Template.Offset> aINPs = new List<Clients.SCR.Template.Offset>();
			bool bDoOnlyIfLast = false;
            foreach (XmlNode cXmlNode in aXmlNodes)
			{
				if (!bool.TryParse(cXmlNode.AttributeValueGet("do_if_last", false), out bDoOnlyIfLast))
					bDoOnlyIfLast = false;

				aINPs.Add(new Clients.SCR.Template.Offset() 
				{ 
					nPresetID = cXmlNode.AttributeGet<int>("id_preset", false), 
					nOffsetIn = cXmlNode.AttributeGet<int>("in", false), 
					nOffsetOut = cXmlNode.AttributeGet<int>("out", false), 
					nDurationSafe = cXmlNode.AttributeGet<int>("safe", false),
					bDoOnlyIfLast = bDoOnlyIfLast, 
					sNextClass = cXmlNode.AttributeValueGet("next_class", false),
					sNextType = cXmlNode.AttributeValueGet("next_type", false),
					sPreClass = cXmlNode.AttributeValueGet("pre_class", false),
					sPreType = cXmlNode.AttributeValueGet("pre_type", false),
					sClass = cXmlNode.AttributeValueGet("class", false),
					sType = cXmlNode.AttributeValueGet("type", false) 
				});
			}
			return aINPs.ToArray();
		}