/// <summary>
        /// Dumps the contents of the Reference Request Table in the debug_log.txt file in the RimWorld game folder.
        /// </summary>
        public void DumpReferenceRequestTable()
        {
            FileLog.Log("Dumped Reference Request Table ---");

            for (var i = 0; i < requestedReferences.Count; i++)
            {
                FileLog.Log(i + ": " + requestedReferences[i]);
            }

            FileLog.Log("End of Dump ---");
        }
        // Debug code here.

#if DEBUG
        /// <summary>
        /// Dumps the contents of the Reference Table in the debug_log.txt file in the RimWorld game folder.
        /// </summary>
        public void DumpReferenceTable()
        {
            FileLog.Log("Dumped Reference Table ---");

            for (var i = 0; i < references.Count; i++)
            {
                FileLog.Log(i + ": (uniqueLoadID=" + references.ElementAt(i).Key + ") - " + references.ElementAt(i).Value);
            }

            FileLog.Log("End of Dump ---");
        }
        /// <summary>
        /// Loads the reference (first parameter) with any add-on label depending on the path relative to the parent.
        /// </summary>
        /// <param name="referenceable"></param>
        /// <param name="label"></param>
        public void LoadReferenceIntoMemory(ILoadReferenceable referenceable, string label)
        {
            // Current file of the reference to be assigned as Reference.pathOfFileContainingReference.
            var currentFile     = GetCroppedFileName(this.loadSaver.CurrentFile.FullName);
            var pathRelToParent = "";

            switch (Scribe.mode)
            {
            case LoadSaveMode.Saving:
                pathRelToParent = (string)CurPathField.GetValue(Scribe.saver) + "/" + label;

                if (label == "li")
                {
                    pathRelToParent += "[" + ScribeSaver_EnterNode_Patch.GetIndexInList(pathRelToParent, label) +
                                       "]";
                }
                else if (label == "thing")
                {
                    pathRelToParent += "[" + ScribeSaver_EnterNode_Patch.GetThingIndex() + "]";
                }

                FileLog.Log("LoadReferenceIntoMemory SAVING (pathRelToParent=" + pathRelToParent + ")");
                break;

            case LoadSaveMode.LoadingVars:
                pathRelToParent = label;
                FileLog.Log("LoadReferenceIntoMemory LOADING (pathRelToParent=" + pathRelToParent + ")");
                break;

            default:
                throw new InvalidProgramException("Invalid program state.");
            }

            var reference = new Reference(currentFile, referenceable);

            if (references.ContainsKey(referenceable.GetUniqueLoadID()))
            {
                Log.Error("There is already a reference entry with the unique load ID of \"" + referenceable.GetUniqueLoadID() + "\"");
                return;
            }

            references.Add(referenceable.GetUniqueLoadID(), reference);
        }