private CPVibro loadVibro(XmlNode cp) { CPVibro vibro = new CPVibro(cp.SelectSingleNode("name").FirstChild.Value); vibro.SignalLevelIndex = getIntValue(cp, "signal_level"); foreach (XmlNode absorber_node in cp.SelectNodes("absorbers/*")) { CPOutside.Reflector absorber = new CPOutside.Reflector(); absorber.square = getDoubleValue(absorber_node, "square"); absorber.MaterialIndex = getIntValue(absorber_node, "ratio"); vibro.absorbersList.Add(absorber); } foreach (XmlNode consumer_node in cp.SelectNodes("consumers/*")) { int consumer; consumer = Int32.Parse(consumer_node.FirstChild.Value); vibro.consumersList.Add(consumer); } vibro.Volume = getDoubleValue(cp, "volume"); vibro.RoomTypeIndex = getIntValue(cp, "room_type"); vibro.Distance = getDoubleValue(cp, "distance"); vibro.MaterialIndex = getIntValue(cp, "material"); vibro.SignalPlaceIndex = getIntValue(cp, "signal_place"); vibro.Results = ResearchResults.FromXml(cp.SelectSingleNode("results")); return vibro; }
private CPOutside loadOutside(XmlNode cp) { CPOutside outside = new CPOutside(cp.SelectSingleNode("name").FirstChild.Value); outside.SignalLevelIndex = getIntValue(cp, "signal_level"); outside.NoiseTypeIndex = getIntValue(cp, "noise_type"); foreach (XmlNode reflector_node in cp.SelectNodes("reflectors/*")) { CPOutside.Reflector reflector = new CPOutside.Reflector(); reflector.square = getDoubleValue(reflector_node, "square"); reflector.MaterialIndex = getIntValue(reflector_node, "material"); outside.reflectorsList.Add(reflector); } foreach (XmlNode absorber_node in cp.SelectNodes("absorbers/*")) { CPOutside.Reflector absorber = new CPOutside.Reflector(); absorber.square = getDoubleValue(absorber_node, "square"); absorber.MaterialIndex = getIntValue(absorber_node, "ratio"); outside.absorbersList.Add(absorber); } foreach (XmlNode consumer_node in cp.SelectNodes("consumers/*")) { int consumer; consumer = Int32.Parse(consumer_node.FirstChild.Value); outside.consumersList.Add(consumer); } outside.Volume = getDoubleValue(cp, "volume"); outside.RoomTypeIndex = getIntValue(cp, "room_type"); outside.Distance = getDoubleValue(cp, "distance"); outside.SoundFadingIndex = getIntValue(cp, "sound_fading"); outside.AngleIndex = getIntValue(cp, "angle"); outside.NoiseReduction = getIntValue(cp, "noise_reduction"); outside.Microphone = getIntValue(cp, "microphone"); outside.MicrophoneText = getDoubleValue(cp, "mic_value"); outside.Results = ResearchResults.FromXml(cp.SelectSingleNode("results")); return outside; }
private CPVent loadVent(XmlNode cp) { CPVent vent = new CPVent(cp.SelectSingleNode("name").FirstChild.Value); vent.SignalLevelIndex = Int32.Parse(cp.SelectSingleNode("signal_level").FirstChild.Value); vent.NoiseTypeIndex = Int32.Parse(cp.SelectSingleNode("noise_type").FirstChild.Value); vent.Distance = getDoubleValue(cp, "distance"); vent.SignalPlace = getIntValue(cp, "signal_place"); foreach (XmlNode absorber_node in cp.SelectNodes("absorbers/*")) { CPOutside.Reflector absorber = new CPOutside.Reflector(); absorber.square = Double.Parse(absorber_node.SelectSingleNode("square").FirstChild.Value); absorber.MaterialIndex = Int32.Parse(absorber_node.SelectSingleNode("ratio").FirstChild.Value); vent.absorbersList.Add(absorber); } foreach (XmlNode consumer_node in cp.SelectNodes("consumers/*")) { int consumer; consumer = Int32.Parse(consumer_node.FirstChild.Value); vent.consumersList.Add(consumer); } vent.Volume = getDoubleValue(cp, "volume"); vent.RoomTypeIndex = getIntValue(cp, "room_type"); vent.NoiseReduction = getIntValue(cp, "noise_reduction"); foreach (XmlNode sector_node in cp.SelectNodes("sectors/*")) { switch(sector_node.Name) { case "beton": FormVent.SectorBeton beton = new FormVent.SectorBeton(); beton.Length = getDoubleValue(sector_node, "length"); beton.Perimetr = getDoubleValue(sector_node, "perimetr"); beton.Square = getDoubleValue(sector_node, "square"); beton.RatioIndex = getIntValue(sector_node, "ratio"); vent.Sectors.Add(beton); break; case "metal": FormVent.SectorMetal metal = new FormVent.SectorMetal(); metal.Length = getDoubleValue(sector_node, "length"); metal.FadingIndex = getIntValue(sector_node, "fading"); vent.Sectors.Add(metal); break; case "turn": FormVent.SectorTurn turn = new FormVent.SectorTurn(); turn.AngleIndex = getIntValue(sector_node, "angle"); vent.Sectors.Add(turn); break; case "extension": FormVent.SectorExtension extension = new FormVent.SectorExtension(); extension.SquareBefore = getDoubleValue(sector_node, "square_before"); extension.SquareAfter = getDoubleValue(sector_node, "square_after"); vent.Sectors.Add(extension); break; } // } vent.Results = ResearchResults.FromXml(cp.SelectSingleNode("results")); return vent; }
private CPNeighbor loadNeighbor(XmlNode cp) { CPNeighbor neigh = new CPNeighbor(cp.SelectSingleNode("name").FirstChild.Value); neigh.SignalLevelIndex = getIntValue(cp, "signal_level"); neigh.NoiseTypeIndex = getIntValue(cp, "noise_type"); foreach (XmlNode reflector_node in cp.SelectNodes("reflectors/*")) { CPOutside.Reflector reflector = new CPOutside.Reflector(); reflector.square = getDoubleValue(reflector_node, "square"); reflector.MaterialIndex = getIntValue(reflector_node, "material"); neigh.reflectorsList.Add(reflector); } foreach (XmlNode absorber_node in cp.SelectNodes("absorbers/*")) { CPOutside.Reflector absorber = new CPOutside.Reflector(); absorber.square = getDoubleValue(absorber_node, "square"); absorber.MaterialIndex = getIntValue(absorber_node, "ratio"); neigh.absorbersList.Add(absorber); } foreach (XmlNode consumer_node in cp.SelectNodes("consumers/*")) { int consumer; consumer = Int32.Parse(consumer_node.FirstChild.Value); neigh.consumersList.Add(consumer); } neigh.Volume = getDoubleValue(cp, "volume"); neigh.RoomTypeIndex = getIntValue(cp, "room_type"); neigh.NoiseReduction = getIntValue(cp, "noise_reduction"); neigh.Results = ResearchResults.FromXml(cp.SelectSingleNode("results")); return neigh; }