SceneGate / Yarhl

Framework for the implementation of format converters like game assets or media files
https://scenegate.github.io/Yarhl/
MIT License
60 stars 10 forks source link

Implement ICloneableFormat #168

Closed Kaplas80 closed 3 years ago

Kaplas80 commented 3 years ago

Description

In this PR, BinaryFormat, NodeContainerFormat and Po classes implement a ICloneableFormat interface, making easier to get duplicates.

Also, there is a new constructor in Node that accepts other node. It makes a new node with the same name and tags than the original node and a deep copy of its format.

Example

// Make a node copy
Node clone = new Node(original);

// Deep copy a BinaryFormat (or other ICloneableFormat)
BinaryFormat newFormat = (BinaryFormat)oldFormat.DeepClone();