public static LightScript Deserialize(TreeNode<YamlObject> tree) { var commandRoot = new TreeNode<Command>(); foreach (var yamlCommandNode in tree) DeserializeCommandsRecursively(commandRoot, yamlCommandNode); var lightScript = new LightScript(commandRoot); YamlSerializer.DeserializeSimpleProperties(lightScript, tree); return lightScript; }
public static Command Deserialize(TreeNode <YamlObject> tree) { // TODO: These two lines take a lot of time, and they will be called a lot of times!!! var allCommandTypes = AppDomain.CurrentDomain.GetAllTypesWhichImplementInterface(typeof(Command)); var commandType = allCommandTypes.FirstOrDefault(type => type.Name.Equals(tree.value.property)); if (commandType == null) { return(null); } var command = (Command)Activator.CreateInstance(commandType); YamlSerializer.DeserializeSimpleProperties(command, tree); return(command); }
public static LightTestFixture Deserialize(TreeNode <YamlObject> tree) { var root = new TreeNode <LightScript>(); var fixture = new LightTestFixture(); YamlSerializer.DeserializeSimpleProperties(fixture, tree); foreach (var yamlScriptNode in tree) { var s = YamlScriptIO.Deserialize(yamlScriptNode); if (s == null || s.Name == null && s.Commands.Count() == 0) // Test fixture name is also part of the tree, so skip it { continue; } fixture.AddScript(Script.FromLightScript(s)); } return(fixture); }