コード例 #1
0
ファイル: KrutaConfigParser.cs プロジェクト: waheedrous/Kruta
        internal MachineConfig MachineFactoryDefaultEnvironment(XmlNode machinesNode)
        {
            var result = new MachineConfig();

            if (machinesNode != null)
            {
                var machineNodeList = machinesNode.SelectNodes(MachinesXml.Machine.Element);
                if (machineNodeList != null)
                {
                    foreach (XmlNode machineNode in machineNodeList)
                    {
                        if (
                            machineNode != null &&
                            machineNode.Attributes[MachinesXml.Machine.Key] != null &&
                            machineNode.Attributes[MachinesXml.Machine.Key].Value.ToLower() == Environment.MachineName.ToLower() &&
                            machineNode.Attributes[MachinesXml.Machine.DefaultEnvironmentAttribute] != null
                            )
                        {
                            result = MachineFactory(machineNode);
                            break;
                        }
                    }
                }
            }
            return(result);
        }
コード例 #2
0
ファイル: KrutaConfigParser.cs プロジェクト: waheedrous/Kruta
        internal MachineConfig MachineFactory(XmlNode machineNode)
        {
            //defaults to current machine and DEVELOPMENT
            // this allows us to not need to define Nodes for individual developers machines
            var result = new MachineConfig
            {
                DefaultEnvironment = EnvironmentsEnum.DEV //<- DO NOT CHANGE TO UNSET
            };

            if (machineNode != null)
            {
                result = new MachineConfig
                {
                    Name = machineNode.Attributes[MachinesXml.Machine.Key].Value,
                    DefaultEnvironment = EnumUtils.Parse <EnvironmentsEnum>(
                        machineNode.Attributes[MachinesXml.Machine.DefaultEnvironmentAttribute].Value
                        )
                };
            }
            return(result);
        }