public void From_XML(System.Xml.Linq.XElement xml) { Reset(); var os = xml.Element("os"); if (os == null) { if (xml.Name == "os") os = xml; else os = null; } var element = os.Element("type"); if (element != null) { var attr = element.Attribute("arch"); if (attr != null) { var b = Bitness; Enum.TryParse(attr.Value, true, out b); Bitness = b; } attr = element.Attribute("machine"); if (attr != null) machine = attr.Value; var m = type; Enum.TryParse(element.Value, true, out m); type = m; } BootOrder.Clear(); foreach (var item in os.Elements("boot")) { var boot = Boot_Types.hd; Enum.TryParse(item.Attribute("dev").Value, true, out boot); BootOrder.Add(boot); } element = os.Element("bootmenu"); if (element != null) { var attr = element.Attribute("enable"); if (attr != null) { if (attr.Value.ToLower() == "yes") ShowBootMenu = true; else ShowBootMenu = false; } } }
private void Reset() { type = Hypervisor_VM_Types.hvm; BootOrder = new List<Boot_Types>(); BootOrder.Add(Boot_Types.cdrom); BootOrder.Add(Boot_Types.hd); Bitness = Guest_OS_Bitness.x86_64; ShowBootMenu = false; machine = "pc-i440fx-2.3"; }