Exemple #1
0
        private static void Join(StackContainer destination, StackContainer source, string name, bool overwrite)
        {
            if (name == "..")
            {
                return;
            }

            if (!string.IsNullOrEmpty(name))
            {
                source.OpenContainer(name);
                if (!destination.TryOpenContainer(name))
                {
                    destination.CreateContainer(name);
                    destination.OpenContainer(name);
                }
            }

            foreach (string value in source.GetValueNames())
            {
                if (!overwrite && destination.ValueExists(value))
                {
                    continue;
                }

                destination.WriteValue(value, source.ReadValue(value));
            }

            foreach (string sub in source.GetContainerNames())
            {
                Join(destination, source, sub, overwrite);
            }

            if (!string.IsNullOrEmpty(name) && (!source.Back() || !destination.Back()))
            {
                throw new StackContainerException();
            }
        }
Exemple #2
0
 public void Join(StackContainer source, bool overwrite = false)
 {
     Join(this, source, "", overwrite);
 }