public static HarddiskFile ToHarddiskFile(this ConfigNode configNode, Harddisk harddisk) { var filename = configNode.GetValue(FILENAME_VALUE_STRING); FileContent fileContent = Decode(configNode.GetValue("line")); harddisk.Save(filename, fileContent); return(new HarddiskFile(harddisk, filename)); }
public static Harddisk ToHardDisk(this ConfigNode configNode) { var capacity = 10000; if (configNode.HasValue("capacity")) { capacity = int.Parse(configNode.GetValue("capacity")); } var toReturn = new Harddisk(capacity); if (configNode.HasValue("volumeName")) { toReturn.Name = configNode.GetValue("volumeName"); } foreach (ConfigNode fileNode in configNode.GetNodes("file")) { toReturn.Save(fileNode.ToHarddiskFile(toReturn)); } return(toReturn); }