private MetadataPhysicalVolumeSection GetPhysicalVolumeMetadata(MetadataVolumeGroupSection vg, string name) { foreach (var pv in vg.PhysicalVolumes) { if (pv.Name == name) { return(pv); } } return(null); }
private void Parse(TextReader data) { string line; var vgSection = new List <MetadataVolumeGroupSection>(); while ((line = ReadLine(data)) != null) { if (line == String.Empty) { continue; } if (line.Contains("=")) { var parameter = ParseParameter(line); switch (parameter.Key.Trim().ToLowerInvariant()) { case "contents": Contents = ParseStringValue(parameter.Value); break; case "version": Version = (int)ParseNumericValue(parameter.Value); break; case "description": Description = ParseStringValue(parameter.Value); break; case "creation_host": CreationHost = ParseStringValue(parameter.Value); break; case "creation_time": CreationTime = ParseDateTimeValue(parameter.Value); break; default: throw new ArgumentOutOfRangeException(parameter.Key, "Unexpected parameter in global metadata"); } } else if (line.EndsWith("{")) { var vg = new MetadataVolumeGroupSection(); vg.Parse(line, data); vgSection.Add(vg); } } VolumeGroupSections = vgSection.ToArray(); }