private static void MergePluginUINavigation(string APluginsPath, ref XmlDocument AUINavigation)
        {
            string[] UINavigationFiles = Directory.GetFiles(APluginsPath, "*UINavigation.yml", SearchOption.AllDirectories);

            foreach (string UINavFile in UINavigationFiles)
            {
                TYml2Xml    parser       = new TYml2Xml(UINavFile);
                XmlDocument UINavigation = parser.ParseYML2XML();
                TYml2Xml.Merge(ref AUINavigation, UINavigation, 1);
            }
        }
        /// <summary>
        /// this loads the contents of the yaml file.
        /// it supports inheritance, base elements are overwritten
        /// </summary>
        /// <param name="AYamlFilename"></param>
        /// <param name="ASelectedLocalisation"></param>
        /// <param name="AAlreadyGotLocalisation"></param>
        /// <param name="depth">0 is the last file that is derived from all base files</param>
        /// <returns></returns>
        protected Boolean LoadRecursively(string AYamlFilename,
                                          string ASelectedLocalisation,
                                          bool AAlreadyGotLocalisation,
                                          Int32 depth)
        {
            // check if file exists for localisation
            string localisedFile = null;

            if ((ASelectedLocalisation != null) && !AAlreadyGotLocalisation)
            {
                localisedFile = Path.GetDirectoryName(AYamlFilename) + Path.DirectorySeparatorChar +
                                Path.GetFileNameWithoutExtension(AYamlFilename) + "." + ASelectedLocalisation + ".yaml";

                // first check if there is such a file
                if (!File.Exists(localisedFile))
                {
                    localisedFile = null;
                }
            }

            if (localisedFile == null)
            {
                localisedFile = AYamlFilename;
            }

            string baseyaml;

            if (!TYml2Xml.ReadHeader(localisedFile, out baseyaml))
            {
                throw new Exception("This is not an OpenPetra Yaml file");
            }

            if ((baseyaml.Length > 0) && baseyaml.EndsWith(".yaml"))
            {
                LoadRecursively(System.IO.Path.GetDirectoryName(AYamlFilename) +
                                System.IO.Path.DirectorySeparatorChar +
                                baseyaml,
                                ASelectedLocalisation,
                                localisedFile != AYamlFilename,
                                depth - 1);
            }

            if ((depth == 0) && (FCodeStorage.FXmlNodes != null))
            {
                // apply the tag, so that we know which things have been changed by the last yml file
                TYml2Xml.Tag((XmlNode)FCodeStorage.FXmlNodes[TParseYAMLFormsDefinition.ROOTNODEYML]);
            }

            XmlDocument newDoc = null;

            localisedFile = Path.GetFullPath(localisedFile);

            if (CachedYamlFiles.ContainsKey(localisedFile))
            {
                newDoc = CachedYamlFiles[localisedFile];
            }
            else
            {
                Console.WriteLine("Loading " + localisedFile + "...");
                TYml2Xml yml2xml = new TYml2Xml(localisedFile);
                newDoc = yml2xml.ParseYML2XML();
                CachedYamlFiles.Add(localisedFile, newDoc);
            }

            TYml2Xml.Merge(ref FCodeStorage.FXmlDocument, newDoc, depth);

            if (TLogging.DebugLevel > 0)
            {
                // for debugging:
                FCodeStorage.FXmlDocument.Save(localisedFile + ".xml");
            }

            FCodeStorage.FXmlNodes = TYml2Xml.ReferenceNodes(FCodeStorage.FXmlDocument);
            FCodeStorage.FRootNode = (XmlNode)FCodeStorage.FXmlNodes[TParseYAMLFormsDefinition.ROOTNODEYML];

            if (baseyaml.Length == 0)
            {
                if (FCodeStorage.FXmlNodes[TYml2Xml.ROOTNODEINTERNAL] == null)
                {
                    throw new Exception("TParseYAMLFormsDefinition.LoadRecursively: YML Document could not be properly parsed");
                }

                if (TXMLParser.GetAttribute((XmlNode)FCodeStorage.FXmlNodes[TParseYAMLFormsDefinition.ROOTNODEYML], "BaseYaml").Length > 0)
                {
                    throw new Exception("The BaseYaml attribute must come first!");
                }
            }

            if (depth == 0)
            {
                FCodeStorage.FFilename = AYamlFilename;
                LoadData(FCodeStorage.FXmlNodes);
            }

            return(true);
        }