View Single Post
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 04-30-2015 , 11:43   Re: Add two KeyValue files together
Reply With Quote #3

Here are the steps I would go about merging those:
  • Load the files into KeyValues handles A and B.
  • (Optional) Create another KeyValues handle for the merge if you need to keep the original handles intact.
  • Iterate over A keys using GotoFirstSubKey() and GotoNextKey(), grabbing the current key using GetSectionName()
  • Check if A's key exists in B.
    • If yes, grab B stats and store the sum in the output handle (or A's handle if no output handle).
    • If no and are using an output handle, store A's data in the output handle.
  • Iterate over B keys same method as A.
  • If B's key does not exist in A, store B into the output handle (or A's handle if no output handle).

And there you will have them merged.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline