/// <summary>
        /// Deserialize the dependency cache from a binary reader
        /// </summary>
        /// <param name="Reader">Reader for the cache data</param>
        /// <returns>New dependency cache object</returns>
        static FlatCPPIncludeDependencyCache Deserialize(BinaryReader Reader)
        {
            FlatCPPIncludeDependencyCache Cache = new FlatCPPIncludeDependencyCache(Reader.ReadFileReference());

            // Create the dependency map
            int NumDependencyMapEntries = Reader.ReadInt32();

            Cache.DependencyMap = new Dictionary <FileReference, FlatCPPIncludeDependencyInfo>(NumDependencyMapEntries);

            // Read all the dependency map entries
            List <FileReference> UniqueFiles = new List <FileReference>(NumDependencyMapEntries * 2);

            for (int Idx = 0; Idx < NumDependencyMapEntries; Idx++)
            {
                FileReference File = Reader.ReadFileReference();

                FlatCPPIncludeDependencyInfo Info = new FlatCPPIncludeDependencyInfo();

                // Read the includes
                int NumIncludes = Reader.ReadInt32();
                Info.Includes = new List <FileReference>(NumIncludes);

                for (int IncludeIdx = 0; IncludeIdx < NumIncludes; IncludeIdx++)
                {
                    Info.Includes.Add(Reader.ReadFileReference(UniqueFiles));
                }

                // Add it to the map
                Cache.DependencyMap.Add(File, Info);
            }

            return(Cache);
        }
        /// <summary>
        /// Sets the new dependencies for the specified file
        /// </summary>
        /// <param name="AbsoluteFilePath">File to set</param>
        /// <param name="Dependencies">List of source dependencies</param>
        public void SetDependenciesForFile(FileReference AbsoluteFilePath, List <FileReference> Dependencies)
        {
            FlatCPPIncludeDependencyInfo DependencyInfo = new FlatCPPIncludeDependencyInfo();

            DependencyInfo.Includes         = Dependencies;
            DependencyInfo.IncludeFileItems = null;

            // @todo ubtmake: We could shrink this file by not storing absolute paths (project and engine relative paths only, except for system headers.)  May affect load times.
            DependencyMap[AbsoluteFilePath] = DependencyInfo;
            bIsDirty = true;
        }
        /// <summary>
        /// Sets the new dependencies for the specified file
        /// </summary>
        /// <param name="AbsoluteFilePath">File to set</param>
        /// <param name="PCHName">The PCH for this file</param>
        /// <param name="Dependencies">List of source dependencies</param>
        public void SetDependenciesForFile(FileReference AbsoluteFilePath, FileReference PCHName, List <FileReference> Dependencies)
        {
            FlatCPPIncludeDependencyInfo DependencyInfo = new FlatCPPIncludeDependencyInfo();

            DependencyInfo.PCHName          = PCHName;          // @todo ubtmake: Not actually used yet.  The idea is to use this to reduce the number of indirect includes we need to store in the cache.
            DependencyInfo.Includes         = Dependencies;
            DependencyInfo.IncludeFileItems = null;

            // @todo ubtmake: We could shrink this file by not storing absolute paths (project and engine relative paths only, except for system headers.)  May affect load times.
            DependencyMap[AbsoluteFilePath] = DependencyInfo;
            bIsDirty = true;
        }
        /// <summary>
        /// Serializes the dependency cache to a binary writer
        /// </summary>
        /// <param name="Writer">Writer to output to</param>
        void Serialize(BinaryWriter Writer)
        {
            Dictionary <FileReference, int> FileToUniqueId = new Dictionary <FileReference, int>();

            Writer.Write(BackingFile);

            // Write out all the dependency info objects
            Writer.Write(DependencyMap.Count);
            foreach (KeyValuePair <FileReference, FlatCPPIncludeDependencyInfo> Pair in DependencyMap)
            {
                Writer.Write(Pair.Key);

                FlatCPPIncludeDependencyInfo Info = Pair.Value;

                Writer.Write(Info.Includes.Count);
                foreach (FileReference Include in Info.Includes)
                {
                    Writer.Write(Include, FileToUniqueId);
                }
            }
        }
		/// <summary>
		/// Sets the new dependencies for the specified file
		/// </summary>
		/// <param name="AbsoluteFilePath">File to set</param>
		/// <param name="PCHName">The PCH for this file</param>
		/// <param name="Dependencies">List of source dependencies</param>
		public void SetDependenciesForFile( string AbsoluteFilePath, string PCHName, List<string> Dependencies )
		{
			var DependencyInfo = new FlatCPPIncludeDependencyInfo();
			DependencyInfo.PCHName = PCHName;	// @todo ubtmake: Not actually used yet.  The idea is to use this to reduce the number of indirect includes we need to store in the cache.
			DependencyInfo.Includes = Dependencies;
			DependencyInfo.IncludeFileItems = null;

			// @todo ubtmake: We could shrink this file by not storing absolute paths (project and engine relative paths only, except for system headers.)  May affect load times.
			DependencyMap[ AbsoluteFilePath.ToLowerInvariant() ] = DependencyInfo;
			bIsDirty = true;
		}
		/// <summary>
		/// Deserialize the dependency cache from a binary reader
		/// </summary>
		/// <param name="Reader">Reader for the cache data</param>
		/// <returns>New dependency cache object</returns>
		static FlatCPPIncludeDependencyCache Deserialize(BinaryReader Reader)
		{
			FlatCPPIncludeDependencyCache Cache = new FlatCPPIncludeDependencyCache(Reader.ReadFileReference());

			// Create the dependency map
			int NumDependencyMapEntries = Reader.ReadInt32();
			Cache.DependencyMap = new Dictionary<FileReference, FlatCPPIncludeDependencyInfo>(NumDependencyMapEntries);

			// Read all the dependency map entries
			List<FileReference> UniqueFiles = new List<FileReference>(NumDependencyMapEntries * 2);
			for (int Idx = 0; Idx < NumDependencyMapEntries; Idx++)
			{
				FileReference File = Reader.ReadFileReference();

				FlatCPPIncludeDependencyInfo Info = new FlatCPPIncludeDependencyInfo();

				// Read the PCH name
				Info.PCHName = Reader.ReadFileReference(UniqueFiles);

				// Read the includes 
				int NumIncludes = Reader.ReadInt32();
				Info.Includes = new List<FileReference>(NumIncludes);

				for (int IncludeIdx = 0; IncludeIdx < NumIncludes; IncludeIdx++)
				{
					Info.Includes.Add(Reader.ReadFileReference(UniqueFiles));
				}

				// Add it to the map
				Cache.DependencyMap.Add(File, Info);
			}

			return Cache;
		}