Exemplo n.º 1
0
 public static CctvNode ToShallowClone(CctvNode cctvNode)
 {
     return(new CctvNode()
     {
         ID = cctvNode.ID,
         Type = cctvNode.Type,
         Name = cctvNode.Name
     });
 }
Exemplo n.º 2
0
        private static CctvNode cctvNodeDeepClone(CCTVHierarchyNode cctvNode)
        {
            CctvNode node = ShallowClone(cctvNode);

            if (cctvNode.Children.Length > 0)
            {
                node.Children = new CctvNode[cctvNode.Children.Length];
                for (int i = 0; i < cctvNode.Children.Length; i++)
                {
                    node.Children[i] = cctvNodeDeepClone(cctvNode.Children[i]);
                }
            }
            return(node);
        }
Exemplo n.º 3
0
        public static CctvNode ToDeepClone(CctvNode cctvNode)
        {
            CctvNode node = ToShallowClone(cctvNode);

            if (cctvNode.Children.Length > 0)
            {
                node.Children = new CctvNode[cctvNode.Children.Length];
                for (int i = 0; i < cctvNode.Children.Length; i++)
                {
                    node.Children[i] = ToDeepClone(cctvNode.Children[i]);
                }
            }
            return(node);
        }
Exemplo n.º 4
0
 public static CctvNode DeepClone(CCTVHierarchyNode hNode)
 {
     try
     {
         if (hNode == null)
         {
             return(null);
         }
         CctvNode node = cctvNodeDeepClone(hNode);
         return(node);
     }
     catch
     {
         return(null);
     }
 }