/// <summary> /// Read the state file if able. /// </summary> private void ReadStateFile() { // First we look to see if we have a resgen linked files cache. If so, then we can use that // cache to speed up processing. If there's a problem reading the cache file (or it // just doesn't exist, then this method will return a brand new cache object. // This method eats IO Exceptions cache = ResGenDependencies.DeserializeCache((StateFile == null) ? null : StateFile.ItemSpec, UseSourcePath, Log); //RWOLFF -- throw here? //ErrorUtilities.VerifyThrow(cache != null, "We did not create a cache!"); }
/// <summary> /// Reads the .cache file from disk into a ResGenDependencies object. /// </summary> /// <param name="stateFile"></param> /// <param name="useSourcePath"></param> /// <returns></returns> internal static ResGenDependencies DeserializeCache(string stateFile, bool useSourcePath, TaskLoggingHelper log) { ResGenDependencies retVal = (ResGenDependencies)StateFileBase.DeserializeCache(stateFile, log, typeof(ResGenDependencies)); if (retVal == null) { retVal = new ResGenDependencies(); } // Ensure that the cache is properly initialized with respect to how resgen will // resolve linked files within .resx files. ResGen has two different // ways for resolving relative file-paths in linked files. The way // that ResGen resolved relative paths before Whidbey was always to // resolve from the current working directory. In Whidbey a new command-line // switch "/useSourcePath" instructs ResGen to use the folder that // contains the .resx file as the path from which it should resolve // relative paths. So we should base our timestamp/existence checking // on the same switch & resolve in the same manner as ResGen. retVal.UseSourcePath = useSourcePath; return(retVal); }