Exemplo n.º 1
0
        public static Operation FromTemplate(OperationTemplate template)
        {
            Operation op = null;

            if (template.op == "add")
            {
                op = new AddOperation();
            }
            else if (template.op == "remove")
            {
                op = new RemoveOperation();
            }
            else if (template.op == "test")
            {
                op = new TestOperation();
            }
            else if (template.op == "move")
            {
                op = new MoveOperation();
            }
            else if (template.op == "copy")
            {
                op = new CopyOperation();
            }
            else if (template.op == "replace")
            {
                op = new ReplaceOperation();
            }

            op.CopyPropertiesFrom(template);

            return op;
        }
Exemplo n.º 2
0
        public  OperationTemplate ToTemplate()
        {
            OperationTemplate template = new OperationTemplate();

            template.op = this.Name;
            template.path = this.Path;
            template.from = this.From;
            template.value = this.Value;

            return template;
        }
Exemplo n.º 3
0
 private void CopyPropertiesFrom(OperationTemplate template)
 {
     this.Name = template.op;
     this.Path = template.path;
     this.From = template.from;
     this.Value = template.value;
 }