public static Jar Mistranslate(Box box) { Jar jar = new Jar(); jar.Name = box.Name; jar.References = box.References; if (box.Defaults != null) { jar.Defaults = box.Defaults.AsDictionary(); } if (box.Clusters != null) { foreach (var cluster in box.Clusters) { jar.Clusters.Add(cluster.Name, cluster.AsDictionary()); } } if (box.Machines != null) { foreach (var machine in box.Machines) { jar.Machines.Add(machine.Name, machine.AsDictionary()); } } return(jar); }
public Box(Jar jar) { Name = jar.Name; References = jar.References; Clusters = new List <Cluster>(); Machines = new List <Machine>(); Defaults = new Configuration(jar.Defaults); reservedKeys = new List <string>() { Machine.ClusterKey }; }
/// <summary> /// According to the myth, Pandora opened a jar (pithos), in modern accounts sometimes mistranslated as "Pandora's box" (see below), /// releasing all the evils of humanity—although the particular evils, aside from plagues and diseases, are not specified in detail /// by Hesiod—leaving only Hope inside once she had closed it again. She opened the jar out of simple curiosity and not as a malicious act. /// </summary> /// <remarks>http://en.wikipedia.org/wiki/Pandora</remarks> /// <param name="jar"></param> /// <returns>Returns Pandora's box</returns> public static Box Mistranslate(Jar jar) { Box box = new Box(jar); if (jar.Clusters != null) { foreach (var cluster in jar.Clusters) { box.AddCluster(cluster.Key, cluster.Value); } } if (jar.Machines != null) { foreach (var machine in jar.Machines) { box.AddMachine(machine.Key, machine.Value); } } return(box); }